revert: 古いプラグインシステム実装前の状態に巻き戻し
- ソースコードをcommit 3f7d71fの状態に復元(古いプラグインシステム実装前) - docsフォルダは最新の状態を維持(BID-FFI設計ドキュメント含む) - nyashバイナリの基本動作確認済み - BID-FFIシステムをクリーンに再実装する準備完了 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -7,11 +7,7 @@
|
||||
*/
|
||||
|
||||
use super::*;
|
||||
use crate::boxes::{NullBox, ConsoleBox, FloatBox, SocketBox, HTTPServerBox, HTTPRequestBox, HTTPResponseBox};
|
||||
#[cfg(not(feature = "dynamic-file"))]
|
||||
use crate::boxes::{FileBox, MathBox, RandomBox, TimeBox, DateTimeBox};
|
||||
#[cfg(feature = "dynamic-file")]
|
||||
use crate::boxes::DateTimeBox;
|
||||
use crate::boxes::{NullBox, ConsoleBox, FloatBox, DateTimeBox, SocketBox, HTTPServerBox, HTTPRequestBox, HTTPResponseBox};
|
||||
// use crate::boxes::intent_box_wrapper::IntentBoxWrapper;
|
||||
use crate::box_trait::SharedNyashBox;
|
||||
use std::sync::Arc;
|
||||
@ -98,18 +94,16 @@ impl NyashInterpreter {
|
||||
message: format!("FileBox constructor expects 1 argument, got {}", arguments.len()),
|
||||
});
|
||||
}
|
||||
// BoxFactoryRegistryを使用して作成(プラグイン対応)
|
||||
use crate::runtime::get_global_registry;
|
||||
let registry = get_global_registry();
|
||||
|
||||
// 引数を評価
|
||||
let mut evaluated_args = Vec::new();
|
||||
for arg in arguments {
|
||||
evaluated_args.push(self.execute_expression(arg)?);
|
||||
let path_value = self.execute_expression(&arguments[0])?;
|
||||
if let Some(path_str) = path_value.as_any().downcast_ref::<StringBox>() {
|
||||
let file_box = Box::new(FileBox::new(&path_str.value)) as Box<dyn NyashBox>;
|
||||
// 🌍 革命的実装:Environment tracking廃止
|
||||
return Ok(file_box);
|
||||
} else {
|
||||
return Err(RuntimeError::TypeError {
|
||||
message: "FileBox constructor requires string path argument".to_string(),
|
||||
});
|
||||
}
|
||||
|
||||
return registry.create_box("FileBox", &evaluated_args)
|
||||
.map_err(|e| RuntimeError::InvalidOperation { message: e });
|
||||
}
|
||||
"ResultBox" => {
|
||||
// ResultBoxは引数1個(成功値)で作成
|
||||
@ -153,33 +147,9 @@ impl NyashInterpreter {
|
||||
message: format!("MathBox constructor expects 0 arguments, got {}", arguments.len()),
|
||||
});
|
||||
}
|
||||
|
||||
println!("🔧 DEBUG: DYNAMIC-FILE feature check...");
|
||||
#[cfg(feature = "dynamic-file")]
|
||||
{
|
||||
println!("🔌 DEBUG: DYNAMIC-FILE ENABLED - Creating MathBox through dynamic library");
|
||||
log::debug!("🔌 DEBUG: Creating MathBox through dynamic library");
|
||||
match super::plugin_loader::PluginLoader::create_math_box() {
|
||||
Ok(math_box) => {
|
||||
println!("🔌 DEBUG: MathBox created successfully, type_name: {}", math_box.type_name());
|
||||
log::debug!("🔌 DEBUG: MathBox created successfully, type_name: {}", math_box.type_name());
|
||||
return Ok(math_box);
|
||||
}
|
||||
Err(e) => {
|
||||
println!("❌ DEBUG: Failed to create MathBox through dynamic library: {}", e);
|
||||
log::error!("Failed to create MathBox through dynamic library: {}", e);
|
||||
// Fall back to static MathBox
|
||||
let math_box = Box::new(MathBox::new()) as Box<dyn NyashBox>;
|
||||
return Ok(math_box);
|
||||
}
|
||||
}
|
||||
}
|
||||
#[cfg(not(feature = "dynamic-file"))]
|
||||
{
|
||||
println!("🔌 DEBUG: DYNAMIC-FILE DISABLED - Creating static MathBox");
|
||||
let math_box = Box::new(MathBox::new()) as Box<dyn NyashBox>;
|
||||
return Ok(math_box);
|
||||
}
|
||||
let math_box = Box::new(MathBox::new()) as Box<dyn NyashBox>;
|
||||
// 🌍 革命的実装:Environment tracking廃止
|
||||
return Ok(math_box);
|
||||
}
|
||||
"NullBox" => {
|
||||
// NullBoxは引数なしで作成
|
||||
@ -392,65 +362,25 @@ impl NyashInterpreter {
|
||||
message: format!("TimeBox constructor expects 0 arguments, got {}", arguments.len()),
|
||||
});
|
||||
}
|
||||
#[cfg(feature = "dynamic-file")]
|
||||
{
|
||||
log::debug!("🔌 DEBUG: Creating TimeBox through dynamic library");
|
||||
let time_box = super::plugin_loader::PluginLoader::create_time_box()?;
|
||||
log::debug!("🔌 DEBUG: TimeBox created successfully, type_name: {}", time_box.type_name());
|
||||
return Ok(time_box);
|
||||
}
|
||||
#[cfg(not(feature = "dynamic-file"))]
|
||||
{
|
||||
let time_box = Box::new(TimeBox::new()) as Box<dyn NyashBox>;
|
||||
return Ok(time_box);
|
||||
}
|
||||
let time_box = Box::new(TimeBox::new()) as Box<dyn NyashBox>;
|
||||
// 🌍 革命的実装:Environment tracking廃止
|
||||
return Ok(time_box);
|
||||
}
|
||||
"DateTimeBox" => {
|
||||
// DateTimeBoxは引数なしで現在時刻、または引数1個でタイムスタンプ
|
||||
match arguments.len() {
|
||||
0 => {
|
||||
#[cfg(feature = "dynamic-file")]
|
||||
{
|
||||
log::debug!("🔌 DEBUG: Creating DateTimeBox (now) through dynamic library");
|
||||
let datetime_box = super::plugin_loader::PluginLoader::create_datetime_now()?;
|
||||
log::debug!("🔌 DEBUG: DateTimeBox created successfully, type_name: {}", datetime_box.type_name());
|
||||
return Ok(datetime_box);
|
||||
}
|
||||
#[cfg(not(feature = "dynamic-file"))]
|
||||
{
|
||||
let datetime_box = Box::new(DateTimeBox::now()) as Box<dyn NyashBox>;
|
||||
return Ok(datetime_box);
|
||||
}
|
||||
let datetime_box = Box::new(DateTimeBox::now()) as Box<dyn NyashBox>;
|
||||
// 🌍 革命的実装:Environment tracking廃止
|
||||
return Ok(datetime_box);
|
||||
}
|
||||
1 => {
|
||||
let timestamp_value = self.execute_expression(&arguments[0])?;
|
||||
|
||||
// Try integer timestamp first
|
||||
if let Some(int_box) = timestamp_value.as_any().downcast_ref::<IntegerBox>() {
|
||||
#[cfg(feature = "dynamic-file")]
|
||||
{
|
||||
// TODO: Add timestamp creation to plugin
|
||||
let datetime_box = Box::new(DateTimeBox::from_timestamp(int_box.value)) as Box<dyn NyashBox>;
|
||||
return Ok(datetime_box);
|
||||
}
|
||||
#[cfg(not(feature = "dynamic-file"))]
|
||||
{
|
||||
let datetime_box = Box::new(DateTimeBox::from_timestamp(int_box.value)) as Box<dyn NyashBox>;
|
||||
return Ok(datetime_box);
|
||||
}
|
||||
}
|
||||
|
||||
// Try string parsing
|
||||
let time_str = timestamp_value.to_string_box().value;
|
||||
#[cfg(feature = "dynamic-file")]
|
||||
{
|
||||
log::debug!("🔌 DEBUG: Creating DateTimeBox from string through dynamic library");
|
||||
let datetime_box = super::plugin_loader::PluginLoader::create_datetime_from_string(&time_str)?;
|
||||
log::debug!("🔌 DEBUG: DateTimeBox created successfully, type_name: {}", datetime_box.type_name());
|
||||
let datetime_box = Box::new(DateTimeBox::from_timestamp(int_box.value)) as Box<dyn NyashBox>;
|
||||
// 🌍 革命的実装:Environment tracking廃止
|
||||
return Ok(datetime_box);
|
||||
}
|
||||
#[cfg(not(feature = "dynamic-file"))]
|
||||
{
|
||||
} else {
|
||||
return Err(RuntimeError::TypeError {
|
||||
message: "DateTimeBox constructor requires integer timestamp".to_string(),
|
||||
});
|
||||
@ -492,18 +422,9 @@ impl NyashInterpreter {
|
||||
message: format!("RandomBox constructor expects 0 arguments, got {}", arguments.len()),
|
||||
});
|
||||
}
|
||||
#[cfg(feature = "dynamic-file")]
|
||||
{
|
||||
log::debug!("🔌 DEBUG: Creating RandomBox through dynamic library");
|
||||
let random_box = super::plugin_loader::PluginLoader::create_random_box()?;
|
||||
log::debug!("🔌 DEBUG: RandomBox created successfully, type_name: {}", random_box.type_name());
|
||||
return Ok(random_box);
|
||||
}
|
||||
#[cfg(not(feature = "dynamic-file"))]
|
||||
{
|
||||
let random_box = Box::new(RandomBox::new()) as Box<dyn NyashBox>;
|
||||
return Ok(random_box);
|
||||
}
|
||||
let random_box = Box::new(RandomBox::new()) as Box<dyn NyashBox>;
|
||||
// 🌍 革命的実装:Environment tracking廃止
|
||||
return Ok(random_box);
|
||||
}
|
||||
"SoundBox" => {
|
||||
// SoundBoxは引数なしで作成
|
||||
|
||||
Reference in New Issue
Block a user