vrq
systask.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (C) 1997-2007, Mark Hummel
3  * This file is part of Vrq.
4  *
5  * Vrq is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * Vrq 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  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301 USA
19  *****************************************************************************
20  */
21 /******************************************************************************
22  *
23  *
24  * systask.hpp
25  * - manager for systask info
26  *
27  ******************************************************************************
28  */
29 
30 #ifndef SYSTASK_HPP
31 #define SYSTASK_HPP
32 
36 class Systask {
37 public:
41  static void Initialize() {}
48  static int Width( CSymbol* symbol, CNode* args )
49  {
50  /*
51  * implement builtin functions
52  */
53  if( !strcmp(symbol->GetName(), "$signed" ) ) {
54  return args->GetWidth();
55  }
56  return 32;
57  }
64  static CNode* WidthExp( CSymbol* symbol, CNode* args )
65  {
66  /*
67  * implement builtin functions
68  */
69  if( !strcmp(symbol->GetName(), "$signed" ) ) {
70  return args->GetWidthExp();
71  }
72  return cINT32(32);
73  }
82  static int WidthConstant( CSymbol* symbol, CNode* args )
83  {
84  /*
85  * implement builtin functions
86  */
87  if( !strcmp(symbol->GetName(), "$signed" ) ) {
88  return args->IsWidthConstant();
89  }
90  return FALSE;
91  }
100  static int WidthVolatile( CSymbol* symbol, CNode* args )
101  {
102  /*
103  * implement builtin functions
104  */
105  if( !strcmp(symbol->GetName(), "$signed" ) ) {
106  return args->IsWidthVolatile();
107  }
108  return TRUE;
109  }
117  static int WidthEvaluateable( CSymbol* symbol, CNode* args )
118  {
119  /*
120  * implement builtin functions
121  */
122  if( !strcmp(symbol->GetName(), "$signed" ) ) {
123  return args->IsWidthEvaluateable();
124  }
125  return FALSE;
126  }
134  static NodeType_t Type( CSymbol* symbol, CNode* args )
135  {
136  /*
137  * implement builtin functions
138  */
139  if( !strcmp(symbol->GetName(), "$signed" ) ) {
140  return eS;
141  }
142  return eB;
143  }
144 };
145 
146 #endif // SYSTASK_HPP
static NodeType_t Type(CSymbol *symbol, CNode *args)
Determine type of systask.
Definition: systask.h:134
static int WidthVolatile(CSymbol *symbol, CNode *args)
Determine if width of systask variable is volatile.
Definition: systask.h:100
signed bit vector, includes integer
Definition: cdatatype.h:104
static int WidthConstant(CSymbol *symbol, CNode *args)
Determine if width of systask variable is constant.
Definition: systask.h:82
CNode * GetWidthExp(void)
Create expression representing width of expression.
Definition: cnode_def.h:8843
static void Initialize()
Initialize class info.
Definition: systask.h:41
static int WidthEvaluateable(CSymbol *symbol, CNode *args)
Determine if width of systask can be evaluated.
Definition: systask.h:117
unsigned bit vector
Definition: cdatatype.h:106
Holder for character strings.
Definition: csymbol.h:44
Class method to query systask info.
Definition: systask.h:36
Primary data structure representing parse tree nodes.
Definition: cnode.h:197
const char * GetName(void) const
Get symbol's text.
CNode * cINT32(INT32 i)
Short cut for creating VCONSTANT node with a given integer value.
Definition: cnode.h:798
int IsWidthEvaluateable(void)
Evaluates if expression width can be evaluated.
Definition: cnode_def.h:9295
static CNode * WidthExp(CSymbol *symbol, CNode *args)
Get width of systask as an expression.
Definition: systask.h:64
static int Width(CSymbol *symbol, CNode *args)
Get width of systask.
Definition: systask.h:48
INT32 GetWidth(void)
Evaluate width of expression.
Definition: cnode.h:494
int IsWidthConstant(void)
Evaluates if expression width is constant.
Definition: cnode_def.h:8521
NodeType_t
Expression node type.
Definition: cdatatype.h:101
int IsWidthVolatile(void)
Evaluates if expression width is volatile.
Definition: cnode_def.h:8681