Added create-skill to the Scheme intepreter.
This commit is contained in:
parent
8dab8bfd06
commit
adc036a1ae
|
@ -3,9 +3,22 @@
|
|||
#include <libguile.h>
|
||||
#include "schemeintegration.h"
|
||||
|
||||
SCM scheme_create_skill(SCM string, SCM skilllist)
|
||||
{
|
||||
size_t skillNameLength = 0;
|
||||
char * skillName = scm_to_latin1_stringn(string, &skillNameLength);
|
||||
createSkill(scm_to_pointer(skilllist), skillName, skillNameLength, false);
|
||||
free(skillName);
|
||||
return SCM_BOOL_T;
|
||||
}
|
||||
|
||||
void * schemeHandler(void * parameters)
|
||||
{
|
||||
SchemeThreadParameters * schemeThreadParameters = parameters;
|
||||
|
||||
scm_init_guile();
|
||||
scm_c_define_gsubr("create-skill", 2, 0, 0, &scheme_create_skill);
|
||||
scm_c_define("skill-list", scm_from_pointer(schemeThreadParameters->skillList, NULL));
|
||||
scm_shell(0, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,13 +2,16 @@
|
|||
// Barra Ó Catháin, 2023.
|
||||
#ifndef SCHEMEINTEGRATION_H
|
||||
#define SCHEMEINTEGRATION_H
|
||||
#include "queue.h"
|
||||
#include "linkedlist.h"
|
||||
|
||||
typedef struct list list;
|
||||
typedef struct queue queue;
|
||||
|
||||
typedef struct SchemeThreadParameters
|
||||
{
|
||||
list * areaList, * skillList;
|
||||
queue * inputQueue, * outputQueue;
|
||||
} SchemeThreadParameters;
|
||||
|
||||
void * schemeHandler(void * parameters);
|
||||
|
|
|
@ -226,11 +226,12 @@ int main(int argc, char ** argv)
|
|||
pthread_create(&outputThread, NULL, &outputThreadHandler, outputParameters);
|
||||
slowPrint("\tOutput Thread is:\t\033[32;40mGREEN.\033[0m\n", delay);
|
||||
|
||||
|
||||
pthread_create(&schemeThread, NULL, &schemeHandler, NULL);
|
||||
SchemeThreadParameters * schemeParameters = malloc(sizeof(SchemeThreadParameters));
|
||||
schemeParameters->skillList = globalSkillList;
|
||||
slowPrint("\tScheme Thread is:\t\033[32;40mGREEN.\033[0m\n", delay);
|
||||
|
||||
slowPrint("=====\n", delay);
|
||||
pthread_create(&schemeThread, NULL, &schemeHandler, schemeParameters);
|
||||
|
||||
while(true)
|
||||
{
|
||||
// Clear the set of file descriptors and add the master socket:
|
||||
|
@ -280,7 +281,7 @@ int main(int argc, char ** argv)
|
|||
if (clientSockets[index] == 0)
|
||||
{
|
||||
clientSockets[index] = connectionFileDesc;
|
||||
printf("Adding to list of sockets as %d.\n", index);
|
||||
//printf("Adding to list of sockets as %d.\n", index);
|
||||
gnutls_transport_set_int(tlssessions[index], clientSockets[index]);
|
||||
do
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue