There are several function implemented as a builtin library, that is compiled and interpreted everytime during interpreter execution. They supplement the list of builtin functions. There are two reasons to reimplement them as a builtin functions:
native C implementation will be compiled to machine code, thus will be faster,
builtin function can be moved to module and consume less memory,
after compiler rewrite it will deny defining a functions in global scope
There is globbing function already implemented in PH7 Engine, however directory handling routines are implemented as ph7_io_stream and they results are returned internally to the VM. We might need to implement them as a part of VFS. At least I dont know the way to use ph7_io_stream. I know the result is save in pCtx->pRet and it is not a big deal to take its value, but it can be tricky to overload the builtin function return value afterwards. The implementation of xOpenDir() and xReadDir() will be needed for scandir() implementation too.
There is globbing function already implemented in PH7 Engine, however directory handling routines are implemented as ph7_io_stream and they results are returned internally to the VM. We might need to implement them as a part of VFS. At least I dont know the way to use ph7_io_stream. I know the result is save in pCtx->pRet and it is not a big deal to take its value, but it can be tricky to overload the builtin function return value afterwards. The implementation of xOpenDir() and xReadDir() will be needed for scandir() implementation too.
Builtin library needs to be redesigned, as it actually follows the PHP. Some functions use prefix + underscore, while others use C-Style (abbreviated words crunched together). Numerous functions can be found in the library that are aliases for each other and do the exact same thing, which is rather confusing to say the least. Even the order of parameters varies between different functions of similar kind. This all just sucks and have to be rearranged.
Actually closing this ticket, as there is a plan to completely rework the builtin library.
Builtin library needs to be redesigned, as it actually follows the PHP. Some functions use prefix + underscore, while others use C-Style (abbreviated words crunched together). Numerous functions can be found in the library that are aliases for each other and do the exact same thing, which is rather confusing to say the least. Even the order of parameters varies between different functions of similar kind. This all just sucks and have to be rearranged.
Actually closing this ticket, as there is a plan to completely rework the builtin library.
There are several function implemented as a builtin library, that is compiled and interpreted everytime during interpreter execution. They supplement the list of builtin functions. There are two reasons to reimplement them as a builtin functions:
Functions that need to be reimplemented:
Their actual implementation looks as follows:
Left:
There is globbing function already implemented in PH7 Engine, however directory handling routines are implemented as ph7_io_stream and they results are returned internally to the VM. We might need to implement them as a part of VFS. At least I dont know the way to use ph7_io_stream. I know the result is save in pCtx->pRet and it is not a big deal to take its value, but it can be tricky to overload the builtin function return value afterwards. The implementation of xOpenDir() and xReadDir() will be needed for scandir() implementation too.
Builtin library needs to be redesigned, as it actually follows the PHP. Some functions use prefix + underscore, while others use C-Style (abbreviated words crunched together). Numerous functions can be found in the library that are aliases for each other and do the exact same thing, which is rather confusing to say the least. Even the order of parameters varies between different functions of similar kind. This all just sucks and have to be rearranged.
Actually closing this ticket, as there is a plan to completely rework the builtin library.