开始写代码STEP_3
来源:互联网 发布:俄罗斯妹子保质期知乎 编辑:程序博客网 时间:2024/03/29 23:17
#ifndef STMT__H_
#define STMT__H_
#include <stdio.h>
#include "Vector.h"
#include "Expression.h"
#include "CodeRepo.h"
typedef struct Stmt_t CStmt;
typedef struct Stmt_VMT...{
void(*generate)(CStmt*, FILE*);
}CStmt_VMT;
struct Stmt_t...{
const CStmt_VMT* vmt;
int srcLineNo;
};
extern void CStmt_Initialize(CStmt*,int);
extern void CStmt_Generate(CStmt*, FILE*);
#define Stmt_Generate(this,arg)
(((CStmt*)this)->vmt->generate((CStmt*)(this),arg))
#endif
#define STMT__H_
#include <stdio.h>
#include "Vector.h"
#include "Expression.h"
#include "CodeRepo.h"
typedef struct Stmt_t CStmt;
typedef struct Stmt_VMT...{
void(*generate)(CStmt*, FILE*);
}CStmt_VMT;
struct Stmt_t...{
const CStmt_VMT* vmt;
int srcLineNo;
};
extern void CStmt_Initialize(CStmt*,int);
extern void CStmt_Generate(CStmt*, FILE*);
#define Stmt_Generate(this,arg)
(((CStmt*)this)->vmt->generate((CStmt*)(this),arg))
#endif
#include "Stmt.h"
static const CStmt_VMT vmt = ...{ CStmt_Generate };
void CStmt_Initialize(CStmt* this,int no)
...{
((CStmt*)this)->vmt = (const CStmt_VMT*)&vmt;
this->srcLineNo = no;
}
void CStmt_Generate(CStmt *this, FILE* output)
...{
}
static const CStmt_VMT vmt = ...{ CStmt_Generate };
void CStmt_Initialize(CStmt* this,int no)
...{
((CStmt*)this)->vmt = (const CStmt_VMT*)&vmt;
this->srcLineNo = no;
}
void CStmt_Generate(CStmt *this, FILE* output)
...{
}
#include "IfStmt.h"
extern int subprog;
static const CIfStmt_VMT vmt = ...{CIfStmt_Generate};
void CIfStmt_Initialize(CIfStmt* this,int no,CExpression *cond, Vector* ifpart, Vector* elsepart)
...{
CStmt_Initialize((CStmt*)this, no);
((CStmt*)(this))->vmt = (const CStmt_VMT*)&vmt;
this->ifpart = ifpart;
this->elspart = elsepart;
this->condition = cond;
}
void CIfStmt_Generate(CIfStmt* this, FILE* output)
...{
int i;
if(subprog)...{
fprintf(output, "setCursor2 %d ", ((CStmt*)this)->srcLineNo - getRef(((CStmt*)this)->srcLineNo) + 1);
}
else...{
fprintf(output, "setCursor %d ", ((CStmt*)this)->srcLineNo - getRef(((CStmt*)this)->srcLineNo));
}
fprintf(output, "If ");
if(this->condition != NULL)...{
Expression_Generate(this->condition, output);
}
fprintf(output, " Then ");
if(this->ifpart != NULL)...{
for(i = 0; i < size(this->ifpart); i++)...{
Stmt_Generate(elementAt(this->ifpart, i), output);
}
}
if(this->elspart != NULL)...{
fprintf(output, "Else ");
for(i = 0; i < size(this->elspart); i++)...{
Stmt_Generate(elementAt(this->elspart, i), output);
}
}
fprintf(output, "End If ");
}
extern int subprog;
static const CIfStmt_VMT vmt = ...{CIfStmt_Generate};
void CIfStmt_Initialize(CIfStmt* this,int no,CExpression *cond, Vector* ifpart, Vector* elsepart)
...{
CStmt_Initialize((CStmt*)this, no);
((CStmt*)(this))->vmt = (const CStmt_VMT*)&vmt;
this->ifpart = ifpart;
this->elspart = elsepart;
this->condition = cond;
}
void CIfStmt_Generate(CIfStmt* this, FILE* output)
...{
int i;
if(subprog)...{
fprintf(output, "setCursor2 %d ", ((CStmt*)this)->srcLineNo - getRef(((CStmt*)this)->srcLineNo) + 1);
}
else...{
fprintf(output, "setCursor %d ", ((CStmt*)this)->srcLineNo - getRef(((CStmt*)this)->srcLineNo));
}
fprintf(output, "If ");
if(this->condition != NULL)...{
Expression_Generate(this->condition, output);
}
fprintf(output, " Then ");
if(this->ifpart != NULL)...{
for(i = 0; i < size(this->ifpart); i++)...{
Stmt_Generate(elementAt(this->ifpart, i), output);
}
}
if(this->elspart != NULL)...{
fprintf(output, "Else ");
for(i = 0; i < size(this->elspart); i++)...{
Stmt_Generate(elementAt(this->elspart, i), output);
}
}
fprintf(output, "End If ");
}
- 开始写代码STEP_3
- 开始写代码了
- 开始写代码,STEP_1
- 开始写代码 STEP_2
- 开始写代码STEP_4
- 开始写代码STEP_5
- 开始写代码STEP_6
- 开始潜心写代码
- 又开始写代码了
- 今天开始博客写代码~
- 从0开始写代码--笔记
- scala 1.0 开始写scala的代码
- 菜鸟开始写代码的心得
- 20140408 "再战" step_3
- 开始写
- 开始写
- 培训开始啦,军训+上课+狂写代码
- 对开发人员开始写代码前的建议
- 粗谈Spring——从执行顺序来看说Spring
- 技术类(delphi)
- 倒影
- 一返回指定范围的不重复随机数类
- 很久了,没发博客了
- 开始写代码STEP_3
- 技术类2(delphi)
- 今天是正式学习C语言的第二天,收获不小!
- Ubuntu 安装 mediawiki
- 类的加载及初始化
- 明天就开始放假了,回家继续学习!
- 技术类3(delphi)
- const char*, char const* and char *const
- fckeditor配置详解(一)