Commit graph

28 commits

Author SHA1 Message Date
Alexander Motzkau
25ab0f48bc Added separate Python types for various closure types
Added LfunClosure, (Simul)EfunClosure, (Unbound/Bound)LambdaClosure and
OperatorClosure types for Python.
2025-07-07 22:14:05 +02:00
Alexander Motzkau
f7c95ae898 Add program_name member function to ldmud.Object object
To streamline Python representations for normal and lightweight objects
also add a program_name member function to normal objects.
2025-07-07 22:14:05 +02:00
Alexander Motzkau
8b3031d3b4 With pragma save_local_names save debugging info for local variables
Previously pragma save_local_names was only used to store information of
variables of coroutines to be inspected by Python code. Extend this to
all local variables.
2025-07-07 22:14:05 +02:00
Alexander Motzkau
15166819ed Implement Python-registered structs
Python can register global struct definitions via ldmud.register_struct().
Also added corresponding namespace ldmud.registered_structs that contains
all registered struct types.
2025-07-07 22:14:05 +02:00
Alexander Motzkau
0142ebbd27 Added abilities to Python integration to trace LPC program execution
Added BEFORE_INSTRUCTION hook to be called for every instruction.
Added call_stack property to query the current stack.
2025-07-07 22:14:05 +02:00
Alexander Motzkau
1db6633aab Implement to_type() efun
to_type() converts a value to a given target type.
If required, does so recursively.
2025-03-21 21:30:30 +01:00
Alexander Motzkau
8b2b719784 Added sub-namespace for registered efuns and types
ldmud.registered_efuns contains all registered Python efuns and
ldmud.registered_types provides all registered Python types.
Those are read-only, for manipulation there is (un)register_efun/type().
2025-03-21 21:30:30 +01:00
Alexander Motzkau
11144cb5c1 Notify Python about all handled signals
Added a Python hook for signals SIGINT, SIGTERM, SIGHUP, SIGUSR1 and SIGUSR2.
2023-03-04 19:52:58 +01:00
Alexander Motzkau
52dc66d499 Add support for LPC type objects in Python
Fully support the LPC type system in Python, providing representations
for basic types (int, float, string, bytes), named (lightweight) object
types, concrete struct types and union types.
2022-10-10 23:38:01 +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
44ea2fb3a8 Added support for Python startup packages
It's now possible to specify a Python package with a __main__ module to
execute at startup.
2022-06-26 15:47:01 +02:00
Alexander Motzkau
bf44f19753 Save local variable names for inspection in coroutines
With the new pragma save_local_names the names of local variables are
stored in the program so they can be inspected (with Python) later on.
2022-01-09 21:22:34 +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
07c99b6e16 Implement support for lvalues of struct members in Python
Struct member access is now done via the .members attribute of
structs and lvalues. For Struct objects this will return a member
object with .name, .type and .value attributes. For Lvalue objects
this will return an Lvalue for the given member.
2020-08-26 22:27:57 +02:00
Alexander Motzkau
e682e553a8 Implement support for lvalues in Python
Add an Lvalue class to represent LPC lvalues.
2020-08-26 22:27:57 +02:00
Alexander Motzkau
68bc5440c7 Python: Implemented variable list for object representation
In Python the representation of an LPC object offers an attribute
variables, that contains all variables of that object with some
information about it and an attribute to change its value.
2020-04-28 22:30:06 +02:00
Alexander Motzkau
855ee6441a Python: Implemented function list for object representation
In Python the representation of an LPC object offers an attribute
functions, that contains all visible functions of that object
with some information about that function and the call operator.
2020-04-28 22:30:06 +02:00
Alexander Motzkau
65c0e08af6 Allow Python routines to wait for a terminated child process.
Don't ignore the SIGCHLD signal anymore, but add a hook for Python routines
to get notified if such a signal arrives. This means we must now wait for
our own ERQ processes, so that they won't become zombies.
2020-04-28 22:30:05 +02:00
Alexander Motzkau
628a6ee00e Implemented type checks for Python efuns
If Python efuns have type annotations they are evaluated
at compile and runtime. Even without annotations the number
of arguments are checked at compile time.
2019-11-04 22:16:19 +01:00
Alexander Motzkau
2d90f34608 Python: Added a few notes to the documentation. 2016-10-12 22:27:48 +02:00
Alexander Motzkau
fc5cc09c9a Python: Implemented (un)register_hook 2016-10-12 22:27:47 +02:00
Alexander Motzkau
f116220d85 Python: Implemented unregister_efun 2016-10-12 22:27:47 +02:00
Alexander Motzkau
8958197107 Python: Implemented (un)register_socket and fixed a few bugs. 2016-10-12 22:27:47 +02:00
Alexander Motzkau
0db245e961 Python: Added support for quoted arrays. 2016-10-12 22:27:47 +02:00
Alexander Motzkau
20db434a67 Python: Added support for symbols. 2016-10-12 22:27:47 +02:00
Alexander Motzkau
61a60536ab Python: Updated documentation. 2016-10-12 22:27:47 +02:00
Alexander Motzkau
9ed8fc5aec Implemented an interface for Python.
This is a first step towards a python interface for LDMud.
Right now efuns can be defined from a python script, that
can have int, float and string as arguments or return values.
2016-10-12 21:42:44 +02:00