Skip to content

Commit

Permalink
move vkext builtins to runtime-common (#1197)
Browse files Browse the repository at this point in the history
  • Loading branch information
astrophysik authored Jan 15, 2025
1 parent 29f2b81 commit 23ce77b
Show file tree
Hide file tree
Showing 21 changed files with 1,155 additions and 683 deletions.
2 changes: 2 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions builtin-functions/kphp-light/functions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ require_once __DIR__ . '/kphp_internal.txt';
require_once __DIR__ . '/math.txt';
require_once __DIR__ . '/time.txt';
require_once __DIR__ . '/regex.txt';
require_once __DIR__ . '/vkext.txt';

/** defined in runtime-core.h **/
function likely ($x ::: bool) ::: bool;
Expand Down
1 change: 0 additions & 1 deletion builtin-functions/kphp-light/unsupported-functions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ require_once __DIR__ . '/unsupported/misc.txt';
require_once __DIR__ . '/unsupported/spl.txt';
require_once __DIR__ . '/unsupported/uberh3.txt';
require_once __DIR__ . '/unsupported/unsupported-server.txt';
require_once __DIR__ . '/unsupported/vkext.txt';
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
<?php

/** @kphp-extern-func-info generate-stub */
// ===== SUPPORTED =====

function vk_utf8_to_win ($text ::: string, $max_len ::: int = 0, $exit_on_error ::: bool = false) ::: string;
/** @kphp-extern-func-info generate-stub */

function vk_win_to_utf8 ($text ::: string, $escape ::: bool = true) ::: string;
/** @kphp-extern-func-info generate-stub */
function vk_flex ($name ::: string, $case_name ::: string, $sex ::: int, $type ::: string, $lang_id ::: int = 0) ::: string;
/** @kphp-extern-func-info generate-stub */

function vk_json_encode ($v ::: mixed) ::: string | false;
/** @kphp-extern-func-info can_throw generate-stub */
function vk_json_encode_safe ($v ::: mixed) ::: string;
/** @kphp-extern-func-info generate-stub */

function vk_sp_deunicode ($str ::: string) ::: string;
/** @kphp-extern-func-info generate-stub */

function vk_sp_simplify ($str ::: string) ::: string;
/** @kphp-extern-func-info generate-stub */

function vk_sp_to_lower ($str ::: string) ::: string;
/** @kphp-extern-func-info generate-stub */

function vk_sp_to_upper ($str ::: string) ::: string;

function vk_whitespace_pack ($str ::: string, $html_opt ::: bool = false) ::: string;

function vk_sp_full_simplify ($str ::: string) ::: string;

// ===== UNSUPPORTED =====

/** @kphp-extern-func-info generate-stub */
function vk_stats_hll_merge($str ::: mixed) ::: string | false;
/** @kphp-extern-func-info generate-stub */
function vk_stats_hll_count($hll ::: string) ::: float | false;
function vk_stats_hll_count($hll ::: string) ::: float | false;

/** @kphp-extern-func-info generate-stub */
function vk_flex ($name ::: string, $case_name ::: string, $sex ::: int, $type ::: string, $lang_id ::: int = 0) ::: string;

/** @kphp-extern-func-info can_throw generate-stub */
function vk_json_encode_safe ($v ::: mixed) ::: string;
8 changes: 7 additions & 1 deletion runtime-common/stdlib/stdlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ prepend(STDLIB_SERIALIZATION stdlib/serialization/ json-functions.cpp
prepend(STDLIB_STRING stdlib/string/ mbstring-functions.cpp
regex-functions.cpp string-functions.cpp)
prepend(STDLIB_SERVER stdlib/server/ url-functions.cpp)
prepend(STDLIB_VKEXT stdlib/vkext/ string-processing.cpp
vkext-functions.cpp)

if(COMPILER_CLANG)
set_source_files_properties(${RUNTIME_COMMON_DIR}/stdlib/vkext/string-processing.cpp PROPERTIES COMPILE_FLAGS -Wno-invalid-source-encoding)
endif()

set(STDLIB_SRC ${STDLIB_ARRAY} ${STDLIB_MATH} ${STDLIB_SERIALIZATION}
${STDLIB_STRING} ${STDLIB_SERVER})
${STDLIB_STRING} ${STDLIB_SERVER} ${STDLIB_VKEXT})
Loading

0 comments on commit 23ce77b

Please sign in to comment.