2 # This file is Copyright 2003, 2006, 2007, 2009, 2010 Dean Hall.
4 # This file is part of the PyMite VM.
5 # The PyMite VM is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU GENERAL PUBLIC LICENSE Version 2.
8 # The PyMite VM is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 # A copy of the GNU GENERAL PUBLIC LICENSE Version 2
12 # is seen in the file COPYING in this directory.
22 * \brief Integer Object Type
24 * Integer object type header.
32 typedef struct PmInt_s
34 /** Object descriptor */
44 * Creates a duplicate Integer object
46 * Created specifically for the index value in FOR_LOOP.
48 * @param pint Pointer to int obj to duplicate.
49 * @param r_pint Return by ref, ptr to new int
50 * @return Return status
52 PmReturn_t
int_dup(pPmObj_t pint
, pPmObj_t
*r_pint
);
55 * Creates a new Integer object
57 * @param val Value to assign int (signed 32-bit).
58 * @param r_pint Return by ref, ptr to new int
59 * @return Return status
61 PmReturn_t
int_new(int32_t val
, pPmObj_t
*r_pint
);
64 * Implements the UNARY_POSITIVE bcode.
66 * Creates a new int with the same value as the given int.
68 * @param pobj Pointer to integer object
69 * @param r_pint Return by reference, ptr to int
70 * @return Return status
72 PmReturn_t
int_positive(pPmObj_t pobj
, pPmObj_t
*r_pint
);
75 * Implements the UNARY_NEGATIVE bcode.
77 * Creates a new int with a value that is the negative of the given int.
79 * @param pobj Pointer to target object
80 * @param r_pint Return by ref, ptr to int
81 * @return Return status
83 PmReturn_t
int_negative(pPmObj_t pobj
, pPmObj_t
*r_pint
);
86 * Implements the UNARY_INVERT bcode.
88 * Creates a new int with a value that is
89 * the bitwise inversion of the given int.
91 * @param pobj Pointer to integer to invert
92 * @param r_pint Return by reference; new integer
93 * @return Return status
95 PmReturn_t
int_bitInvert(pPmObj_t pobj
, pPmObj_t
*r_pint
);
99 * Sends out an integer object in decimal notation with MSB first.
100 * The number is preceded with a "-" when necessary.
102 * @param pObj Ptr to int object
103 * @return Return status
105 PmReturn_t
int_print(pPmObj_t pint
);
108 * Prints the byte in ascii-coded hexadecimal out the platform output
110 * @param b Byte to print
112 PmReturn_t
int_printHexByte(uint8_t b
);
115 * Prints the integer in ascii-coded hexadecimal out the platform output
117 * @param n Integer to print
119 PmReturn_t
_int_printHex(intptr_t n
);
122 * Prints the Int object in ascii-coded hexadecimal out the platform output
124 * @param pint Pointer to Int object
126 PmReturn_t
int_printHex(pPmObj_t pint
);
127 #endif /* HAVE_PRINT */
130 * Returns by reference an integer that is x raised to the power of y.
132 * @param px The integer base
133 * @param py The integer exponent
134 * @param r_pn Return by reference; New integer with value of x ** y
135 * @return Return status
137 PmReturn_t
int_pow(pPmObj_t px
, pPmObj_t py
, pPmObj_t
*r_pn
);
139 #endif /* __INT_H__ */