update pikaCompiler api to new api

This commit is contained in:
lyon 2023-06-10 16:54:36 +08:00
parent 5e30d7482b
commit ea986f3ef8
7 changed files with 19 additions and 15 deletions

View File

@ -1,2 +1,3 @@
bash make.sh
cd package/pikascript && \
./pika $1

View File

@ -1,3 +1,3 @@
MajorVersion = "1"
MinorVersion = "12"
MicroVersion = "3"
MinorVersion = "13"
MicroVersion = "0"

View File

@ -758,7 +758,7 @@ PikaObj* newRootObj(char* name, NewFun newObjFun) {
logo_printed = 1;
pika_platform_printf("\r\n");
pika_platform_printf("~~~/ POWERED BY \\~~~\r\n");
pika_platform_printf("~ pikascript.com ~\r\n");
pika_platform_printf("~ pikapython.com ~\r\n");
pika_platform_printf("~~~~~~~~~~~~~~~~~~~~\r\n");
}
if (NULL != __pikaMain) {
@ -2783,6 +2783,7 @@ void _do_pika_eventListener_send(PikaEventListener* self,
}
__exit:
pika_GIL_EXIT();
return;
#endif
}

View File

@ -1,5 +1,5 @@
#define PIKA_VERSION_MAJOR 1
#define PIKA_VERSION_MINOR 12
#define PIKA_VERSION_MICRO 3
#define PIKA_VERSION_MINOR 13
#define PIKA_VERSION_MICRO 0
#define PIKA_EDIT_TIME "2023/05/14 12:55:46"
#define PIKA_EDIT_TIME "2023/06/10 16:44:53"

View File

@ -102,6 +102,8 @@ extern "C" {
#define PIKA_BOOL pika_bool
#define PIKA_TRUE pika_true
#define PIKA_FALSE pika_false
#define pikaScriptInit pikaPythonInit
#define pikaScriptShell pikaPythonShell
#endif

View File

@ -142,25 +142,25 @@ impl ClassInfo {
pub fn script_fn(&self, version_info: VersionInfo) -> String {
let mut script_fn = String::new();
/* add pikaScriptInit function define */
/* add pikaPythonInit function define */
script_fn.push_str("volatile PikaObj *__pikaMain;\r\n");
script_fn.push_str("PikaObj *pikaScriptInit(void){\r\n");
script_fn.push_str("PikaObj *pikaPythonInit(void){\r\n");
/* print version info */
script_fn.push_str(
" __platform_printf(\"======[pikascript packages installed]======\\r\\n\");\r\n",
" pika_platform_printf(\"======[pikapython packages installed]======\\r\\n\");\r\n",
);
script_fn.push_str(" pks_printVersion();\r\n");
script_fn.push_str(" pika_printVersion();\r\n");
for (package_name, package_version) in version_info.package_list {
script_fn.push_str(
format!(
" __platform_printf(\"{}=={}\\r\\n\");\r\n",
" pika_platform_printf(\"{}=={}\\r\\n\");\r\n",
package_name, package_version
)
.as_str(),
);
}
script_fn.push_str(
" __platform_printf(\"===========================================\\r\\n\");\r\n",
" pika_platform_printf(\"===========================================\\r\\n\");\r\n",
);
/* create the root object */
script_fn.push_str(" PikaObj* pikaMain = newRootObj(\"pikaMain\", New_PikaMain);\r\n");

View File

@ -18,12 +18,12 @@ pub fn pika_compiler_entry() {
";
/* new a version_info object */
println!("(pikascript) packages installed:");
println!("(pikapython) packages installed:");
let mut version_info = VersionInfo::new();
version_info = VersionInfo::analyse_file(version_info, String::from("requestment.txt"));
println!();
println!("(pikascript) pika compiler:");
println!("(pikapython) pika compiler:");
/* new a compiler, sellect to path */
let mut compiler = Compiler::new(String::from(""), String::from("pikascript-api/"));
@ -166,7 +166,7 @@ pub fn pika_compiler_entry() {
f.write("#include \"PikaObj.h\"\n".as_bytes()).unwrap();
f.write("#include \"PikaMain.h\"\n".as_bytes()).unwrap();
f.write("\n".as_bytes()).unwrap();
f.write("PikaObj * pikaScriptInit(void);\n".as_bytes())
f.write("PikaObj * pikaPythonInit(void);\n".as_bytes())
.unwrap();
f.write("\n".as_bytes()).unwrap();
f.write("#endif\n".as_bytes()).unwrap();