Begin adding Scheme intepreretation.
We now have a scheme thread and a interpreter.
This commit is contained in:
parent
995a177c37
commit
8dab8bfd06
7
Makefile
7
Makefile
|
@ -4,9 +4,10 @@ clientsrc = $(wildcard src/*.c) \
|
||||||
clientobj = $(clientsrc:.c=.o)
|
clientobj = $(clientsrc:.c=.o)
|
||||||
serversrc = $(wildcard src/*.c) \
|
serversrc = $(wildcard src/*.c) \
|
||||||
src/server/SilverMUDServer.c
|
src/server/SilverMUDServer.c
|
||||||
serverobj = $(serversrc:.c=.o)
|
serverobj = $(serversrc:.c=.o)
|
||||||
CLIENTLDFLAGS= -lpthread -lncurses -lgnutls
|
CFLAGS = `pkg-config --cflags guile-3.0`
|
||||||
SERVERLDFLAGS= -lpthread -lncurses -lgnutls
|
CLIENTLDFLAGS= -lpthread -lncurses -lgnutls `pkg-config --libs guile-3.0`
|
||||||
|
SERVERLDFLAGS= -lpthread -lncurses -lgnutls `pkg-config --libs guile-3.0`
|
||||||
SilverMUDClient: $(clientobj)
|
SilverMUDClient: $(clientobj)
|
||||||
gcc -o $@ $^ $(CLIENTLDFLAGS)
|
gcc -o $@ $^ $(CLIENTLDFLAGS)
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
// Let the compiler know that we're going to define these types:
|
// Let the compiler know that we're going to define these types:
|
||||||
typedef struct playerPath playerPath;
|
typedef struct playerPath playerPath;
|
||||||
typedef struct playerArea playerArea;
|
typedef struct playerArea playerArea;
|
||||||
|
typedef struct list list;
|
||||||
|
|
||||||
// A path, which contains a name, and a pointer to the area which the player will travel to:
|
// A path, which contains a name, and a pointer to the area which the player will travel to:
|
||||||
struct playerPath
|
struct playerPath
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
// schemeintegration.h: Function definitions for SilverMUD's Scheme integration.
|
||||||
|
// Barra Ó Catháin, 2023.
|
||||||
|
#include <libguile.h>
|
||||||
|
#include "schemeintegration.h"
|
||||||
|
|
||||||
|
void * schemeHandler(void * parameters)
|
||||||
|
{
|
||||||
|
scm_init_guile();
|
||||||
|
scm_shell(0, NULL);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
// schemeintegration.h: Data-structures and function prototypes for SilverMUD's Scheme integration.
|
||||||
|
// Barra Ó Catháin, 2023.
|
||||||
|
#ifndef SCHEMEINTEGRATION_H
|
||||||
|
#define SCHEMEINTEGRATION_H
|
||||||
|
#include "linkedlist.h"
|
||||||
|
|
||||||
|
typedef struct list list;
|
||||||
|
|
||||||
|
typedef struct SchemeThreadParameters
|
||||||
|
{
|
||||||
|
list * areaList, * skillList;
|
||||||
|
} SchemeThreadParameters;
|
||||||
|
|
||||||
|
void * schemeHandler(void * parameters);
|
||||||
|
|
||||||
|
#endif
|
|
@ -26,6 +26,7 @@
|
||||||
#include "../linkedlist.h"
|
#include "../linkedlist.h"
|
||||||
#include "../texteffects.h"
|
#include "../texteffects.h"
|
||||||
#include "../inputoutput.h"
|
#include "../inputoutput.h"
|
||||||
|
#include "../schemeintegration.h"
|
||||||
|
|
||||||
typedef struct sockaddr sockaddr;
|
typedef struct sockaddr sockaddr;
|
||||||
void sigintHandler(int signal)
|
void sigintHandler(int signal)
|
||||||
|
@ -41,7 +42,7 @@ int main(int argc, char ** argv)
|
||||||
int socketFileDesc, connectionFileDesc, length, clientsAmount,
|
int socketFileDesc, connectionFileDesc, length, clientsAmount,
|
||||||
socketCheck, activityCheck, returnVal;
|
socketCheck, activityCheck, returnVal;
|
||||||
fd_set connectedClients;
|
fd_set connectedClients;
|
||||||
pthread_t gameLogicThread, outputThread;
|
pthread_t gameLogicThread, outputThread, schemeThread;
|
||||||
int clientSockets[PLAYERCOUNT];
|
int clientSockets[PLAYERCOUNT];
|
||||||
userMessage sendBuffer, receiveBuffer;
|
userMessage sendBuffer, receiveBuffer;
|
||||||
playerInfo connectedPlayers[PLAYERCOUNT];
|
playerInfo connectedPlayers[PLAYERCOUNT];
|
||||||
|
@ -223,10 +224,13 @@ int main(int argc, char ** argv)
|
||||||
outputParameters->tlssessions = tlssessions;
|
outputParameters->tlssessions = tlssessions;
|
||||||
outputParameters->connectedPlayers = connectedPlayers;
|
outputParameters->connectedPlayers = connectedPlayers;
|
||||||
pthread_create(&outputThread, NULL, &outputThreadHandler, outputParameters);
|
pthread_create(&outputThread, NULL, &outputThreadHandler, outputParameters);
|
||||||
|
|
||||||
slowPrint("\tOutput Thread is:\t\033[32;40mGREEN.\033[0m\n", delay);
|
slowPrint("\tOutput Thread is:\t\033[32;40mGREEN.\033[0m\n", delay);
|
||||||
slowPrint("=====\n", delay);
|
|
||||||
|
|
||||||
|
|
||||||
|
pthread_create(&schemeThread, NULL, &schemeHandler, NULL);
|
||||||
|
slowPrint("\tScheme Thread is:\t\033[32;40mGREEN.\033[0m\n", delay);
|
||||||
|
|
||||||
|
slowPrint("=====\n", delay);
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
// Clear the set of file descriptors and add the master socket:
|
// Clear the set of file descriptors and add the master socket:
|
||||||
|
|
Loading…
Reference in New Issue