From 64404bba202b44c9e0f1d16dea05d80891abe6bf Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 27 Sep 2021 10:13:03 +0800 Subject: [PATCH] syscall -> extern (#21) --- nac3core/src/toplevel/composer.rs | 2 +- nac3embedded/demo.py | 16 ++++++++-------- nac3embedded/language.py | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/nac3core/src/toplevel/composer.rs b/nac3core/src/toplevel/composer.rs index 273c2075..c708c0f6 100644 --- a/nac3core/src/toplevel/composer.rs +++ b/nac3core/src/toplevel/composer.rs @@ -1381,7 +1381,7 @@ impl TopLevelComposer { { if !decorator_list.is_empty() && matches!(&decorator_list[0].node, - ast::ExprKind::Name{ id, .. } if id == &"syscall".into()) + ast::ExprKind::Name{ id, .. } if id == &"extern".into()) { instance_to_symbol.insert("".into(), simple_name.to_string()); continue; diff --git a/nac3embedded/demo.py b/nac3embedded/demo.py index 4d784f1f..d9c52fb8 100644 --- a/nac3embedded/demo.py +++ b/nac3embedded/demo.py @@ -2,42 +2,42 @@ from language import * from numpy import int32, int64 -@syscall +@extern def now_mu() -> int64: raise NotImplementedError("syscall not simulated") -@syscall +@extern def at_mu(t: int64): raise NotImplementedError("syscall not simulated") -@syscall +@extern def delay_mu(dt: int64): raise NotImplementedError("syscall not simulated") -@syscall +@extern def rtio_init(): raise NotImplementedError("syscall not simulated") -@syscall +@extern def rtio_get_counter() -> int64: raise NotImplementedError("syscall not simulated") -@syscall +@extern def rtio_output(target: int32, data: int32): raise NotImplementedError("syscall not simulated") -@syscall +@extern def rtio_input_timestamp(timeout_mu: int64, channel: int32) -> int64: raise NotImplementedError("syscall not simulated") -@syscall +@extern def rtio_input_data(channel: int32) -> int32: raise NotImplementedError("syscall not simulated") diff --git a/nac3embedded/language.py b/nac3embedded/language.py index 3a767a21..2d3457ff 100644 --- a/nac3embedded/language.py +++ b/nac3embedded/language.py @@ -4,14 +4,14 @@ from functools import wraps import nac3embedded -__all__ = ["syscall", "kernel"] +__all__ = ["extern", "kernel"] nac3 = nac3embedded.NAC3() allow_object_registration = True -def syscall(function): +def extern(function): assert allow_object_registration nac3.register_object(function) return function