]> pd.if.org Git - lice/blob - conv.h
autocommit for files dated 2014-11-17 20:15:26
[lice] / conv.h
1 #ifndef LICE_CONV_HDR
2 #define LICE_CONV_HDR
3
4 /*
5  * File: conv.h
6  *  Implements the interface to LICE's type conversion.
7  */
8 #include "ast.h"
9
10 /*
11  * Function: conv_capable
12  *  Determines if type conversion is capable for a given type.
13  *
14  * Parameters:
15  *  type    - The type to test for conversion capability
16  *
17  * Returns:
18  *  `true` if conversion is capable, `false` otherwise.
19  */
20 bool conv_capable(data_type_t *type);
21
22 /*
23  * Function: conv_senority
24  *  Determines the senority of two types in question, returning the
25  *  one which out ranks the other. This is usually used in binary
26  *  operations, thus the naming of lhs and rhs are used.
27  *
28  * Parameters:
29  *  lhs     - Left hand side type
30  *  rhs     - Right hand side type
31  *
32  * Returns:
33  *  `lhs` if outranks `rhs`, otherwise `rhs`
34  */
35 data_type_t *conv_senority(data_type_t *lhs, data_type_t *rhs);
36
37 /*
38  * Function: conv_rank
39  *  Determines the conversion ranking of a given data type.
40  *
41  * Parameters:
42  *  type    - The type to get the conversion ranking of.
43  *
44  * Returns:
45  *  An integer value of the conversion ranking of the given data type,
46  *  which can be used in the process of typicla relational, or comparitive
47  *  checks.
48  */
49 int conv_rank(data_type_t *type);
50
51 /*
52  * Function: conv_usual
53  *  Given a binary operation and the two operands, this will perform
54  *  usualy type conversion and return an ast node that signifies that
55  *  operation (including the conversion).
56  *
57  * Parameters:
58  *  operation   - An ast type, or character literal for typical binary
59  *                operations, like '+'.
60  *  left        - The left hand side of the expression.
61  *  right       - The right hand side of the expression.
62  */
63 ast_t *conv_usual(int operation, ast_t *left, ast_t *right);
64
65 #endif