summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2016-09-23 10:59:54 -0600
committerTuowen Zhao <ztuowen@gmail.com>2016-09-23 10:59:54 -0600
commit699861922d5349ffa98b518f34016b2be2ca368d (patch)
treeb1172a41c89b382487772ef05c8a5ce70c068fa0 /lib
parent16f097d5548e9b31ab4b0dc343afeb680b361e28 (diff)
downloadchill-699861922d5349ffa98b518f34016b2be2ca368d.tar.gz
chill-699861922d5349ffa98b518f34016b2be2ca368d.tar.bz2
chill-699861922d5349ffa98b518f34016b2be2ca368d.zip
more changes
Diffstat (limited to 'lib')
-rwxr-xr-xlib/chillcg/include/code_gen/CG_chillRepr.h107
1 files changed, 54 insertions, 53 deletions
diff --git a/lib/chillcg/include/code_gen/CG_chillRepr.h b/lib/chillcg/include/code_gen/CG_chillRepr.h
index 36b2fa4..4a0510f 100755
--- a/lib/chillcg/include/code_gen/CG_chillRepr.h
+++ b/lib/chillcg/include/code_gen/CG_chillRepr.h
@@ -7,7 +7,7 @@
#include <string.h>
#include <code_gen/CG_outputRepr.h>
-#ifndef __STDC_CONSTANT_MACROS
+#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#endif
@@ -17,69 +17,70 @@
namespace omega {
-class CG_chillRepr : public CG_outputRepr {
- friend class CG_chillBuilder;
-public:
- CG_chillRepr() { stmtclassname = strdup("NOTHING"); }
-
-
- char *type() const { return strdup("chill"); };
- //
- std::vector<chillAST_node*> chillnodes; // TODO make private
- void printChillNodes() const {
- for (int i=0; i<chillnodes.size(); i++) {
- chillnodes[i]->print(); printf("\n"); }
- fflush(stdout);
- };
-
- CG_chillRepr( std::vector<chillAST_node*> cnodes ) {
- chillnodes = cnodes;
- }
-
- CG_chillRepr( chillAST_node *chillast ) {
- stmtclassname = strdup(chillast->getTypeString());
- //fprintf(stderr, "made new chillRepr of class %s\n", stmtclassname);
- if (chillast->asttype == CHILLAST_NODETYPE_COMPOUNDSTMT) {
- std::vector<chillAST_node*> children = chillast->getChildren();
- int numchildren = children.size();
- for (int i=0; i<numchildren; i++) {
- chillnodes.push_back( children[i] );
- //fprintf(stderr, "adding a statement from a CompoundStmt\n");
+ class CG_chillRepr : public CG_outputRepr {
+ friend class CG_chillBuilder;
+
+ public:
+ CG_chillRepr() { stmtclassname = strdup("NOTHING"); }
+
+
+ char *type() const { return strdup("chill"); };
+ //
+ std::vector<chillAST_node *> chillnodes; // TODO make private
+ void printChillNodes() const {
+ for (int i = 0; i < chillnodes.size(); i++) {
+ chillnodes[i]->print();
+ printf("\n");
}
+ fflush(stdout);
+ };
+
+ CG_chillRepr(std::vector<chillAST_node *> cnodes) {
+ chillnodes = cnodes;
}
- else { // for now, assume it's a single statement
- chillnodes.push_back( chillast ); // ??
+
+ CG_chillRepr(chillAST_node *chillast) {
+ stmtclassname = strdup(chillast->getTypeString());
+ //fprintf(stderr, "made new chillRepr of class %s\n", stmtclassname);
+ if (chillast->asttype == CHILLAST_NODETYPE_COMPOUNDSTMT) {
+ std::vector<chillAST_node *> children = chillast->getChildren();
+ int numchildren = children.size();
+ for (int i = 0; i < numchildren; i++) {
+ chillnodes.push_back(children[i]);
+ //fprintf(stderr, "adding a statement from a CompoundStmt\n");
+ }
+ } else { // for now, assume it's a single statement
+ chillnodes.push_back(chillast); // ??
+ }
}
- }
- void addStatement( chillAST_node *s ) { chillnodes.push_back( s ); } ;
-
- std::vector<chillAST_node*> getChillCode() const { return chillnodes; };
- chillAST_node *GetCode() ;
-
-
- ~CG_chillRepr();
- CG_outputRepr *clone() const;
- void clear();
+ void addStatement(chillAST_node *s) { chillnodes.push_back(s); };
+
+ std::vector<chillAST_node *> getChillCode() const { return chillnodes; };
+
+ chillAST_node *GetCode();
+
+
+ ~CG_chillRepr();
+
+ CG_outputRepr *clone() const;
-
-
+ void clear();
+ //---------------------------------------------------------------------------
+ // Dump operations
+ //---------------------------------------------------------------------------
+ void dump() const { printChillNodes(); };
- //---------------------------------------------------------------------------
- // Dump operations
- //---------------------------------------------------------------------------
- void dump() const { printChillNodes(); };
- void Dump() const;
- //void DumpToFile(FILE *fp = stderr) const;
-private:
+ void Dump() const;
+ //void DumpToFile(FILE *fp = stderr) const;
+ private:
- char *stmtclassname; // chill
-
-};
+ char *stmtclassname; // chill
+ };
} // namespace