mirror of
https://github.com/deuill/go-php.git
synced 2024-09-21 00:40:45 +00:00
Alex Palaistras
6fa93f5160
This commit contains an initial version of variable bindings to a context, along with tests. Currently supported types are integers, floating point numbers, and strings.
41 lines
595 B
C
41 lines
595 B
C
// Standard library.
|
|
#include <stdio.h>
|
|
#include <errno.h>
|
|
|
|
// PHP includes.
|
|
#include <main/php.h>
|
|
|
|
// Local includes.
|
|
#include "engine.h"
|
|
#include "value.h"
|
|
|
|
void *value_long(long int value) {
|
|
zval *v;
|
|
|
|
MAKE_STD_ZVAL(v);
|
|
ZVAL_LONG(v, value);
|
|
|
|
return_multi((void *) v, 0);
|
|
}
|
|
|
|
void *value_double(double value) {
|
|
zval *v;
|
|
|
|
MAKE_STD_ZVAL(v);
|
|
ZVAL_DOUBLE(v, value);
|
|
|
|
return_multi((void *) v, 0);
|
|
}
|
|
|
|
void *value_string(char *value) {
|
|
zval *v;
|
|
|
|
MAKE_STD_ZVAL(v);
|
|
ZVAL_STRING(v, value, 1);
|
|
|
|
return_multi((void *) v, 0);
|
|
}
|
|
|
|
void value_destroy(void *zvalptr) {
|
|
zval_dtor((zval *) zvalptr);
|
|
} |