forked from JoscarJiang/MiniSQL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.c
More file actions
180 lines (163 loc) · 3.24 KB
/
check.c
File metadata and controls
180 lines (163 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#include "structs.h"
#include"filemanip.h"
#include"check.h"
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void PPI(){ // 用于查看indexID.bin中存储的内容。建议结合二进制文件察看器,避免0x0d
FILE* fp = fopen("indexID.bin","rb");
int sh;
char name[100];
while(ftell(fp) != GetFileSize11(fp)){
fread(&sh,IID_BYTE,1,fp);
memset(name,0,100);
fread(name,MAX_INDEX_NAME,1,fp);
printf("%d %s\n",sh,name);
}
fclose(fp);
}
void PPGB(){ // 用于察看当前读寄存器的状态
struct buf* pb = GlobalBuffer->head;
int i;
for(i = 0; i < 16; i++){
printf("%5d",i);
}
// printf("\n");
for(i = 0; i < 16; i++){
printf("%5d",(pb->data - readBuf[0]) / BUFFER_SIZE);
pb = pb->next;
}
// printf("\n");
pb = GlobalBuffer->head;
for(i = 0 ; i<16; i++){
printf(" %c%c%c",pb->fileName[3],pb->fileName[4],pb->fileName[5]);
pb = pb->next;
}
// printf("\n");
pb = GlobalBuffer->head;
for(i = 0 ; i<16; i++){
// printf("%5d",pb->line);
pb = pb->next;
}
// printf("\n");
pb = GlobalBuffer->head;
for(i = 0 ; i<16; i++){
printf("%5d",pb->size);
pb = pb->next;
}
// printf("\n");
pb = GlobalBuffer->head;
for(i = 0 ; i<16; i++){
printf("%5d",pb->valid);
pb = pb->next;
}
printf("\n");
}
void PPIL(IntList il){
if(!il)return;
IntList top = il;
while(il){
printf("%d ",il->data);
il = il->next;
}
printf("\n");
}
void PPBINSIZE(){
FILE* f1; f1 = fopen("indexID.bin","rb");
printf("indexID.bin:%d\n",GetFileSize11(f1));
fclose(f1);
FILE* f2; f2 = fopen("indices.bin","rb");
printf("indices.bin:%d\n",GetFileSize11(f2));
fclose(f2);
FILE* f3; f3 = fopen("tableID.bin","rb");
printf("tableID.bin:%d\n",GetFileSize11(f3));
fclose(f3);
FILE* f4; f4 = fopen("tables.bin","rb");
printf("tables.bin:%d\n",GetFileSize11(f4));
fclose(f4);
// FILE* f5 = fopen("table0.bin","rb");
// printf("table0.bin:%d\n",GetFileSize11(f5));
// fclose(f5);
}
void PPCOND(Cond c){
int count = 0;
int i;
Cond check = c;
while(check){
check = check->next;
count++;
}
printf("%8s","Num");
for(i=0;i<count;i++){
printf("%4d",i);
}
printf("\n");
check = c;
printf("%8s","op");
for(i=0;i<count;i++){
printf("%4d",check->op);
check = check->next;
}
printf("\n");
check = c;
printf("%8s","an");
for(i=0;i<count;i++){
printf("%4s",check->an);
check = check->next;
}
printf("\n");
check = c;
printf("%8s","type");
for(i=0;i<count;i++){
printf("%4d",check->value->type);
check = check->next;
}
printf("\n");
}
void PPPVL(PVoidList pvl){
PVoidList p = pvl;
while(p){
int i;
for(i=0;i<4;i++){
printf("%02X ",(((char*)p->data)[i]));
}
printf("||");
p = p->next;
}
printf("\n");
}
void PPMT(MetaTable T){
printf(" valid:%d\n",T->valid);
int i;
for(i=0;i<T->valid;i++){
printf(" a[%d]: name:%s,pk%d,size%d,type%d,unique%d\n",i,T->a[i]->name,T->a[i]->pk,T->a[i]->size,T->a[i]->type,T->a[i]->unique);
}
}
void PPV(Values vv){
Values x = vv;
int count = 0;
while(x){
count++;
x=x->next;
}
int i;
printf("%10s","Num");
for(i=0;i<count;i++){
printf("%4d",i);
}
printf("\n");
printf("%10s","type");
x = vv;
for(i=0;i<count;i++){
printf("%4d",x->type);
x = x->next;
}
printf("\n");
printf("%10s","size");
x = vv;
for(i=0;i<count;i++){
printf("%4d",x->size);
x = x->next;
}
printf("\n");
}