diff options
author | gingold | 2012-12-11 02:42:52 +0000 |
---|---|---|
committer | gingold | 2012-12-11 02:42:52 +0000 |
commit | 5ced3fe5ff931c09b99510f992cfa33e72f41492 (patch) | |
tree | db6a94d20e5626a38e0e6994bfc4e702e9bb936e /translate/grt/grt-stacks.ads | |
parent | b07663058eaf7adcfe75a1e7f6b24891ba647bc3 (diff) | |
download | ghdl-5ced3fe5ff931c09b99510f992cfa33e72f41492.tar.gz ghdl-5ced3fe5ff931c09b99510f992cfa33e72f41492.tar.bz2 ghdl-5ced3fe5ff931c09b99510f992cfa33e72f41492.zip |
Use a convention C access for instance, to fix windows crash.
Diffstat (limited to 'translate/grt/grt-stacks.ads')
-rw-r--r-- | translate/grt/grt-stacks.ads | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/translate/grt/grt-stacks.ads b/translate/grt/grt-stacks.ads index 920012c..30b9f05 100644 --- a/translate/grt/grt-stacks.ads +++ b/translate/grt/grt-stacks.ads @@ -16,8 +16,24 @@ -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. with System; use System; +with Ada.Unchecked_Conversion; package Grt.Stacks is + -- Instance is the parameter of the process procedure. + -- This is in fact a fully opaque type whose content is private to the + -- process. + type Instance is limited private; + type Instance_Acc is access all Instance; + pragma Convention (C, Instance_Acc); + + -- A process is identified by a procedure having a single private + -- parameter (its instance). + type Proc_Acc is access procedure (Self : Instance_Acc); + pragma Convention (C, Proc_Acc); + + function To_Address is new Ada.Unchecked_Conversion + (Instance_Acc, System.Address); + type Stack_Type is new Address; Null_Stack : constant Stack_Type := Stack_Type (Null_Address); @@ -28,7 +44,8 @@ package Grt.Stacks is -- Create a new stack, which on first execution will call FUNC with -- an argument ARG. - function Stack_Create (Func : Address; Arg : Address) return Stack_Type; + function Stack_Create (Func : Proc_Acc; Arg : Instance_Acc) + return Stack_Type; -- Resume stack TO and save the current context to the stack pointed by -- CUR. @@ -50,6 +67,8 @@ package Grt.Stacks is procedure Error_Null_Access; pragma No_Return (Error_Null_Access); private + type Instance is null record; + pragma Import (C, Stack_Init, "grt_stack_init"); pragma Import (C, Stack_Create, "grt_stack_create"); pragma Import (C, Stack_Switch, "grt_stack_switch"); |