Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin support #1328

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
06027eb
Plugin support
ray73864 May 2, 2020
bef2971
Add flags to configure so that they get put correctly into the genera…
ray73864 May 2, 2020
daf7ec2
Updated to use calloc/realloc/free so that the plugins array can be w…
ray73864 May 2, 2020
b392572
Change from using an array to using a doubly-linked list, likely don'…
ray73864 May 3, 2020
773dbb1
Removed old code from bsd.c, forgot to update local.dst with changes …
ray73864 May 3, 2020
566634b
Revert local.dst, move timers to their individual plugins with the sq…
ray73864 May 3, 2020
82b2996
Merge branch 'pennmush:master' into master
ray73864 Sep 25, 2021
082cac1
Merge branch 'pennmush:master' into master
ray73864 Oct 8, 2021
a24bccf
GCC 10 defaults to -fno-common which means any variables in a header …
ray73864 Oct 8, 2021
dc40027
Move plugin declarations from conf.h to a new plugin.h and include th…
ray73864 Oct 8, 2021
67bbe95
Math plugin test utilising TinyExpr library
ray73864 Oct 9, 2021
81cfddf
Modified next_token() in tinyexpr.c so that it was te_next_token() in…
ray73864 Oct 10, 2021
8d398e5
Forgot to add the plugin header :P
ray73864 Oct 10, 2021
e6ec5ff
Remove test BDV plugin
ray73864 Oct 10, 2021
0168de1
Prune the list of included files to only those actually needed by thi…
ray73864 Oct 10, 2021
eac62d7
Don't track the .so file anymore, since it's created by compiling the…
ray73864 Oct 10, 2021
4596569
Start of the move of plugins from a doubley linked-list to an array o…
ray73864 Oct 11, 2021
18ef98b
Update gitignore
ray73864 Oct 11, 2021
7a02474
Move load_plugins and unload_plugins to be above the main function, t…
ray73864 Oct 11, 2021
f1321d5
Add a check with snprintf so that if it is longer than 255 bytes (Can…
ray73864 Oct 11, 2021
f58346e
Switch over to Penn's mush_(malloc/realloc/free) functions
ray73864 Oct 11, 2021
5e91e82
Support for plugin information: Plugin Name, Author, and Version.
ray73864 Oct 12, 2021
5b7ba21
Testing having a plugin_info struct that differs between the plugin a…
ray73864 Oct 12, 2021
925cf5a
Move plugin code to plugin.c
ray73864 Oct 12, 2021
361c00a
Add comments for load_plugin() and unload_plugin()
ray73864 Oct 12, 2021
c241c73
Start the adding of the @plugin function and make the plugins directo…
ray73864 Oct 15, 2021
20ec5df
Move over to using a HASHTAB instead of an array, easier to work with.
ray73864 Oct 15, 2021
39f6629
Modify the PLUGIN_INFO struct so that plugins can provide a short des…
ray73864 Oct 15, 2021
2fe914c
Separate out the logic for @plugin/list into its own function that is…
ray73864 Oct 16, 2021
e21a9f8
Implement @plugin/info
ray73864 Oct 16, 2021
586e375
The start of the load/unload/reload functionality
ray73864 Oct 17, 2021
df5ba91
Split out some more of the loading and unloading to generic functions…
ray73864 Oct 17, 2021
a60d63b
Move functions to be above the COMMAND(cmd_plugin) reference to silen…
ray73864 Oct 17, 2021
d25e1a1
Forgot to close the directory after scanning through it.
ray73864 Oct 17, 2021
cb82274
Further testing of loading a plugin manually, this time using stat().
ray73864 Oct 17, 2021
b9af16a
@plugin/load now correctly loads a plugin, but it incorrectly sets th…
ray73864 Oct 17, 2021
a6a1e34
Further changes (possibly an improvement?) to @plugin/list.
ray73864 Oct 17, 2021
9502e62
Changes to plugin.c to provide the reason why the plugin failed to op…
ray73864 Dec 1, 2021
c5a91ed
Instead of returning -1 on error, return the error message from dlerr…
ray73864 Dec 3, 2021
f7b037b
Update documentation and remove 'active' since the easiest way to mak…
ray73864 Dec 3, 2021
8a84c9c
Instead of setting the plugin id each time a plugin is added, reseque…
ray73864 Dec 3, 2021
a705468
Instead of looping through the hash to get the list of loaded plugins…
ray73864 Dec 3, 2021
beb7414
Add a new @plugins command which is essentially a shortcut for @plugi…
ray73864 Dec 4, 2021
6bc779a
Merge branch 'pennmush:master' into master
ray73864 May 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ dbtools/grepdb
dbtools/pwutil
pcre2
pcre2-10.*
game/reboot.db
plugins/math.so
4 changes: 2 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -10863,7 +10863,7 @@ done

CC="${SAVED_CC}"
CFLAGS="${SAVED_CFLAGS}"
LIBS="${SAVED_LIBS}"
LIBS="${SAVED_LIBS} -ldl"



Expand Down Expand Up @@ -11297,7 +11297,7 @@ if test -d pcre2 ; then
rm -rf pcre2/
fi
CPPFLAGS="${CPPFLAGS} -I../pcre2/include"
LDFLAGS="${LDFLAGS} ../pcre2/lib/libpcre2-8.a"
LDFLAGS="${LDFLAGS} ../pcre2/lib/libpcre2-8.a -rdynamic -Wl,--unresolved-symbols=ignore-in-object-files"
$as_echo "#define HAVE_PCRE 1" >>confdefs.h


Expand Down
3 changes: 3 additions & 0 deletions hdrs/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ struct options_table {
connlog_db[FILE_PATH_LEN]; /**< Sqlite3 file to use for connection logs. */
char dict_file[FILE_PATH_LEN]; /**< List of words to load into suggest() db */
char colors_file[FILE_PATH_LEN]; /**< JSON file holding the colors database */
char plugins_dir[FILE_PATH_LEN]; /**< Directory for where plugins are found based on the penn-root dir */
};

typedef struct mssp MSSP;
Expand Down Expand Up @@ -548,6 +549,8 @@ int can_view_config_option(dbref player, PENNCONF *opt);

#define READ_REMOTE_DESC (options.read_remote_desc)

#define PLUGINS_DIR (options.plugins_dir)

typedef struct globals_table GLOBALTAB;

/** State of the MUSH
Expand Down
32 changes: 32 additions & 0 deletions hdrs/plugin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* \file plugin.h
*
* \brief Routines for Penn's plugin system.
*/

#ifndef __PENNPLUGIN_H
#define __PENNPLUGIN_H

typedef struct plugin_info {
char *name;
char *author;
char *app_version;
int version_id;
char shortdesc[30];
char description[BUFFER_LEN];
} PLUGIN_INFO;

typedef struct penn_plugin {
void* handle;
char *name;
char file[256];
int id;
PLUGIN_INFO *info;
} PENN_PLUGIN;

extern HASHTAB plugins;

extern void load_plugins();
extern void unload_plugins();

#endif /* __PENN_PLUGIN_H */