Commit graph

102 commits

Author SHA1 Message Date
Stephan Weinberger
2c4de6ccb8
Add simul-efuns for deprecated alist efuns
Provide two implementations: 

alists_sorted.c keeps alists with sorted key arrays. However this is restricted to LPC comparable types (numbers and strings) and homogeneous keys.

alists_unsorted.c implements alists without sorting the keys. If the Lib does not rely on ordered key arrays this implementation offers far superior performance for some operations.
2025-07-07 21:54:13 +02:00
Alexander Motzkau
6d5702f019 Added a few sefun implementations of LDMud 3.2 efuns
Simul-efun implementations of deprecated efuns from the
mud Seifenblase by Myonara@UNItopia and Gnomi@UNItopia.
2025-03-21 21:30:30 +01:00
Alexander Motzkau
fb691fa2ea Implement LPC Type objects
Add a new type 'lpctype' to contain a type object, describing a compile-time
type, together with a decltype() operator and to_lpctype() and check_type()
efuns.
2022-09-25 22:20:32 +02:00
Alexander Motzkau
88237ec5e3 Implement standard struct definitions for use in efuns
Struct declarations in struct_spec are now available to every LPC program.
2022-09-22 22:17:24 +02:00
Alexander Motzkau
93628de926 Implement compile_string() efun
compile_string() compiles a string into a lambda closure.
It uses the same compiler as regular LPC code.
2022-08-06 14:02:12 +02:00
Alexander Motzkau
508b6efc82 Add Python statistics to driver_info()
Add driver_info information DI_NUM_LPC_PYTHON_REFS and
DI_NUM_PYTHON_LPC_REFS to get the number of references between
both runtime environments.
2022-06-30 22:17:26 +02:00
Alexander Motzkau
8365fa5ebe Implement usage of Python objects in LPC
Python can register certain types for LPC. Objects of those types
can then be passed between Python and LPC code.
2022-05-25 23:16:58 +02:00
Alexander Motzkau
1f36a52038 Add statistics for coroutines to driver_info()
Add driver_info information DI_NUM_COROUTINES and DI_SIZE_COROUTINES
to query the current number and size of coroutines.
2022-06-30 20:07:37 +02:00
Alexander Motzkau
e19544ccce Add statistics for lightweight objects to driver_info()
Add driver_info information DI_NUM_LWOBJECTS and DI_SIZE_LWOBJECTS
to query the current number and size of lightweight objects.
2022-06-29 23:46:00 +02:00
Alexander Motzkau
16a333352f Added sample implementation for TLS and MCCP negotation
Added an implementation for negotiating TLS and MCCP
automatically to mudlib/telnetneg.c.
2022-04-25 23:53:16 +02:00
Alexander Motzkau
ba33be9909 Added driver hooks for lightweight object initialization
Added optional driver hooks to finish initialization of
lightweight objects, who have either been copied or restored.
2022-02-20 22:46:48 +01:00
Zesstra
6b2aa7ee1b Added DI_NUM_SIMUL_EFUNS to driver_info()
Added info about the number of simul_efuns (active or not) in
the simul_efun table (simul_efun_table).

Some admins may find this interesting to verify that they stay
below the limit for creating real closures to sefuns (currently
2048).
2022-01-11 21:47:01 +01:00
Alexander Motzkau
8556262748 Implement coroutines
Add a new type and several statements to LPC to implement coroutines.
Coroutines allow a function to suspend its execution and resume it
later.
2022-01-09 21:22:34 +01:00
Alexander Motzkau
0659a4124d Implement lightweight objects
Add a new type and data structure to LPC. Lightweight objects combine
properties from structs (small memory footprint, automatic lifetime
management) and objects (capsulation, functions).
(Implements #688)
2022-01-09 01:13:21 +01:00
Alexander Motzkau
3df4c15ccb Implement named object types
Extend the type system with named object types like
'object "/std/room" var;' to include a mandatory program.
This is only checked by runtime type checks.
(Implements #842)
2022-01-09 01:13:21 +01:00
Daniel McCarney
7f14d6028d Add line argument for log_error()
When a compile error is reported, pass the line numer as an additional
argument to the master when calling log_error(), so the mudlib can
provide better error messages or file context as part of the response.
(Implements #898)
2022-01-08 21:22:22 +01:00
Daniel McCarney
264d845769 query_ip_number/_name simul-efuns: fix argument type
For returning the IP address in the first argument its type also
needs to contain int*.
2021-11-29 21:22:52 +01:00
Daniel McCarney
21945c1f30 query_ip_number/_name simul-efuns: guard for interactives
When query_ip_number()/query_ip_name() is given a non-interactive object
return 0 (instead of throwing an error), just like the original
implementation did.
2021-11-29 21:22:25 +01:00
Alexander Motzkau
89771d51ab Give noecho/charmode information in interactive_info()
Added option II_NOECHO and II_CHARMODE for interactive_info() to
return noecho and charmode information about the given interactive.
(Implements #235)
2020-11-08 17:33:54 +01:00
Alexander Motzkau
12e82958ac Reimplement type information in struct_info() and variable_list()
Since introduction of type objects struct_info() and variable_list()
didn't return any type information anymore. functionlist() however did,
used its code for converting type objects to integers also for the
other two efuns.
2020-11-06 17:14:53 +01:00
Fuchur
ccbde57d6e debug_info sefun: fix security problem in DINFO_DUMP case
- the dumps are written to a file, so check whether the *caller* has
  the necessary access rights
2021-03-30 17:57:16 +02:00
Fuchur
47f558a0d7 debug_info sefun: fix DINFO_OBJLIST cases
- the second argument is optional
- return 0 if the index is too large
2021-03-30 17:57:16 +02:00
Mike Conley
8b045b5e6b Update telnet.h for TELOPT_CHARSET (42)
To align with support for [Telopt CHARSET Option](https://tools.ietf.org/html/rfc2066).
2020-07-13 20:06:09 +02:00
Alexander Motzkau
072873e383 Check that the deprecated sefun implementations still work
Added a test that compiles the supplied sefun implementations for
deprecated efuns to check that they still work with newer drivers.
Fixed a few bugs so the test will work.
2019-10-05 23:23:12 +02:00
Alexander Motzkau
f0c1c3a3e6 Added runtime type for byte sequences.
Introduces T_BYTES as a runtime type for byte sequences
similar to T_STRING.
2019-04-28 16:43:50 +02:00
Alexander Motzkau
b24832bb67 Added interactive configuration option for the encoding.
Added a configure_interactive option IC_ENCODING that denotes
the source and target encoding of the interactive. Input and
output will automatically converted using this encoding.
2019-04-28 16:43:50 +02:00
Alexander Motzkau
345e12699c Added driver configuration option for file name conversion.
Added a configure_driver option DC_FILESYSTEM_ENCODING to specify the
encoding for filenames. It is initialized per default with the default
locale's encoding with the exception of the C locale which gets UTF-8
as its encoding.
2019-04-27 13:30:14 +02:00
Alexander Motzkau
26be9661cf Added support for different encodings in the lexer.
The lexer now converts each file internally to UTF-8 before lexing and
parsing it. Added a driver hook H_FILE_ENCODING to query the encoding
for each file (default is the very restrictive ASCII encoding).
2019-04-27 13:30:14 +02:00
Alexander Motzkau
71028ac722 Added more signal handling actions.
The mudlib can now configure signal handling for
SIGINT, SIGHUP, SIGUSR1 and SIGUSR2 via configure_driver().
Added the new possibility of interrupting an LPC or Python
execution thread via a signal.
2019-02-26 21:43:28 +01:00
Zesstra
da05e1ded1 Added options to configure some time intervals.
configure_driver gets options to configure the time intervals
for swapping out programs and variables and for calling
the cleanup and reset hooks.
driver_info() can be used to query these intervals.
2019-02-25 21:37:31 +01:00
Mike Conley
3d8459a404 Update telnet.h 2019-01-01 20:24:59 +01:00
Richard James Salts
ccf5a221ca Correcting spelling mistakes in documentation and output strings 2018-02-07 22:42:05 +11:00
Alexander Motzkau
ddf06a06af Corrected handling of missing interactives in replacement sefuns
The replacement simul-efun implementations for set_buffer_size,
set_combine_charset, get_combine_charset, set_connection_charset and
get_connection_charset threw errors when there was no current
interactive object. The original efun implementation ignored
that quietly. So correcting the simul-efun implementations.
(Fixes #855)
2018-02-04 00:08:39 +01:00
Zesstra
301da1a7f7 debug_info.h: include driver_info.h
The compatibility header for debug_info() did not
include some defines the sefuns debug_info() needs.
They are defined in driver_info.h, so this will be
included if the trace defines are not present yet.
(Resolves #0000857)
2018-02-02 16:18:49 +01:00
Alexander Motzkau
cf06dff217 Removed the seteuid() and export_uid() efuns
Removed the efuns seteuid() and export_uid() in favor of the new
configure_object() with OC_EUID flag. UIDs are constant this way
and all EUID changes will get master oversight using the privilege
violation checks (Resolves #828).
2017-09-27 00:45:43 +02:00
Alexander Motzkau
8048abd552 Add an lvalue count (driver_info(DI_NUM_LVALUES)).
Count each allocated and freed lvalue object and return that
count in driver_info(DI_NUM_LVALUES).
2017-09-27 00:45:41 +02:00
Alexander Motzkau
5932e5b64c Python: Port change in closure types to LPC's lpctype.h
When Python support is compiled in, operator closures use
another closure type range. Update the lpctype.h to reflect
this. Also implement a __PYTHON__ define, to detect the
python support in mudlibs.
2016-10-12 22:27:48 +02:00
Alexander Motzkau
6f500ab02b Removed the efun set_is_wizard and all builtin special actions
Removed the special driver actions 'status', 'malloc', dumpallobj'
and 'opcdump'. They can be implemented as normal actions.
Also removed the efun set_is_wizard() which activates these actions.
(Issue #596)
2016-01-25 23:41:23 +01:00
Alexander Motzkau
f426c71b01 Removed the efun query_snoop
Removed the efun query_snoop() in favor of the new
interactive_info(). (Issue #596)
2016-01-25 23:41:23 +01:00
Alexander Motzkau
2477bb1e21 Removed the efun query_udp_port
Removed the efun query_udp_port() in favor of the new
driver_info(). Also the udp port is no longer the default
value for the tcp port argument of net_connect, because it
makes no sense. (Issue #596)
2016-01-25 23:41:23 +01:00
Alexander Motzkau
48b02ba9ab Removed the efun query_mud_port
Removed the efun query_mud_port() in favor of the new
driver_info() and interactive_info(). (Issue #596)
2016-01-25 23:41:23 +01:00
Alexander Motzkau
8548489abe Removed the efun query_load_average
Removed the efun query_load_average() in favor of the new
driver_info(). (Issue #596)
2016-01-25 23:41:23 +01:00
Alexander Motzkau
b6ca26e408 Removed the efun set_extra_wizinfo_size
Removed the efun set_extra_wizinfo_size() in favor of the new
configure_driver(). (Issue #596)
2016-01-25 23:41:23 +01:00
Alexander Motzkau
be40553319 Removed the efuns set_limits and query_limits
Removed the efuns set_limits() and query_limits() in favor
of the new configure_driver() and driver_info. (Issue #596)
2016-01-25 23:41:23 +01:00
Alexander Motzkau
40ca915a43 Removed the debug_info efun.
Removed the debug_info() efun in favor of the new
driver_info(), dump_driver_info() and objects(). (Issue #596)
2016-01-25 23:41:23 +01:00
Alexander Motzkau
5a8d289a9f Implemented options for driver_info and the efuns objects and dump_driver_info.
Implemented the functionality of several efuns as options to driver_info
and added new efuns objects and dump_driver_info. (Issue #596)
2016-01-25 23:41:22 +01:00
Alexander Motzkau
6063936d1a Removed the query_input_pending efun.
Removed the query_input_pending() efun in favor of the new
interactive_info(ob, II_INPUT_PENDING). (Issue #596)
2016-01-25 23:41:22 +01:00
Alexander Motzkau
bb9e7a76d9 Removed the query_idle efun.
Removed the query_idle() efun in favor of the new
interactive_info(ob, II_IDLE). (Issue #596)
2016-01-25 23:41:22 +01:00
Alexander Motzkau
666bb8dcb2 Removed the query_editing efun.
Removed the query_editing() efun in favor of the new
interactive_info(ob, II_EDITING). (Issue #596)
2016-01-25 23:41:22 +01:00
Alexander Motzkau
016d676509 Removed the query_ip_name/number() efuns.
Removed the query_ip_name() and query_ip_number() efuns in favor of the
new interactive_info(ob, II_IP_NAME), interactive_info(ob, II_IP_NUMBER),
and interactive_info(ob, II_IP_ADDRESS). (Issue #596)
2016-01-25 23:41:22 +01:00