2015-10-04 18:28:44 +00:00
|
|
|
// Copyright 2015 Alexander Palaistras. All rights reserved.
|
|
|
|
// Use of this source code is governed by the MIT license that can be found in
|
|
|
|
// the LICENSE file.
|
|
|
|
|
2015-10-01 23:48:33 +00:00
|
|
|
#ifndef CONTEXT_H
|
|
|
|
#define CONTEXT_H
|
|
|
|
|
|
|
|
typedef struct _engine_context {
|
|
|
|
#ifdef ZTS
|
|
|
|
void *ptsrm_ls; // Pointer to TSRM local storage.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void *parent; // Pointer to parent Go context, used for passing to callbacks.
|
2015-10-16 13:41:13 +00:00
|
|
|
int (*write)(struct _engine_context *context, const char *msg, unsigned int len);
|
2015-10-01 23:48:33 +00:00
|
|
|
} engine_context;
|
|
|
|
|
|
|
|
engine_context *context_new(void *parent);
|
|
|
|
void context_exec(engine_context *context, char *filename);
|
2015-10-17 23:26:09 +00:00
|
|
|
void *context_eval(engine_context *context, char *script);
|
|
|
|
void context_bind(engine_context *context, char *name, void *value);
|
2015-10-16 13:41:13 +00:00
|
|
|
int context_write(engine_context *context, const char *str, unsigned int len);
|
2015-10-01 23:48:33 +00:00
|
|
|
void context_destroy(engine_context *context);
|
|
|
|
|
|
|
|
#endif
|