smokes: add PHI/core/integration tests; parity uses Python LLVM harness; test runner noise filter\nparser: add opt-in TokenCursor bridge (NYASH_PARSER_TOKEN_CURSOR=1) for expressions\nmir: fix PHI incoming preds to use exit blocks; add debug PHI verification\nplugins(net/filebox): warning cleanup (dead_code), no behavior change\ndocs: smokes v2 README – add test accumulation policy and LLVM harness note\nCURRENT_TASK: Phase 15.5 newline refactor resume + plan
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
// ============ Error Codes (BID-1 alignment) ============
|
||||
pub const NYB_SUCCESS: i32 = 0;
|
||||
pub const NYB_E_SHORT_BUFFER: i32 = -1;
|
||||
#[allow(dead_code)]
|
||||
pub const NYB_E_INVALID_TYPE: i32 = -2;
|
||||
pub const NYB_E_INVALID_METHOD: i32 = -3;
|
||||
pub const NYB_E_INVALID_ARGS: i32 = -4;
|
||||
@ -23,6 +24,7 @@ pub const METHOD_FINI: u32 = u32::MAX; // Destructor
|
||||
// ============ TLV Tags ============
|
||||
pub const TLV_TAG_BOOL: u8 = 1;
|
||||
pub const TLV_TAG_I32: u8 = 2;
|
||||
#[allow(dead_code)]
|
||||
pub const TLV_TAG_I64: u8 = 3;
|
||||
pub const TLV_TAG_STRING: u8 = 6;
|
||||
pub const TLV_TAG_BYTES: u8 = 7;
|
||||
@ -30,4 +32,5 @@ pub const TLV_TAG_HANDLE: u8 = 8;
|
||||
pub const TLV_TAG_VOID: u8 = 9;
|
||||
|
||||
// ============ FileBox Type ID ============
|
||||
#[allow(dead_code)]
|
||||
pub const FILEBOX_TYPE_ID: u32 = 6;
|
||||
|
||||
@ -4,6 +4,7 @@ use std::os::raw::c_char;
|
||||
|
||||
// ============ FFI Types ============
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[repr(C)]
|
||||
pub struct NyashMethodInfo {
|
||||
pub method_id: u32,
|
||||
@ -11,6 +12,7 @@ pub struct NyashMethodInfo {
|
||||
pub signature: u32,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[repr(C)]
|
||||
pub struct NyashPluginInfo {
|
||||
pub type_id: u32,
|
||||
|
||||
@ -24,6 +24,7 @@ impl FileBoxInstance {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn with_path(path: String) -> Self {
|
||||
Self {
|
||||
file: None,
|
||||
@ -41,11 +42,13 @@ pub static INSTANCES: Lazy<Mutex<HashMap<u32, FileBoxInstance>>> =
|
||||
pub static INSTANCE_COUNTER: AtomicU32 = AtomicU32::new(1);
|
||||
|
||||
/// Allocate a new instance ID
|
||||
#[allow(dead_code)]
|
||||
pub fn allocate_instance_id() -> u32 {
|
||||
INSTANCE_COUNTER.fetch_add(1, Ordering::Relaxed)
|
||||
}
|
||||
|
||||
/// Store an instance with the given ID
|
||||
#[allow(dead_code)]
|
||||
pub fn store_instance(id: u32, instance: FileBoxInstance) -> Result<(), &'static str> {
|
||||
match INSTANCES.lock() {
|
||||
Ok(mut map) => {
|
||||
@ -57,6 +60,7 @@ pub fn store_instance(id: u32, instance: FileBoxInstance) -> Result<(), &'static
|
||||
}
|
||||
|
||||
/// Remove an instance by ID
|
||||
#[allow(dead_code)]
|
||||
pub fn remove_instance(id: u32) -> Option<FileBoxInstance> {
|
||||
match INSTANCES.lock() {
|
||||
Ok(mut map) => map.remove(&id),
|
||||
@ -65,6 +69,7 @@ pub fn remove_instance(id: u32) -> Option<FileBoxInstance> {
|
||||
}
|
||||
|
||||
/// Get mutable access to an instance
|
||||
#[allow(dead_code)]
|
||||
pub fn with_instance_mut<F, R>(id: u32, f: F) -> Result<R, &'static str>
|
||||
where
|
||||
F: FnOnce(&mut FileBoxInstance) -> R,
|
||||
@ -79,6 +84,7 @@ where
|
||||
}
|
||||
|
||||
/// Get access to an instance
|
||||
#[allow(dead_code)]
|
||||
pub fn with_instance<F, R>(id: u32, f: F) -> Result<R, &'static str>
|
||||
where
|
||||
F: FnOnce(&FileBoxInstance) -> R,
|
||||
|
||||
@ -45,10 +45,12 @@ pub fn write_tlv_bool(v: bool, result: *mut u8, result_len: *mut usize) -> i32 {
|
||||
write_tlv_result(&[(TLV_TAG_BOOL, &b)], result, result_len)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn write_tlv_string(s: &str, result: *mut u8, result_len: *mut usize) -> i32 {
|
||||
write_tlv_result(&[(TLV_TAG_STRING, s.as_bytes())], result, result_len)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn write_tlv_handle(
|
||||
type_id: u32,
|
||||
instance_id: u32,
|
||||
@ -164,6 +166,7 @@ pub fn tlv_parse_string(data: &[u8]) -> Result<String, ()> {
|
||||
tlv_parse_string_at(data, &mut pos)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn tlv_parse_bytes(data: &[u8]) -> Result<Vec<u8>, ()> {
|
||||
let (_, argc, mut pos) = tlv_parse_header(data)?;
|
||||
if argc < 1 {
|
||||
@ -197,6 +200,7 @@ pub fn tlv_parse_handle(data: &[u8]) -> Result<(u32, u32), ()> {
|
||||
Ok((type_id, instance_id))
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn tlv_parse_one_string(data: &[u8]) -> Result<String, ()> {
|
||||
let (_, argc, mut pos) = tlv_parse_header(data)?;
|
||||
if argc < 1 {
|
||||
@ -205,6 +209,7 @@ pub fn tlv_parse_one_string(data: &[u8]) -> Result<String, ()> {
|
||||
tlv_parse_string_at(data, &mut pos)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn tlv_parse_string_and_bytes(data: &[u8]) -> Result<(String, Vec<u8>), ()> {
|
||||
let (_, argc, mut pos) = tlv_parse_header(data)?;
|
||||
if argc < 2 {
|
||||
|
||||
@ -8,6 +8,5 @@ use std::collections::HashMap;
|
||||
use std::io::Write as IoWrite;
|
||||
use std::net::TcpStream;
|
||||
use std::sync::Mutex;
|
||||
use std::time::Duration;
|
||||
|
||||
include!("client_impl.rs");
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
use crate::abi::NyashTypeBoxFfi;
|
||||
use crate::consts::*;
|
||||
use crate::ffi::{self, slice};
|
||||
use crate::state::{self, RequestState, ResponseState, SockConnState};
|
||||
use crate::state::{self, RequestState, ResponseState};
|
||||
use crate::tlv;
|
||||
use std::collections::HashMap;
|
||||
use std::io::Write as IoWrite;
|
||||
|
||||
@ -2,12 +2,10 @@ use crate::abi::NyashTypeBoxFfi;
|
||||
use crate::consts::*;
|
||||
use crate::ffi::{self, slice};
|
||||
use crate::http_helpers;
|
||||
use crate::state::{self, ResponseState, SockConnState};
|
||||
use crate::state::{self, ResponseState};
|
||||
use crate::tlv;
|
||||
use std::collections::HashMap;
|
||||
use std::io::Write as IoWrite;
|
||||
use std::net::TcpStream;
|
||||
use std::sync::Mutex;
|
||||
// unused imports removed
|
||||
use std::time::Duration;
|
||||
|
||||
include!("response_impl.rs");
|
||||
|
||||
@ -2,7 +2,7 @@ use crate::abi::NyashTypeBoxFfi;
|
||||
use crate::consts::*;
|
||||
use crate::ffi::{self, slice};
|
||||
use crate::http_helpers;
|
||||
use crate::state::{self, RequestState, ResponseState, ServerState, SockConnState};
|
||||
use crate::state::{self, RequestState, ServerState, SockConnState};
|
||||
use crate::tlv;
|
||||
use std::collections::VecDeque;
|
||||
use std::net::TcpListener;
|
||||
|
||||
@ -66,12 +66,14 @@ pub(crate) static RESPONSE_ID: AtomicU32 = AtomicU32::new(1);
|
||||
pub(crate) static CLIENT_ID: AtomicU32 = AtomicU32::new(1);
|
||||
pub(crate) static SOCK_SERVER_ID: AtomicU32 = AtomicU32::new(1);
|
||||
pub(crate) static SOCK_CONN_ID: AtomicU32 = AtomicU32::new(1);
|
||||
#[allow(dead_code)]
|
||||
pub(crate) static SOCK_CLIENT_ID: AtomicU32 = AtomicU32::new(1);
|
||||
|
||||
pub(crate) static SOCK_SERVERS: Lazy<Mutex<HashMap<u32, SockServerState>>> =
|
||||
Lazy::new(|| Mutex::new(HashMap::new()));
|
||||
pub(crate) static SOCK_CONNS: Lazy<Mutex<HashMap<u32, SockConnState>>> =
|
||||
Lazy::new(|| Mutex::new(HashMap::new()));
|
||||
#[allow(dead_code)]
|
||||
pub(crate) static SOCK_CLIENTS: Lazy<Mutex<HashMap<u32, SockClientState>>> =
|
||||
Lazy::new(|| Mutex::new(HashMap::new()));
|
||||
|
||||
@ -111,6 +113,7 @@ pub(crate) fn next_sock_conn_id() -> u32 {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn next_sock_client_id() -> u32 {
|
||||
SOCK_CLIENT_ID.fetch_add(1, Ordering::Relaxed)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user