AppendixH - Appendix H: HLA Compile-time Functions Beta...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Appendix H: HLA Compile-time Functions Beta Draft - Do not distribute © 2001, By Randall Hyde Page 1493 HLA Compile-Time Functions Appendix H H.1 Conversion Functions The con v ersion functions translate data from one format to another . F or e xample, functions in this group can con v ert inte gers to strings or strings to inte gers. These routines pro vide the compile-time equi v a- lent of the HLA Standard Library CONV module. The compile-time con v ersion routines are unusual in the set of compile-time function insof ar as the y do not require a leading "@" symbol. Instead, the con v ersion routines use the names of se v eral of the b uilt-in data types. The follo wing table describes each of these functions: T able 1: Compile-T ime Data Con v ersion Functions Function P arameters a Description boolean boolean( constExpr ) ConstExpr can be a bool- ean, inte ger , character , or string operand. If constExpr is numeric, this function returns f alse for zero and true for an y other v alue. F or characters, "t" or "f" returns true or f alse (respecti v ely), an ything else is an error . F or strings, the operands must be "true" or "f alse" (else an error occurs). The boolean function returns boolean v alues unchanged and returns an error for an y other type. int8 xxxx ( constExpr ) Note: xxxx represents one of the function names to the left. constExpr can be an y constant e xpression that e v aluates to a numeric, character , boolean, or string operand. These functions will con v ert their operand to the specifi ed data type. These functions gen- erate an error if the resulting v alue will not fi t in the specifi ed data type (e.g., int8(-1000) will generate an error). Note that HLA treats byte , wor d, and dw ord functions identically to uns8 , uns16 , and uns32 (respecti v ely). F or boolean operands, true returns one and f alse returns zero. If the operand is a real v alue, then these func- tions truncate the v alue to obtain the corre- sponding inte ger return v alue. F or character operands, these function return the corresponding ASCII code of the charac- ter . F or string operands, the string must be a le g al sequence of characters that form a decimal number . int16 int32 uns8 uns16 uns32 byte w ord dw ord AppendixH Page 1494 © 2001, By Randall Hyde Beta Draft - Do not distribute real32 xxxxxx ( constExpr ) Note: xxxxxx represents one of the function names to the left. constExpr can be an y constant e xpression that e v aluates to a numeric or string operand. These functions con v ert their specifi ed oper- and to the corresponding real v alue. These functions con v ert inte ger operands to the cor- responding real v alue. If the operand is a string expression, it must be a valid sequence of characters that corresponds to an HLA floating point value. These functions convert that string to the corresponding real value....
View Full Document

This note was uploaded on 08/08/2011 for the course CS 101 taught by Professor Jitenderkumarchhabra during the Summer '11 term at National Institute of Technology, Calicut.

Page1 / 38

AppendixH - Appendix H: HLA Compile-time Functions Beta...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online