@@ -21,3 +21,77 @@ macro_rules! godot_init {
2121 } ;
2222 } ;
2323}
24+
25+ /// Legacy macro that declares all the API endpoints necessary to initialize a NativeScript library.
26+ ///
27+ /// This is a shim for the new [`#[gdnative::init::callbacks]`][crate::init::callbacks] attribute
28+ /// macro, which is now used to declare API callbacks along with the
29+ /// [`GDNativeCallbacks`][crate::init::GDNativeCallbacks] trait.
30+ #[ macro_export]
31+ #[ deprecated = "use the #[gdnative::init::callbacks] attribute macro instead" ]
32+ macro_rules! godot_nativescript_init {
33+ ( ) => {
34+ const _: ( ) = {
35+ struct GDNativeCallbacksImpl ;
36+
37+ #[ $crate:: init:: callbacks]
38+ unsafe impl $crate:: init:: GDNativeCallbacks for GDNativeCallbacksImpl { }
39+ } ;
40+ } ;
41+ ( $callback: ident) => {
42+ const _: ( ) = {
43+ struct GDNativeCallbacksImpl ;
44+
45+ #[ $crate:: init:: callbacks]
46+ unsafe impl $crate:: init:: GDNativeCallbacks for GDNativeCallbacksImpl {
47+ fn nativescript_init( handle: $crate:: init:: InitHandle ) {
48+ $callback( handle) ;
49+ }
50+ }
51+ } ;
52+ } ;
53+ ( _ as $fn_name: ident) => {
54+ :: std:: compile_error!( "this syntax is no longer supported. use the #[gdnative::init::callbacks] attribute macro with a prefix instead" ) ;
55+ } ;
56+ ( $callback: ident as $fn_name: ident) => {
57+ :: std:: compile_error!( "this syntax is no longer supported. use the #[gdnative::init::callbacks] attribute macro with a prefix instead" ) ;
58+ } ;
59+ }
60+
61+ /// This macro now does nothing. It is provided only for limited backwards compatibility.
62+ ///
63+ /// Use the new [`#[gdnative::init::callbacks]`][crate::init::callbacks] attribute macro and,
64+ /// [`GDNativeCallbacks`][crate::init::GDNativeCallbacks] trait instead.
65+ #[ macro_export]
66+ #[ deprecated = "use the #[gdnative::init::callbacks] attribute macro instead" ]
67+ macro_rules! godot_gdnative_init {
68+ ( ) => { } ;
69+ ( $callback: ident) => {
70+ :: std:: compile_error!( "this syntax is no longer supported. use the #[gdnative::init::callbacks] attribute macro instead" ) ;
71+ } ;
72+ ( _ as $fn_name: ident) => {
73+ :: std:: compile_error!( "this syntax is no longer supported. use the #[gdnative::init::callbacks] attribute macro with a prefix instead" ) ;
74+ } ;
75+ ( $callback: ident as $fn_name: ident) => {
76+ :: std:: compile_error!( "this syntax is no longer supported. use the #[gdnative::init::callbacks] attribute macro with a prefix instead" ) ;
77+ } ;
78+ }
79+
80+ /// This macro now does nothing. It is provided only for limited backwards compatibility.
81+ ///
82+ /// Use the new [`#[gdnative::init::callbacks]`][crate::init::callbacks] attribute macro and,
83+ /// [`GDNativeCallbacks`][crate::init::GDNativeCallbacks] trait instead.
84+ #[ macro_export]
85+ #[ deprecated = "use the #[gdnative::init::callbacks] attribute macro instead" ]
86+ macro_rules! godot_gdnative_terminate {
87+ ( ) => { } ;
88+ ( $callback: ident) => {
89+ :: std:: compile_error!( "this syntax is no longer supported. use the #[gdnative::init::callbacks] attribute macro instead" ) ;
90+ } ;
91+ ( _ as $fn_name: ident) => {
92+ :: std:: compile_error!( "this syntax is no longer supported. use the #[gdnative::init::callbacks] attribute macro with a prefix instead" ) ;
93+ } ;
94+ ( $callback: ident as $fn_name: ident) => {
95+ :: std:: compile_error!( "this syntax is no longer supported. use the #[gdnative::init::callbacks] attribute macro with a prefix instead" ) ;
96+ } ;
97+ }
0 commit comments