add #ifndef for each module in __pikaBinding.c

release v1.10.6

uprdate msc
This commit is contained in:
pikastech 2022-08-30 18:40:07 +08:00
parent c8137e8204
commit 3a5b289c0d
5 changed files with 19 additions and 4 deletions

View File

@ -1,3 +1,3 @@
MajorVersion = "1"
MinorVersion = "10"
MicroVersion = "5"
MicroVersion = "6"

View File

@ -1,5 +1,5 @@
#define PIKA_VERSION_MAJOR 1
#define PIKA_VERSION_MINOR 10
#define PIKA_VERSION_MICRO 5
#define PIKA_VERSION_MICRO 6
#define PIKA_EDIT_TIME "2022/08/29 18:54:14"
#define PIKA_EDIT_TIME "2022/08/30 18:40:40"

View File

@ -8,6 +8,7 @@ use crate::version_info::VersionInfo;
use std::collections::BTreeMap;
#[derive(Debug)]
pub struct ClassInfo {
pub this_file_name: String,
pub this_class_name: String,
pub this_class_name_without_file: String,
pub super_class_name: String,
@ -58,6 +59,7 @@ impl ClassInfo {
let this_class_name_without_file = this_calss_name.clone();
this_calss_name = ClassInfo::add_file_profix(&file_name, &this_calss_name, is_package);
let new_class_info = ClassInfo {
this_file_name: file_name.clone(),
this_class_name: this_calss_name,
this_class_name_without_file: this_class_name_without_file,
super_class_name: super_class_name,

View File

@ -75,13 +75,24 @@ pub fn pika_compiler_entry() {
f.write("\n".as_bytes()).unwrap();
for (_, class_info) in compiler.class_list.iter() {
/* get module_name */
let mut module_name = class_info.this_file_name.clone();
if module_name == "" {
module_name = class_info.this_class_name.clone();
}
/* create module control macro */
let module_define = format!(
"#ifndef PIKA_MODULE_{}_DISABLE\n",
module_name.to_ascii_uppercase()
);
f.write(module_define.as_bytes()).unwrap();
/* create method api function */
f.write(class_info.method_api_fn().as_bytes()).unwrap();
/* create new classs function */
f.write(class_info.new_class_fn().as_bytes()).unwrap();
f.write("\n".as_bytes()).unwrap();
/* create contruactor */
if !class_info.is_package {
f.write("\n".as_bytes()).unwrap();
let name = String::from(class_info.this_class_name.to_string());
f.write(format!("Arg *{}(PikaObj *self){{\n", &name).as_bytes())
.unwrap();
@ -89,6 +100,8 @@ pub fn pika_compiler_entry() {
.unwrap();
f.write("}\n".as_bytes()).unwrap();
}
f.write("#endif\n".as_bytes()).unwrap();
f.write("\n".as_bytes()).unwrap();
}
/* make the .h file for each python class */