forked from phper-framework/phper
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from dmalusev/feat/c-translation-units
feat: C modules into separate translation units
- Loading branch information
Showing
14 changed files
with
167 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <phper.h> | ||
|
||
zend_class_entry phper_init_class_entry(const char *class_name, | ||
size_t class_name_len) { | ||
|
||
zend_class_entry class_ce = {0}; | ||
INIT_CLASS_ENTRY_EX(class_ce, class_name, class_name_len, NULL); | ||
return class_ce; | ||
} | ||
|
||
zend_class_entry * | ||
phper_register_class_entry(zend_class_entry *ce, zend_class_entry *parent, | ||
const zend_function_entry *functions) { | ||
ce->info.internal.builtin_functions = functions; | ||
|
||
if (parent == NULL) { | ||
return zend_register_internal_class(ce); | ||
} | ||
|
||
return zend_register_internal_class_ex(ce, parent); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include <phper.h> | ||
|
||
zend_string *phper_get_function_or_method_name(const zend_function *func) { | ||
return get_function_or_method_name(func); | ||
} | ||
|
||
zend_string *phper_get_function_name(const zend_function *func) { | ||
return func->common.function_name; | ||
} | ||
|
||
bool phper_call_user_function(zval *object, zval *function_name, | ||
zval *retval_ptr, const zval *params, | ||
uint32_t param_count, | ||
const HashTable *named_params) { | ||
|
||
_call_user_function_impl(object, function_name, retval_ptr, param_count, | ||
(zval *)params, | ||
(HashTable *)named_params) == SUCCESS; | ||
} | ||
|
||
const zval *phper_zend_call_var_num(const zend_execute_data *execute_data, | ||
int index) { | ||
return ZEND_CALL_VAR_NUM(execute_data, index); | ||
} | ||
|
||
const zval *phper_zend_call_arg(const zend_execute_data *execute_data, | ||
int index) { | ||
return ZEND_CALL_ARG(execute_data, index); | ||
} | ||
|
||
uint32_t phper_zend_num_args(const zend_execute_data *execute_data) { | ||
return ZEND_NUM_ARGS(); | ||
} | ||
|
||
bool phper_zend_get_parameters_array_ex(uint32_t param_count, | ||
zval *argument_array) { | ||
return zend_get_parameters_array_ex(param_count, argument_array) == SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <phper.h> | ||
|
||
zend_class_entry phper_init_interface_entry(const char *class_name, | ||
size_t class_name_len) { | ||
zend_class_entry class_ce = {0}; | ||
INIT_CLASS_ENTRY_EX(class_ce, class_name, class_name_len, NULL); | ||
return class_ce; | ||
} | ||
|
||
zend_class_entry * | ||
phper_register_interface_entry(zend_class_entry *ce, | ||
const zend_function_entry *functions) { | ||
ce->info.internal.builtin_functions = functions; | ||
return zend_register_internal_interface(ce); | ||
} | ||
|
||
bool phper_instanceof_function(const zend_class_entry *instance_ce, | ||
const zend_class_entry *ce) { | ||
return instanceof_function(instance_ce, ce) != 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <phper.h> | ||
|
||
zval *phper_get_this(const zend_execute_data *execute_data) { | ||
return getThis(); | ||
} | ||
|
||
size_t phper_zend_object_properties_size(const zend_class_entry *ce) { | ||
return zend_object_properties_size((zend_class_entry *)ce); | ||
} | ||
|
||
void *phper_zend_object_alloc(size_t obj_size, const zend_class_entry *ce) { | ||
return zend_object_alloc(obj_size, (zend_class_entry *)ce); | ||
} | ||
|
||
bool phper_object_init_ex(zval *arg, const zend_class_entry *class_type) { | ||
return object_init_ex(arg, (zend_class_entry *)class_type) == SUCCESS; | ||
} | ||
|
||
void phper_zend_object_release(zend_object *obj) { | ||
zend_object_release(obj); | ||
} | ||
|
||
uint32_t phper_zend_object_gc_refcount(const zend_object *obj) { | ||
return GC_REFCOUNT(obj); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.