Split Requests.cpp instead of Td.cpp.

This commit is contained in:
levlam 2024-08-15 10:40:14 +03:00
parent c7eea9cf97
commit 7664383813

View File

@ -203,7 +203,7 @@ function split_file($file, $chunks, $undo) {
$set_sizes[$parent] = 0;
}
$sets[$parent] .= $f;
$set_sizes[$parent] += preg_match('/Td::~?Td/', $f) ? 1000000 : strlen($f);
$set_sizes[$parent] += strlen($f);
}
arsort($set_sizes);
@ -293,7 +293,6 @@ function split_file($file, $chunks, $undo) {
);
}
if (!preg_match('/Td::~?Td/', $new_content)) { // destructor Td::~Td needs to see definitions of all forward-declared classes
$td_methods = array(
'AccentColorId' => 'AccentColorId',
'account_manager[_(-](?![.]get[(][)])|AccountManager[^;>]' => 'AccountManager',
@ -455,18 +454,6 @@ function split_file($file, $chunks, $undo) {
$new_content = str_replace($include_name, '', $new_content);
}
}
} else {
$new_content = preg_replace_callback(
'|#include "[a-z_A-Z/0-9.]*"|',
function ($matches) {
if (strpos($matches[0], "Manager") !== false || strpos($matches[0], "HashtagHints") !== false || strpos($matches[0], "Td.h") !== false) {
return $matches[0];
}
return '';
},
$new_content
);
}
if (!file_exists($new_files[$n]) || file_get_contents($new_files[$n]) !== $new_content) {
echo "Writing file ".$new_files[$n].PHP_EOL;
@ -487,8 +474,8 @@ $undo = in_array('--undo', $argv) || in_array('-u', $argv);
$files = array('td/telegram/ChatManager' => 10,
'td/telegram/MessagesManager' => 50,
'td/telegram/NotificationManager' => 10,
'td/telegram/Requests' => 50,
'td/telegram/StickersManager' => 10,
'td/telegram/Td' => 50,
'td/telegram/UserManager' => 10,
'td/generate/auto/td/telegram/td_api' => 10,
'td/generate/auto/td/telegram/td_api_json' => 10,