Commit graph

60 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
00c4239b20 Removed the get/set_connection/combine_charset() efuns.
Removed the efuns set_connection_charset(), get_connection_charset(),
set_combine_charset(), and get_combine_charset() in favor of the new
configure_object() with IC_CONNECTION_CHARSET_AS_STRING,
IC_CONNECTION_CHARSET_AS_ARRAY, IC_COMBINE_CHARSET_AS_STRING,
IC_COMBINE_CHARSET_AS_ARRAY, and IC_QUOTE_IAC. Added simul-efun
implementations providing the old interface. (Issue #596)
2016-01-25 23:40:19 +01:00
Alexander Motzkau
964f016504 Implemented options for interactive_info.
Added the functionality of several efuns as options
to interactive_info. (Issue #596)
2016-01-25 22:36:26 +01:00
Alexander Motzkau
18e7830eb2 Implemented options for configure_interactive.
Implemented the functionality of several efuns as options
to configure_interactive and interactive_info. (Issue #596)
2016-01-25 22:36:26 +01:00
Alexander Motzkau
95afc0c457 Implemented the new object_info.
object_info() got a whole new design. Added a simul-efun implementation
providing the old interface. (Issue #596)
2016-01-25 22:18:59 +01:00
Alexander Motzkau
aaaca9a3fa Implemented efuns configure_object, interactive_info and driver_info.
configure_object completes the configure_* efuns for objects.
interactive_info and driver_info complement the already
existing configure_interactive and configure_driver. (Issue #596)
2016-01-25 22:18:59 +01:00
Zesstra
7ab9377e76 Make cipher lists configurable
configure_driver() supports setting the cipher list (OpenSSL)
or priorities (GnuTLS).
Otherwise, defaults are used which favor strong ciphers with
PFS and forbid SSLv3 and weak ciphers.
(fixes #849)
2016-01-20 16:58:53 +01:00
Zesstra
69cec783fb Make DH parameters configurable
The DH parameters can now be set with configure_driver().
The argument is expected to be a PEM encoded string or
0 to restore the built-in defaults.
pkg-gnutls keeps the parameters in a permanently allocated
block, pkg-openssl does not keep a copy of the parameters
for itself.
If the parameters can't be imported, the driver tries to
retain the old parameters, which is guaranteed for GnuTLS,
but not for OpenSSL.
(fixes #846)
2016-01-20 16:58:40 +01:00
Zesstra
e7d2b16c72 Removed light support.
The old and very basic light support was removed.
It was rarely used and the mudlibs do a better
and more flexible job at maintaining light
from/in objects.
object_info() does not report OIB_TOTAL_LIGHT any
more, therefore the array OINFO_BASIC is one
element shorter.
(fixed #775)
2015-05-01 12:01:29 +02:00
Alexander Motzkau
fae85ab2d3 configure_driver: Added DC_TLS_CERTIFICATE to select a certificate. 2013-10-06 22:42:58 +02:00
Zesstra
ba9f4da6a3 net_connect(): don't return errno.
Returning errno is not a good idea since the numbers are
implementation defined and there is no good way on the LPC
side to make sense of the number.
Additionally there was a complaint about transient errors
not clearly identifiable.
We now return our own error numbers, defined in comm.h.
(fixes #427)
2013-08-19 22:30:07 +02:00
Zesstra
8d0a6f45f2 Make time between data cleanups configurable.
The time between two data cleanups of an objects was derived from the
general cleanup time (time until to call clean_up() in the object).
This did not make much sense. It now has a default of 3600s and can
be configured at run-time with configure_driver().
2012-12-03 18:29:54 +01:00
Zesstra
5ad13e353c Removed a bunch of conditional USE_STRUCT code.
Since structs are always active, the corresponding checks with
#ifdef USE_STRUCTS are removed as well.

git-svn-id: svn://svn.bearnip.com/ldmud/trunk@3062 56160b6e-f8f8-0310-bd54-bccebfe6a2f2
2011-11-22 22:46:01 +00:00
Zesstra
c7dab2c567 char* telopts contains names without TELOPT_. *sigh*
git-svn-id: svn://svn.bearnip.com/ldmud/trunk@3028 56160b6e-f8f8-0310-bd54-bccebfe6a2f2
2011-09-15 12:15:35 +00:00
Zesstra
67cb1f5f40 Added new telnet options.
TELOPT_KERMIT and TELOPT_SEND_URL were new,
TELOPT_EXOPL is not really an unofficial, mud-specific option.

git-svn-id: svn://svn.bearnip.com/ldmud/trunk@3027 56160b6e-f8f8-0310-bd54-bccebfe6a2f2
2011-09-15 11:22:42 +00:00
Zesstra
2540c460af Added new runtime limit LIMIT_MEMORY (fixes #302).
As discussed in bug #302, we introduce an optional limit for the
_additional_ memory consumption per top-level execution. This is not to
prevent against malicious users, but against accidental allocations of
huge amounts of memory. The limit should not be set too low. The minimum
is 50000 bytes, but the recommendation is to set it much higher.
(interpret.c, simulate.c)

git-svn-id: svn://svn.bearnip.com/ldmud/trunk@2983 56160b6e-f8f8-0310-bd54-bccebfe6a2f2
2011-02-15 23:12:04 +00:00
Zesstra
bf6c28aa77 Detect long executions with ITIMER_PROF.
ITIMER_PROF is a timer which accounts time spent on the process and its
syscalls. This patch adds a handler for the SIGPROF signal and sets a
timer at the beginning of each top-level execution. At the end the
timer is deactivated again.
Should it trigger in between the handler will set a flag and the
interpreter will dump a stacktrace into the debuglog after the current
instruction.
This feature is deactivated by default.
(backend.c, interpreter.c)

git-svn-id: svn://svn.bearnip.com/ldmud/trunk@2930 56160b6e-f8f8-0310-bd54-bccebfe6a2f2
2010-09-25 20:17:29 +00:00
Zesstra
a96d847670 Make calling of heartbeats configurable at run-time.
Heartbeats were called only when players are logged on. They are now
called regardless of logged-on players.
However, the mudlib can activate/deactivate the calls to heartbeats
globally by using configure_driver().
(efuns.c, heartbeat.c, main.c)

git-svn-id: svn://svn.bearnip.com/ldmud/trunk@2887 56160b6e-f8f8-0310-bd54-bccebfe6a2f2
2010-03-14 16:46:16 +00:00
Zesstra
492b6b0ef8 Added our own header file for the signals.
Created mudlib/sys/signals.h our own definitions of the SIG* for the
mudlib and translate the host system signals.
Merged the SIGTERM handler into the general signal handler.
(backend.c)

git-svn-id: svn://svn.bearnip.com/ldmud/trunk@2879 56160b6e-f8f8-0310-bd54-bccebfe6a2f2
2010-02-19 20:12:21 +00:00
Gnomi
443edf8ff4 - Pass all unknown telnet options to the mudlib. (#670)
(comm.c)


git-svn-id: svn://svn.bearnip.com/ldmud/trunk@2767 56160b6e-f8f8-0310-bd54-bccebfe6a2f2
2009-10-12 10:01:42 +00:00
Zesstra
5eaec30ae6 Removed ptmalloc keywords from mudlib headers.
Somehow I forgot to include these files in the previous patch.

git-svn-id: svn://svn.bearnip.com/ldmud/trunk@2747 56160b6e-f8f8-0310-bd54-bccebfe6a2f2
2009-09-20 09:46:20 +00:00
Gnomi
3e4b7818c8 - (pkg-xml2.c, arraylist.c, configure) Added support for XML parsing
using libxml2. (Bug #538, thanks, Bardioc!)


git-svn-id: svn://svn.bearnip.com/ldmud/trunk@2585 56160b6e-f8f8-0310-bd54-bccebfe6a2f2
2009-05-18 07:42:29 +00:00
Zesstra
63d7322546 - (efuns.c, efuns.h, func_spec, string_spec, doc/, mudlib/)
Added new efun: configure_driver() and documentation.
  configure_driver() will configure variuous aspects of the driver at run-time.
  The first settings available is now the soft and hard memory limits.


git-svn-id: svn://svn.bearnip.com/ldmud/trunk@2556 56160b6e-f8f8-0310-bd54-bccebfe6a2f2
2009-05-04 17:48:28 +00:00
Gnomi
ea1ab65f82 - (mudlib/sys/configuration.h) Fixed a typo in a define.
git-svn-id: svn://svn.bearnip.com/ldmud/trunk@2554 56160b6e-f8f8-0310-bd54-bccebfe6a2f2
2009-04-19 16:56:03 +00:00