metasepi / postmortem

Postmortem for open-source operating systems
MIT License
1 stars 0 forks source link

Define array of char in typedef #27

Closed master-q closed 3 years ago

master-q commented 3 years ago

https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/TESTATS/fieldarr.dats

Umm... We can't define a member as array on ATS side?

(*
typedef point = @{ xyz= @[double][3] }
*)

(* ****** ****** *)
//
%{^
typedef
struct { double xyz[3] ; } point_t ;
%} // end of [%{^]
//
typedef point =
$extype_struct "point_t" of { xyz= @[double][3] }
master-q commented 3 years ago

Asked at mailing list: https://groups.google.com/g/ats-lang-users/c/xoIHAYGBzdQ

master-q commented 3 years ago

Today, ATS2 only supports it with inline C code such as following:

https://github.com/jats-ug/practice-ats/blob/master/array_typedef/main.dats