1(* 2 Title: Foreign Function Interface: constants 3 Author: David Matthews 4 Copyright David Matthews 2015, 2016-17, 2019 5 6 This library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public 8 License version 2.1 as published by the Free Software Foundation. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with this library; if not, write to the Free Software 17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18*) 19 20(* This is defined separately so that the values are computed and 21 available as compile-time constants for the Foreign structure. *) 22structure ForeignConstants = 23struct 24 (* Assume that the alignment requirements for these types are the 25 same as the size. *) 26 local 27 val sizeFloat: word = RunCall.rtsCallFast1 "PolySizeFloat" () 28 and sizeDouble: word = RunCall.rtsCallFast1 "PolySizeDouble" () 29 and sizeShort: word = RunCall.rtsCallFast1 "PolySizeShort" () 30 and sizeInt: word = RunCall.rtsCallFast1 "PolySizeInt" () 31 and sizeLong: word = RunCall.rtsCallFast1 "PolySizeLong" () 32 in 33 val saFloat = {size=sizeFloat, align=sizeFloat} 34 and saDouble = {size=sizeDouble, align=sizeDouble} 35 and saShort = {size=sizeShort, align=sizeShort} 36 and saInt = {size=sizeInt, align=sizeInt} 37 and saLong = {size=sizeLong, align=sizeLong} 38 end 39 40 val bigEndian : bool = LibrarySupport.bigEndian 41 and wordSize : word = RunCall.bytesPerWord 42 and sysWordSize: word = LibrarySupport.sysWordSize 43end; 44