@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,805 @@
|
|
|
1
|
+
// contrib.h
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* zonetime - returns ctime(int) for timezone string
|
|
5
|
+
*
|
|
6
|
+
* returns ctime(int) for timezone string.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
string zonetime(string timezone, int timestamp);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* variables - returns array of global variable names
|
|
13
|
+
*
|
|
14
|
+
* int == 0:
|
|
15
|
+
* returns array of global variable names
|
|
16
|
+
*
|
|
17
|
+
* int != 0
|
|
18
|
+
* returns array of arrays of variable name & type
|
|
19
|
+
* @param {object} ob - object to query
|
|
20
|
+
* @param {int} flag (optional) defaults to 0
|
|
21
|
+
*/
|
|
22
|
+
mixed *variables(object ob, int flag);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* upper_case() - returns a string with every letter supplied in the source
|
|
26
|
+
capitalised.
|
|
27
|
+
*
|
|
28
|
+
* Returns a new string with every character in <text> converted to upper case.
|
|
29
|
+
*
|
|
30
|
+
* string text = upper_case( "I like cheese." ) ; // "I LIKE CHEESE."
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
string upper_case(string text);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* test_load - test if a file is loadable
|
|
37
|
+
*
|
|
38
|
+
* Tests if a file is loadable. Will return 1 if a file is loadable,
|
|
39
|
+
* otherwise 0. If a file attempting to be loaded contains errors,
|
|
40
|
+
* they will be reported, in which case, you may need to wrap the
|
|
41
|
+
* function call in a catch statement to retrieve the 0 result.
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
int test_load( string filename );
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* terminal_colour() - return a wrapped and indented string where the driver
|
|
48
|
+
substitutes %^KEY%^ in the string with the matching VALUE of KEY in the
|
|
49
|
+
supplied mapping.
|
|
50
|
+
*
|
|
51
|
+
* string: to be parsed for '%^KEY%^' sequences
|
|
52
|
+
* mapping: 'KEY:value' pairs
|
|
53
|
+
* 1st int: wrap after int printed symbols
|
|
54
|
+
* if int < 0 fillout lines with blank's
|
|
55
|
+
*
|
|
56
|
+
* wrap = 4:
|
|
57
|
+
* '12\n345'
|
|
58
|
+
* wrap = -4:
|
|
59
|
+
* '12 \n345 '
|
|
60
|
+
*
|
|
61
|
+
* minwrap: 2
|
|
62
|
+
*
|
|
63
|
+
* 2nd int: indent by int blanks
|
|
64
|
+
* maxindent: wrap-2
|
|
65
|
+
*
|
|
66
|
+
* returns wrapped and indented string with each '%^KEY%^' replaced by KEY's value
|
|
67
|
+
* or original string if no '%^KEY%^' sequence is found
|
|
68
|
+
* (shouldn't it at least be wrapped and indented?)
|
|
69
|
+
*
|
|
70
|
+
*/
|
|
71
|
+
string terminal_colour(string, mapping, int | void, int | void);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* string_difference - return levenshtein difference
|
|
75
|
+
*
|
|
76
|
+
* returns levenshtein difference
|
|
77
|
+
*
|
|
78
|
+
*/
|
|
79
|
+
int string_difference(string, string);
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* store_variable - store a value in an object's global variable
|
|
83
|
+
*
|
|
84
|
+
* This efun stores the value in the global variable variable_name in `ob`.
|
|
85
|
+
*
|
|
86
|
+
* `variable_name` is name of the global variable.
|
|
87
|
+
* `value` is the data to be stored in the global variable.
|
|
88
|
+
* `ob` defaults to this_object() if not specified.
|
|
89
|
+
*
|
|
90
|
+
* If `ob` is not specified, then `variable_name` can be any global variable
|
|
91
|
+
* in the inheritance hierarchy, regardless of scope. If `ob` is specified,
|
|
92
|
+
* then `variable_name` must be public scope.
|
|
93
|
+
*
|
|
94
|
+
* This is a potential security hazard and, therefore, you may wish to overload
|
|
95
|
+
* this function to perform security checks.
|
|
96
|
+
*
|
|
97
|
+
* store_variable( "weight", 150, this_player() ) ;
|
|
98
|
+
*
|
|
99
|
+
*/
|
|
100
|
+
void store_variable(string variable_name, mixed value, void|object ob);
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* store_class_member
|
|
104
|
+
*
|
|
105
|
+
* Store <value> in the <class_element>th member of an <instantiated_class>.
|
|
106
|
+
*
|
|
107
|
+
* Returns an updated version of the <instantiated_class>.
|
|
108
|
+
*
|
|
109
|
+
* class person {
|
|
110
|
+
* string name ;
|
|
111
|
+
* int age ;
|
|
112
|
+
* string city ;
|
|
113
|
+
* }
|
|
114
|
+
*
|
|
115
|
+
* void fun()
|
|
116
|
+
* {
|
|
117
|
+
* class person me = new(class person) ;
|
|
118
|
+
*
|
|
119
|
+
* me->name = "Foo" ;
|
|
120
|
+
* me->age = 42 ;
|
|
121
|
+
* me->city = "Fooville" ;
|
|
122
|
+
*
|
|
123
|
+
* write( sprintf("%O\n", me) ) ;
|
|
124
|
+
*
|
|
125
|
+
* // Result:
|
|
126
|
+
* // CLASS( 3 elements
|
|
127
|
+
* // "Foo",
|
|
128
|
+
* // 42,
|
|
129
|
+
* // "Fooville"
|
|
130
|
+
* // )
|
|
131
|
+
*
|
|
132
|
+
* me = store_class_member( me, 1, 43 ) ;
|
|
133
|
+
*
|
|
134
|
+
* write( sprintf("%O\n", me) ) ;
|
|
135
|
+
*
|
|
136
|
+
* // Result:
|
|
137
|
+
* // CLASS( 3 elements
|
|
138
|
+
* // "Foo",
|
|
139
|
+
* // 43,
|
|
140
|
+
* // "Fooville"
|
|
141
|
+
* // )
|
|
142
|
+
* }
|
|
143
|
+
*
|
|
144
|
+
*/
|
|
145
|
+
mixed store_class_member(mixed instantiated_class, int class_element, mixed value);
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* shuffle
|
|
149
|
+
*
|
|
150
|
+
* randomly reorders the elements of the given array (changes original!!!)
|
|
151
|
+
*
|
|
152
|
+
*/
|
|
153
|
+
mixed *shuffle(mixed *arr);
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
*
|
|
157
|
+
*
|
|
158
|
+
*
|
|
159
|
+
*
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* send_nullbyte - sends '\0' to interactive
|
|
165
|
+
*
|
|
166
|
+
* sends '\0' to interactive, returns -2 in case of error 1 otherwise
|
|
167
|
+
*
|
|
168
|
+
*/
|
|
169
|
+
int send_nullbyte(object);
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* roll_MdN() - dice roll generator where you specify the number of dice and
|
|
173
|
+
the number of sides to each die, with bonus if supplied.
|
|
174
|
+
*
|
|
175
|
+
* rolls `sides`-sided die `rolls` number of times and returns the sum
|
|
176
|
+
* of all rolls
|
|
177
|
+
*
|
|
178
|
+
* if `bonus` is supplied, will add the bonus and return the result.
|
|
179
|
+
*
|
|
180
|
+
* // roll a 1d4
|
|
181
|
+
* roll_MdN(1, 4)
|
|
182
|
+
*
|
|
183
|
+
* // roll 2d6
|
|
184
|
+
* roll_MdN(2, 6)
|
|
185
|
+
*
|
|
186
|
+
* // roll 1d10 and add 15
|
|
187
|
+
* roll_MdN(1, 10, 15)
|
|
188
|
+
* @param {int} rolls - number of dice
|
|
189
|
+
* @param {int} sides - number of sides on each die
|
|
190
|
+
* @param {int} bonus - (optional) bonus to add to the roll, defaults to 0
|
|
191
|
+
*/
|
|
192
|
+
int roll_MdN(int rolls, int sides, int bonus);
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* restore_from_string() - like restore_object(), but restores variables from
|
|
196
|
+
a string where the string is in the same format as from restore_object()
|
|
197
|
+
*
|
|
198
|
+
* uses string as restore_object uses file meaning of int the same
|
|
199
|
+
* @param {string} str - string to restore from
|
|
200
|
+
* @param {int} flag - defaults to 0
|
|
201
|
+
*/
|
|
202
|
+
void restore_from_string(string str, int flag);
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* replaceable - check if object is replaceable
|
|
206
|
+
*
|
|
207
|
+
* string *func defaults to ({ "create", "__INIT" }) and contains a list of
|
|
208
|
+
* functions which may be ignored for checking
|
|
209
|
+
*
|
|
210
|
+
* checks if object defines any functions itself (beside create)
|
|
211
|
+
*
|
|
212
|
+
* returns 1 if no and object is not simul_efun object and not ???
|
|
213
|
+
* 0 otherwise
|
|
214
|
+
*
|
|
215
|
+
*/
|
|
216
|
+
int replaceable(object, void | string *func);
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* repeat_string() - repeat a string a certain number of times.
|
|
220
|
+
*
|
|
221
|
+
* returns a new string
|
|
222
|
+
*
|
|
223
|
+
* - repeats <= 0: ""
|
|
224
|
+
* - repeats > 0 original string repeated either int times or the maximum
|
|
225
|
+
* number of times without getting greater than the maximum string length
|
|
226
|
+
*
|
|
227
|
+
* maxstrlen = 5:
|
|
228
|
+
* repeat_string("ab", 3) = "abab"
|
|
229
|
+
*
|
|
230
|
+
* maxstrlen >=6:
|
|
231
|
+
* repeat_string("ab", 3) = "ababab"
|
|
232
|
+
*
|
|
233
|
+
*/
|
|
234
|
+
string repeat_string(string str, int repeats);
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* remove_shadow() - remove all shadows from the specified object, or remove
|
|
238
|
+
a specified shadow from another object. does not destruct the shadow.
|
|
239
|
+
*
|
|
240
|
+
* ob defaults to this_object()
|
|
241
|
+
* returns 0 if object is either destroyed or is no shadow and isn't shadowed
|
|
242
|
+
* returns 1 otherwise
|
|
243
|
+
*
|
|
244
|
+
* ob <- shadow1 <- shadow2
|
|
245
|
+
*
|
|
246
|
+
* remove(shadow2): ob <- shadow1 shadow2
|
|
247
|
+
* remove(shadow1): ob <- shadow2 shadow1
|
|
248
|
+
* remove(ob): shadow1 <- shadow2 ob
|
|
249
|
+
*
|
|
250
|
+
* #ifndef NO_SHADOWS
|
|
251
|
+
*
|
|
252
|
+
*/
|
|
253
|
+
int remove_shadow(object ob);
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* remove_interactive - removes the interactive object
|
|
257
|
+
*
|
|
258
|
+
* If the argument object is interactive and not destructed, cause it to be
|
|
259
|
+
* disconnected and lose interactive status. Returns 1 when the operation is
|
|
260
|
+
* successful.
|
|
261
|
+
*
|
|
262
|
+
* This function requires PACKAGE_CONTRIB to be defined in the options file.
|
|
263
|
+
*
|
|
264
|
+
*/
|
|
265
|
+
int remove_interactive(object interactive);
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* remove_get_char() - cancels active input_to
|
|
269
|
+
*
|
|
270
|
+
* cancels active input_to
|
|
271
|
+
* set's interactive->carryover = NULL
|
|
272
|
+
* set's interactive->num_carry = 0
|
|
273
|
+
*
|
|
274
|
+
* returns -3 if argument missing
|
|
275
|
+
* -2 if object destroyed or not interactive
|
|
276
|
+
* -1 if no input_to active
|
|
277
|
+
* 1 otherwise
|
|
278
|
+
*
|
|
279
|
+
*/
|
|
280
|
+
int remove_get_char(object interactive);
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* remove_charmode() - switches interactive object into linemode
|
|
284
|
+
*
|
|
285
|
+
* switches interactive object into linemode
|
|
286
|
+
*
|
|
287
|
+
* returns -1 if argument missing
|
|
288
|
+
* -2 in case of error (object destroyed or not interactive)
|
|
289
|
+
* current input_to flags with char_mode unset
|
|
290
|
+
*
|
|
291
|
+
*/
|
|
292
|
+
int remove_charmode(object);
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* real_time
|
|
296
|
+
*
|
|
297
|
+
* returns local server time
|
|
298
|
+
*
|
|
299
|
+
*/
|
|
300
|
+
int real_time();
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* query_replaced_program
|
|
304
|
+
*
|
|
305
|
+
* obiect defaults to this_object()
|
|
306
|
+
*
|
|
307
|
+
* if object called replace_program this function returns the path to the object
|
|
308
|
+
* it was replaced with
|
|
309
|
+
*
|
|
310
|
+
*/
|
|
311
|
+
string query_replaced_program(void | object);
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* query_num
|
|
315
|
+
*
|
|
316
|
+
* Warning: English only!!!
|
|
317
|
+
*
|
|
318
|
+
* Converts `num` into a string representation. If `many` is greater than 0
|
|
319
|
+
* and `num` is greater than `many`, the resulting string is "many".
|
|
320
|
+
*
|
|
321
|
+
* Any `num` greater than 99,999 is always "many", the same for any `num` less
|
|
322
|
+
* than 0.
|
|
323
|
+
* @param {int} num - number to convert
|
|
324
|
+
* @param {int} many - (optional) defaults to 0
|
|
325
|
+
*/
|
|
326
|
+
varargs string query_num(int num, int many);
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* query_notify_fail
|
|
330
|
+
*
|
|
331
|
+
* returns current notify_fail setting (funcp or string)
|
|
332
|
+
* #ifndef NO_ADD_ACTION
|
|
333
|
+
*
|
|
334
|
+
*/
|
|
335
|
+
mixed query_notify_fail();
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* query_ip_port - returns local_port of connection
|
|
339
|
+
*
|
|
340
|
+
* object defaults to this_player()
|
|
341
|
+
*
|
|
342
|
+
* returns local_port of connection or 0 if object not interactive
|
|
343
|
+
*
|
|
344
|
+
*/
|
|
345
|
+
int query_ip_port(void | object);
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* query_charmode
|
|
349
|
+
*
|
|
350
|
+
* returns -1 if argument missing
|
|
351
|
+
* -2 in case of error (object destroyed or not interactive)
|
|
352
|
+
* 0 if interactive object is in line mode
|
|
353
|
+
* !0 otherwise (actual value depends on compile time define)
|
|
354
|
+
*
|
|
355
|
+
*/
|
|
356
|
+
int query_charmode(object);
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* program_info
|
|
360
|
+
*
|
|
361
|
+
* object defaults to ALL objects
|
|
362
|
+
*
|
|
363
|
+
* returns mapping consinsting of:
|
|
364
|
+
*
|
|
365
|
+
* - header size : int
|
|
366
|
+
* - code size : int
|
|
367
|
+
* - function size : int
|
|
368
|
+
* - var size : int
|
|
369
|
+
* - class size : int
|
|
370
|
+
* - inherit size : int
|
|
371
|
+
* - saved type size : int
|
|
372
|
+
* - total size : int
|
|
373
|
+
*
|
|
374
|
+
*/
|
|
375
|
+
mapping program_info(void | object);
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* pluralize - return plural form
|
|
379
|
+
*
|
|
380
|
+
* for english only!
|
|
381
|
+
*
|
|
382
|
+
* returns plural form:
|
|
383
|
+
* 'a red house' -> 'red houses'
|
|
384
|
+
* 'a sack of rice' -> 'sacks of rice'
|
|
385
|
+
*
|
|
386
|
+
*/
|
|
387
|
+
string pluralize(string);
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* num_classes - returns the number of classes used by object
|
|
391
|
+
*
|
|
392
|
+
* returns the number of classes used by object
|
|
393
|
+
*
|
|
394
|
+
*/
|
|
395
|
+
int num_classes(object);
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* network_stats
|
|
399
|
+
*
|
|
400
|
+
* returns mapping:
|
|
401
|
+
*
|
|
402
|
+
* - incoming packets total : int
|
|
403
|
+
* - incoming volume total : int
|
|
404
|
+
* - outgoing packets total : int
|
|
405
|
+
* - outgoing volume total : int
|
|
406
|
+
*
|
|
407
|
+
* - incoming packets port X : int
|
|
408
|
+
* - incoming volume port X : int
|
|
409
|
+
* - outgoing packets port X : int
|
|
410
|
+
* - outgoing volume port X : int
|
|
411
|
+
*
|
|
412
|
+
* #ifdef PACKAGE_SOCKETS:
|
|
413
|
+
*
|
|
414
|
+
* - incoming packets sockets : int
|
|
415
|
+
* - incoming volume sockets : int
|
|
416
|
+
* - outgoing packets sockets : int
|
|
417
|
+
* - outgoing volume sockets : int
|
|
418
|
+
*
|
|
419
|
+
*/
|
|
420
|
+
mapping network_stats();
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* named_livings - return named livings
|
|
424
|
+
*
|
|
425
|
+
* returns all those livings [see efun::livings()] which have
|
|
426
|
+
* set_living_name and enable_command called #ifndef NO_ADD_ACTION
|
|
427
|
+
*
|
|
428
|
+
*/
|
|
429
|
+
object *named_livings( void );
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* min() - searches for the minimum value inside an array
|
|
433
|
+
*
|
|
434
|
+
* Searches minimum value for (int|float|string) arrays. If flag is 0 or
|
|
435
|
+
* omitted the minimum value will be returned, otherwise the first index
|
|
436
|
+
* of its occurrence.
|
|
437
|
+
*
|
|
438
|
+
*/
|
|
439
|
+
mixed min(mixed * arr);
|
|
440
|
+
mixed min(mixed * arr, int flag);
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* memory_summary()
|
|
444
|
+
*
|
|
445
|
+
* returns mapping:
|
|
446
|
+
* ([
|
|
447
|
+
* "prog1" : ([
|
|
448
|
+
* "var1" : mem_usage,
|
|
449
|
+
* ...
|
|
450
|
+
* ]),
|
|
451
|
+
* ...
|
|
452
|
+
* ])
|
|
453
|
+
*
|
|
454
|
+
*/
|
|
455
|
+
mapping memory_summary();
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* max() - searches for the maximum value inside an array
|
|
459
|
+
*
|
|
460
|
+
* Searches maximum value for (int|float|string) arrays. If flag is 0 or
|
|
461
|
+
* omitted the maximum value will be returned, otherwise the first index
|
|
462
|
+
* of its occurrence.
|
|
463
|
+
*
|
|
464
|
+
*/
|
|
465
|
+
mixed max(mixed * arr);
|
|
466
|
+
mixed max(mixed * arr, int flag);
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* is_daylight_savings_time
|
|
470
|
+
*
|
|
471
|
+
* returns 1 if given time in given timezone is within daylight saving region
|
|
472
|
+
* 0 if not
|
|
473
|
+
* -1 on error
|
|
474
|
+
*
|
|
475
|
+
*/
|
|
476
|
+
int is_daylight_savings_time(string, int);
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* heart_beats - returns an array of all objects with enabled heartbeat
|
|
480
|
+
*
|
|
481
|
+
* returns an array of all objects with enabled heartbeat
|
|
482
|
+
*
|
|
483
|
+
*/
|
|
484
|
+
object *heart_beats( void );
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* get_garbage() - get all clones without environments or inventories which are
|
|
488
|
+
not shadowing.
|
|
489
|
+
*
|
|
490
|
+
* returns array of all (up to **MAX_ARRAY_SIZE**) those cloned(!) objects which
|
|
491
|
+
* have neither environment nor inventory and aren't shadowing another object
|
|
492
|
+
* and haven't object->super set
|
|
493
|
+
*
|
|
494
|
+
*/
|
|
495
|
+
object *get_garbage();
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* functions() - returns a string array of function names or mixed* array of
|
|
499
|
+
information for all functions in a passed object.
|
|
500
|
+
*
|
|
501
|
+
* Returns an array of strings containing the function names found in
|
|
502
|
+
* <ob>. The functions returned will include all functions, whether public,
|
|
503
|
+
* protected, or private. The <flag> parameter is by default zero.
|
|
504
|
+
*
|
|
505
|
+
* Flag: 0
|
|
506
|
+
* Returns: a string array containing function names, including all inherited
|
|
507
|
+
* functions.
|
|
508
|
+
* ({ "func1", "func2", "func3", "func4", ... })
|
|
509
|
+
*
|
|
510
|
+
* Flag: 1
|
|
511
|
+
* Returns: A two-dimensional array of mixed arrays containing additional
|
|
512
|
+
* information about each function, including all inherited functions.
|
|
513
|
+
*
|
|
514
|
+
* ({
|
|
515
|
+
* ({
|
|
516
|
+
* "func1", // function name
|
|
517
|
+
* 2, // number of parameters in function
|
|
518
|
+
* "int", // return type of function
|
|
519
|
+
* "object", // the first parameter
|
|
520
|
+
* "string *", // the second parameter
|
|
521
|
+
* }),
|
|
522
|
+
* ...
|
|
523
|
+
* })
|
|
524
|
+
*
|
|
525
|
+
* Flag: 2
|
|
526
|
+
* Like Flag 0, but excludes inherited functions.
|
|
527
|
+
*
|
|
528
|
+
* Flag: 3
|
|
529
|
+
* Like Flag 1, but excludes inherited functions.
|
|
530
|
+
*
|
|
531
|
+
* @param {object} ob - object to query
|
|
532
|
+
* @param {int} flag (optional) defaults to 0
|
|
533
|
+
*/
|
|
534
|
+
mixed *functions(object ob, int flag);
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* function_owner - returns the object defining the given function
|
|
538
|
+
*
|
|
539
|
+
* returns the object defining the given function.
|
|
540
|
+
*
|
|
541
|
+
*/
|
|
542
|
+
object function_owner(function);
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* file_length - return the line count of a file
|
|
546
|
+
*
|
|
547
|
+
* returns
|
|
548
|
+
*
|
|
549
|
+
* - line count
|
|
550
|
+
* - -1 in case of error (e.g insufficient privs)
|
|
551
|
+
* - -2 if file is directory
|
|
552
|
+
*
|
|
553
|
+
*/
|
|
554
|
+
int file_length(string);
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* fetch_variable - fetch a value stored in an object's global variable
|
|
558
|
+
*
|
|
559
|
+
* This efun returns the value stored in the global variable `variable_name`
|
|
560
|
+
* in ob.
|
|
561
|
+
*
|
|
562
|
+
* `variable_name` is name of the global variable.
|
|
563
|
+
* `ob` defaults to this_object() if not specified.
|
|
564
|
+
*
|
|
565
|
+
* If `ob` is not specified, then `variable_name` can be any global variable
|
|
566
|
+
* in the inheritance hierarchy, regardless of scope. If `ob` is specified,
|
|
567
|
+
* then `variable_name` must be public scope.
|
|
568
|
+
*
|
|
569
|
+
* This is a potential security hazard and, therefore, you may wish to overload
|
|
570
|
+
* this function to perform security checks.
|
|
571
|
+
*
|
|
572
|
+
* int weight = fetch_variable( "weight", this_player() ) ;
|
|
573
|
+
* printf("%d\n", weight") ;
|
|
574
|
+
*
|
|
575
|
+
* // result: 150
|
|
576
|
+
*
|
|
577
|
+
*/
|
|
578
|
+
mixed fetch_variable(string variable_name, void|object ob);
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* fetch_class_member() - return the value of a specified, indexed member of
|
|
582
|
+
an instantiated class.
|
|
583
|
+
*
|
|
584
|
+
* Given an <instantiated_class>, return the value of the <index>th
|
|
585
|
+
* member. This is particularly useful when you have an anonymous
|
|
586
|
+
* class with no labels for the data members.
|
|
587
|
+
*
|
|
588
|
+
* mixed me = assemble_class( ({ "Foo", 42, "Fooville" }) ) ;
|
|
589
|
+
* int age ;
|
|
590
|
+
* string name, city ;
|
|
591
|
+
*
|
|
592
|
+
* name = fetch_class_member( me, 0 ) ;
|
|
593
|
+
* age = fetch_class_member( me, 1 ) ;
|
|
594
|
+
* city = fetch_class_member( me, 2 ) ;
|
|
595
|
+
*
|
|
596
|
+
*/
|
|
597
|
+
mixed fetch_class_member( mixed instantiated_class, int index );
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* event() - call event_* in other objects with specified parameters. similar
|
|
601
|
+
to call_other, but with no return type.
|
|
602
|
+
*
|
|
603
|
+
* Calls "event_" + event_name in target. "event_" + event_name must be a
|
|
604
|
+
* public function.
|
|
605
|
+
*
|
|
606
|
+
* Target can be a single object or an array of objects.
|
|
607
|
+
*
|
|
608
|
+
* If the target is a single object, the event efun will first call the event
|
|
609
|
+
* function in the object and then it will call the event function all of the
|
|
610
|
+
* objects in the target's all_inventory().
|
|
611
|
+
*
|
|
612
|
+
* If the target is an array of objects, the event efun will call the event
|
|
613
|
+
* function in all of the objects specified. Unlike the single-target version,
|
|
614
|
+
* it will not cascade to each of the object's inventories.
|
|
615
|
+
*
|
|
616
|
+
* The efun will pass as its first argument the calling object followed by
|
|
617
|
+
* all of the specified arguments.
|
|
618
|
+
*
|
|
619
|
+
* // In a room
|
|
620
|
+
*
|
|
621
|
+
* // will call event_heal_up on the room, and then every object in the room
|
|
622
|
+
* event( this_object(), "heal_up", 50, 50 ) ;
|
|
623
|
+
*
|
|
624
|
+
* // will call event_heal_up in the results of users() efun
|
|
625
|
+
* event( users(), "heal_up", 25, 25 ) ;
|
|
626
|
+
*
|
|
627
|
+
* // In a player object
|
|
628
|
+
*
|
|
629
|
+
* // To take advantage of this event, write an event_heal_up in the player
|
|
630
|
+
* // object to receive the call
|
|
631
|
+
* void event_heal_up(object source, int health, int mana)
|
|
632
|
+
* {
|
|
633
|
+
* message("heal", sprintf("You were healed %d health and %d mana by %O.\n", health, mana, source), this_object()) ;
|
|
634
|
+
* }
|
|
635
|
+
*
|
|
636
|
+
*/
|
|
637
|
+
void event(object | object * target, string event_name, mixed *args...);
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* element_of() - returns random elememt of given array
|
|
641
|
+
*
|
|
642
|
+
* returns random elememt of given array
|
|
643
|
+
*
|
|
644
|
+
*/
|
|
645
|
+
mixed element_of(mixed *arr);
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* disassemble_class() - given an instantiated class, returns a mixed* array
|
|
649
|
+
with elements comprised of the values of each member of the class.
|
|
650
|
+
*
|
|
651
|
+
* Given an <instantiated_class>, return a mixed array containing the
|
|
652
|
+
* values of all of the members.
|
|
653
|
+
*
|
|
654
|
+
* class person {
|
|
655
|
+
* string name ;
|
|
656
|
+
* int age ;
|
|
657
|
+
* string city ;
|
|
658
|
+
* }
|
|
659
|
+
*
|
|
660
|
+
* void fun()
|
|
661
|
+
* {
|
|
662
|
+
* mixed *result ;
|
|
663
|
+
* class person me = new(class person);
|
|
664
|
+
*
|
|
665
|
+
* me->name = "Foo" ;
|
|
666
|
+
* me->age = 42 ;
|
|
667
|
+
* me->city = "Fooville" ;
|
|
668
|
+
*
|
|
669
|
+
* result = disassemble_class( me ) ;
|
|
670
|
+
*
|
|
671
|
+
* write( sprintf("%O\n", result ) ) ;
|
|
672
|
+
*
|
|
673
|
+
* // ({ /* sizeof() == 3 *\/
|
|
674
|
+
* // "Foo",
|
|
675
|
+
* // 42,
|
|
676
|
+
* // "Fooville"
|
|
677
|
+
* // })
|
|
678
|
+
* }
|
|
679
|
+
*
|
|
680
|
+
*/
|
|
681
|
+
mixed *disassemble_class( mixed instantiated_class );
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* debug_message() - logs a debug message
|
|
685
|
+
*
|
|
686
|
+
* Prints the given message on the <stderr> file desciptor of the driver
|
|
687
|
+
* and appends it to the debug log.
|
|
688
|
+
*
|
|
689
|
+
*/
|
|
690
|
+
void debug_message(string msg);
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* mixed copy(mixed arg) - return a deep copy of an array, buffer, class, or
|
|
694
|
+
mapping
|
|
695
|
+
*
|
|
696
|
+
* arg is either one of:
|
|
697
|
+
*
|
|
698
|
+
* - array
|
|
699
|
+
* - buffer (if compiled into driver)
|
|
700
|
+
* - class
|
|
701
|
+
* - mapping
|
|
702
|
+
*
|
|
703
|
+
* returns deep copy
|
|
704
|
+
*
|
|
705
|
+
* This is particularly useful when you wish to have data that is passed
|
|
706
|
+
* by reference, but do not want to alter the original.
|
|
707
|
+
*
|
|
708
|
+
*/
|
|
709
|
+
mixed copy(mixed arg);
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* compressedp() - returns if interactive connection uses telopt compress
|
|
713
|
+
*
|
|
714
|
+
* returns if interactive connection uses telopt compress
|
|
715
|
+
* #ifdef PACKAGE_COMPRESS
|
|
716
|
+
*
|
|
717
|
+
*/
|
|
718
|
+
int compressedp(object ob);
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* classes() - return names of classes used by object
|
|
722
|
+
*
|
|
723
|
+
* Return a string array consisting of names of classes used by <ob>.
|
|
724
|
+
*
|
|
725
|
+
* The <verbose> parameter is optional and by default 0.
|
|
726
|
+
*
|
|
727
|
+
* If <verbose> is non-zero, then additional information will be
|
|
728
|
+
* returned.
|
|
729
|
+
*
|
|
730
|
+
* string *classes_used = classes( ob ) ;
|
|
731
|
+
* // ({ "class_name", }) ;
|
|
732
|
+
*
|
|
733
|
+
* mixed *classes_used = classes( ob, 1 ) ;
|
|
734
|
+
*
|
|
735
|
+
* // ({
|
|
736
|
+
* // ({
|
|
737
|
+
* // "class_name",
|
|
738
|
+
* // ({
|
|
739
|
+
* // "member_name",
|
|
740
|
+
* // "type"
|
|
741
|
+
* // }),
|
|
742
|
+
* // ...
|
|
743
|
+
* // }),
|
|
744
|
+
* // ...
|
|
745
|
+
* // })
|
|
746
|
+
*
|
|
747
|
+
*/
|
|
748
|
+
mixed *classes(object ob, int verbose);
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* base_name - return the base name without object id (OID)
|
|
752
|
+
*
|
|
753
|
+
* In the first version, return the segment of the <text> up to, but
|
|
754
|
+
* not including the first occurrence of #.
|
|
755
|
+
*
|
|
756
|
+
* Like the first version, but performs file_name on <ob> first.
|
|
757
|
+
*
|
|
758
|
+
* Like the second version, but the object is this_object().
|
|
759
|
+
*
|
|
760
|
+
* string path = base_name( "/std/object#123" ) ; // "/std/object"
|
|
761
|
+
*
|
|
762
|
+
* object ob = new("/std/object) ;
|
|
763
|
+
* string path = base_name( ob ) ; // "/std/object"
|
|
764
|
+
*
|
|
765
|
+
* // in /std/object
|
|
766
|
+
* string path = base_name() ; // "/std/object"
|
|
767
|
+
*
|
|
768
|
+
*/
|
|
769
|
+
string base_name(string text);
|
|
770
|
+
string base_name(object ob);
|
|
771
|
+
string base_name();
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* assemble_class() - provided an array, return a class composed of the members
|
|
775
|
+
of that array.
|
|
776
|
+
*
|
|
777
|
+
* Takes an array of <elements> and returns an instantiated class.
|
|
778
|
+
*
|
|
779
|
+
* mixed *elements = ({ "Foo", 42, "Fooville" }) ;
|
|
780
|
+
* mixed cl = assemble_class( elements ) ;
|
|
781
|
+
*
|
|
782
|
+
* write( sprintf( "%O\n", cl ) ) ;
|
|
783
|
+
*
|
|
784
|
+
* // CLASS( 3 elements
|
|
785
|
+
* // "Foo",
|
|
786
|
+
* // 42,
|
|
787
|
+
* // "Fooville"
|
|
788
|
+
* // )
|
|
789
|
+
*
|
|
790
|
+
*/
|
|
791
|
+
mixed assemble_class( mixed *elements );
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* abs() - return the absolute value of a number
|
|
795
|
+
*
|
|
796
|
+
* Returns the absolute value of the supplied <number>.
|
|
797
|
+
*
|
|
798
|
+
* int value = abs( 10 ); // 10
|
|
799
|
+
* int value = abs( -10 ); // 10
|
|
800
|
+
* float value = abs( 3.14 ); // 3.140000
|
|
801
|
+
* float value = abs( -3.14 ); // 3.140000
|
|
802
|
+
*
|
|
803
|
+
*/
|
|
804
|
+
mixed abs( int | float number );
|
|
805
|
+
|