开始写代码,STEP_1
来源:互联网 发布:网络用语ky是什么意思 编辑:程序博客网 时间:2024/04/25 16:55
#include "Vector.h"
void Vector_Initialize(Vector* this)
...{
this->count = 0;
}
void add(Vector* this, void* obj)
...{
this->obj[this->count] = obj;
this->count++;
}
int size(Vector* this)
...{
return this->count;
}
void* elementAt(Vector* this, int pos)
...{
return this->obj[pos];
}
void addVector(Vector* this, void* data)
...{
int i;
for(i = 0;i<size(data);i++)...{
add(this,elementAt(data,i));
}
}
void Vector_Initialize(Vector* this)
...{
this->count = 0;
}
void add(Vector* this, void* obj)
...{
this->obj[this->count] = obj;
this->count++;
}
int size(Vector* this)
...{
return this->count;
}
void* elementAt(Vector* this, int pos)
...{
return this->obj[pos];
}
void addVector(Vector* this, void* data)
...{
int i;
for(i = 0;i<size(data);i++)...{
add(this,elementAt(data,i));
}
}
#ifndef VECTOR_H__
#define VECTOR_H__
#define VECTOR_MAX 256
typedef struct...{
void* obj[VECTOR_MAX];
int count;
}Vector;
void Vector_Initialize(Vector* this);
void add(Vector* this, void* obj);
int size(Vector* this);
void* elementAt(Vector* this, int pos);
void addVector(Vector* this, void* data);
#endif
#define VECTOR_H__
#define VECTOR_MAX 256
typedef struct...{
void* obj[VECTOR_MAX];
int count;
}Vector;
void Vector_Initialize(Vector* this);
void add(Vector* this, void* obj);
int size(Vector* this);
void* elementAt(Vector* this, int pos);
void addVector(Vector* this, void* data);
#endif
#include "Numeric.h"
static const CNumeric_VMT vmt = ...{CNumeric_Generate};
void CNumeric_Initialize(CNumeric* this, int val)
...{
((CExpression*)this)->vmt = (const CExpression_VMT*)&vmt;
this->value = val;
}
void CNumeric_Generate(CNumeric* this, FILE* output)
...{
fprintf(output, "%d", this->value);
}
static const CNumeric_VMT vmt = ...{CNumeric_Generate};
void CNumeric_Initialize(CNumeric* this, int val)
...{
((CExpression*)this)->vmt = (const CExpression_VMT*)&vmt;
this->value = val;
}
void CNumeric_Generate(CNumeric* this, FILE* output)
...{
fprintf(output, "%d", this->value);
}
#ifndef NUMERIC__H_
#define NUMERIC__H_
#include "Expression.h"
#include <stdio.h>
typedef struct Numeric_t CNumeric;
typedef struct...{
void (*generate)(CNumeric*, FILE*);
}CNumeric_VMT;
struct Numeric_t...{
CExpression super;
int value;
};
extern void CNumeric_Initialize(CNumeric*, int);
extern void CNumeric_Generate(CNumeric*, FILE*);
#endif
#define NUMERIC__H_
#include "Expression.h"
#include <stdio.h>
typedef struct Numeric_t CNumeric;
typedef struct...{
void (*generate)(CNumeric*, FILE*);
}CNumeric_VMT;
struct Numeric_t...{
CExpression super;
int value;
};
extern void CNumeric_Initialize(CNumeric*, int);
extern void CNumeric_Generate(CNumeric*, FILE*);
#endif
#include "PrimaryExpression.h"
static const CPrimaryExpression_VMT vmt = ...{ CPrimaryExpression_Generate };
void CPrimaryExpression_Initialize(CPrimaryExpression* this)
...{
CExpression_Initialize((CExpression*)this);
((CExpression*)this)->vmt = (const CExpression_VMT*)&vmt;
}
void CPrimaryExpression_Generate(CPrimaryExpression* this, FILE* output)
...{
}
static const CPrimaryExpression_VMT vmt = ...{ CPrimaryExpression_Generate };
void CPrimaryExpression_Initialize(CPrimaryExpression* this)
...{
CExpression_Initialize((CExpression*)this);
((CExpression*)this)->vmt = (const CExpression_VMT*)&vmt;
}
void CPrimaryExpression_Generate(CPrimaryExpression* this, FILE* output)
...{
}
#ifndef _PRIMARY_EXPRESSION_H
#define _PRIMARY_EXPRESSION_H
#include "Expression.h"
#include <stdio.h>
typedef struct PrimaryExpression_t CPrimaryExpression;
typedef struct...{
void (*generate)(CPrimaryExpression*, FILE*);
}CPrimaryExpression_VMT;
struct PrimaryExpression_t...{
CExpression super;
};
extern void CPrimaryExpression_Initialize(CPrimaryExpression*);
extern void CPrimaryExpression_Generate(CPrimaryExpression*, FILE*);
#endif
#define _PRIMARY_EXPRESSION_H
#include "Expression.h"
#include <stdio.h>
typedef struct PrimaryExpression_t CPrimaryExpression;
typedef struct...{
void (*generate)(CPrimaryExpression*, FILE*);
}CPrimaryExpression_VMT;
struct PrimaryExpression_t...{
CExpression super;
};
extern void CPrimaryExpression_Initialize(CPrimaryExpression*);
extern void CPrimaryExpression_Generate(CPrimaryExpression*, FILE*);
#endif
#include "Expression.h"
static const CExpression_VMT vmt = ...{CExpression_Generate};
void CExpression_Initialize(CExpression* this)
...{
((CExpression*)this)->vmt = (const CExpression_VMT*)&vmt;
}
void CExpression_Generate(CExpression *this, FILE *output)
...{
}
static const CExpression_VMT vmt = ...{CExpression_Generate};
void CExpression_Initialize(CExpression* this)
...{
((CExpression*)this)->vmt = (const CExpression_VMT*)&vmt;
}
void CExpression_Generate(CExpression *this, FILE *output)
...{
}
#ifndef EXPRESSION__H_
#define EXPRESSION__H_
#include <stdio.h>
typedef struct Expression_t CExpression;
typedef struct...{
void (*generate)(CExpression*, FILE*);
}CExpression_VMT;
struct Expression_t...{
const CExpression_VMT *vmt;
};
extern void CExpression_Initialize(CExpression*);
extern void CExpression_Generate(CExpression*, FILE*);
#define Expression_Generate(this, output)
(((CExpression*)(this))->vmt->generate((CExpression*)(this),output))
#endif
#define EXPRESSION__H_
#include <stdio.h>
typedef struct Expression_t CExpression;
typedef struct...{
void (*generate)(CExpression*, FILE*);
}CExpression_VMT;
struct Expression_t...{
const CExpression_VMT *vmt;
};
extern void CExpression_Initialize(CExpression*);
extern void CExpression_Generate(CExpression*, FILE*);
#define Expression_Generate(this, output)
(((CExpression*)(this))->vmt->generate((CExpression*)(this),output))
#endif
#include "FunctionCall.h"
static const CFunctionCall_VMT vmt = ...{ CFunctionCall_Generate };
void CFunctionCall_Initialize(CFunctionCall* this, char* name, Vector* parm)
...{
CPrimaryExpression_Initialize((CPrimaryExpression*)this);
((CExpression*)this)->vmt = (const CExpression_VMT*)&vmt;
this->name = name;
this->parm = parm;
}
void CFunctionCall_Generate(CFunctionCall* this, FILE* output)
...{
int i;
fprintf(output, "%s(", this->name);
for(i = 0; i< size(this->parm); i++)...{
Expression_Generate(elementAt(this->parm, i), output);
if(i < size(this->parm) - 1)...{
fprintf(output, ",");
}
}
fprintf(output, ")");
}
static const CFunctionCall_VMT vmt = ...{ CFunctionCall_Generate };
void CFunctionCall_Initialize(CFunctionCall* this, char* name, Vector* parm)
...{
CPrimaryExpression_Initialize((CPrimaryExpression*)this);
((CExpression*)this)->vmt = (const CExpression_VMT*)&vmt;
this->name = name;
this->parm = parm;
}
void CFunctionCall_Generate(CFunctionCall* this, FILE* output)
...{
int i;
fprintf(output, "%s(", this->name);
for(i = 0; i< size(this->parm); i++)...{
Expression_Generate(elementAt(this->parm, i), output);
if(i < size(this->parm) - 1)...{
fprintf(output, ",");
}
}
fprintf(output, ")");
}
#ifndef FUNCTIONCALL__H_
#define FUNCTIONCALL__H_
#include "PrimaryExpression.h"
#include "Vector.h"
#include <stdio.h>
typedef struct FunctionCall_t CFunctionCall;
typedef struct...{
void (*generate)(CFunctionCall*,FILE*);
}CFunctionCall_VMT;
struct FunctionCall_t...{
CPrimaryExpression super;
char* name;
Vector *parm;
};
extern void CFunctionCall_Initialize(CFunctionCall*, char*, Vector*);
extern void CFunctionCall_Generate(CFunctionCall*, FILE*);
#endif
#define FUNCTIONCALL__H_
#include "PrimaryExpression.h"
#include "Vector.h"
#include <stdio.h>
typedef struct FunctionCall_t CFunctionCall;
typedef struct...{
void (*generate)(CFunctionCall*,FILE*);
}CFunctionCall_VMT;
struct FunctionCall_t...{
CPrimaryExpression super;
char* name;
Vector *parm;
};
extern void CFunctionCall_Initialize(CFunctionCall*, char*, Vector*);
extern void CFunctionCall_Generate(CFunctionCall*, FILE*);
#endif
- 开始写代码,STEP_1
- 开始写代码了
- 开始写代码 STEP_2
- 开始写代码STEP_3
- 开始写代码STEP_4
- 开始写代码STEP_5
- 开始写代码STEP_6
- 开始潜心写代码
- 又开始写代码了
- 今天开始博客写代码~
- 从0开始写代码--笔记
- scala 1.0 开始写scala的代码
- 菜鸟开始写代码的心得
- 开始写
- 开始写
- 培训开始啦,军训+上课+狂写代码
- 对开发人员开始写代码前的建议
- 从今天开始写博客、托管代码到 Github
- apache使用.htaccess文件实现用户认证
- [Oracle]高效的SQL语句之分析函数--row_number() /rank()/dense_rank()
- sqlserver数据库异步处理的存储过程
- XPath 位置路径
- ILE下的各种语言(C/C++, CL, RPG, COBOL)的混合编程实例及原理简介
- 开始写代码,STEP_1
- _bstr_t的内存泄露问题
- 如何在托管程序中动态加载dll并且调用其中的函数
- .Net代码自动生成器下载-三种
- 皮鞋怎样保养
- XPath 轴
- SQL SERVER 存储过程分页的3种通用方法
- WAP常见问题问答大全
- XPath 常用函数