summaryrefslogtreecommitdiffhomepage
path: root/src/libMsg/MsgKit/Server.h
blob: 5fa3ef9dd9d4c309737f9268a3180a68a7824a08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org)
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/nekernel-org/nekernel

#ifndef MSGKIT_SERVER_H
#define MSGKIT_SERVER_H

#ifdef __cplusplus
#include <CoreFoundation.fwrk/headers/String.h>
#else
#include <libSystem/SystemKit/System.h>
#endif

/// @author Amlal El Mahrouss
/// @file Server.h
/// @brief The libMsg LISP system.

struct LIBMSG_EXPR;

/// @brief an expression chain of LibMSG.
struct LIBMSG_EXPR final {
#ifdef __cplusplus
  CF::CFString* l_key{nullptr};
  CF::CFString* l_value{nullptr};
#else
  // if we use C, we won't know about CF, so let's make those private.
  VoidPtr l_private_data[2]{nullptr};
#endif

  LIBMSG_EXPR* l_head{nullptr};
  LIBMSG_EXPR* l_tail{nullptr};
  LIBMSG_EXPR* l_child{nullptr};
};

/// @brief Function type for LibMSG lisp.
typedef Void (*libmsg_func_type)(struct LIBMSG_EXPR* self, VoidPtr arg, SizeT arg_size);

IMPORT_C Void   libmsg_init_library(libmsg_func_type* funcs, SizeT cnt);
IMPORT_C UInt32 libmsg_close_library(Void);
IMPORT_C UInt32 libmsg_eval_expr(struct LIBMSG_EXPR* head);

#endif