cnt -> count

This commit is contained in:
xmm15 2020-02-15 18:20:04 -06:00
parent 420ff49c6f
commit 1fcbe40f9e
195 changed files with 2319 additions and 2310 deletions

Binary file not shown.

View File

@ -2,7 +2,7 @@ U0 BgtDataRead()
{
CBgtEntry *tmpb;
CBgtTemplate *tmpt;
I64 i,cnt,size;
I64 i,count,size;
U8 *b,*ptr;
I64 max_num;
U8 **s=StrFileRead(bgt_string_file,&max_num);
@ -15,8 +15,8 @@ U0 BgtDataRead()
t_head.b.date=Now;
if (ptr=b=FileRead(bgt_data_file,&size)) {
cnt=*ptr(I64 *)++;
for (i=0;i<cnt;i++) {
count=*ptr(I64 *)++;
for (i=0;i<count;i++) {
tmpb=CAlloc(sizeof(CBgtEntry));
MemCpy(&tmpb->start,ptr,BE_SIZE);
tmpb->credit=StrNew(s[tmpb->credit_idx]);
@ -26,8 +26,8 @@ U0 BgtDataRead()
ptr+=BE_SIZE;
}
cnt=*ptr(I64 *)++;
for (i=0;i<cnt;i++) {
count=*ptr(I64 *)++;
for (i=0;i<count;i++) {
tmpt=CAlloc(sizeof(CBgtTemplate));
MemCpy(&tmpt->start,ptr,BT_SIZE);
ptr+=BT_SIZE;
@ -48,7 +48,7 @@ U0 BgtDataRead()
U0 BgtDataWrite()
{
I64 i,num=0,size,cnt1,cnt2;
I64 i,num=0,size,count1,count2;
CHashTable *table=HashTableNew(1024);
CBgtEntry *tmpb;
CBgtTemplate *tmpt;
@ -64,33 +64,33 @@ U0 BgtDataWrite()
}
tmpb=b_head.next;
cnt1=0;
count1=0;
while (tmpb!=&b_head) {
if (tmpb->type!=BE_TEMPLATE_COPY) {
tmpb->credit_idx =StrFileAdd(tmpb->credit,&num,table);
tmpb->debit_idx =StrFileAdd(tmpb->debit,&num,table);
tmpb->desc_idx =StrFileAdd(tmpb->desc,&num,table);
cnt1++;
count1++;
}
tmpb=tmpb->next;
}
tmpt=t_head.next;
cnt2=0;
count2=0;
while (tmpt!=&t_head) {
tmpt->b.credit_idx =StrFileAdd(tmpt->b.credit,&num,table);
tmpt->b.debit_idx =StrFileAdd(tmpt->b.debit,&num,table);
tmpt->b.desc_idx =StrFileAdd(tmpt->b.desc,&num,table);
cnt2++;
count2++;
tmpt=tmpt->next;
}
StrFileWrite(bgt_string_file,table);
StrFileDel(table);
size=sizeof(I64)*2+cnt1*BE_SIZE+cnt2*(BT_SIZE+BE_SIZE);
size=sizeof(I64)*2+count1*BE_SIZE+count2*(BT_SIZE+BE_SIZE);
buf=ptr=MAlloc(size);
MemCpy(ptr,&cnt1,sizeof(I64));
MemCpy(ptr,&count1,sizeof(I64));
ptr+=sizeof(I64);
tmpb=b_head.next;
while (tmpb!=&b_head) {
@ -101,7 +101,7 @@ U0 BgtDataWrite()
tmpb=tmpb->next;
}
MemCpy(ptr,&cnt2,sizeof(I64));
MemCpy(ptr,&count2,sizeof(I64));
ptr+=sizeof(I64);
tmpt=t_head.next;
while (tmpt!=&t_head) {

View File

@ -137,8 +137,8 @@ U0 BgtRegen()
//and line entries, so we never had to resync.
doc_ce=pdoc->cur_entry;
timeout_jiffy=cnts.jiffies+JIFFY_FREQ; //Max one second.
while (doc_ce!=pdoc && cnts.jiffies<timeout_jiffy) {
timeout_jiffy=counts.jiffies+JIFFY_FREQ; //Max one second.
while (doc_ce!=pdoc && counts.jiffies<timeout_jiffy) {
while (doc_ce->type_u8!=DOCT_MENU_VAL || !(tmpb_ce=doc_ce->user_data)) {
doc_ce=doc_ce->next;
if (doc_ce==pdoc) goto br_cont;

View File

@ -78,14 +78,14 @@ I64 StrEntriesCompare(CHashGeneric *h1,CHashGeneric *h2)
public U0 StrFileWrite(U8 *name,CHashTable *table,Bool no_nums=FALSE)
{
I64 i,j,cnt,color=BLACK;
I64 i,j,count,color=BLACK;
CDoc *doc=DocNew(name);
CHashGeneric *tmph,**a;
if (table) {
cnt=0; //Count Strings
count=0; //Count Strings
for (i=0;i<=table->mask;i++)
cnt+=LinkedLstCnt(table->body[i]);
a=MAlloc(cnt*sizeof(CHashGeneric *));
count+=LinkedLstCount(table->body[i]);
a=MAlloc(count*sizeof(CHashGeneric *));
j=0; //Load Strings
for (i=0;i<=table->mask;i++) {
tmph=table->body[i];
@ -94,8 +94,8 @@ public U0 StrFileWrite(U8 *name,CHashTable *table,Bool no_nums=FALSE)
tmph=tmph->next;
}
}
QSortI64(a,cnt,&StrEntriesCompare);
for (i=0;i<cnt;i++) {
QSortI64(a,count,&StrEntriesCompare);
for (i=0;i<count;i++) {
tmph=a[i];
if (tmph->user_data1&15!=color) {
DocPrint(doc,"$$FG,%d$$",tmph->user_data1&15);

View File

@ -5,8 +5,8 @@
class Ball
{
I32 vertex_cnt;
I32 tri_cnt;
I32 vertex_count;
I32 tri_count;
CD3I32 v[VERTICES_NUM];
CMeshTri t[TRIS_NUM];
} *b;
@ -35,10 +35,10 @@ U0 BDCorrect(BallDefineStruct *bd)
I64 AddVertex(BallDefineStruct *,I64 x,I64 y,I64 z)
{
I64 i;
for (i=0;i<b->vertex_cnt;i++)
for (i=0;i<b->vertex_count;i++)
if (b->v[i].x==x && b->v[i].y==y && b->v[i].z==z)
return i;
i=b->vertex_cnt++;
i=b->vertex_count++;
b->v[i].x=x;
b->v[i].y=y;
b->v[i].z=z;
@ -47,7 +47,7 @@ I64 AddVertex(BallDefineStruct *,I64 x,I64 y,I64 z)
I64 AddTri(BallDefineStruct *,I64 c,I64 n0,I64 n1,I64 n2)
{
I64 res=b->tri_cnt++;
I64 res=b->tri_count++;
b->t[res].color=c;
b->t[res].nums[0]=n0;
b->t[res].nums[1]=n1;
@ -59,16 +59,16 @@ U8 *Ball2CSprite()
{
//See $LK,"::/Zenith/Gr/GrSpritePlot.HC",A="FL:::/Zenith/Gr/GrSpritePlot.HC,1"$ for how CSprite are stored.
U8 *res=MAlloc(sizeof(CSpriteMeshU8s)+
b->vertex_cnt*sizeof(CD3I32)+b->tri_cnt*sizeof(CMeshTri)
b->vertex_count*sizeof(CD3I32)+b->tri_count*sizeof(CMeshTri)
+sprite_elem_base_sizes[SPT_END]),
*dst=res;
*dst++ =SPT_MESH;
*dst(I32 *)++ =b->vertex_cnt;
*dst(I32 *)++ =b->tri_cnt;
MemCpy(dst,&b->v,b->vertex_cnt*sizeof(CD3I32));
dst+=b->vertex_cnt*sizeof(CD3I32);
MemCpy(dst,&b->t,b->tri_cnt*sizeof(CMeshTri));
dst+=b->tri_cnt*sizeof(CMeshTri);
*dst(I32 *)++ =b->vertex_count;
*dst(I32 *)++ =b->tri_count;
MemCpy(dst,&b->v,b->vertex_count*sizeof(CD3I32));
dst+=b->vertex_count*sizeof(CD3I32);
MemCpy(dst,&b->t,b->tri_count*sizeof(CMeshTri));
dst+=b->tri_count*sizeof(CMeshTri);
*dst++ =SPT_END;
return res;
}
@ -116,7 +116,7 @@ public U8 *BallGen()
"%h7c",'\n';
Sprite(res,"\t\t$$SP,\"<1>\",BI=%d$$");
"%h7c",'\n';
"Vertices:%d\n",b->vertex_cnt;
"Vertices:%d\n",b->vertex_count;
Free(b);
"Do another";
if (YorN)

View File

@ -5,8 +5,8 @@
class Man
{
I32 vertex_cnt;
I32 tri_cnt;
I32 vertex_count;
I32 tri_count;
CD3I32 v[VERTICES_NUM];
CMeshTri t[TRIS_NUM];
} *m;
@ -142,7 +142,7 @@ U0 MDCorrect(ManDefineStruct *md)
I64 AddVertex(ManDefineStruct *md,I64 x,I64 y,I64 z)
{
I64 res=m->vertex_cnt++;
I64 res=m->vertex_count++;
m->v[res].x=-x;
m->v[res].y=-y-md->leg_len-md->foot_rad*2;
m->v[res].z=-z;
@ -151,7 +151,7 @@ I64 AddVertex(ManDefineStruct *md,I64 x,I64 y,I64 z)
I64 AddTri(ManDefineStruct *,I64 c,I64 n0,I64 n1,I64 n2)
{
I64 res=m->tri_cnt++;
I64 res=m->tri_count++;
m->t[res].color=c;
m->t[res].nums[0]=n1;
m->t[res].nums[1]=n0;
@ -213,16 +213,16 @@ U8 *Man2CSprite()
{
//See $LK,"::/Zenith/Gr/GrSpritePlot.HC",A="FL:::/Zenith/Gr/GrSpritePlot.HC,1"$ for how CSprite are stored.
U8 *res=MAlloc(sizeof(CSpriteMeshU8s)+
m->vertex_cnt*sizeof(CD3I32)+m->tri_cnt*sizeof(CMeshTri)+
m->vertex_count*sizeof(CD3I32)+m->tri_count*sizeof(CMeshTri)+
sprite_elem_base_sizes[SPT_END]),
*dst=res;
*dst++ =SPT_MESH;
*dst(I32 *)++ =m->vertex_cnt;
*dst(I32 *)++ =m->tri_cnt;
MemCpy(dst,&m->v,m->vertex_cnt*sizeof(CD3I32));
dst+=m->vertex_cnt*sizeof(CD3I32);
MemCpy(dst,&m->t,m->tri_cnt*sizeof(CMeshTri));
dst+=m->tri_cnt*sizeof(CMeshTri);
*dst(I32 *)++ =m->vertex_count;
*dst(I32 *)++ =m->tri_count;
MemCpy(dst,&m->v,m->vertex_count*sizeof(CD3I32));
dst+=m->vertex_count*sizeof(CD3I32);
MemCpy(dst,&m->t,m->tri_count*sizeof(CMeshTri));
dst+=m->tri_count*sizeof(CMeshTri);
*dst++ =SPT_END;
return res;
}

View File

@ -641,7 +641,7 @@ mo_got_message:
tmpn=psm.cur_note;
while (tmpn!=&psm.head) {
if (tmpn->type!=PSMT_METER) {
timeout_val=cnts.jiffies;
timeout_val=counts.jiffies;
if (ms.pos_text.y-Fs->win_top<18)
message_code=ScanMessage(&arg1,&arg2,1<<MESSAGE_KEY_DOWN|
1<<MESSAGE_MS_L_DOWN|1<<MESSAGE_MS_R_UP|1<<MESSAGE_CMD);

View File

@ -24,7 +24,7 @@ U0 SpanDel(CMathODE *ode)
U8 *SpanSave(CMathODE *ode,I64 *_size=NULL)
{
I64 cnt;
I64 count;
U8 *res,*ptr;
MyMass *tmpm;
MySpring *tmps;
@ -41,9 +41,9 @@ U8 *SpanSave(CMathODE *ode,I64 *_size=NULL)
else
h.num_springs=0;
cnt=sizeof(SpanHeader)+h.num_masses*M_SIZE+h.num_springs*S_SIZE;
count=sizeof(SpanHeader)+h.num_masses*M_SIZE+h.num_springs*S_SIZE;
ptr=res=MAlloc(cnt);
ptr=res=MAlloc(count);
MemCpy(ptr,&h,sizeof(SpanHeader));
ptr+=sizeof(SpanHeader);
@ -60,7 +60,7 @@ U8 *SpanSave(CMathODE *ode,I64 *_size=NULL)
ptr+=S_SIZE;
tmps=tmps->next;
}
if (_size) *_size=cnt;
if (_size) *_size=count;
return res;
}

View File

@ -274,14 +274,14 @@ U0 MPMenDraw(CDC *dc2)
{
CTask *task=dc2->win_task;
CDC *dc=DCAlias(dc2,task);
I64 i,r[16],lo=Gs->num*U_NUM/mp_cnt,hi=(Gs->num+1)*U_NUM/mp_cnt,
I64 i,r[16],lo=Gs->num*U_NUM/mp_count,hi=(Gs->num+1)*U_NUM/mp_count,
yy,phase,scroll_y=MAP_HEIGHT-100-100*(tS-t0);
Unit *tmpu;
Explosion *tmpe;
U8 *tmps,**_tmps;
F64 tt,ts=tS;
for (i=Gs->num;i<E_NUM;i+=mp_cnt) {
for (i=Gs->num;i<E_NUM;i+=mp_count) {
tmpe=&e[i];
yy=(tmpe->y-scroll_y)&(MAP_HEIGHT-1);
if (-32<=yy<=task->pix_bottom+32 && !tmpe->dead) {
@ -376,8 +376,8 @@ U0 DrawIt(CTask *task,CDC *dc)
}
DCDepthBufAlloc(dc);
mp_not_done_flags=1<<mp_cnt-1;
for (i=0;i<mp_cnt;i++)
mp_not_done_flags=1<<mp_count-1;
for (i=0;i<mp_count;i++)
JobQueue(&MPMenDraw,dc,i);
while (mp_not_done_flags)
Yield;
@ -509,9 +509,9 @@ U0 CheckCollisions()
x=tmpu->x;
y=(tmpu->y-scroll_y)&(MAP_HEIGHT-1);
if (0<=x<GR_WIDTH && 0<=y<GR_HEIGHT) {
dc2->collision_cnt=0;
dc2->collision_count=0;
GrRect(dc2,x-3,y-9,6,8);
if (dc2->collision_cnt)
if (dc2->collision_count)
ManDie(tmpu,TRUE);
}
}
@ -817,7 +817,7 @@ U0 Titanium()
try {
while (TRUE) {
next_update_jiffy=cnts.jiffies+JIFFY_FREQ/100;
next_update_jiffy=counts.jiffies+JIFFY_FREQ/100;
while (message_code=ScanMessage(&ch,&sc,1<<MESSAGE_KEY_DOWN+1<<MESSAGE_KEY_UP)) {
switch (message_code) {
case MESSAGE_KEY_DOWN:

View File

@ -10,7 +10,7 @@ U0 PlayerIndirect()
remaining++;
}
while (remaining) {
if (!alive_cnt[0] || !alive_cnt[1])
if (!alive_count[0] || !alive_count[1])
throw('GameOver',TRUE);
message_code=GetMessage(&arg1,&arg2,1<<MESSAGE_KEY_DOWN|1<<MESSAGE_MS_L_DOWN|1<<MESSAGE_MS_L_UP|
1<<MESSAGE_MS_R_UP);
@ -68,7 +68,7 @@ U0 PlayerMove()
I64 message_code,arg1,arg2;
ViewPlayerSet(cur_player);
while (TRUE) {
if (!alive_cnt[0] || !alive_cnt[1])
if (!alive_count[0] || !alive_count[1])
throw('GameOver',TRUE);
message_code=GetMessage(&arg1,&arg2,1<<MESSAGE_KEY_DOWN|1<<MESSAGE_MS_L_DOWN|1<<MESSAGE_MS_L_UP|
1<<MESSAGE_MS_R_UP);
@ -113,7 +113,7 @@ U0 PlayerDirect()
I64 message_code,arg1,arg2;
ViewPlayerSet(cur_player);
while (TRUE) {
if (!alive_cnt[0] || !alive_cnt[1])
if (!alive_count[0] || !alive_count[1])
throw('GameOver',TRUE);
message_code=GetMessage(&arg1,&arg2,1<<MESSAGE_KEY_DOWN|1<<MESSAGE_MS_L_DOWN|1<<MESSAGE_MS_L_UP|
1<<MESSAGE_MS_R_UP);

Binary file not shown.

View File

@ -69,7 +69,7 @@ Bool DamageDo(Unit *target,F64 damage)
Sleep(1000*animation_delay);
target->life=0;
VisRecalc(VR_FRIENDLY_UNIT_DIED,target);
alive_cnt[target->player]--;
alive_count[target->player]--;
return TRUE;
} else {
if (target->armor) {
@ -201,7 +201,7 @@ Bool HexOccupy(Bool overrun,Unit *tmpu,Unit *target)
} else {
tmpu->life=0;
VisRecalc(VR_FRIENDLY_UNIT_DIED,tmpu);
alive_cnt[tmpu->player]--;
alive_count[tmpu->player]--;
"$$RED$$Failure$$FG$$\n";
while (scrncast.ona) //see $LK,"Snd",A="MN:Snd"$()
Yield;

View File

@ -78,7 +78,7 @@ U8 vis_unit_bitmap[2][(((UNITS_NUM+7)&~7)*UNITS_NUM)>>3];
#define PHASE_END 6
I64 phase,cur_player,enemy_player,view_player,turn,
cursor_row,cursor_col,alive_cnt[2],
cursor_row,cursor_col,alive_count[2],
player_indirect[2],player_move[2],player_direct[2];
F64 animation_delay=0.5;

View File

@ -71,10 +71,10 @@ U0 DrawHexes()
}
}
U0 MakeTerrain(U8 color,I64 cnt,I64 clus_lo,I64 clus_hi)
U0 MakeTerrain(U8 color,I64 count,I64 clus_lo,I64 clus_hi)
{
I64 i,j,l,row,col;
for (i=0;i<cnt;i++) {
for (i=0;i<count;i++) {
col=RandU32%map_cols;
row=RandU32%map_rows;
l=clus_lo+RandU16%(clus_hi-clus_lo+1);
@ -234,9 +234,9 @@ U0 InitUnits()
I64 i,j,row,col,type;
Unit *tmpu;
MemSet(units,0,sizeof(units));
alive_cnt[0]=alive_cnt[1]=UNITS_NUM;
alive_count[0]=alive_count[1]=UNITS_NUM;
for (j=0;j<2;j++)
for (i=0;i<alive_cnt[j];i++) {
for (i=0;i<alive_count[j];i++) {
tmpu=&units[j][i];
tmpu->player=j;
tmpu->num=i;

View File

@ -133,7 +133,7 @@ Bool MPVisRecalc(MPCtrl1 *job)
Bool VisRecalc(I64 mode,Unit *tmpu=NULL)
{
I64 i,hi,k,cnt;
I64 i,hi,k,count;
Bool res;
/*The compiler doesn't go out of it's way
to know if something is const.;-)This
@ -143,8 +143,8 @@ AOT binaries.ZenithOS has a limited
stk size, so don't get in the habit.
$LK,"MAlloc",A="MN:MAlloc"$() would probably be the better choice.
*/
MPCtrl1 job[mp_cnt];
CJob *cmd[mp_cnt];
MPCtrl1 job[mp_count];
CJob *cmd[mp_count];
if (mode==VR_FRIENDLY_UNIT_DIED) {
MemSet((&vis_unit_bitmap[enemy_player])(U8 *)+
@ -153,7 +153,7 @@ $LK,"MAlloc",A="MN:MAlloc"$() would probably be the better choice.
return 0; //Return any value--don't care
}
cnt=mp_cnt; //Cores
count=mp_count; //Cores
hi=UNITS_NUM;
if (mode==VR_ONE_ENEMY_UNIT) {
for (hi--;hi>=0;hi--)
@ -162,22 +162,22 @@ $LK,"MAlloc",A="MN:MAlloc"$() would probably be the better choice.
hi++;
}
k=hi;
if (hi/mp_cnt<2)
cnt=1;
for (i=0;i<cnt;i++) {
if (hi/mp_count<2)
count=1;
for (i=0;i<count;i++) {
job[i].mode=mode;
job[i].tmpu=tmpu;
job[i].hi=k;
k-=hi/cnt;
k-=hi/count;
if (k<0) k=0;
if (i==cnt-1) k=0;
if (i==count-1) k=0;
job[i].lo=k;
}
res=FALSE;
for (i=0;i<cnt;i++)
for (i=0;i<count;i++)
cmd[i]=JobQueue(&MPVisRecalc,&job[i],i,0);
for (i=0;i<cnt;i++)
for (i=0;i<count;i++)
if (JobResGet(cmd[i]))
res=TRUE;
if (mode==VR_UPDATE_FRIENDLY_UNIT)
@ -198,26 +198,26 @@ U0 MPVisRecalcMap(MPCtrl2 *job)
U0 VisRecalcMap(I64 row,I64 col)
{
I64 i,hi,k,cnt;
MPCtrl2 job[mp_cnt];
CJob *cmd[mp_cnt];
I64 i,hi,k,count;
MPCtrl2 job[mp_count];
CJob *cmd[mp_count];
cnt=mp_cnt; //Cores
count=mp_count; //Cores
hi=map_rows;
k=hi;
if (hi/mp_cnt<2)
cnt=1;
for (i=0;i<cnt;i++) {
if (hi/mp_count<2)
count=1;
for (i=0;i<count;i++) {
job[i].row=row;
job[i].col=col;
job[i].hi=k;
k-=hi/cnt;
k-=hi/count;
if (k<0) k=0;
if (i==cnt-1) k=0;
if (i==count-1) k=0;
job[i].lo=k;
}
for (i=0;i<cnt;i++)
for (i=0;i<count;i++)
cmd[i]=JobQueue(&MPVisRecalcMap,&job[i],i,0);
for (i=0;i<cnt;i++)
for (i=0;i<count;i++)
JobResGet(cmd[i]);
}

View File

@ -15,7 +15,7 @@ U0 TurnNew()
moving_unit=NULL;
SleepUntil(message_off_timeout);
message_off_timeout=cnts.jiffies+JIFFY_FREQ*2*animation_delay+1;
message_off_timeout=counts.jiffies+JIFFY_FREQ*2*animation_delay+1;
Snd(74);
StrPrint(message_buf,"Turn %d",++turn);
VRSetUp(0);
@ -35,7 +35,7 @@ U0 PhaseNew()
}
SleepUntil(message_off_timeout);
message_off_timeout=cnts.jiffies+JIFFY_FREQ*2*animation_delay+1;
message_off_timeout=counts.jiffies+JIFFY_FREQ*2*animation_delay+1;
Snd(74);
switch (phase) {
case PHASE_INDIRECT0:
@ -94,7 +94,7 @@ U0 CharDo(U8 ch)
U0 UserCheck()
{
I64 ch;
if (!alive_cnt[0] || !alive_cnt[1])
if (!alive_count[0] || !alive_count[1])
throw('GameOver',TRUE);
if (ch=ScanChar)
CharDo(ch);

View File

@ -6,12 +6,12 @@ Bool ParseAsmImm(CCompCtrl *cc,CAsmArg *arg)
arg->num.local_asm_undef_hash=NULL;
arg->num.glbl_asm_undef_hash=NULL;
cc->asm_undef_hash=NULL;
cc->abs_cnts=0;
cc->abs_counts=0;
cc->flags&=~(CCF_UNRESOLVED+CCF_LOCAL);
if (!IsLexExpression2Bin(cc,&arg->num.machine_code))
LexSkipEol(cc);
else {
if (cc->abs_cnts.externs)
if (cc->abs_counts.externs)
LexExcept(cc,"Extern Not Allowed at ");
if (cc->flags & CCF_UNRESOLVED) {
if (cc->flags & CCF_LOCAL) {
@ -114,8 +114,8 @@ U0 ParseAsmArg(CCompCtrl *cc,CAsmArg *arg,Bool rel)
} else {
pa_asm_direct_imm:
ParseAsmImm(cc,arg);
arg->num.abs_cnts=cc->abs_cnts;
if (arg->size<=1 && !rel && arg->num.abs_cnts&1) {
arg->num.abs_counts=cc->abs_counts;
if (arg->size<=1 && !rel && arg->num.abs_counts&1) {
if (cc->aotc->seg_size==16)
arg->size=2;
else
@ -162,7 +162,7 @@ pa_asm_direct_imm:
} else {
pa_asm_indirect_imm:
ParseAsmImm(cc,arg);
arg->num.abs_cnts=cc->abs_cnts;
arg->num.abs_counts=cc->abs_counts;
}
}
if (cc->token!=']')
@ -265,7 +265,7 @@ mm_done:
return res;
}
Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 count,Bool U8_avail)
{
CAOTCtrl *aotc=cc->aotc;
I64 i;
@ -273,8 +273,8 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
if (!num2->imm_flag)
num2->num.i-=num2->rel;
for (i=0;i<cnt;i++) {
if (num2->U8_cnt==1) {
for (i=0;i<count;i++) {
if (num2->U8_count==1) {
if (num2->num.local_asm_undef_hash||num2->num.glbl_asm_undef_hash)
AsmUnresolvedAdd(cc,num2->num.machine_code,IET_REL_I8+num2->imm_flag,
aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
@ -283,7 +283,7 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
else if (!num2->imm_flag && !(I8_MIN<=num2->num.i<=I8_MAX))
LexExcept(cc,"Branch out of range at ");
if (num2->imm_flag) {
if (num2->num.abs_cnts.abs_addres&1) {
if (num2->num.abs_counts.abs_addres&1) {
tmpa=CAlloc(sizeof(CAOTAbsAddr));
tmpa->next=aotc->abss;
aotc->abss=tmpa;
@ -291,7 +291,7 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
tmpa->type=AAT_ADD_U8;
}
} else {
if (num2->num.abs_cnts.c_addres&1) {
if (num2->num.abs_counts.c_addres&1) {
tmpa=CAlloc(sizeof(CAOTAbsAddr));
tmpa->next=aotc->abss;
aotc->abss=tmpa;
@ -301,7 +301,7 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
}
AOTStoreCodeU8(cc,num2->num.i);
} else {
if (num2->U8_cnt==2) {
if (num2->U8_count==2) {
if (num2->num.local_asm_undef_hash||num2->num.glbl_asm_undef_hash)
AsmUnresolvedAdd(cc,num2->num.machine_code,IET_REL_I16+num2->imm_flag,
aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
@ -310,7 +310,7 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
else if (!num2->imm_flag && !(I16_MIN<=num2->num.i<=I16_MAX))
LexExcept(cc,"Branch out of range at ");
if (num2->imm_flag) {
if (num2->num.abs_cnts.abs_addres&1) {
if (num2->num.abs_counts.abs_addres&1) {
tmpa=CAlloc(sizeof(CAOTAbsAddr));
tmpa->next=aotc->abss;
aotc->abss=tmpa;
@ -318,7 +318,7 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
tmpa->type=AAT_ADD_U16;
}
} else {
if (num2->num.abs_cnts.c_addres&1) {
if (num2->num.abs_counts.c_addres&1) {
tmpa=CAlloc(sizeof(CAOTAbsAddr));
tmpa->next=aotc->abss;
aotc->abss=tmpa;
@ -328,7 +328,7 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
}
AOTStoreCodeU8(cc,num2->num.i.u8[0]);
AOTStoreCodeU8(cc,num2->num.i.u8[1]);
} else if (num2->U8_cnt==4) {
} else if (num2->U8_count==4) {
if (num2->num.local_asm_undef_hash||num2->num.glbl_asm_undef_hash)
AsmUnresolvedAdd(cc,num2->num.machine_code,IET_REL_I32+num2->imm_flag,
aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
@ -337,7 +337,7 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
else if (!num2->imm_flag && !(I32_MIN<=num2->num.i<=I32_MAX))
LexExcept(cc,"Branch out of range at ");
if (num2->imm_flag) {
if (num2->num.abs_cnts.abs_addres&1) {
if (num2->num.abs_counts.abs_addres&1) {
tmpa=CAlloc(sizeof(CAOTAbsAddr));
tmpa->next=aotc->abss;
aotc->abss=tmpa;
@ -345,7 +345,7 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
tmpa->type=AAT_ADD_U32;
}
} else {
if (num2->num.abs_cnts.c_addres&1) {
if (num2->num.abs_counts.c_addres&1) {
tmpa=CAlloc(sizeof(CAOTAbsAddr));
tmpa->next=aotc->abss;
aotc->abss=tmpa;
@ -354,14 +354,14 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
}
}
AOTStoreCodeU32(cc,num2->num.i);
} else if (num2->U8_cnt==8) {
} else if (num2->U8_count==8) {
if (num2->num.local_asm_undef_hash||num2->num.glbl_asm_undef_hash)
AsmUnresolvedAdd(cc,num2->num.machine_code,IET_REL_I64+num2->imm_flag,
aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
num2->num.glbl_asm_undef_hash,cc->lex_include_stk->line_num,
U8_avail);
if (num2->imm_flag) {
if (num2->num.abs_cnts.abs_addres&1) {
if (num2->num.abs_counts.abs_addres&1) {
tmpa=CAlloc(sizeof(CAOTAbsAddr));
tmpa->next=aotc->abss;
aotc->abss=tmpa;
@ -369,7 +369,7 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
tmpa->type=AAT_ADD_U64;
}
} else {
if (num2->num.abs_cnts.c_addres&1) {
if (num2->num.abs_counts.c_addres&1) {
tmpa=CAlloc(sizeof(CAOTAbsAddr));
tmpa->next=aotc->abss;
aotc->abss=tmpa;
@ -392,7 +392,7 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
U8 asm_seg_prefixes[6]={0x26,0x2E,0x36,0x3E,0x64,0x65};
Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcount)
{
CAOTCtrl *aotc=cc->aotc;
I64 i,j,arg1,arg2,om,seg,arg1mask,arg2mask;
@ -401,16 +401,16 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
CInst *tmpins;
CAsmIns cur,best;
best.U8_cnt=255;
if (argcnt>0)
best.U8_count=255;
if (argcount>0)
arg1mask=AsmMakeArgMask(cc,&aotc->arg1);
else
arg1mask=1;
if (argcnt>1)
if (argcount>1)
arg2mask=AsmMakeArgMask(cc,&aotc->arg2);
else
arg2mask=1;
for (i=0;i<tmpo->inst_entry_cnt;i++) {
for (i=0;i<tmpo->inst_entry_count;i++) {
tmpins=&tmpo->ins[i];
if (tmpins->arg1==ARGT_REL8 || tmpins->arg2==ARGT_REL8)
U8_avail=TRUE;
@ -433,7 +433,7 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
arg2=tmpins->arg2;
tmpa1=&aotc->arg1;
tmpa2=&aotc->arg2;
cur.last_opcode_U8=tmpins->opcode[tmpins->opcode_cnt-1];
cur.last_opcode_U8=tmpins->opcode[tmpins->opcode_count-1];
if (tmpins->slash_val<8) {
cur.ModrM|=tmpins->slash_val<<3;
@ -444,23 +444,23 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
aotc->seg_size!=16 && tmpins->flags & IEF_OP_SIZE16)
cur.has_operand_prefix=TRUE;
if (om==OM_IB) cur.imm.U8_cnt=1;
else if (om==OM_IW) cur.imm.U8_cnt=2;
else if (om==OM_ID) cur.imm.U8_cnt=4;
if (om==OM_IB) cur.imm.U8_count=1;
else if (om==OM_IW) cur.imm.U8_count=2;
else if (om==OM_ID) cur.imm.U8_count=4;
if (om==OM_CB) {
cur.imm.U8_cnt=1;
cur.imm.U8_count=1;
cur.imm.imm_flag=FALSE;
} else if (om==OM_CW) {
cur.imm.U8_cnt=2;
cur.imm.U8_count=2;
cur.imm.imm_flag=FALSE;
} else if (om==OM_CD) {
cur.imm.U8_cnt=4;
cur.imm.U8_count=4;
cur.imm.imm_flag=FALSE;
}
if (argcnt==1) {
if (best.U8_cnt!=255 && !found_second_possible && !best.is_dft) {
if (argcount==1) {
if (best.U8_count!=255 && !found_second_possible && !best.is_dft) {
found_second_possible=TRUE;
if (!aotc->arg1.size)
PrintWarn("no size specified at %s,%04d\n",
@ -490,7 +490,7 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
tmpa1->reg1==REG_NONE) {
cur.ModrM=cur.ModrM+5;
MemCpy(&cur.disp.num,&tmpa1->num,sizeof(CAsmNum));
cur.disp.U8_cnt=4;
cur.disp.U8_count=4;
if (aotc->seg_size==64)
cur.disp.imm_flag=FALSE;
} else {
@ -519,7 +519,7 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
if (tmpa1->reg1>=20) //RBPu8,RSPu8,RSIu8,RDIu8?
cur.has_REX=TRUE;
MemCpy(&cur.disp.num,&tmpa1->num,sizeof(CAsmNum));
cur.disp.U8_cnt=4;
cur.disp.U8_count=4;
} else {
cur.SIB|=(tmpa1->reg1&7)<<3+tmpa1->reg2&7;
if (tmpa1->reg1&15>7)
@ -533,7 +533,7 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
if (tmpa1->reg2&7==REG_RBP &&
!tmpa1->imm_or_off_present && tmpa1->indirect) {
cur.ModrM|=0x40;
cur.disp.U8_cnt=1;
cur.disp.U8_count=1;
ModrM_complete=TRUE;
}
}
@ -544,13 +544,13 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
if (!cur.disp.num.machine_code &&
I8_MIN<=cur.disp.num.i<=I8_MAX) {
cur.ModrM|=0x40;
cur.disp.U8_cnt=1;
cur.disp.U8_count=1;
} else if (aotc->seg_size==16) {
cur.ModrM|=0x80;
cur.disp.U8_cnt=2;
cur.disp.U8_count=2;
} else {
cur.ModrM|=0x80;
cur.disp.U8_cnt=4;
cur.disp.U8_count=4;
}
} else if (!tmpa1->indirect) {
cur.has_addr_prefix=FALSE;
@ -558,7 +558,7 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
} else {
if (tmpa1->reg1&7==REG_RBP) {
cur.ModrM|=0x40;
cur.disp.U8_cnt=1;
cur.disp.U8_count=1;
}
}
}
@ -569,8 +569,8 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
cur.REX|=8;
MemCpy(&cur.imm.num,&tmpa1->num,sizeof(CAsmNum));
}
} else if (argcnt==2) {
if (best.U8_cnt!=255 && !found_second_possible && !best.is_dft) {
} else if (argcount==2) {
if (best.U8_count!=255 && !found_second_possible && !best.is_dft) {
found_second_possible=TRUE;
if (!aotc->arg1.size && !aotc->arg2.size)
PrintWarn("no size specified at %s,%04d\n",
@ -658,7 +658,7 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
if (tmpa1->reg1>=20) //RBPu8,RSPu8,RSIu8,RDIu8?
cur.has_REX=TRUE;
MemCpy(&cur.disp.num,&tmpa1->num,sizeof(CAsmNum));
cur.disp.U8_cnt=4;
cur.disp.U8_count=4;
} else {
cur.SIB|=(tmpa1->reg1&7)<<3+tmpa1->reg2&7;
if (tmpa1->reg1&15>7)
@ -672,7 +672,7 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
if (tmpa1->reg2&7==REG_RBP &&
!tmpa1->imm_or_off_present && tmpa1->indirect) {
cur.ModrM|=0x40;
cur.disp.U8_cnt=1;
cur.disp.U8_count=1;
ModrM_complete=TRUE;
}
}
@ -682,7 +682,7 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
tmpa1->indirect && tmpa1->reg1==REG_NONE) {
cur.ModrM=cur.ModrM&0xF8+5;
MemCpy(&cur.disp.num,&tmpa1->num,sizeof(CAsmNum));
cur.disp.U8_cnt=4;
cur.disp.U8_count=4;
if (aotc->seg_size==64)
cur.disp.imm_flag=FALSE;
} else {
@ -691,13 +691,13 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
if (!cur.disp.num.machine_code &&
I8_MIN<=cur.disp.num.i<=I8_MAX) {
cur.ModrM|=0x40;
cur.disp.U8_cnt=1;
cur.disp.U8_count=1;
} else if (aotc->seg_size==16) {
cur.ModrM|=0x80;
cur.disp.U8_cnt=2;
cur.disp.U8_count=2;
} else {
cur.ModrM|=0x80;
cur.disp.U8_cnt=4;
cur.disp.U8_count=4;
}
} else if (!tmpa1->indirect) {
cur.has_addr_prefix=FALSE;
@ -705,7 +705,7 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
} else {
if (tmpa1->reg1&7==REG_RBP) {
cur.ModrM|=0x40;
cur.disp.U8_cnt=1;
cur.disp.U8_count=1;
}
}
}
@ -713,64 +713,64 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
} else if (ARGT_MOFFS8<=arg1<=ARGT_MOFFS64) {
MemCpy(&cur.disp.num,&tmpa1->num,sizeof(CAsmNum));
if (aotc->seg_size==16)
cur.disp.U8_cnt=2;
cur.disp.U8_count=2;
else
cur.disp.U8_cnt=4;
cur.disp.U8_count=4;
cur.has_addr_prefix=FALSE;
} else if (ARGT_MOFFS8<=arg2<=ARGT_MOFFS64) {
MemCpy(&cur.disp.num,&tmpa2->num,sizeof(CAsmNum));
if (aotc->seg_size==16)
cur.disp.U8_cnt=2;
cur.disp.U8_count=2;
else
cur.disp.U8_cnt=4;
cur.disp.U8_count=4;
cur.has_addr_prefix=FALSE;
} else if (ARGT_IMM8<=arg1<=ARGT_IMM64 ||
ARGT_UIMM8<=arg1<=ARGT_UIMM64) {
MemCpy(&cur.imm.num,&tmpa1->num,sizeof(CAsmNum));
if (arg1==ARGT_IMM8 || arg1==ARGT_UIMM8) cur.imm.U8_cnt=1;
else if (arg1==ARGT_IMM16 || arg1==ARGT_UIMM16) cur.imm.U8_cnt=2;
else if (arg1==ARGT_IMM32 || arg1==ARGT_UIMM32) cur.imm.U8_cnt=4;
if (arg1==ARGT_IMM8 || arg1==ARGT_UIMM8) cur.imm.U8_count=1;
else if (arg1==ARGT_IMM16 || arg1==ARGT_UIMM16) cur.imm.U8_count=2;
else if (arg1==ARGT_IMM32 || arg1==ARGT_UIMM32) cur.imm.U8_count=4;
else {
cur.imm.U8_cnt=8;
cur.imm.U8_count=8;
cur.REX|=8;
}
}
if (ARGT_IMM8<=arg2<=ARGT_IMM64 ||
ARGT_UIMM8<=arg2<=ARGT_UIMM64) {
MemCpy(&cur.imm.num,&tmpa2->num,sizeof(CAsmNum));
if (arg2==ARGT_IMM8 || arg2==ARGT_UIMM8) cur.imm.U8_cnt=1;
else if (arg2==ARGT_IMM16 || arg2==ARGT_UIMM16) cur.imm.U8_cnt=2;
if (arg2==ARGT_IMM8 || arg2==ARGT_UIMM8) cur.imm.U8_count=1;
else if (arg2==ARGT_IMM16 || arg2==ARGT_UIMM16) cur.imm.U8_count=2;
else if (arg2==ARGT_IMM32 || arg2==ARGT_UIMM32) {
cur.imm.U8_cnt=4;
cur.imm.U8_count=4;
if (tmpins->flags&IEF_REX_ONLY_R8_R15 && arg2==ARGT_UIMM32)
cur.REX&=~8;
} else {
cur.imm.U8_cnt=8;
cur.imm.U8_count=8;
cur.REX|=8;
}
}
}
cur.U8_cnt=tmpins->opcode_cnt+cur.disp.U8_cnt+cur.imm.U8_cnt;
if (cur.has_ModrM) cur.U8_cnt++;
if (cur.has_SIB) cur.U8_cnt++;
cur.U8_count=tmpins->opcode_count+cur.disp.U8_count+cur.imm.U8_count;
if (cur.has_ModrM) cur.U8_count++;
if (cur.has_SIB) cur.U8_count++;
if (aotc->seg_size==64 && cur.REX&0x40==0x40 &&
(cur.REX!=0x40 || cur.has_REX) &&
(cur.REX&7 || !(tmpins->flags&IEF_REX_ONLY_R8_R15 ||
tmpins->flags&IEF_REX_XOR_LIKE && tmpa1->reg1==tmpa2->reg1 &&
cur.ModrM&0xC0==0xC0)))
cur.U8_cnt++;
if (cur.U8_cnt<best.U8_cnt &&
cur.U8_count++;
if (cur.U8_count<best.U8_count &&
!(tmpins->flags & IEF_DONT_SWITCH_MODES &&
(cur.has_addr_prefix || cur.has_operand_prefix)))
MemCpy(&best,&cur,sizeof(CAsmIns));
}
}
if (best.U8_cnt<255) {
if (best.U8_count<255) {
tmpins=best.tmpins;
seg=REG_NONE;
if (argcnt>1 && aotc->arg2.seg!=REG_NONE && !aotc->arg2.just_seg)
if (argcount>1 && aotc->arg2.seg!=REG_NONE && !aotc->arg2.just_seg)
seg=aotc->arg2.seg;
else if (argcnt>0 && aotc->arg1.seg!=REG_NONE && !aotc->arg1.just_seg)
else if (argcount>0 && aotc->arg1.seg!=REG_NONE && !aotc->arg1.just_seg)
seg=aotc->arg1.seg;
if (seg!=REG_NONE)
AOTStoreCodeU8(cc,asm_seg_prefixes[seg]);
@ -784,7 +784,7 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
tmpins->flags&IEF_REX_XOR_LIKE && tmpa1->reg1==tmpa2->reg1 &&
best.ModrM&0xC0==0xC0)))
AOTStoreCodeU8(cc,best.REX);
for (j=0;j<tmpins->opcode_cnt-1;j++)
for (j=0;j<tmpins->opcode_count-1;j++)
AOTStoreCodeU8(cc,tmpins->opcode[j]);
AOTStoreCodeU8(cc,best.last_opcode_U8);
@ -793,14 +793,14 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
if (best.has_SIB)
AOTStoreCodeU8(cc,best.SIB);
if (best.disp.U8_cnt) {
best.disp.rel=aotc->rip+best.disp.U8_cnt+best.imm.U8_cnt;
if (best.disp.U8_count) {
best.disp.rel=aotc->rip+best.disp.U8_count+best.imm.U8_count;
if (!AsmStoreNum(cc,&best.disp,1,U8_avail))
return FALSE;
}
if (best.imm.U8_cnt) {
best.imm.rel=aotc->rip+best.imm.U8_cnt;
if (best.imm.U8_count) {
best.imm.rel=aotc->rip+best.imm.U8_count;
if (!AsmStoreNum(cc,&best.imm,1,U8_avail))
return FALSE;
}
@ -811,13 +811,13 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
LexExcept(cc,"Invalid inst at ");
}
U0 ParseAsmDefine(CCompCtrl *cc,I64 U8_cnt)
U0 ParseAsmDefine(CCompCtrl *cc,I64 U8_count)
{
Bool is_dup;
I64 i,dup_val;
U8 *ptr;
CAsmNum2 num2;
num2.U8_cnt=U8_cnt;
num2.U8_count=U8_count;
while (cc->token && cc->token!=';') {
num2.num.local_asm_undef_hash=NULL;
@ -830,13 +830,13 @@ U0 ParseAsmDefine(CCompCtrl *cc,I64 U8_cnt)
Lex(cc); //Skip Str
} else {
is_dup=FALSE;
cc->abs_cnts=0;
cc->abs_counts=0;
cc->asm_undef_hash=NULL;
cc->flags&=~(CCF_UNRESOLVED+CCF_LOCAL);
if (!IsLexExpression2Bin(cc,&num2.num.machine_code))
LexSkipEol(cc);
else {
if (cc->abs_cnts.externs)
if (cc->abs_counts.externs)
LexExcept(cc,"Extern Not Allowed at ");
if (cc->flags & CCF_UNRESOLVED) {
if (cc->flags & CCF_LOCAL) {
@ -866,10 +866,10 @@ U0 ParseAsmDefine(CCompCtrl *cc,I64 U8_cnt)
}
num2.rel=0;
num2.imm_flag=TRUE;
num2.num.abs_cnts=cc->abs_cnts;
num2.num.abs_counts=cc->abs_counts;
if (is_dup) {
if (num2.num.local_asm_undef_hash || num2.num.glbl_asm_undef_hash)
LexExcept(cc,"Undefined DUP cnt at ");
LexExcept(cc,"Undefined DUP count at ");
num2.num.i=dup_val;
AsmStoreNum(cc,&num2,i,FALSE);
} else {
@ -904,7 +904,7 @@ U0 ParseBinFile(CCompCtrl *cc)
U0 ParseAsmBlk(CCompCtrl *cc,I64 cmp_flags)
{
CAOTCtrl *aotc=cc->aotc;
I64 i,j,k,argcnt,
I64 i,j,k,argcount,
old_flags=cc->flags & CCF_ASM_EXPRESSIONS;
CHashOpcode *tmpo;
CHashExport *tmpex;
@ -1008,15 +1008,15 @@ U0 ParseAsmBlk(CCompCtrl *cc,I64 cmp_flags)
} else if (cc->hash_entry->type & HTT_OPCODE) {
tmpo=cc->hash_entry;
Lex(cc); //skip opcode
argcnt=0;
argcount=0;
if (tmpo->ins[0].arg1) {
argcnt++;
argcount++;
if (ARGT_REL8<=tmpo->ins[0].arg1<=ARGT_REL32)
ParseAsmArg(cc,&aotc->arg1,TRUE);
else
ParseAsmArg(cc,&aotc->arg1,FALSE);
if (tmpo->ins[0].arg2) {
argcnt++;
argcount++;
if (cc->token!=',')
LexExcept(cc,"Expecting ',' at ");
else {
@ -1028,7 +1028,7 @@ U0 ParseAsmBlk(CCompCtrl *cc,I64 cmp_flags)
}
}
}
ParseAsmInst(cc,tmpo,argcnt);
ParseAsmInst(cc,tmpo,argcount);
} else if (cc->hash_entry->type & HTT_EXPORT_SYS_SYM) {
if (Btr(&cc->hash_entry->type,HTf_UNRESOLVED)) {
if (cc->hash_entry->type & HTF_LOCAL) {
@ -1087,7 +1087,7 @@ U0 ParseAsmBlk(CCompCtrl *cc,I64 cmp_flags)
g_lb->type=CMT_ASM_LABEL;
g_lb->flags|=CMF_DEFINED;
g_lb->rip=aotc->rip;
g_lb->use_cnt++; //Disable warning on unused labels.
g_lb->use_count++; //Disable warning on unused labels.
ICAdd(cc,IC_LABEL,g_lb,0);
}
if (cc->token==TK_DBL_COLON) {

View File

@ -100,16 +100,16 @@ U0 AsmHashLoad()
LexExcept(cc,"Expecting opcode at ");
MemSet(tmpo_max,0,size_max);
tmpo_max->type=HTT_OPCODE;
tmpo_max->inst_entry_cnt=0;
tmpo_max->inst_entry_count=0;
tmpo_max->str=cc->cur_str;
cc->cur_str=0;
Lex(cc); //Skip OPCODE
while (cc->token && cc->token!=';' && cc->token!=':') {
tmpins=&tmpo_max->ins[tmpo_max->inst_entry_cnt];
tmpins->ins_entry_num=tmpo_max->inst_entry_cnt++;
tmpins=&tmpo_max->ins[tmpo_max->inst_entry_count];
tmpins->ins_entry_num=tmpo_max->inst_entry_count++;
tmpins->slash_val=SV_NONE; //Not zero!!
while (cc->token==TK_I64) {
tmpins->opcode[tmpins->opcode_cnt++]=cc->cur_i64;
tmpins->opcode[tmpins->opcode_count++]=cc->cur_i64;
Lex(cc);
}
if (cc->token==',')
@ -151,10 +151,10 @@ U0 AsmHashLoad()
}
}
}
size=offset(CHashOpcode.ins)+sizeof(CInst)*tmpo_max->inst_entry_cnt;
size=offset(CHashOpcode.ins)+sizeof(CInst)*tmpo_max->inst_entry_count;
tmpo=MAlloc(size);
MemCpy(tmpo,tmpo_max,size);
tmpo->use_cnt=0;
tmpo->use_count=0;
if (HashFind(tmpo->str,cmp.asm_hash,HTT_OPCODE))
LexExcept(cc,"Duplicate OPCODE entry ");
HashAdd(tmpo,cmp.asm_hash);

View File

@ -130,11 +130,11 @@ I64 AsmLexExpression(CCompCtrl *cc)
I64 res=0;
cc->asm_undef_hash=NULL;
cc->flags&=~(CCF_UNRESOLVED+CCF_LOCAL);
cc->abs_cnts=0;
cc->abs_counts=0;
if (!IsLexExpression2Bin(cc,&machine_code))
LexSkipEol(cc);
else {
if (cc->abs_cnts.externs)
if (cc->abs_counts.externs)
LexExcept(cc,"Extern Not Allowed at ");
if (cc->flags & CCF_UNRESOLVED)
LexExcept(cc,"Undefined sym at ");

View File

@ -106,7 +106,7 @@ U0 AOTGlobalsResolve(CCompCtrl *cc,CAOT *tmpaot)
if (!(tmpex->type & HTF_IMPORT)) {
if (cc->htc.local_var_lst) {
tmpex->type|=HTF_GOTO_LABEL;
tmpex->use_cnt++;
tmpex->use_count++;
} else {
PrintErr("Undefined sym at line:%04d %s\n",
tmpu->line_num,tmpex->str);
@ -135,7 +135,7 @@ U0 AOTGlobalsResolve(CCompCtrl *cc,CAOT *tmpaot)
tmpex=cc->htc.glbl_hash_table->body[i];
while (tmpex) {
if (tmpex->type & (HTF_IMPORT|HTF_GOTO_LABEL)) {
if (tmpex->use_cnt && (tmpie=tmpex->ie_lst)) {
if (tmpex->use_count && (tmpie=tmpex->ie_lst)) {
if (tmpex->type&HTF_GOTO_LABEL)
tmpie->flags|=IEF_GOTO_LABEL;
if (tmpex->import_name)

View File

@ -306,7 +306,7 @@ U0 ICPreIncDec(CIntermediateCode *tmpi,I64 op,I64 rip)
I64 r;
CHashClass *tmpc=tmpi->ic_class,*tmpc1=tmpc-1;
if (tmpi->ic_flags & ICF_BY_VAL) {
if (tmpc->ptr_stars_cnt && tmpc1->size!=1) {
if (tmpc->ptr_stars_count && tmpc1->size!=1) {
ICAddSubEctImm(tmpi,
tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
tmpi->arg1.reg,tmpi->arg1.disp,
@ -328,7 +328,7 @@ U0 ICPreIncDec(CIntermediateCode *tmpi,I64 op,I64 rip)
tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
r=REG_RCX;
}
if (tmpc->ptr_stars_cnt &&
if (tmpc->ptr_stars_count &&
tmpc1->size!=1) {
ICAddSubEctImm(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,r,0,
MDF_DISP+tmpi->arg1_type_pointed_to,r,0,
@ -351,7 +351,7 @@ U0 ICPostIncDec(CIntermediateCode *tmpi,I64 op,I64 rip)
ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
tmpi->arg1.reg,tmpi->arg1.disp,rip);
if (tmpc->ptr_stars_cnt && tmpc1->size!=1)
if (tmpc->ptr_stars_count && tmpc1->size!=1)
ICAddSubEctImm(tmpi,
tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
tmpi->arg1.reg,tmpi->arg1.disp,
@ -373,7 +373,7 @@ U0 ICPostIncDec(CIntermediateCode *tmpi,I64 op,I64 rip)
if (tmpi->res.type.mode)
ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
MDF_DISP+tmpi->arg1_type_pointed_to,r,0,rip);
if (tmpc->ptr_stars_cnt && tmpc1->size!=1)
if (tmpc->ptr_stars_count && tmpc1->size!=1)
ICAddSubEctImm(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,r,0,
MDF_DISP+tmpi->arg1_type_pointed_to,r,0,tmpc1->size,op.u16[3],rip);
else
@ -595,7 +595,7 @@ U0 ICCompAndBranch(CIntermediateCode *tmpi,Bool has_res,I64 rip,
}
}
rip+=tmpi->ic_cnt;
rip+=tmpi->ic_count;
lb=OptLabelFwd(tmpi->ic_data);
short_jmp=ToBool(tmpi->ic_flags&ICF_SHORT_JMP);
if (!buf && lb->addr!=INVALID_PTR) {
@ -658,7 +658,7 @@ U0 ICTestAndBranch(CIntermediateCode *tmpi,I64 rip,I64 is,U8 *buf,I64 rip2)
} else
ICTest(tmpi,tmpi->arg1.reg);
rip+=tmpi->ic_cnt;
rip+=tmpi->ic_count;
lb=OptLabelFwd(tmpi->ic_data);
short_jmp=ToBool(tmpi->ic_flags&ICF_SHORT_JMP);
if (!buf && lb->addr!=INVALID_PTR) {
@ -691,7 +691,7 @@ U0 ICFlagBranch(CIntermediateCode *tmpi,I64 rip,I64 is,U8 *buf)
Bool short_jmp;
CCodeMisc *lb;
rip+=tmpi->ic_cnt;
rip+=tmpi->ic_count;
lb=OptLabelFwd(tmpi->ic_data);
short_jmp=ToBool(tmpi->ic_flags&ICF_SHORT_JMP);
if (!buf && lb->addr!=INVALID_PTR) {

View File

@ -129,7 +129,7 @@ U0 ICAndBranch(CIntermediateCode *tmpi,I64 rip,I64 is,U8 *buf,I64 rip2)
ICModr2(tmpi,i,,d1,rip2);
}
rip+=tmpi->ic_cnt;
rip+=tmpi->ic_count;
lb=OptLabelFwd(tmpi->ic_data);
short_jmp=ToBool(tmpi->ic_flags&ICF_SHORT_JMP);
if (!buf && lb->addr!=INVALID_PTR) {
@ -310,7 +310,7 @@ U0 ICBrBitOps(CIntermediateCode *tmpi,I64 rip,
ICModr2(tmpi,i,,arg2->disp,rip2);
}
rip+=tmpi->ic_cnt;
rip+=tmpi->ic_count;
lb=OptLabelFwd(tmpi->ic_data);
short_jmp=ToBool(tmpi->ic_flags&ICF_SHORT_JMP);
if (!buf && lb->addr!=INVALID_PTR) {
@ -602,7 +602,7 @@ U0 ICXorEqu(CIntermediateCode *tmpi,I64 rip2)
U0 ICSwitch(CIntermediateCode *tmpi,I64 rip,
Bool nobound,CCompCtrl *cc,U8 *buf,I64 rip2)
{
I64 i,j,cnt,min,max,begin,r;
I64 i,j,count,min,max,begin,r;
CCodeMisc *lb;
Bool short_jmp;
CAOTAbsAddr *tmpa;
@ -645,7 +645,7 @@ U0 ICSwitch(CIntermediateCode *tmpi,I64 rip,
ICU24(tmpi,i);
}
rip+=tmpi->ic_cnt;
rip+=tmpi->ic_count;
lb=tmpi->ic_data(CCodeMisc *)->dft;
short_jmp=ToBool(tmpi->ic_flags&ICF_SHORT_JMP);
if (!buf && lb->addr!=INVALID_PTR) {
@ -695,13 +695,13 @@ U0 ICSwitch(CIntermediateCode *tmpi,I64 rip,
else
ICU8(tmpi,0x49);
ICU24(tmpi,0x98BE0F+(r&7)<<16);
cnt=1;
count=1;
} else if (lb->flags&CMF_U8_JMP_TABLE) {
if (r<8)
cnt=2;
count=2;
else {
ICU8(tmpi,0x49);
cnt=1;
count=1;
}
ICU24(tmpi,0x98B60F+(r&7)<<16);
} else if (lb->flags&CMF_I16_JMP_TABLE) {
@ -710,21 +710,21 @@ U0 ICSwitch(CIntermediateCode *tmpi,I64 rip,
else
ICU8(tmpi,0x4A);
ICU32(tmpi,0x451CBF0F+(r&7)<<27);
cnt=0;
count=0;
} else if (lb->flags&CMF_U16_JMP_TABLE) {
if (r<8)
cnt=1;
count=1;
else {
ICU8(tmpi,0x4A);
cnt=0;
count=0;
}
ICU32(tmpi,0x451CB70F+(r&7)<<27);
} else {
if (r<8)
cnt=2;
count=2;
else {
ICU8(tmpi,0x42);
cnt=1;
count=1;
}
ICU24(tmpi,0x851C8B+(r&7)<<19);
}
@ -733,7 +733,7 @@ U0 ICSwitch(CIntermediateCode *tmpi,I64 rip,
tmpa->next=cc->aotc->abss;
tmpa->type=AAT_ADD_U32;
cc->aotc->abss=tmpa;
tmpa->rip=rip2+tmpi->ic_cnt;
tmpa->rip=rip2+tmpi->ic_count;
ICU32(tmpi,lb->addr+cc->aotc->rip);
} else
ICU32(tmpi,lb->addr+buf);
@ -746,14 +746,14 @@ U0 ICSwitch(CIntermediateCode *tmpi,I64 rip,
tmpa->next=cc->aotc->abss;
tmpa->type=AAT_ADD_U32;
cc->aotc->abss=tmpa;
tmpa->rip=rip2+tmpi->ic_cnt;
tmpa->rip=rip2+tmpi->ic_count;
ICU32(tmpi,begin+cc->aotc->rip);
} else
ICU32(tmpi,begin+buf);
} else
cnt+=6;
count+=6;
ICU16(tmpi,0xE3FF); //JMP EBX
for (i=0;i<cnt;i++) //Code must always shrink, not expand
for (i=0;i<count;i++) //Code must always shrink, not expand
ICU8(tmpi,OC_NOP);
tmpi->ic_flags&=~ICF_CODE_FINAL;
}

View File

@ -21,7 +21,7 @@ U0 CompNoteFloatOp(CCompCtrl *cc,CIntermediateCode *tmpi,
case CN_INST:
if (cc->last_float_op_ic!=tmpi) {
if (cc->dont_push_float) {
if (intermediate_code_table[tmpi->ic_code].arg_cnt==IS_2_ARG &&
if (intermediate_code_table[tmpi->ic_code].arg_count==IS_2_ARG &&
cc->last_float_op_ic->res.reg!=REG_R8)
tmpi->ic_flags|=ICF_ALT_TEMPLATE;
else
@ -29,7 +29,7 @@ U0 CompNoteFloatOp(CCompCtrl *cc,CIntermediateCode *tmpi,
link=TRUE;
}
} else {
if (intermediate_code_table[tmpi->ic_code].arg_cnt==IS_2_ARG &&
if (intermediate_code_table[tmpi->ic_code].arg_count==IS_2_ARG &&
cc->last_float_op_pos!=CN_A1)
tmpi->ic_flags|=ICF_ALT_TEMPLATE;
else
@ -114,10 +114,10 @@ U0 ICCopyTemplate(CCompCtrl *cc,CIntermediateCode *tmpi,I64 op,
}
}
}
MemCpy(&tmpi->ic_body[tmpi->ic_cnt],ptr,i);
MemCpy(&tmpi->ic_body[tmpi->ic_count],ptr,i);
if (!off_the_record)
CompNoteFloatOp(cc,tmpi,dont_pushable,dont_popable,pos);
tmpi->ic_cnt+=i;
tmpi->ic_count+=i;
}
U0 ICFCvt(CCompCtrl *cc,CIntermediateCode *tmpi,I64 r1,
@ -288,18 +288,18 @@ U0 ICFPow(CCompCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
if (buf) {
tmpie=CAlloc(sizeof(CAOTImportExport));
tmpie->type=IET_IMM_I64;
tmpie->rip=rip+tmpi->ic_cnt-8;
tmpie->rip=rip+tmpi->ic_count-8;
tmpie->next=tmpex->ie_lst;
tmpex->ie_lst=tmpie;
}
ICU16(tmpi,0xD3FF);
} else {
ICU8(tmpi,0xE8);
ICU32(tmpi,-(rip+tmpi->ic_cnt+4));
ICU32(tmpi,-(rip+tmpi->ic_count+4));
if (buf) {
tmpie=CAlloc(sizeof(CAOTImportExport));
tmpie->type=IET_REL_I32;
tmpie->rip=rip+tmpi->ic_cnt-4;
tmpie->rip=rip+tmpi->ic_count-4;
tmpie->next=tmpex->ie_lst;
tmpex->ie_lst=tmpie;
}
@ -308,7 +308,7 @@ U0 ICFPow(CCompCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
if (tmpex->type&HTF_UNRESOLVED)
throw('Compiler');
else {
i=tmpex->val-(rip+tmpi->ic_cnt+5);
i=tmpex->val-(rip+tmpi->ic_count+5);
if (!(I32_MIN<=i<=I32_MAX)) {
throw('Compiler');
// ICU16(tmpi,0xBB48);
@ -321,7 +321,7 @@ U0 ICFPow(CCompCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
}
}
} else {
i=tmpex->val-(rip+tmpi->ic_cnt+5);
i=tmpex->val-(rip+tmpi->ic_count+5);
if (!(I32_MIN<=i<=I32_MAX)) {
ICU16(tmpi,0xBB48);
ICU64(tmpi,tmpex->val);

View File

@ -446,7 +446,7 @@ U0 ICFCmpAndBranch(CCompCtrl *cc,CIntermediateCode *tmpi,I64 rip,
}
}
rip+=tmpi->ic_cnt;
rip+=tmpi->ic_count;
lb=OptLabelFwd(tmpi->ic_data);
short_jmp=ToBool(tmpi->ic_flags&ICF_SHORT_JMP);
if (!buf && lb->addr!=INVALID_PTR) {

View File

@ -16,44 +16,44 @@ sign or zero extended to 64-bits.
U0 ICU8(CIntermediateCode *tmpi,U8 b)
{
tmpi->ic_body[tmpi->ic_cnt++]=b;
tmpi->ic_body[tmpi->ic_count++]=b;
}
U0 ICRex(CIntermediateCode *tmpi,U8 b)
{
if (b)
tmpi->ic_body[tmpi->ic_cnt++]=b;
tmpi->ic_body[tmpi->ic_count++]=b;
}
U0 ICOpSizeRex(CIntermediateCode *tmpi,U8 b)
{
tmpi->ic_body[tmpi->ic_cnt++]=OC_OP_SIZE_PREFIX;
tmpi->ic_body[tmpi->ic_count++]=OC_OP_SIZE_PREFIX;
if (b)
tmpi->ic_body[tmpi->ic_cnt++]=b;
tmpi->ic_body[tmpi->ic_count++]=b;
}
U0 ICU16(CIntermediateCode *tmpi,U16 w)
{
*(&tmpi->ic_body[tmpi->ic_cnt])(U16)=w;
tmpi->ic_cnt+=2;
*(&tmpi->ic_body[tmpi->ic_count])(U16)=w;
tmpi->ic_count+=2;
}
U0 ICU24(CIntermediateCode *tmpi,U32 d)
{//Writes extra harmless overhanging byte.
*(&tmpi->ic_body[tmpi->ic_cnt])(U32)=d;
tmpi->ic_cnt+=3;
*(&tmpi->ic_body[tmpi->ic_count])(U32)=d;
tmpi->ic_count+=3;
}
U0 ICU32(CIntermediateCode *tmpi,U32 d)
{
*(&tmpi->ic_body[tmpi->ic_cnt])(U32)=d;
tmpi->ic_cnt+=4;
*(&tmpi->ic_body[tmpi->ic_count])(U32)=d;
tmpi->ic_count+=4;
}
U0 ICU64(CIntermediateCode *tmpi,U64 q)
{
*(&tmpi->ic_body[tmpi->ic_cnt])(U64)=q;
tmpi->ic_cnt+=8;
*(&tmpi->ic_body[tmpi->ic_count])(U64)=q;
tmpi->ic_count+=8;
}
U0 ICAddRSP(CIntermediateCode *tmpi,I64 i,Bool optimize=TRUE)
@ -62,11 +62,11 @@ U0 ICAddRSP(CIntermediateCode *tmpi,I64 i,Bool optimize=TRUE)
CIntermediateCode *tmpil1;
if (optimize) {
tmpil1=tmpi;
if (tmpi->ic_last_start<0 && !tmpi->ic_cnt &&
if (tmpi->ic_last_start<0 && !tmpi->ic_count &&
(tmpil1=OptLag1(tmpi)) && tmpil1->ic_last_start<0)
tmpil1=NULL;
if (tmpil1) {
j=tmpil1->ic_cnt;
j=tmpil1->ic_count;
if (tmpil1->ic_last_start==j-4 && tmpil1->ic_body[j-3]==0x83 &&
tmpil1->ic_body[j-4]==0x48) {
if (tmpil1->ic_body[j-2]==0xEC)
@ -87,7 +87,7 @@ U0 ICAddRSP(CIntermediateCode *tmpi,I64 i,Bool optimize=TRUE)
j=0;
if (j) {
if (tmpi==tmpil1) {
tmpi->ic_cnt=tmpi->ic_last_start;
tmpi->ic_count=tmpi->ic_last_start;
i+=j;
} else if (!(tmpi->ic_flags&ICF_PREV_DELETED)) {
tmpil1->ic_flags|=ICF_DEL_PREV_INS;
@ -97,7 +97,7 @@ U0 ICAddRSP(CIntermediateCode *tmpi,I64 i,Bool optimize=TRUE)
}
}
}
last_start=tmpi->ic_cnt;
last_start=tmpi->ic_count;
if (i>0) {
if (i<=I8_MAX)
ICU32(tmpi,0xC48348+i<<24);
@ -116,7 +116,7 @@ U0 ICAddRSP(CIntermediateCode *tmpi,I64 i,Bool optimize=TRUE)
} else
throw('Compiler');
}
if (optimize && tmpi->ic_cnt>last_start)
if (optimize && tmpi->ic_count>last_start)
tmpi->ic_last_start=last_start;
}
@ -249,7 +249,7 @@ U0 ICModr2(CIntermediateCode *tmpi,I64 i,CICType t=0,I64 d,I64 rip=0)
d-=4;
}
case MODR_RIP_REL:
ICU32(tmpi,d-(rip+4+tmpi->ic_cnt));
ICU32(tmpi,d-(rip+4+tmpi->ic_count));
tmpi->ic_flags&=~ICF_CODE_FINAL;
break;
}
@ -445,8 +445,8 @@ I64 ICBuiltInFloatConst(F64 d)
U0 ICMov(CIntermediateCode *tmpi,
CICType t1,I64 r1,I64 d1,CICType t2,I64 r2,I64 d2,I64 rip)
{
I64 i,cnt1,cnt2,b1_rex,b2_rex,b1,b2,b1_modr,b2_modr,
b1_r1,b1_r2,b2_r1,b2_r2,last_start=tmpi->ic_cnt;
I64 i,count1,count2,b1_rex,b2_rex,b1,b2,b1_modr,b2_modr,
b1_r1,b1_r2,b2_r1,b2_r2,last_start=tmpi->ic_count;
CIntermediateCode *tmpil1;
Bool old_lock=Btr(&tmpi->ic_flags,ICf_LOCK);
switch (Bsr(t1)) {
@ -582,21 +582,21 @@ move_done:
tmpil1=NULL;
if (tmpil1) {
if (tmpil1==tmpi)
cnt1=last_start-tmpil1->ic_last_start;
count1=last_start-tmpil1->ic_last_start;
else {
if (!(tmpil1->ic_flags&ICF_CODE_FINAL))
tmpi->ic_flags&=~ICF_CODE_FINAL;
if (last_start)
cnt1=0;
count1=0;
else
cnt1=tmpil1->ic_cnt-tmpil1->ic_last_start;
count1=tmpil1->ic_count-tmpil1->ic_last_start;
}
cnt2=tmpi->ic_cnt-last_start;
if (cnt1 && cnt1==cnt2) {
count2=tmpi->ic_count-last_start;
if (count1 && count1==count2) {
b1_rex=tmpil1->ic_body[tmpil1->ic_last_start];
b2_rex=tmpi->ic_body[last_start];
if (b1_rex&0x48==0x48 && b2_rex&0x48==0x48) {
for (i=1;i<cnt1;i++)
for (i=1;i<count1;i++)
if ((b1=tmpil1->ic_body[tmpil1->ic_last_start+i])==
(b2=tmpi->ic_body[last_start+i])) {
if (i==1 && (b2==0x89 || b2==0x8B)) {
@ -606,7 +606,7 @@ move_done:
b2_modr=tmpi->ic_body[last_start+2];
b2_r1=b2_modr&7 +Bt(&b2_rex,0)<<3;
b2_r2=b2_modr>>3&7+Bt(&b2_rex,2)<<3;
if (cnt1==3 && b2_modr&0xC0==0xC0) {
if (count1==3 && b2_modr&0xC0==0xC0) {
if (b2_r1==b2_r2)
goto move_redundant;
if (b1_modr&0xC0==0xC0) {
@ -628,7 +628,7 @@ move_done:
b2_modr=tmpi->ic_body[last_start+2];
b2_r1=b2_modr&7 +Bt(&b2_rex,0)<<3;
b2_r2=b2_modr>>3&7+Bt(&b2_rex,2)<<3;
if (cnt1==3 && b2_modr&0xC0==0xC0) {
if (count1==3 && b2_modr&0xC0==0xC0) {
if (b2_r1==b2_r2)
goto move_redundant;
if (b1==0x89 && b2==0x8B || b1==0x8B && b2==0x89) {
@ -645,15 +645,15 @@ move_done:
!(b1==0x89 && b2==0x8B || b1==0x8B && b2==0x89))
break;
}
if (i==cnt1) {
if (i==count1) {
move_redundant:
tmpi->ic_cnt=last_start;
tmpi->ic_count=last_start;
}
}
}
}
}
if (tmpi->ic_cnt>last_start>tmpi->ic_last_start)
if (tmpi->ic_count>last_start>tmpi->ic_last_start)
tmpi->ic_last_start=last_start;
BEqu(&tmpi->ic_flags,ICf_LOCK,old_lock);
}
@ -679,7 +679,7 @@ U0 ICLea(CIntermediateCode *tmpi,CICType t1,I64 r1,I64 d1,
tmpa->next=cc->aotc->abss;
tmpa->type=AAT_ADD_U32;
cc->aotc->abss=tmpa;
tmpa->rip=rip+tmpi->ic_cnt-4;
tmpa->rip=rip+tmpi->ic_count-4;
}
tmpi->ic_flags&=~ICF_CODE_FINAL;
break;

View File

@ -75,7 +75,7 @@ U0 LexWarn(CCompCtrl *cc,U8 *str=NULL)
}
} else
LexPutPos(cc);
cc->warning_cnt++;
cc->warning_count++;
}
U0 LexExcept(CCompCtrl *cc,U8 *str=NULL)
@ -88,7 +88,7 @@ U0 LexExcept(CCompCtrl *cc,U8 *str=NULL)
if (!IsRaw)
ZenithErr("Task:%08X %s\n",Fs,str);
LexPutPos(cc);
cc->error_cnt++;
cc->error_count++;
FlushMessages;
if (!Bt(&sys_run_level,RLf_ZENITH_SERVER))
Debug("Type \"Fix;\"");
@ -104,7 +104,7 @@ U0 UndefinedExtern()
U0 UnusedExternWarning(CCompCtrl *cc,CHashClass *tmpc)
{
PrintWarn("Unused extern '%s'\n",tmpc->str);
cc->warning_cnt++;
cc->warning_count++;
}
U0 ParenWarning(CCompCtrl *cc)
@ -118,15 +118,15 @@ U0 ICClassPut(CHashClass *c)
{
I64 i;
if (!c) return;
if (c->ptr_stars_cnt>4) {
PrintErr("put_class ptrcnt=%d\n",c->ptr_stars_cnt);
if (c->ptr_stars_count>4) {
PrintErr("put_class ptrcount=%d\n",c->ptr_stars_count);
while (TRUE)
//TODO:
Yield;
}
for (i=0;i<c->ptr_stars_cnt;i++)
for (i=0;i<c->ptr_stars_count;i++)
'*';
c-=c->ptr_stars_cnt;
c-=c->ptr_stars_count;
if (c->str)
"%s",c->str;
else {

View File

@ -26,7 +26,7 @@ extern CHashClass *ParseClass(
extern CHashFun *ParseFunJoin(
CCompCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags);
extern I64 ParseKeyWord(CCompCtrl *cc);
extern Bool ParseStatement(CCompCtrl *cc,I64 try_cnt=0,
extern Bool ParseStatement(CCompCtrl *cc,I64 try_count=0,
CCodeMisc *lb_break=NULL,I64 cmp_flags=CMPF_PRS_SEMICOLON);
extern U0 ParseStreamBlk(CCompCtrl *cc);
extern CHashClass *ParseType(CCompCtrl *cc,CHashClass **_tmpc1,

View File

@ -59,7 +59,7 @@ I64 HashEntrySize2(CHashSrcSym *tmph)
res+=MSize2(tmph(CHashGlobalVar *)->data_addr);
if (tmph(CHashGlobalVar *)->fun_ptr)
res+=HashEntrySize2(tmph(CHashGlobalVar *)->fun_ptr
-tmph(CHashGlobalVar *)->fun_ptr->ptr_stars_cnt);
-tmph(CHashGlobalVar *)->fun_ptr->ptr_stars_count);
}
} else if (tmph->type & HTT_FILE)
res+=MSize2(tmph(CHashGeneric *)->user_data0);
@ -118,7 +118,7 @@ U0 MapFileWrite(CHashTable *h,U8 *map_name,U8 drv_let)
tmpb->data=MAlloc(size);
MemCpy(tmpb->data,dbg_info,size);
tmpb->num=doc->cur_bin_num++;
tmpb->use_cnt=1;
tmpb->use_count=1;
QueueInsert(tmpb,doc->bin_head.last);
} else
dbg_info=NULL;

View File

@ -102,8 +102,8 @@ CAOT *CompJoin(CCompCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=
okay=FALSE;
}
if (!okay) {
if (cc->error_cnt<1)
cc->error_cnt=1;
if (cc->error_count<1)
cc->error_count=1;
cc->aot=res->parent_aot;
Free(res);
LinkedLstDel(aotc->bin);
@ -155,7 +155,7 @@ CAOT *CompJoin(CCompCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=
}
CAOT *CompBuf(U8 *buf,U8 *map_name=NULL,
I64 *error_cnt=NULL, I64 *warning_cnt=NULL,U8 mapfile_drv_let=0)
I64 *error_count=NULL, I64 *warning_count=NULL,U8 mapfile_drv_let=0)
{
CCompCtrl *cc;
CAOT *res=NULL;
@ -163,8 +163,8 @@ CAOT *CompBuf(U8 *buf,U8 *map_name=NULL,
cc->flags|=CCF_AOT_COMPILE;
QueueInsert(cc,Fs->last_cc);
res=CompJoin(cc,CMPF_LEX_FIRST,map_name,mapfile_drv_let);
if (error_cnt) *error_cnt=cc->error_cnt;
if (warning_cnt) *warning_cnt=cc->warning_cnt;
if (error_count) *error_count=cc->error_count;
if (warning_count) *warning_count=cc->warning_count;
QueueRemove(cc);
if (res)
CompCtrlDel(cc);
@ -228,7 +228,7 @@ U0 CompFixUpJITAsm(CCompCtrl *cc,CAOT *tmpaot)
if(!(g_lb=COCGoToLabelFind(cc,str)))
"Unresolved Reference:%s\n",str;
else {
g_lb->use_cnt++;
g_lb->use_count++;
g_lb=OptLabelFwd(g_lb);
i=g_lb->addr+tmpaot->buf;
}
@ -338,7 +338,7 @@ U0 CompFixUpAOTAsm(CCompCtrl *cc,CAOT *tmpaot)
if(!(g_lb=COCGoToLabelFind(cc,tmpie->str)))
"Unresolved Reference:%s\n",tmpie->str;
else {
g_lb->use_cnt++;
g_lb->use_count++;
g_lb=OptLabelFwd(g_lb);
}
} else
@ -417,11 +417,11 @@ U0 CompFixUpAOTAsm(CCompCtrl *cc,CAOT *tmpaot)
}
I64 Comp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
{//AOT Compile HC or PRJ file a and output BIN file. Returns err_cnt.
{//AOT Compile HC or PRJ file a and output BIN file. Returns err_count.
U8 *ptr,*fbuf=NULL,*fbuf2=NULL,*fbuf3=NULL,
*patch_table=MAlloc(0x20000);
CAOT *tmpaot;
I64 i,cnt,size=0,error_cnt=0,warning_cnt=0,aot_U8s=0;
I64 i,count,size=0,error_count=0,warning_count=0,aot_U8s=0;
CBinFile *bfh;
CAOTImportExport *tmpie,*tmpie1;
CAOTAbsAddr *tmpa,*tmpa1;
@ -433,20 +433,20 @@ I64 Comp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
if (map_name)
fbuf3=ExtDft(map_name,"MAP");
if (tmpaot=CompBuf(fbuf2,fbuf3,&error_cnt,&warning_cnt,mapfile_drv_let)) {
if (tmpaot=CompBuf(fbuf2,fbuf3,&error_count,&warning_count,mapfile_drv_let)) {
aot_U8s=tmpaot->aot_U8s;
ptr=patch_table;
//See $LK,"Load",A="MN:Load"$()
cnt=0;
count=0;
tmpa=tmpaot->abss;
while (tmpa) {
if (!(tmpa->type&IEF_IMM_NOT_REL))
cnt++;
count++;
tmpa=tmpa->next;
}
if (cnt) {
if (count) {
*ptr++=IET_ABS_ADDR;
*ptr(U32 *)++=cnt;
*ptr(U32 *)++=count;
*ptr++=0;
tmpa=tmpaot->abss;
while (tmpa) {
@ -460,15 +460,15 @@ I64 Comp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
tmphg=tmpaot->heap_glbls;
while (tmphg) {
tmphg1=tmphg->next;
cnt=0;
count=0;
tmphgr=tmphg->references;
while (tmphgr) {
cnt++;
count++;
tmphgr=tmphgr->next;
}
if (cnt) {
if (count) {
*ptr++=IET_DATA_HEAP;
*ptr(U32 *)++=cnt;
*ptr(U32 *)++=count;
if (tmphg->str) {
i=StrLen(tmphg->str);
MemCpy(ptr,tmphg->str,i+1);
@ -564,8 +564,8 @@ I64 Comp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
Free(fbuf2);
Free(fbuf3);
Print("Errs:%d Warns:%d Code:%X Size:%X\n",
error_cnt,warning_cnt,aot_U8s,size);
return error_cnt;
error_count,warning_count,aot_U8s,size);
return error_count;
}
I64 ExePutS(U8 *buf,U8 *filename=NULL,

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@
#define IS_0_ARG 0
#define IS_1_ARG 1
#define IS_2_ARG 2
#define IS_V_ARG 3 //Variable Arg Cnt
#define IS_V_ARG 3 //Variable Arg Count
#define IST_NULL 0
#define IST_DEREF 1
@ -12,7 +12,7 @@
class CIntermediateStruct
{
U8 arg_cnt,res_cnt,type;
U8 arg_count,res_count,type;
Bool fpop,not_const,pad[3];
U8 *name;
};

View File

@ -67,10 +67,10 @@ extern I64 Comp(U8 *filename,
U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0);
#help_index "Debugging/Unassemble"
public extern U8 *U(U8 *rip,I64 cnt=20,I64 seg_size=64);
public extern U8 *U(U8 *rip,I64 count=20,I64 seg_size=64);
public extern U0 Ui(U8 *buf,U8 **_rip,I64 seg_size=64,
I64 *_jmp_dst=NULL,Bool just_ins=FALSE);
public extern I64 Un(U8 *rip,I64 cnt=0x80,I64 seg_size=64);
public extern I64 Un(U8 *rip,I64 count=0x80,I64 seg_size=64);
extern CUAsmGlobals uasm;
#help_index "Hash/System"

View File

@ -97,7 +97,7 @@ Bool LexDollar(CCompCtrl *cc,CDoc *doc,CDocEntry *doc_e)
Free(cc->dollar_buf);
st=Doc2PlainText(doc,doc_e);
cc->dollar_buf=MStrPrint("$$%$$Q$$",st);
cc->dollar_cnt=2;
cc->dollar_count=2;
Free(st);
return TRUE;
} else
@ -425,10 +425,10 @@ I64 LexInStr(CCompCtrl *cc,U8 *buf,I64 size,Bool *done)
}
} else if (ch=='$$') {
buf[i++]='$$';
if (cc->dollar_cnt)
cc->dollar_cnt--;
if (cc->dollar_count)
cc->dollar_count--;
else if (LexGetChar(cc)!='$$') {
cc->dollar_cnt=1;
cc->dollar_count=1;
cc->flags|=CCF_USE_LAST_U16;
}
} else
@ -799,7 +799,7 @@ lex_float_start:
MemCpy(buf2,buf,j);
}
tmph(CHashDefineStr *)->data=buf2;
tmph(CHashDefineStr *)->cnt=-1;
tmph(CHashDefineStr *)->count=-1;
HashAdd(tmph,cc->htc.define_hash_table);
}
cc->flags&=~CCF_NO_DEFINES;

View File

@ -72,7 +72,7 @@ CMemberLst *MemberFind(U8 *needle_str,CHashClass *haystack_class)
tmpm=haystack_class->member_lst_and_root;
while (tmpm) {
if (!(i=StrCmp(tmpm->str,needle_str))) {
tmpm->use_cnt++;
tmpm->use_count++;
return tmpm;
}
if (i<=0)
@ -119,7 +119,7 @@ U0 MemberAdd(CCompCtrl *cc,CMemberLst *tmpm,CHashClass *tmpc,I64 mode)
if (mode==PRS1B_LOCAL_VAR) {
tmpm->member_class_base=
tmpm->member_class-tmpm->member_class->ptr_stars_cnt;
tmpm->member_class-tmpm->member_class->ptr_stars_count;
if (Bt(&cc->opts,OPTf_WARN_DUP_TYPES) &&
MemberClassBaseFind(tmpm->member_class_base,tmpc))
LexWarn(cc,"Duplicate type at ");
@ -154,9 +154,9 @@ CMemberLst *MemberLstNew(I64 _reg)
return res;
}
Bool MemberLstCmp(CMemberLst *tmpm1,CMemberLst *tmpm2,I64 cnt=I64_MAX)
Bool MemberLstCmp(CMemberLst *tmpm1,CMemberLst *tmpm2,I64 count=I64_MAX)
{
while (tmpm1 && tmpm2 && cnt--) {
while (tmpm1 && tmpm2 && count--) {
if (StrCmp(tmpm1->str,tmpm2->str) ||
tmpm1->member_class!=tmpm2->member_class ||
tmpm1->member_class_base!=tmpm2->member_class_base)
@ -174,7 +174,7 @@ Bool MemberLstCmp(CMemberLst *tmpm1,CMemberLst *tmpm2,I64 cnt=I64_MAX)
tmpm1=tmpm1->next;
tmpm2=tmpm2->next;
}
if (cnt<0 || !tmpm1 && !tmpm2)
if (count<0 || !tmpm1 && !tmpm2)
return TRUE;
else
return FALSE;
@ -191,7 +191,7 @@ U0 MemberLstDel(CMemberLst *tmpm)
if (tmpm->flags & MLF_STR_DFT_AVAILABLE)
Free(tmpm->dft_val);
if (tmpm->flags & MLF_FUN)
HashDel(tmpm->fun_ptr-tmpm->fun_ptr->ptr_stars_cnt);
HashDel(tmpm->fun_ptr-tmpm->fun_ptr->ptr_stars_count);
tmp_meta=tmpm->meta;
while (tmp_meta) {
tmp_meta1=tmp_meta->next;
@ -213,9 +213,9 @@ U0 ClassMemberLstDel(CHashClass *tmpc)
tmpc->last_in_member_lst=&tmpc->member_lst_and_root;
tmpc->member_lst_and_root=NULL;
tmpc->member_class_base_root=NULL;
tmpc->member_cnt=0;
tmpc->member_count=0;
if (tmpc->type&HTT_FUN)
tmpc(CHashFun *)->arg_cnt=0;
tmpc(CHashFun *)->arg_count=0;
}
I64 MemberLstSize(CHashClass *tmpc)
@ -230,7 +230,7 @@ I64 MemberLstSize(CHashClass *tmpc)
if (tmpm->flags & MLF_STR_DFT_AVAILABLE)
res+=MSize2(tmpm->dft_val);
if (tmpm->flags & MLF_FUN)
res+=HashEntrySize2(tmpm->fun_ptr-tmpm->fun_ptr->ptr_stars_cnt);
res+=HashEntrySize2(tmpm->fun_ptr-tmpm->fun_ptr->ptr_stars_count);
tmp_meta=tmpm->meta;
while (tmp_meta) {
res+=MSize2(tmp_meta->str);

View File

@ -488,7 +488,7 @@ U0 OptFixSizeOf(CIntermediateCode *tmpi1,
tmpi1->t.arg2_tree->ic_code=IC_IMM_I64;
tmpi1->t.arg2_tree->ic_class=tmpcc;
tmpi_push->ic_class=tmpcc;
if (tmpcc->ptr_stars_cnt) {
if (tmpcc->ptr_stars_count) {
tmpcc--;
if (tmpcc->size==1)
goto here;
@ -517,7 +517,7 @@ I64 CompRawType(CHashClass *tmpc)
I64 CompRawTypePointed(CHashClass *tmpc)
{
if (tmpc) {
if (tmpc->ptr_stars_cnt)
if (tmpc->ptr_stars_count)
tmpc--;
tmpc=OptClassFwd(tmpc);
return tmpc->raw_type;

View File

@ -45,7 +45,7 @@ args.
tmpi_push=tmpi;
MemSet(&tmpi->arg1,0,3*sizeof(CICArg));
tmpi->arg1_type_pointed_to=0;
switch [intermediate_code_table[code].arg_cnt] {
switch [intermediate_code_table[code].arg_count] {
case IS_V_ARG:
ps->ptr-=tmpi->ic_data>>2;
break;
@ -96,7 +96,7 @@ args.
OptSetNOP1(tmpi);
} else {
if (tmpi->ic_data) {//was paren
if (!tmpi_push->ic_class->ptr_stars_cnt) {
if (!tmpi_push->ic_class->ptr_stars_count) {
if (tmpi_push->ic_class->raw_type==RT_F64)
tmpi_push->ic_class2=cmp.internal_types[RT_F64];
else
@ -265,7 +265,7 @@ args.
}
break;
end:
if (!tmpi_push->ic_class->ptr_stars_cnt) {
if (!tmpi_push->ic_class->ptr_stars_count) {
if (tmpi_push->ic_class->raw_type==RT_F64)
tmpi_push->ic_class2=cmp.internal_types[RT_F64];
else
@ -712,7 +712,7 @@ args.
tmpi->ic_class=cmp.internal_types[RT_I64];
break;
end:
if (!tmpi_push->ic_class->ptr_stars_cnt) {
if (!tmpi_push->ic_class->ptr_stars_count) {
if (tmpi_push->ic_class->raw_type==RT_F64)
tmpi_push->ic_class2=cmp.internal_types[RT_F64];
else if (is_unsigned)
@ -808,7 +808,7 @@ args.
break;
end:
tmpi->ic_flags&=~ICF_RES_TO_INT;
if (!tmpi_push->ic_class->ptr_stars_cnt) {
if (!tmpi_push->ic_class->ptr_stars_count) {
if (tmpi_push->ic_class->raw_type==RT_F64)
tmpi_push->ic_class2=cmp.internal_types[RT_F64];
else if (is_unsigned)
@ -1256,7 +1256,7 @@ args.
ICPut(cc,tmpi);
LexExcept(cc,"Compiler Optimization Error at ");
}
if (intermediate_code_table[code].arg_cnt==IS_2_ARG) {
if (intermediate_code_table[code].arg_count==IS_2_ARG) {
if (tmpi_push->ic_precedence&~ASSOC_MASK==PREC_ASSIGN)
OptFixSizeOf(tmpi2,tmpi_push,tmpi1->ic_class-1);
else {
@ -1264,7 +1264,7 @@ args.
OptFixSizeOf(tmpi2,tmpi_push,tmpi1->ic_class);
}
}
if (intermediate_code_table[tmpi_push->ic_code].res_cnt) {
if (intermediate_code_table[tmpi_push->ic_code].res_count) {
ParsePush(ps,tmpi->ic_class2);
ParsePush(ps,tmpi_push);
}

View File

@ -4,7 +4,7 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
CCodeMisc *lb;
CIntermediateCode *tmpi,*tmpi1,*tmpi2,*tmpi_next,
*tmpil1,*tmpil2;
I64 code,i,j,l,member_cnt,used_reg_mask=0;
I64 code,i,j,l,member_count,used_reg_mask=0;
CMemberLst *tmpm;
COptMemberVar *mv=NULL;
CAOT *tmpaot;
@ -18,11 +18,11 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
reg_offsets[i].m=NULL;
}
if (cc->htc.fun) {
member_cnt=cc->htc.fun->member_cnt;
member_count=cc->htc.fun->member_count;
if (Bt(&cc->htc.fun->flags,Ff_DOT_DOT_DOT))
member_cnt+=2;
mv=CAlloc(member_cnt*sizeof(COptMemberVar));
member_cnt=0;
member_count+=2;
mv=CAlloc(member_count*sizeof(COptMemberVar));
member_count=0;
tmpm=cc->htc.fun->member_lst_and_root;
while (tmpm) {
tmpc=OptClassFwd(tmpm->member_class);
@ -36,10 +36,10 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
} else if (tmpc->raw_type!=RT_F64 && tmpm->reg!=REG_NONE ||
tmpm->reg==REG_ALLOC) {
if (tmpm->reg==REG_ALLOC)
mv[member_cnt].score=I64_MAX/2; //big but not too big
mv[member_cnt].offset_start=tmpm->offset;
mv[member_cnt].offset_end=tmpm->offset+MaxI64(1,tmpm->size);
mv[member_cnt++].m=tmpm;
mv[member_count].score=I64_MAX/2; //big but not too big
mv[member_count].offset_start=tmpm->offset;
mv[member_count].offset_end=tmpm->offset+MaxI64(1,tmpm->size);
mv[member_count++].m=tmpm;
} else if (tmpm->reg==REG_ALLOC)
PrintWarn("Can't reg var\n $$LK,\"FL:%s,%d\"$$'%s' in '%s'\n",
cc->lex_include_stk->full_name,
@ -47,7 +47,7 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
tmpm=tmpm->next;
}
} else
member_cnt=0;
member_count=0;
tmpi=cc->coc.coc_head.next;
while (code=tmpi->ic_code) {
@ -61,7 +61,7 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
} else
tmpil1=tmpil2=&cmp.ic_nop;
tmpc=tmpi->ic_class;
switch [intermediate_code_table[code].arg_cnt] {
switch [intermediate_code_table[code].arg_count] {
case IS_V_ARG:
ps->ptr-=tmpi->ic_data>>3;
break;
@ -90,7 +90,7 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
case IS_0_ARG: //nobound switch
break;
}
if (intermediate_code_table[code].res_cnt) {
if (intermediate_code_table[code].res_count) {
tmpi->res.type=MDF_STK+CompRawType(tmpc);
tmpi->ic_flags|=ICF_RES_WAS_STK;
ParsePush(ps,tmpi);
@ -127,7 +127,7 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
tmpi->ic_code=IC_MOV;
OptFree(tmpi1);
if (tmpi->arg1.reg==REG_RBP)
for (i=0;i<member_cnt;i++)
for (i=0;i<member_count;i++)
if (mv[i].offset_start==tmpi->arg1.disp) {
mv[i].lea_balance--;
mv[i].score++;
@ -155,7 +155,7 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
case IC_DEREF_MM:
if (tmpi1->ic_code==IC_LEA && tmpi1->arg1.type&MDF_DISP &&
tmpi1->arg1.reg==REG_RBP)
for (i=0;i<member_cnt;i++)
for (i=0;i<member_count;i++)
if (mv[i].offset_start==tmpi1->arg1.disp) {
mv[i].lea_balance--;
mv[i].score++;
@ -190,7 +190,7 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
tmpi->arg1.reg=REG_RBP;
tmpi->arg1.type=MDF_DISP+tmpi->arg1.type.raw_type;
tmpi->arg1.disp=tmpi->ic_data;
for (i=0;i<member_cnt;i++)
for (i=0;i<member_count;i++)
if (mv[i].offset_start<=tmpi->ic_data<mv[i].offset_end) {
mv[i].lea_balance++;
mv[i].score++;
@ -237,7 +237,7 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
case IC_XOR_EQU:
if (tmpi1->ic_code==IC_LEA && tmpi1->arg1.type&MDF_DISP &&
tmpi1->arg1.reg==REG_RBP)
for (i=0;i<member_cnt;i++)
for (i=0;i<member_count;i++)
if (mv[i].offset_start==tmpi1->arg1.disp) {
mv[i].lea_balance--;
mv[i].score++;
@ -269,7 +269,7 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
case IC_NOBOUND_SWITCH:
case IC_SWITCH:
lb=OptLabelFwd(tmpi->ic_data(CCodeMisc *)->dft);
lb->use_cnt++;
lb->use_count++;
break;
case IC_ASM:
tmpaot=tmpi->ic_data;
@ -278,7 +278,7 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
if (IET_REL_I0<=tmpie->type<=IET_IMM_I64 &&
tmpie->str && tmpie->flags&IEF_GOTO_LABEL &&
(lb=COCGoToLabelFind(cc,tmpie->str)))
lb->use_cnt++; //Prevent deadcode elimination.
lb->use_count++; //Prevent deadcode elimination.
tmpie=tmpie->next;
}
break;
@ -361,7 +361,7 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
case IC_BR_MM_NOT_ZERO:
if (tmpi1->ic_code==IC_LEA && tmpi1->arg1.type&MDF_DISP &&
tmpi1->arg1.reg==REG_RBP)
for (i=0;i<member_cnt;i++)
for (i=0;i<member_count;i++)
if (mv[i].offset_start==tmpi1->arg1.disp) {
mv[i].lea_balance--;
mv[i].score++;
@ -394,7 +394,7 @@ here1:
lb=tmpi->ic_data;
else
lb=OptLabelFwd(tmpi->ic_data);
lb->use_cnt++;
lb->use_count++;
break;
case IC_NOP1:
tmpi=OptFree(tmpi);
@ -535,11 +535,11 @@ R12 and R13 as non-pointer register variables, such as index variables i,j,k.
~(REGG_LOCAL_VARS|REGG_LOCAL_NON_PTR_VARS)|used_reg_mask;
if (!Bt(&cc->opts,OPTf_NO_REG_VAR) &&
!(cc->flags & CCF_NO_REG_OPT)) {
QSort(mv,member_cnt,sizeof(COptMemberVar),&OptMVCompare);
while (member_cnt && !mv[member_cnt-1].score)
member_cnt--;
QSort(mv,member_count,sizeof(COptMemberVar),&OptMVCompare);
while (member_count && !mv[member_count-1].score)
member_count--;
j=0;
for (i=0;i<member_cnt;i++) {
for (i=0;i<member_count;i++) {
if (!mv[i].lea_balance && mv[i].offset_start) {//addr operator cancels
mv[j].m=mv[i].m;
mv[j].offset_start=mv[i].offset_start;
@ -559,7 +559,7 @@ R12 and R13 as non-pointer register variables, such as index variables i,j,k.
for (i=0;i<j && l<cmp.num_non_ptr_vars;i++) {
tmpm=mv[i].m;
tmpc=OptClassFwd(tmpm->member_class);
if (!tmpc->ptr_stars_cnt && !tmpm->dim.next) {
if (!tmpc->ptr_stars_count && !tmpm->dim.next) {
while (l<cmp.num_non_ptr_vars &&
Bts(&cc->htc.fun->used_reg_mask,cmp.non_ptr_vars_map[l]))
l++;

View File

@ -151,8 +151,8 @@ U0 OptPass4(CCompCtrl *cc,COptReg *reg_offsets,I64 *_type)
if (dead_code&&code!=IC_LABEL) {
if (code==IC_JMP||code==IC_SUB_CALL) {
lb=OptLabelFwd(tmpi->ic_data);
if (lb->use_cnt>0)
lb->use_cnt--;
if (lb->use_count>0)
lb->use_count--;
}
tmpi=OptFree(tmpi);
} else {
@ -166,7 +166,7 @@ U0 OptPass4(CCompCtrl *cc,COptReg *reg_offsets,I64 *_type)
tmpil2=tmpil3=&cmp.ic_nop;
} else
tmpil1=tmpil2=tmpil3=&cmp.ic_nop;
switch [intermediate_code_table[code].arg_cnt] {
switch [intermediate_code_table[code].arg_count] {
case IS_V_ARG:
ps->ptr-=tmpi->ic_data>>3;
break;
@ -527,7 +527,7 @@ p4_sib:
break;
case IC_LABEL:
lb=tmpi->ic_data;
if (lb->use_cnt)
if (lb->use_count)
dead_code=FALSE;
break;
case IC_JMP:
@ -549,7 +549,7 @@ p4_sib:
tmpi->arg1.disp=0;
tmpil1->res.type=MDF_REG+tmpil1->res.type.raw_type;
tmpil1->res.disp=0;
if (intermediate_code_table[tmpi->ic_code].arg_cnt==IS_2_ARG) {
if (intermediate_code_table[tmpi->ic_code].arg_count==IS_2_ARG) {
tmpi->arg1.reg=REG_R8;
tmpil1->res.reg=REG_R8;
} else {
@ -676,7 +676,7 @@ p4_sib:
if (tmpi) {
while (OptIC4(tmpi));
code=tmpi->ic_code;
if (intermediate_code_table[code].res_cnt)
if (intermediate_code_table[code].res_count)
ParsePush(ps,tmpi);
}
}

View File

@ -15,7 +15,7 @@ U0 OptPass5(CCompCtrl *cc)
ICPut(cc,tmpi);
}
}
if (intermediate_code_table[code].arg_cnt==IS_V_ARG)
if (intermediate_code_table[code].arg_count==IS_V_ARG)
ps->ptr-=tmpi->ic_data>>3;
if (code==IC_PUSH_REGS) {
for (i=0;i<REG_REGS_NUM;i++)

View File

@ -59,7 +59,7 @@ U0 OptPass6Lag(CCompCtrl *cc,CPrsStk *ps,CIntermediateCode *tmpi,
ps->ptr--;
stk_ptr=ParsePop(ps);
}
if (intermediate_code_table[code].arg_cnt==IS_V_ARG)
if (intermediate_code_table[code].arg_count==IS_V_ARG)
stk_ptr-=tmpi->ic_data>>3;
if (tmpi->arg2.type&MDF_STK) {
stk_ptr--;
@ -147,7 +147,7 @@ U0 OptPass6(CCompCtrl *cc)
tmpi->arg1.disp=0;
tmpil2->res.type=MDF_REG+tmpil2->res.type.raw_type;
tmpil2->res.disp=0;
if (intermediate_code_table[tmpi->ic_code].arg_cnt==IS_2_ARG) {
if (intermediate_code_table[tmpi->ic_code].arg_count==IS_2_ARG) {
tmpi->arg1.reg=REG_R8;
tmpil2->res.reg=REG_R8;
} else {

View File

@ -7,7 +7,7 @@ size is now known
cc->pass==10 is final pass, code is placed into buf.
*/
CIntermediateCode *tmpi,*tmpi_next;
I64 i,cnt,num_lines=cc->max_line+1-cc->min_line,rip=0,rip2;
I64 i,count,num_lines=cc->max_line+1-cc->min_line,rip=0,rip2;
U8 *ptr,saved_arg1_arg2_r[3*sizeof(CICArg)];
CCodeMisc *lb;
CAOT *tmpaot;
@ -42,7 +42,7 @@ cc->pass==10 is final pass, code is placed into buf.
cc->last_float_op_ic=NULL;
tmpi=&cc->coc.coc_head;
tmpi->ic_last_start=-1;
tmpi->ic_cnt=0;
tmpi->ic_count=0;
tmpi=tmpi->next;
while (tmpi->ic_code) {
tmpi_next=tmpi->next;
@ -60,7 +60,7 @@ cc->pass==10 is final pass, code is placed into buf.
if (cc->pass==7)
cc->dont_push_float=Btr(&tmpi->ic_flags,ICf_DONT_PUSH_FLOAT0);
MemCpy(saved_arg1_arg2_r,&tmpi->arg1,3*sizeof(CICArg));
tmpi->ic_cnt=0;
tmpi->ic_count=0;
tmpi->ic_last_start=-1;
if (tmpi->arg2.type.mode) {
if (tmpi->ic_flags & ICF_ARG2_TO_F64) {
@ -105,7 +105,7 @@ cc->pass==10 is final pass, code is placed into buf.
tmpa->next=aotc->abss;
tmpa->type=AAT_ADD_U64;
aotc->abss=tmpa;
tmpa->rip=rip2+tmpi->ic_cnt-8;
tmpa->rip=rip2+tmpi->ic_count-8;
}
break;
case IC_HEAP_GLBL:
@ -118,7 +118,7 @@ cc->pass==10 is final pass, code is placed into buf.
tmphgr=CAlloc(sizeof(CAOTHeapGlobalRef));
tmphgr->next=tmphg->references;
tmphg->references=tmphgr;
tmphgr->rip=rip2+tmpi->ic_cnt-8;
tmphgr->rip=rip2+tmpi->ic_count-8;
}
break;
case IC_ADDR_IMPORT:
@ -128,7 +128,7 @@ cc->pass==10 is final pass, code is placed into buf.
tmpg=tmpi->ic_data;
tmpie=CAlloc(sizeof(CAOTImportExport));
tmpie->type=IET_IMM_U32;
tmpie->rip=rip2+tmpi->ic_cnt-4;
tmpie->rip=rip2+tmpi->ic_count-4;
tmpie->next=tmpg->ie_lst;
tmpg->ie_lst=tmpie;
}
@ -136,13 +136,13 @@ cc->pass==10 is final pass, code is placed into buf.
break;
case IC_RIP:
ICU16(tmpi,0xB848);
ICU64(tmpi,rip2+tmpi->ic_cnt-2);
ICU64(tmpi,rip2+tmpi->ic_count-2);
if (cc->flags&CCF_AOT_COMPILE && buf &&!(cc->flags&CCF_NO_ABSS)) {
tmpa=CAlloc(sizeof(CAOTAbsAddr));
tmpa->next=aotc->abss;
tmpa->type=AAT_ADD_U64;
aotc->abss=tmpa;
tmpa->rip=rip2+tmpi->ic_cnt-8;
tmpa->rip=rip2+tmpi->ic_count-8;
}
break;
end:
@ -305,7 +305,7 @@ cc->pass==10 is final pass, code is placed into buf.
break;
case IC_ASM:
tmpaot=tmpi->ic_data;
tmpi->ic_cnt+=tmpaot->aot_U8s;
tmpi->ic_count+=tmpaot->aot_U8s;
if (buf) {
MemCpy(buf+rip,tmpaot->buf,tmpaot->aot_U8s);
Free(tmpaot->buf);
@ -316,7 +316,7 @@ cc->pass==10 is final pass, code is placed into buf.
CompFixUpAOTAsm(cc,tmpaot);
else
CompFixUpJITAsm(cc,tmpaot);
cnt=tmpi->ic_cnt;
count=tmpi->ic_count;
goto op789A_skip_copy;
}
break;
@ -344,7 +344,7 @@ cc->pass==10 is final pass, code is placed into buf.
break;
case IC_CALL_INDIRECT2:
ICU16(tmpi,0xBB48);
if (cc->flags&CCF_AOT_COMPILE) i=rip2+tmpi->ic_cnt;
if (cc->flags&CCF_AOT_COMPILE) i=rip2+tmpi->ic_count;
ICU64(tmpi,tmpi->ic_data);
ICU16(tmpi,0x13FF);
if (buf && cc->flags&CCF_AOT_COMPILE&& !(cc->flags&CCF_NO_ABSS)) {
@ -363,7 +363,7 @@ cc->pass==10 is final pass, code is placed into buf.
tmpf=tmpi->ic_data;
tmpie=CAlloc(sizeof(CAOTImportExport));
tmpie->type=IET_IMM_I64;
tmpie->rip=rip2+tmpi->ic_cnt-8;
tmpie->rip=rip2+tmpi->ic_count-8;
tmpie->next=tmpf->ie_lst;
tmpf->ie_lst=tmpie;
}
@ -375,7 +375,7 @@ cc->pass==10 is final pass, code is placed into buf.
tmpf=tmpi->ic_data;
tmpie=CAlloc(sizeof(CAOTImportExport));
tmpie->type=IET_REL_I32;
tmpie->rip=rip2+tmpi->ic_cnt-4;
tmpie->rip=rip2+tmpi->ic_count-4;
tmpie->next=tmpf->ie_lst;
tmpf->ie_lst=tmpie;
}
@ -406,12 +406,12 @@ cc->pass==10 is final pass, code is placed into buf.
if (Bt(&cc->htc.fun->flags,Ff_HASERRCODE))
ICAddRSP(tmpi,8);
ICU16(tmpi,0xCF48);
} else if (cc->htc.fun && cc->htc.fun->arg_cnt &&
} else if (cc->htc.fun && cc->htc.fun->arg_count &&
(Bt(&cc->htc.fun->flags,Ff_RET1) ||
Bt(&cc->htc.fun->flags,Ff_ARGPOP)) &&
!Bt(&cc->htc.fun->flags,Ff_NOARGPOP)) {
ICU8(tmpi,0xC2);
ICU16(tmpi,cc->htc.fun->arg_cnt<<3);
ICU16(tmpi,cc->htc.fun->arg_count<<3);
} else
ICU8(tmpi,0xC3);
break;
@ -1063,14 +1063,14 @@ cc->pass==10 is final pass, code is placed into buf.
}
}
}
cnt=tmpi->ic_cnt;
count=tmpi->ic_count;
if (tmpi->ic_flags&ICF_DEL_PREV_INS) {
if (cc->pass>8)
cnt=tmpi->ic_last_start;
count=tmpi->ic_last_start;
tmpi->ic_flags&=~ICF_DEL_PREV_INS;
}
if (cnt && buf)
MemCpy(buf+rip,tmpi->ic_body,cnt);
if (count && buf)
MemCpy(buf+rip,tmpi->ic_body,count);
op789A_skip_copy:
if (dbg_info && cc->min_line<=tmpi->ic_line<=cc->max_line) {
i=tmpi->ic_line-cc->min_line;
@ -1078,18 +1078,18 @@ op789A_skip_copy:
dbg_info->body[i]=rip2;
}
if (tmpi->ic_flags&ICF_PASS_TRACE &&
Bt(&cc->saved_pass_trace,cc->pass) && cnt) {
Bt(&cc->saved_pass_trace,cc->pass) && count) {
"$$RED$$";
if (buf)
Un(buf+rip,cnt,64);
Un(buf+rip,count,64);
else
Un(tmpi->ic_body,cnt,64);
Un(tmpi->ic_body,count,64);
"$$FG$$";
}
if (!(tmpi->ic_flags&(ICF_CODE_FINAL|ICF_DONT_RESTORE)))
MemCpy(&tmpi->arg1,saved_arg1_arg2_r,3*sizeof(CICArg));
rip+=cnt;
if (tmpi->ic_cnt>=IC_BODY_SIZE && tmpi->ic_code!=IC_ASM)
rip+=count;
if (tmpi->ic_count>=IC_BODY_SIZE && tmpi->ic_code!=IC_ASM)
throw('Compiler');
op789A_next:
tmpi=tmpi_next;

View File

@ -18,15 +18,15 @@ CIntermediateCode *ParseAddOp(CCompCtrl *cc,I64 stk_op,CHashClass *tmpc)
Bool div_sizeof=FALSE;
switch (stk_op.u16[0]) {
case IC_ADD:
if (tmpc->ptr_stars_cnt && !tmpi->ic_class->ptr_stars_cnt &&
if (tmpc->ptr_stars_count && !tmpi->ic_class->ptr_stars_count &&
tmpi->ic_class->raw_type!=RT_F64) {
ICAdd(cc,IC_SIZEOF,1,cmp.internal_types[RT_I64]);
ICAdd(cc,IC_MUL,0,cmp.internal_types[RT_I64]);
}
break;
case IC_SUB:
if (tmpc->ptr_stars_cnt && tmpi->ic_class->raw_type!=RT_F64) {
if (!tmpi->ic_class->ptr_stars_cnt) {
if (tmpc->ptr_stars_count && tmpi->ic_class->raw_type!=RT_F64) {
if (!tmpi->ic_class->ptr_stars_count) {
ICAdd(cc,IC_SIZEOF,1,cmp.internal_types[RT_I64]);
ICAdd(cc,IC_MUL,0,cmp.internal_types[RT_I64]);
} else
@ -39,7 +39,7 @@ CIntermediateCode *ParseAddOp(CCompCtrl *cc,I64 stk_op,CHashClass *tmpc)
break;
case IC_ADD_EQU:
case IC_SUB_EQU:
if (tmpc->ptr_stars_cnt) {
if (tmpc->ptr_stars_count) {
ICAdd(cc,IC_SIZEOF,1,cmp.internal_types[RT_I64]);
ICAdd(cc,IC_MUL,0,cmp.internal_types[RT_I64]);
}
@ -148,10 +148,10 @@ pe_check_binary_ops2:
} else {
tmpi=cc->coc.coc_head.last;
tmpc=tmpi->ic_class;
if (stk_op.u16[0]==IC_DEREF && tmpc->ptr_stars_cnt)
if (stk_op.u16[0]==IC_DEREF && tmpc->ptr_stars_count)
tmpc--;
else if (stk_op.u16[0]==IC_ADDR) {
cc->abs_cnts.c_addres++;
cc->abs_counts.c_addres++;
if (intermediate_code_table[tmpi->ic_code].type==IST_DEREF)
OptFree(tmpi);
tmpc++;
@ -173,7 +173,7 @@ pe_do_binary_op:
case IC_ADD:
case IC_SUB:
tmpi=cc->coc.coc_head.last;
if (!tmpi->ic_class->ptr_stars_cnt &&
if (!tmpi->ic_class->ptr_stars_count &&
tmpi->ic_class->raw_type!=RT_F64) {
ICAdd(cc,IC_SIZEOF,1,cmp.internal_types[RT_I64]);
ICAdd(cc,IC_MUL,0,cmp.internal_types[RT_I64]);
@ -202,7 +202,7 @@ pe_do_binary_op:
tmpi=cc->coc.coc_head.last;
tmpc=OptClassFwd(tmpi->ic_class);
if (intermediate_code_table[tmpi->ic_code].type!=IST_DEREF ||
!tmpc->ptr_stars_cnt && !Bt(&tmpc->flags,Cf_INTERNAL_TYPE))
!tmpc->ptr_stars_count && !Bt(&tmpc->flags,Cf_INTERNAL_TYPE))
LexExcept(cc,"Invalid lval at ");
tmpi->ic_code=IC_NOP1; //Important for setting class (pretty sure)
cur_op.u8[2]=PREC_ASSIGN|ASSOCF_RIGHT;
@ -310,7 +310,7 @@ U0 ParseSizeOf(CCompCtrl *cc)
LexExcept(cc,"Invalid class at ");
if (tmpm=cc->local_var_entry) {
tmpc=tmpm->member_class;
i=tmpc->size*tmpm->dim.total_cnt;
i=tmpc->size*tmpm->dim.total_count;
if (Lex(cc)=='.')
goto pu_sizeof_member;
} else {
@ -335,11 +335,11 @@ pu_sizeof_member:
if (Lex(cc)!=TK_IDENT || !(tmpm=MemberFind(cc->cur_str,tmpc)))
LexExcept(cc,"Invalid member at ");
else if (cc->local_var_entry)
cc->local_var_entry->use_cnt--;
cc->local_var_entry->use_count--;
tmpc=tmpm->member_class;
//Probably others like this:
#assert offset(CHashClass.size)==offset(CHashGlobalVar.size)
i=tmpc->size*tmpm->dim.total_cnt;
i=tmpc->size*tmpm->dim.total_count;
}
}
}
@ -373,7 +373,7 @@ U0 ParseOffsetOf(CCompCtrl *cc)
if (Lex(cc)!=TK_IDENT || !(tmpm=MemberFind(cc->cur_str,tmpc)))
LexExcept(cc,"Invalid member at ");
else if (cc->local_var_entry)
cc->local_var_entry->use_cnt--;
cc->local_var_entry->use_count--;
i+=tmpm->offset;
tmpc=tmpm->member_class;
} while (Lex(cc)=='.');
@ -382,7 +382,7 @@ U0 ParseOffsetOf(CCompCtrl *cc)
I64 ParseFunCall(CCompCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
{
I64 i,argc_cnt,dft_val;
I64 i,argc_count,dft_val;
Bool is_first_arg=TRUE,needs_right_paren,is_print,is_putchars,
is_template_fun;
CHashClass *tmpc2,*last_class=NULL;
@ -427,9 +427,9 @@ I64 ParseFunCall(CCompCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
COCPush(cc);
tmpcbh=cc->coc.coc_next;
cc->coc.coc_next=NULL;
i=tmpf->arg_cnt;
i=tmpf->arg_count;
tmpm=tmpf->member_lst_and_root;
argc_cnt=0;
argc_count=0;
if (cc->token=='(') {
Lex(cc);
needs_right_paren=TRUE;
@ -456,7 +456,7 @@ I64 ParseFunCall(CCompCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
(cc->token==')' || cc->token==',' || !needs_right_paren)) {
dft_val=tmpm->dft_val;
if (tmpm->flags & MLF_LASTCLASS && last_class)
dft_val=(last_class-last_class->ptr_stars_cnt)->str;
dft_val=(last_class-last_class->ptr_stars_count)->str;
if (tmpm->flags & (MLF_STR_DFT_AVAILABLE|MLF_LASTCLASS) &&
cc->flags&CCF_AOT_COMPILE) {
cm=COCMiscNew(cc,CMT_STR_CONST);
@ -506,7 +506,7 @@ I64 ParseFunCall(CCompCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
throw('Compiler');
COCPush(cc);
is_first_arg=FALSE;
argc_cnt++;
argc_count++;
} while (cc->token==',');
}
} else if (needs_right_paren) {
@ -523,11 +523,11 @@ I64 ParseFunCall(CCompCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
throw('Compiler');
COCPush(cc);
is_first_arg=FALSE;
argc_cnt++;
argc_count++;
} while (cc->token==',');
}
}
tmpi->ic_data=argc_cnt++; //++ so add_esp latter works
tmpi->ic_data=argc_count++; //++ so add_esp latter works
}
if (needs_right_paren) {
if (cc->token==')')
@ -557,9 +557,9 @@ I64 ParseFunCall(CCompCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
else {
if (indirect)
ICAdd(cc,IC_CALL_INDIRECT,
(argc_cnt+tmpf->arg_cnt)<<3,tmpf->return_class);
(argc_count+tmpf->arg_count)<<3,tmpf->return_class);
else if (Bt(&tmpf->flags,Cf_EXTERN)) {
cc->abs_cnts.externs++;
cc->abs_counts.externs++;
if (cc->flags&CCF_AOT_COMPILE) {
if (tmpf->type&HTF_IMPORT)
ICAdd(cc,IC_CALL_IMPORT,tmpf,tmpf->return_class);
@ -572,14 +572,14 @@ I64 ParseFunCall(CCompCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
if ((Bt(&tmpf->flags,Ff_RET1) || Bt(&tmpf->flags,Ff_ARGPOP)) &&
!Bt(&tmpf->flags,Ff_NOARGPOP)) {
if (indirect) {
ICAdd(cc,IC_ADD_RSP1,(argc_cnt+tmpf->arg_cnt)<<3,tmpf->return_class);
ICAdd(cc,IC_ADD_RSP1,(argc_count+tmpf->arg_count)<<3,tmpf->return_class);
ICAdd(cc,IC_ADD_RSP,8,tmpf->return_class);
} else
ICAdd(cc,IC_ADD_RSP1,(argc_cnt+tmpf->arg_cnt)<<3,tmpf->return_class);
ICAdd(cc,IC_ADD_RSP1,(argc_count+tmpf->arg_count)<<3,tmpf->return_class);
} else {
if (indirect)
argc_cnt++;
ICAdd(cc,IC_ADD_RSP,(argc_cnt+tmpf->arg_cnt)<<3,tmpf->return_class);
argc_count++;
ICAdd(cc,IC_ADD_RSP,(argc_count+tmpf->arg_count)<<3,tmpf->return_class);
}
}
if (!is_template_fun)
@ -635,7 +635,7 @@ I64 ParseUnaryTerm(CCompCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
}
LexExcept(cc,"Can't take addr of extern fun");
}
cc->abs_cnts.externs++;
cc->abs_counts.externs++;
ICAdd(cc,IC_IMM_I64,
&tmpf->exe_addr,cmp.internal_types[RT_PTR]);
ICAdd(cc,IC_DEREF,0,cmp.internal_types[RT_PTR]);
@ -644,12 +644,12 @@ I64 ParseUnaryTerm(CCompCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
ICAdd(cc,IC_ABS_ADDR,
tmpf->exe_addr,cmp.internal_types[RT_PTR]);
if (cc->flags&CCF_ASM_EXPRESSIONS)
cc->abs_cnts.abs_addres++;
cc->abs_counts.abs_addres++;
} else
ICAdd(cc,IC_IMM_I64,
tmpf->exe_addr,cmp.internal_types[RT_PTR]);
}
cc->abs_cnts.c_addres++;
cc->abs_counts.c_addres++;
Lex(cc);
return PE_MAYBE_MODIFIERS;
}
@ -657,7 +657,7 @@ I64 ParseUnaryTerm(CCompCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
tmpex=tmpc;
if (cc->flags&CCF_ASM_EXPRESSIONS &&
!(cc->flags&CCF_AOT_COMPILE) && tmpex->type&HTF_IMM) {
cc->abs_cnts.c_addres++;
cc->abs_counts.c_addres++;
ICAdd(cc,IC_IMM_I64,
tmpex->val,cmp.internal_types[RT_PTR]);
Lex(cc);
@ -706,7 +706,7 @@ I64 ParseUnaryTerm(CCompCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
break;
case '$$':
if (cc->flags & CCF_ASM_EXPRESSIONS) {
cc->abs_cnts.abs_addres++;
cc->abs_counts.abs_addres++;
if (cc->flags&CCF_AOT_COMPILE)
ICAdd(cc,IC_ABS_ADDR,cc->aotc->rip,cmp.internal_types[RT_PTR]);
else
@ -767,7 +767,7 @@ I64 ParseUnaryTerm(CCompCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
if (tmpm->flags & MLF_FUN && !(cc->flags&CCF_ASM_EXPRESSIONS)) {
ParsePopDeref(ps);
cc->flags|=CCF_FUN_EXP;
ParsePush2(ps,tmpm->fun_ptr-tmpm->fun_ptr->ptr_stars_cnt);
ParsePush2(ps,tmpm->fun_ptr-tmpm->fun_ptr->ptr_stars_count);
}
if (tmpm->dim.next) {
*_tmpad=tmpm->dim.next;
@ -833,7 +833,7 @@ pu_export_sys_sym:
if (PREC_TERM>*max_prec)
*max_prec=PREC_TERM;
if (!(tmpex->type & (HTF_IMM|HTF_IMPORT)))
cc->abs_cnts.abs_addres++;
cc->abs_counts.abs_addres++;
if (tmpex->type & HTF_UNRESOLVED) {
if (!(cc->flags&CCF_ASM_EXPRESSIONS))
LexExcept(cc,"Illegal fwd ref at ");
@ -853,7 +853,7 @@ pu_export_sys_sym:
ICAdd(cc,IC_ABS_ADDR,tmpex->val,cmp.internal_types[RT_PTR]);
else {
if (tmpex->type&HTF_IMM)
cc->abs_cnts.c_addres++;
cc->abs_counts.c_addres++;
ICAdd(cc,IC_IMM_I64,tmpex->val,cmp.internal_types[RT_PTR]);
}
}
@ -889,7 +889,7 @@ pu_export_sys_sym:
}
} else {
if (tmpg->flags & GVF_EXTERN) {
cc->abs_cnts.externs++;
cc->abs_counts.externs++;
ICAdd(cc,IC_IMM_I64,&tmpg->data_addr,tmpc);
ICAdd(cc,IC_DEREF,0,tmpc);
} else
@ -899,7 +899,7 @@ pu_export_sys_sym:
if (tmpg->flags & GVF_FUN) {
ParsePopDeref(ps);
cc->flags|=CCF_FUN_EXP;
ParsePush2(ps,tmpg->fun_ptr-tmpg->fun_ptr->ptr_stars_cnt);
ParsePush2(ps,tmpg->fun_ptr-tmpg->fun_ptr->ptr_stars_count);
}
return PE_UNARY_MODIFIERS;
case HTt_CLASS:
@ -987,7 +987,7 @@ I64 ParseUnaryModifier(CCompCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
if (!*unary_post_prec)
*unary_post_prec=PREC_TERM;
tmpc=cc->coc.coc_head.last->ic_class;
if ((!tmpc->ptr_stars_cnt || cc->flags & CCF_ARRAY) && cc->token=='.')
if ((!tmpc->ptr_stars_count || cc->flags & CCF_ARRAY) && cc->token=='.')
LexExcept(cc,"Must be address, not value ");
if (!(cc->flags & CCF_RAX))
tmpc--;
@ -997,7 +997,7 @@ I64 ParseUnaryModifier(CCompCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
!(tmpm=MemberFind(cc->cur_str,tmpc)))
LexExcept(cc,"Invalid member at ");
else if (cc->local_var_entry)
cc->local_var_entry->use_cnt--;
cc->local_var_entry->use_count--;
Lex(cc); //skip member name
tmpc1=tmpm->member_class+1;
ICAdd(cc,IC_IMM_I64,tmpm->offset,tmpc1);
@ -1008,7 +1008,7 @@ I64 ParseUnaryModifier(CCompCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
}
if(tmpm->flags & MLF_FUN) {
ParsePopDeref(ps);
ParsePush2(ps,tmpm->fun_ptr-tmpm->fun_ptr->ptr_stars_cnt);
ParsePush2(ps,tmpm->fun_ptr-tmpm->fun_ptr->ptr_stars_count);
cc->flags|=CCF_FUN_EXP;
}
ICAdd(cc,IC_ADD,0,tmpc1);
@ -1057,17 +1057,17 @@ I64 ParseUnaryModifier(CCompCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
*unary_post_prec=PREC_TERM;
Lex(cc);
tmpc=OptClassFwd(cc->coc.coc_head.last->ic_class);
if (!tmpc->ptr_stars_cnt)
if (!tmpc->ptr_stars_count)
LexExcept(cc,"Not array or ptr ");
if (!(cc->flags & (CCF_ARRAY | CCF_RAX))) {
tmpc=OptClassFwd(tmpc-1);
if (!tmpc->ptr_stars_cnt)
if (!tmpc->ptr_stars_count)
LexExcept(cc,"Not array or ptr ");
ICAdd(cc,IC_DEREF+PREC_UNARY_PRE<<16,0,tmpc);
}
tmpc1=tmpc-1;
if (tmpad1=*_tmpad) {
ICAdd(cc,IC_IMM_I64,tmpad1->total_cnt*tmpc1->size,tmpc);
ICAdd(cc,IC_IMM_I64,tmpad1->total_count*tmpc1->size,tmpc);
if (*_tmpad=tmpad1->next) {
old_flags=cc->flags;
if (!ParseExpression(cc,NULL,FALSE,ps))

View File

@ -51,7 +51,7 @@ for one * and two fwd for two **.
tmpc->type=HTT_CLASS;
tmpc->raw_type=RT_PTR;
tmpc->size=sizeof(U8 *);
tmpc->ptr_stars_cnt=i;
tmpc->ptr_stars_count=i;
tmpc++;
}
res->last_in_member_lst=&res->member_lst_and_root;
@ -68,7 +68,7 @@ CHashFun *ParseFunNew()
tmpf->type=HTT_FUN;
tmpf->raw_type=RT_PTR;
tmpf->size=sizeof(U8 *);
tmpf->ptr_stars_cnt=i;
tmpf->ptr_stars_count=i;
tmpf++;
}
res->last_in_member_lst=&res->member_lst_and_root;
@ -88,7 +88,7 @@ CIntermediateCode *ICAdd(CCompCtrl *cc,
Bts(&cc->flags,CCf_PASS_TRACE_PRESENT);
flags|=ICF_PASS_TRACE;
}
if (cc->lock_cnt)
if (cc->lock_count)
flags|=ICF_LOCK;
tmpi->ic_flags=flags;
tmpi->ic_line=cc->last_line_num;
@ -197,7 +197,7 @@ U0 COCDel(CCompCtrl *cc,CCodeCtrl *coc)
if (!(cm->flags&CMF_DEFINED)) {
undef=cm->str;
cm->str=NULL;
} else if (!cm->use_cnt) {
} else if (!cm->use_count) {
PrintWarn("Unused label %s\n",cm->str);
LexWarn(cc,"Unused label at ");
}

View File

@ -19,7 +19,7 @@ CHashClass *ParseClass(CCompCtrl *cc,I64 keyword,I64 fsp_flags,Bool is_extern)
if (tmpc) {
if (!Bt(&tmpc->flags,Cf_EXTERN))
tmpc=NULL;
else if (tmpc->use_cnt<3)
else if (tmpc->use_count<3)
UnusedExternWarning(cc,tmpc);
}
if (tmpc) {
@ -36,7 +36,7 @@ CHashClass *ParseClass(CCompCtrl *cc,I64 keyword,I64 fsp_flags,Bool is_extern)
LBtr(&tmpc->flags,Cf_EXTERN);
if (fsp_flags&FSF_PUBLIC)
tmpc->type|=HTF_PUBLIC;
tmpc->use_cnt=0;
tmpc->use_count=0;
if (cc->last_U16=='\n')
HashSrcFileSet(cc,tmpc,-1);
else
@ -66,7 +66,7 @@ CHashFun *ParseFunJoin(CCompCtrl *cc,CHashClass *tmp_return,
CAOTCtrl *aotc=cc->aotc;
CHashClass *header_return;
CHashFun *tmpf;
I64 header_arg_cnt;
I64 header_arg_count;
if (name) {//if not fun_ptr
if (cc->flags&CCF_AOT_COMPILE) {
if ((tmpf=HashFind(name,cc->htc.glbl_hash_table,HTT_FUN)) &&
@ -76,7 +76,7 @@ CHashFun *ParseFunJoin(CCompCtrl *cc,CHashClass *tmp_return,
if ((tmpf=HashSingleTableFind(name,cc->htc.glbl_hash_table,HTT_FUN)) &&
!Bt(&tmpf->flags,Cf_EXTERN))
tmpf=NULL;
if (tmpf && tmpf->use_cnt<3)
if (tmpf && tmpf->use_count<3)
UnusedExternWarning(cc,tmpf);
} else
tmpf=NULL;
@ -87,7 +87,7 @@ CHashFun *ParseFunJoin(CCompCtrl *cc,CHashClass *tmp_return,
Free(tmpf->idx);
tmpf->idx=NULL;
Free(name);
header_arg_cnt=tmpf->arg_cnt;
header_arg_count=tmpf->arg_count;
header_lst=tmpf->member_lst_and_root;
header_return=tmpf->return_class;
tmpf->member_lst_and_root=NULL;
@ -109,11 +109,11 @@ CHashFun *ParseFunJoin(CCompCtrl *cc,CHashClass *tmp_return,
}
BEqu(&tmpf->type,HTf_PUBLIC,fsp_flags&FSF_PUBLIC);
tmpf->return_class=tmp_return;
tmpf->use_cnt=0;
tmpf->use_count=0;
HashSrcFileSet(cc,tmpf);
ParseVarLst(cc,tmpf,PRS0_NULL|PRS1_FUN_ARG);
tmpf->arg_cnt=tmpf->member_cnt;
if (0<tmpf->arg_cnt<<3<=I16_MAX && !Bt(&tmpf->flags,Ff_DOT_DOT_DOT))
tmpf->arg_count=tmpf->member_count;
if (0<tmpf->arg_count<<3<=I16_MAX && !Bt(&tmpf->flags,Ff_DOT_DOT_DOT))
LBts(&tmpf->flags,Ff_RET1);
tmpm=tmpf->member_lst_and_root;
while (tmpm) {
@ -125,11 +125,11 @@ CHashFun *ParseFunJoin(CCompCtrl *cc,CHashClass *tmp_return,
if (GetOption(OPTf_WARN_HEADER_MISMATCH)) {
if (tmpf->return_class!=header_return) {
PrintWarn("Fun Header return mismatch '%s'\n",tmpf->str);
cc->warning_cnt++;
cc->warning_count++;
}
if (!MemberLstCmp(tmpf->member_lst_and_root,header_lst,header_arg_cnt)) {
if (!MemberLstCmp(tmpf->member_lst_and_root,header_lst,header_arg_count)) {
PrintWarn("Fun header args mismatch '%s'\n",tmpf->str);
cc->warning_cnt++;
cc->warning_count++;
}
}
MemberLstDel(header_lst);
@ -193,11 +193,11 @@ U0 ParseFun(CCompCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags)
tmpm=cc->htc.fun->member_lst_and_root;
while (tmpm) {
if (tmpm->flags & MLF_NO_UNUSED_WARN) {
if (tmpm->use_cnt>1&&StrCmp(tmpm->str,"_anon_"))
if (tmpm->use_count>1&&StrCmp(tmpm->str,"_anon_"))
PrintWarn("Unneeded no_warn\n $$LK,\"FL:%s,%d\"$$'%s' in '%s'\n",
cc->lex_include_stk->full_name,cc->lex_include_stk->line_num,
tmpm->str,cc->htc.fun->str);
} else if (!tmpm->use_cnt && GetOption(OPTf_WARN_UNUSED_VAR))
} else if (!tmpm->use_count && GetOption(OPTf_WARN_UNUSED_VAR))
PrintWarn("Unused var\n $$LK,\"FL:%s,%d\"$$'%s' in '%s'\n",
cc->lex_include_stk->full_name,cc->lex_include_stk->line_num,
tmpm->str,cc->htc.fun->str);
@ -226,7 +226,7 @@ U0 ParseGlobalVarLst(CCompCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
if (!st) return;
if (tmpad.next)
is_array=TRUE;
else if (tmpad.total_cnt<0) {
else if (tmpad.total_count<0) {
is_array=TRUE;
tmpc--;
} else
@ -282,11 +282,11 @@ U0 ParseGlobalVarLst(CCompCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
return;
}
} else {
if (tmpad.total_cnt<0) {
if (tmpad.total_count<0) {
i=0;
undef_array_size=TRUE;
} else {
i=tmpad.total_cnt;
i=tmpad.total_count;
undef_array_size=FALSE;
}
if (tmpf_fun_ptr)
@ -390,8 +390,8 @@ U0 ParseGlobalVarLst(CCompCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
tmpg->var_class=tmpc;
tmpg->str=st;
tmpg->size=j;
tmpg->dim.total_cnt=i;
tmpg->use_cnt=0;
tmpg->dim.total_count=i;
tmpg->use_count=0;
if (cc->last_U16=='\n')
HashSrcFileSet(cc,tmpg,-1);
else
@ -416,7 +416,7 @@ U0 ParseGlobalVarLst(CCompCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
Lex(cc);
ParseGlobalInit(cc,tmpg,1);
LexPopNoRestore(cc);
tmpg->size=tmpg->dim.total_cnt*tmpc->size;
tmpg->size=tmpg->dim.total_count*tmpc->size;
if (tmphg)
tmphg->size=tmpg->size;
if (cc->flags&CCF_AOT_COMPILE)
@ -436,9 +436,9 @@ U0 ParseGlobalVarLst(CCompCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
LexPopNoRestore(cc);
}
if (has_alias) {
if (tmpex(CHashGlobalVar *)->use_cnt<2) {
if (tmpex(CHashGlobalVar *)->use_count<2) {
PrintWarn("Unused extern '%s'\n",tmpex(CHashGlobalVar *)->str);
cc->warning_cnt++;
cc->warning_count++;
}
tmpex(CHashGlobalVar *)->flags|=GVF_ALIAS;
tmpex(CHashGlobalVar *)->data_addr=tmpg->data_addr;
@ -456,7 +456,7 @@ U0 ParseGlobalVarLst(CCompCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
}
}
U0 ParseIf(CCompCtrl *cc,I64 try_cnt,CCodeMisc *lb_break)
U0 ParseIf(CCompCtrl *cc,I64 try_count,CCodeMisc *lb_break)
{
CCodeMisc *lb,*lb1;
I64 k;
@ -470,20 +470,20 @@ U0 ParseIf(CCompCtrl *cc,I64 try_cnt,CCodeMisc *lb_break)
Lex(cc);
lb=COCMiscNew(cc,CMT_LABEL);
ICAdd(cc,IC_BR_ZERO,lb,0);
ParseStatement(cc,try_cnt,lb_break);
ParseStatement(cc,try_count,lb_break);
k=ParseKeyWord(cc);
if (k==KW_ELSE) {
Lex(cc);
lb1=COCMiscNew(cc,CMT_LABEL);
ICAdd(cc,IC_JMP,lb1,0);
ICAdd(cc,IC_LABEL,lb,0);
ParseStatement(cc,try_cnt,lb_break);
ParseStatement(cc,try_count,lb_break);
ICAdd(cc,IC_LABEL,lb1,0);
} else
ICAdd(cc,IC_LABEL,lb,0);
}
U0 ParseWhile(CCompCtrl *cc,I64 try_cnt)
U0 ParseWhile(CCompCtrl *cc,I64 try_count)
{
CCodeMisc *lb,*lb_done;
if (cc->token!='(')
@ -498,18 +498,18 @@ U0 ParseWhile(CCompCtrl *cc,I64 try_cnt)
Lex(cc);
lb_done=COCMiscNew(cc,CMT_LABEL);
ICAdd(cc,IC_BR_ZERO,lb_done,0);
ParseStatement(cc,try_cnt,lb_done);
ParseStatement(cc,try_count,lb_done);
ICAdd(cc,IC_JMP,lb,0);
ICAdd(cc,IC_LABEL,lb_done,0);
}
U0 ParseDoWhile(CCompCtrl *cc,I64 try_cnt)
U0 ParseDoWhile(CCompCtrl *cc,I64 try_count)
{
CCodeMisc *lb,*lb_done;
lb=COCMiscNew(cc,CMT_LABEL);
lb_done=COCMiscNew(cc,CMT_LABEL);
ICAdd(cc,IC_LABEL,lb,0);
ParseStatement(cc,try_cnt,lb_done);
ParseStatement(cc,try_count,lb_done);
if (ParseKeyWord(cc)!=KW_WHILE)
LexExcept(cc,"Missing 'while' at");
if (Lex(cc)!='(')
@ -526,7 +526,7 @@ U0 ParseDoWhile(CCompCtrl *cc,I64 try_cnt)
Lex(cc);
}
U0 ParseFor(CCompCtrl *cc,I64 try_cnt)
U0 ParseFor(CCompCtrl *cc,I64 try_count)
{
CCodeCtrl *tmpcbh;
CCodeMisc *lb,*lb_done;
@ -534,7 +534,7 @@ U0 ParseFor(CCompCtrl *cc,I64 try_cnt)
if (cc->token!='(')
LexExcept(cc,"Expecting '(' at ");
Lex(cc);
ParseStatement(cc,try_cnt);
ParseStatement(cc,try_count);
lb=COCMiscNew(cc,CMT_LABEL);
ICAdd(cc,IC_LABEL,lb,0);
@ -549,7 +549,7 @@ U0 ParseFor(CCompCtrl *cc,I64 try_cnt)
COCPush(cc);
COCInit(cc);
if (cc->token!=')')
ParseStatement(cc,try_cnt,NULL,0);
ParseStatement(cc,try_count,NULL,0);
COCPush(cc);
tmpcbh=COCPopNoFree(cc);
COCPop(cc);
@ -557,7 +557,7 @@ U0 ParseFor(CCompCtrl *cc,I64 try_cnt)
LexExcept(cc,"Missing ')' at ");
Lex(cc);
ParseStatement(cc,try_cnt,lb_done);
ParseStatement(cc,try_count,lb_done);
COCAppend(cc,tmpcbh);
ICAdd(cc,IC_JMP,lb,0);
ICAdd(cc,IC_LABEL,lb_done,0);
@ -575,7 +575,7 @@ class CSwitchCase {
CSubSwitch *ss;
};
U0 ParseSwitch(CCompCtrl *cc,I64 try_cnt)
U0 ParseSwitch(CCompCtrl *cc,I64 try_count)
{
CSwitchCase *header=NULL,*tmps,*tmps1; //Leaks on except
CSubSwitch head,*tmpss; //Leaks on except
@ -594,12 +594,12 @@ U0 ParseSwitch(CCompCtrl *cc,I64 try_cnt)
QueueInit(&head);
head.last->lb_break=COCMiscNew(cc,CMT_LABEL);
head.last->lb_break->use_cnt++;
head.last->lb_break->use_count++;
lb_dft=COCMiscNew(cc,CMT_LABEL);
lb_dft->use_cnt++;
lb_dft->use_count++;
mc_jt=COCMiscNew(cc,CMT_JMP_TABLE);
mc_jt->begin=COCMiscNew(cc,CMT_LABEL);
mc_jt->begin->use_cnt++;
mc_jt->begin->use_count++;
if (!ParseExpression(cc,NULL,FALSE))
throw('Compiler');
tmpi_sub=ICAdd(cc,IC_IMM_I64,0,cmp.internal_types[RT_I64]);
@ -632,7 +632,7 @@ sw_cont:
tmpss=MAlloc(sizeof(CSubSwitch));
QueueInsert(tmpss,head.last);
head.last->lb_break=COCMiscNew(cc,CMT_LABEL);
head.last->lb_break->use_cnt++;
head.last->lb_break->use_count++;
lb_fwd_case=COCMiscNew(cc,CMT_LABEL);
tmpi_jmp=ICAdd(cc,IC_JMP,lb_fwd_case,0);
@ -656,7 +656,7 @@ sw_cont:
}
goto sw_cont;
default:
ParseStatement(cc,try_cnt);
ParseStatement(cc,try_count);
}
}
break;
@ -668,7 +668,7 @@ sw_cont:
Lex(cc);
lb_entry=COCMiscNew(cc,CMT_LABEL);
ICAdd(cc,IC_LABEL,lb_entry,0);
lb_entry->use_cnt++;
lb_entry->use_count++;
if (head.next!=&head) {
tmpss=head.next;
while (tmpss!=&head) {
@ -739,7 +739,7 @@ sw_cont:
dft_found=TRUE;
break;
default:
ParseStatement(cc,try_cnt,head.last->lb_break);
ParseStatement(cc,try_count,head.last->lb_break);
}
}
sw_sub_end:
@ -839,7 +839,7 @@ U0 ParseStreamBlk(CCompCtrl *cc)
Lex(cc); //Skip '}'
}
U0 ParseTryBlk(CCompCtrl *cc,I64 try_cnt)
U0 ParseTryBlk(CCompCtrl *cc,I64 try_count)
{
CCodeMisc *lb_catch,*lb_done,*lb_untry;
CHashClass *tmpc=cmp.internal_types[RT_PTR];
@ -859,7 +859,7 @@ U0 ParseTryBlk(CCompCtrl *cc,I64 try_cnt)
ICAdd(cc,IC_GET_LABEL,lb_untry,tmpc,ICF_PUSH_RES);
ICAdd(cc,IC_GET_LABEL,lb_catch,tmpc,ICF_PUSH_RES);
if (Bt(&tmp_try->flags,Cf_EXTERN)) {
cc->abs_cnts.externs++;
cc->abs_counts.externs++;
if (cc->flags&CCF_AOT_COMPILE)
ICAdd(cc,IC_CALL_IMPORT,tmp_try,tmpc);
else
@ -874,12 +874,12 @@ U0 ParseTryBlk(CCompCtrl *cc,I64 try_cnt)
ICAdd(cc,IC_CALL_END,0,tmpc);
ICAdd(cc,IC_END_EXP,0,0,ICF_RES_NOT_USED);
ParseStatement(cc,try_cnt+1);
ParseStatement(cc,try_count+1);
ICAdd(cc,IC_LABEL,lb_untry,0);
ICAdd(cc,IC_CALL_START,0,0);
if (Bt(&tmp_untry->flags,Cf_EXTERN)) {
cc->abs_cnts.externs++;
cc->abs_counts.externs++;
if (cc->flags&CCF_AOT_COMPILE)
ICAdd(cc,IC_CALL_IMPORT,tmp_untry,tmpc);
else
@ -896,12 +896,12 @@ U0 ParseTryBlk(CCompCtrl *cc,I64 try_cnt)
Lex(cc);
ICAdd(cc,IC_LABEL,lb_catch,0);
ParseStatement(cc,try_cnt+1);
ParseStatement(cc,try_count+1);
ICAdd(cc,IC_RET,0,tmpc);
ICAdd(cc,IC_LABEL,lb_done,0);
}
Bool ParseStatement(CCompCtrl *cc,I64 try_cnt=0,
Bool ParseStatement(CCompCtrl *cc,I64 try_count=0,
CCodeMisc *lb_break=NULL,I64 cmp_flags=CMPF_PRS_SEMICOLON)
{
I64 i,fsp_flags=0;
@ -923,7 +923,7 @@ Bool ParseStatement(CCompCtrl *cc,I64 try_cnt=0,
if (cc->token=='{') {
Lex(cc);
while (cc->token!='}' && cc->token!=TK_EOF)
ParseStatement(cc,try_cnt,lb_break);
ParseStatement(cc,try_count,lb_break);
if (cc->lex_include_stk==cc->fun_lex_file)
cc->max_line=cc->lex_include_stk->line_num;
if (Lex(cc)!=',') goto sm_done;
@ -963,27 +963,27 @@ Bool ParseStatement(CCompCtrl *cc,I64 try_cnt=0,
start:
Lex(cc);
case KW_LOCK:
cc->lock_cnt++;
ParseStatement(cc,try_cnt);
cc->lock_cnt--;
cc->lock_count++;
ParseStatement(cc,try_count);
cc->lock_count--;
break;
case KW_TRY:
ParseTryBlk(cc,try_cnt);
ParseTryBlk(cc,try_count);
break;
case KW_IF:
ParseIf(cc,try_cnt,lb_break);
ParseIf(cc,try_count,lb_break);
break;
case KW_FOR:
ParseFor(cc,try_cnt);
ParseFor(cc,try_count);
break;
case KW_WHILE:
ParseWhile(cc,try_cnt);
ParseWhile(cc,try_count);
break;
case KW_DO:
ParseDoWhile(cc,try_cnt);
ParseDoWhile(cc,try_count);
break;
case KW_SWITCH:
ParseSwitch(cc,try_cnt);
ParseSwitch(cc,try_count);
break;
end:
end:
@ -1089,12 +1089,12 @@ sm_import:
case KW_RETURN:
if (!cc->htc.fun)
LexExcept(cc,"Not in fun. Can't return a val ");
if (try_cnt) {
if (try_count) {
tmp_untry=HashFind("SysUntry",
cc->htc.hash_table_lst,HTT_FUN);
for (i=0;i<try_cnt;i++) {
for (i=0;i<try_count;i++) {
if (Bt(&tmp_untry->flags,Cf_EXTERN)) {
cc->abs_cnts.externs++;
cc->abs_counts.externs++;
if (cc->flags&CCF_AOT_COMPILE)
ICAdd(cc,IC_CALL_IMPORT,
tmp_untry,cmp.internal_types[RT_PTR]);
@ -1126,7 +1126,7 @@ sm_import:
g_lb->str=cc->cur_str;
cc->cur_str=NULL;
}
g_lb->use_cnt++;
g_lb->use_count++;
ICAdd(cc,IC_JMP,g_lb,0);
Lex(cc);
goto sm_semicolon;

View File

@ -29,7 +29,7 @@ U0 ParseVarInit(CCompCtrl *cc,U8 **_dst,CHashClass *tmpc,CArrayDim *tmpad,
LexExcept(cc,"Missing '}' at ");
Lex(cc);
} else {
if (tmpc->ptr_stars_cnt==1 &&
if (tmpc->ptr_stars_count==1 &&
((tmpc-1)->raw_type==RT_I8 || (tmpc-1)->raw_type==RT_U8) &&
!tmpad && cc->token==TK_STR)
is_str=TRUE;
@ -123,20 +123,20 @@ class CVI2
U0 ParseVarInit2(CCompCtrl *cc,U8 **_dst,CHashClass *tmpc,
CArrayDim *tmpad,U8 *data_addr_rip,U8 **_base,Bool data_heap,I64 pass)
{
I64 i,j,cnt;
I64 i,j,count;
U8 *st,*_b;
CVI2 head,*tmpvi,*tmpvi1;
CArrayDim *tmpad1;
tmpc=OptClassFwd(tmpc);
if (tmpad1=tmpad->next) {
if (!tmpc->ptr_stars_cnt &&
if (!tmpc->ptr_stars_count &&
(tmpc->raw_type==RT_I8 || tmpc->raw_type==RT_U8) &&
cc->token==TK_STR) {
LexPopNoRestore(cc);
st=LexExtStr(cc,&i);
if (tmpad1->cnt<0) {//[]
tmpad1->cnt=i;
tmpad->total_cnt=i*tmpad1->total_cnt;
if (tmpad1->count<0) {//[]
tmpad1->count=i;
tmpad->total_count=i*tmpad1->total_count;
Free(*_base);
if (data_heap)
*_base=MAlloc(i);
@ -145,8 +145,8 @@ U0 ParseVarInit2(CCompCtrl *cc,U8 **_dst,CHashClass *tmpc,
MemCpy(*_base,st,i);
*_dst=*_base+i;
} else {
MemCpy(*_dst,st,tmpad1->cnt);
*_dst+=tmpad1->cnt;
MemCpy(*_dst,st,tmpad1->count);
*_dst+=tmpad1->count;
}
Free(st);
LexPush(cc);
@ -156,23 +156,23 @@ U0 ParseVarInit2(CCompCtrl *cc,U8 **_dst,CHashClass *tmpc,
LexPush(cc);
Lex(cc);
}
if (tmpad1->cnt<0) {//[]
if (tmpad1->count<0) {//[]
QueueInit(&head);
cnt=0;
count=0;
while (cc->token!='}') {
tmpvi=MAlloc(offset(CVI2.base)+tmpad1->total_cnt*tmpc->size);
tmpvi=MAlloc(offset(CVI2.base)+tmpad1->total_count*tmpc->size);
_b=&tmpvi->base;
ParseVarInit2(cc,&_b,tmpc,tmpad1,data_addr_rip,_base,data_heap,pass);
QueueInsert(tmpvi,head.last);
if (cc->token==',')
Lex(cc);
cnt++;
count++;
}
Lex(cc); //skip '}'
tmpad1->cnt=cnt;
tmpad->total_cnt=cnt*tmpad1->total_cnt;
j=tmpad1->total_cnt*tmpc->size;
i=cnt*j;
tmpad1->count=count;
tmpad->total_count=count*tmpad1->total_count;
j=tmpad1->total_count*tmpc->size;
i=count*j;
Free(*_base);
if (data_heap)
*_base=_b=MAlloc(i);
@ -188,9 +188,9 @@ U0 ParseVarInit2(CCompCtrl *cc,U8 **_dst,CHashClass *tmpc,
}
*_dst=_b;
} else {
for (i=0;i<tmpad1->cnt;i++) {
for (i=0;i<tmpad1->count;i++) {
ParseVarInit2(cc,_dst,tmpc,tmpad1,data_addr_rip,_base,data_heap,pass);
if (tmpad1->cnt>1 && cc->token==',')
if (tmpad1->count>1 && cc->token==',')
Lex(cc);
}
if (cc->token=='}')
@ -249,8 +249,8 @@ U0 ParseArrayDims(CCompCtrl *cc,I64 mode,CArrayDim *dim)
CArrayDim *tmpad,*tmpad1;
I64 j;
dim->next=NULL;
dim->cnt=0;
dim->total_cnt=1;
dim->count=0;
dim->total_count=1;
tmpad1=&dim->next;
if (cc->token=='[') {
if (mode.u8[1]==PRS1B_FUN_ARG)
@ -266,7 +266,7 @@ U0 ParseArrayDims(CCompCtrl *cc,I64 mode,CArrayDim *dim)
tmpad->next=NULL;
tmpad1=&dim;
do {
tmpad1->total_cnt*=j;
tmpad1->total_count*=j;
if (!tmpad1->next) {
tmpad1->next=tmpad;
break;
@ -274,8 +274,8 @@ U0 ParseArrayDims(CCompCtrl *cc,I64 mode,CArrayDim *dim)
tmpad1=tmpad1->next;
} while (tmpad1);
tmpad1=tmpad;
tmpad->cnt=j;
tmpad->total_cnt=1;
tmpad->count=j;
tmpad->total_count=1;
if (cc->token!=']')
LexExcept(cc,"Missing ']' at ");
} while (Lex(cc)=='[');
@ -286,7 +286,7 @@ CHashClass *ParseType(CCompCtrl *cc,CHashClass **_tmpc1,
I64 *_mode,CMemberLst *tmpm,U8 **_ident,CHashFun **_fun_ptr,
CHashExport **_tmpex,CArrayDim *tmpad,I64 fsp_flags)
{
I64 k,ptr_stars_cnt,mode=*_mode;
I64 k,ptr_stars_count,mode=*_mode;
CHashClass *tmpc1=*_tmpc1,*tmpc2;
CHashFun *fun_ptr=NULL;
CHashExport *tmpex=NULL;
@ -295,7 +295,7 @@ CHashClass *ParseType(CCompCtrl *cc,CHashClass **_tmpc1,
if (!tmpc1 || !(tmpc1->type & (HTT_CLASS|HTT_INTERNAL_TYPE)))
LexExcept(cc,"Invalid class at ");
ptr_stars_cnt=0;
ptr_stars_count=0;
while (cc->token=='*') {
if (mode.u8[1]) {
LexPopNoRestore(cc);
@ -303,7 +303,7 @@ CHashClass *ParseType(CCompCtrl *cc,CHashClass **_tmpc1,
}
Lex(cc);
tmpc1++;
if (++ptr_stars_cnt>PTR_STARS_NUM)
if (++ptr_stars_count>PTR_STARS_NUM)
LexExcept(cc,"Too many *'s at ");
}
@ -321,13 +321,13 @@ CHashClass *ParseType(CCompCtrl *cc,CHashClass **_tmpc1,
if (cc->token=='(') {
if (Lex(cc)!='*')
LexExcept(cc,"Expecting '*' at ");
ptr_stars_cnt=1; //fun_ptr
ptr_stars_count=1; //fun_ptr
while (Lex(cc)=='*')
ptr_stars_cnt++; //fun_ptr
if (ptr_stars_cnt>PTR_STARS_NUM)
ptr_stars_count++; //fun_ptr
if (ptr_stars_count>PTR_STARS_NUM)
LexExcept(cc,"Too many *'s at ");
} else
ptr_stars_cnt=-1; //fun_ptr
ptr_stars_count=-1; //fun_ptr
if (_ident) {
if (cc->token==TK_IDENT) {
@ -347,19 +347,19 @@ CHashClass *ParseType(CCompCtrl *cc,CHashClass **_tmpc1,
}
}
if (ptr_stars_cnt>=0) { //fun_ptr
if (ptr_stars_count>=0) { //fun_ptr
if (cc->token!=')')
LexExcept(cc,"Missing ')' at ");
if (Lex(cc)!='(')
LexExcept(cc,"Expecting '(' at ");
fun_ptr=ParseFunJoin(cc,tmpc1,NULL,fsp_flags)+ptr_stars_cnt;
tmpc1=cmp.internal_types[RT_PTR]+ptr_stars_cnt;
fun_ptr=ParseFunJoin(cc,tmpc1,NULL,fsp_flags)+ptr_stars_count;
tmpc1=cmp.internal_types[RT_PTR]+ptr_stars_count;
}
ParseArrayDims(cc,mode,tmpad);
tmpc2=OptClassFwd(tmpc1);
if (tmpc2->ptr_stars_cnt) {
tmpc2-=tmpc2->ptr_stars_cnt;
if (tmpc2->ptr_stars_count) {
tmpc2-=tmpc2->ptr_stars_count;
if (tmpc2->type&HTT_INTERNAL_TYPE && !tmpc2->size)
LexWarn(cc,"use \"U8 *\" instead of \"U0 *\" at ");
}
@ -391,11 +391,11 @@ U0 ParseDotDotDot(CCompCtrl *cc,CHashFun *tmpf,I64 _reg)
tmpm->flags=MLF_DOT_DOT_DOT;
tmpm->member_class=cmp.internal_types[RT_I64];
tmpm->str=StrNew("argv");
tmpm->dim.total_cnt=127; //arbitrary
tmpm->dim.total_count=127; //arbitrary
tmpm->dim.next=tmpad=MAlloc(sizeof(CArrayDim));
tmpad->next=NULL;
tmpad->cnt=127; //arbitrary
tmpad->total_cnt=1;
tmpad->count=127; //arbitrary
tmpad->total_count=1;
tmpm->offset=tmpf->size;
tmpm->size=8; //Close enough
tmpf->size+=8;//Close enough
@ -526,10 +526,10 @@ pvl_restart3:
MemberAdd(cc,tmpm,tmpc,mode.u8[1]);
else
MemberAdd(cc,tmpm,tmpc,PRS1B_NULL);
tmpc->member_cnt++;
tmpc->member_count++;
tmpc2=tmpm->member_class;
i=tmpc2->size*tmpm->dim.total_cnt;
i=tmpc2->size*tmpm->dim.total_count;
switch (mode.u8[1]) {
case PRS1B_STATIC_LOCAL_VAR:
if (i<0) {
@ -562,7 +562,7 @@ pvl_restart3:
Lex(cc); //skip =
ParseStaticInit(cc,tmpm,1);
LexPopNoRestore(cc);
i=tmpc2->size*tmpm->dim.total_cnt;
i=tmpc2->size*tmpm->dim.total_count;
k=(i+7)&~7;
if (cc->flags&CCF_AOT_COMPILE) {
k>>=3;
@ -581,7 +581,7 @@ pvl_restart3:
for (k=0;k<i;k++)
AOTStoreCodeU8At(cc,tmpm->static_data_rip+k,
tmpm->static_data[k]);
tmpm->use_cnt=0;
tmpm->use_count=0;
cc->flags|=CCF_DONT_MAKE_RES;
}
if (cc->flags&CCF_AOT_COMPILE)
@ -611,7 +611,7 @@ pvl_restart3:
Lex(cc);
if (!ParseExpression(cc,NULL,TRUE))
throw('Compiler');
tmpm->use_cnt=0;
tmpm->use_count=0;
cc->flags|=CCF_DONT_MAKE_RES;
} else
LexPopNoRestore(cc);

View File

@ -1,17 +1,17 @@
I64 InstEntriesCompare(CInst *tmpins1,CInst *tmpins2)
{
I64 i1,i2,j=0,res=0,oc_cnt1=tmpins1->opcode_cnt,oc_cnt2=tmpins2->opcode_cnt;
I64 i1,i2,j=0,res=0,oc_count1=tmpins1->opcode_count,oc_count2=tmpins2->opcode_count;
if (tmpins1->flags&IEF_STI_LIKE)
oc_cnt1--;
oc_count1--;
if (tmpins2->flags&IEF_STI_LIKE)
oc_cnt2--;
oc_count2--;
while (TRUE) {
if (j<oc_cnt1 && j<oc_cnt2) {
if (j<oc_count1 && j<oc_count2) {
if (res=tmpins1->opcode[j]-tmpins2->opcode[j])
return res;
j++;
} else {
if (res=oc_cnt1-oc_cnt2)
if (res=oc_count1-oc_count2)
return res;
if (tmpins1->flags&IEF_STI_LIKE && tmpins2->flags&IEF_STI_LIKE)
@ -65,7 +65,7 @@ U0 DumpUAsmTables()
CInst *InstEntryFind(U8 *rip,I64 opsize,I64 seg_size)
{//Binary Search
I64 i,j,n,m,k,arg1,arg2,o1,o2,oc_cnt;
I64 i,j,n,m,k,arg1,arg2,o1,o2,oc_count;
CInst *tmpins,**table;
i=0;
if (seg_size==64) {
@ -84,12 +84,12 @@ CInst *InstEntryFind(U8 *rip,I64 opsize,I64 seg_size)
while (TRUE) { //ief_compare_start
arg1=tmpins->arg1;
arg2=tmpins->arg2;
oc_cnt=tmpins->opcode_cnt;
oc_count=tmpins->opcode_count;
if (tmpins->flags&IEF_STI_LIKE)
oc_cnt--;
if (n<oc_cnt) {
oc_count--;
if (n<oc_count) {
o1=rip[n];
if (n==tmpins->opcode_cnt-1 && tmpins->flags & IEF_PLUS_OPCODE)
if (n==tmpins->opcode_count-1 && tmpins->flags & IEF_PLUS_OPCODE)
o1&=-8;
o2=tmpins->opcode[n++];
if (m=o1-o2)
@ -132,11 +132,11 @@ CInst *InstEntryFind(U8 *rip,I64 opsize,I64 seg_size)
m=1;
goto ief_compare_done;
case SV_I_REG:
m=rip[n]>>3-tmpins->opcode[tmpins->opcode_cnt-1]>>3;
m=rip[n]>>3-tmpins->opcode[tmpins->opcode_count-1]>>3;
goto ief_compare_done;
case SV_STI_LIKE:
if (!(m=rip[n]>>3-tmpins->opcode[tmpins->opcode_cnt-1]>>3))
m=rip[n]-tmpins->opcode[tmpins->opcode_cnt-1];
if (!(m=rip[n]>>3-tmpins->opcode[tmpins->opcode_count-1]>>3))
m=rip[n]-tmpins->opcode[tmpins->opcode_count-1];
goto ief_compare_done;
case SV_R_REG:
case SV_NONE:
@ -209,7 +209,7 @@ U0 UAsmHashLoad()
while (tmph) {
if (tmph->type==HTT_OPCODE && !(tmph->oc_flags&OCF_ALIAS)) {
tmpins=&tmph->ins;
for (k=0;k<tmph->inst_entry_cnt;k++) {
for (k=0;k<tmph->inst_entry_count;k++) {
uasm.table_16_32_entries++;
if (!(tmpins->flags&IEF_NOT_IN_64_BIT))
uasm.table_64_entries++;
@ -228,7 +228,7 @@ U0 UAsmHashLoad()
while (tmph) {
if (tmph->type==HTT_OPCODE && !(tmph->oc_flags&OCF_ALIAS)) {
tmpins=&tmph->ins;
for (k=0;k<tmph->inst_entry_cnt;k++) {
for (k=0;k<tmph->inst_entry_count;k++) {
uasm.table_16_32[j1++]=tmpins;
if (!(tmpins->flags&IEF_NOT_IN_64_BIT))
uasm.table_64[j2++]=tmpins;
@ -341,7 +341,7 @@ U0 Ui(U8 *buf,U8 **_rip,I64 seg_size=64,I64 *_jmp_dst=NULL,Bool just_ins=FALSE)
tmpins=tmpins2;
}
rip+=tmpins->opcode_cnt;
rip+=tmpins->opcode_count;
tmpo=tmpins(U8 *)-tmpins->ins_entry_num*sizeof(CInst)
-offset(CHashOpcode.ins);
if (just_ins)
@ -367,7 +367,7 @@ U0 Ui(U8 *buf,U8 **_rip,I64 seg_size=64,I64 *_jmp_dst=NULL,Bool just_ins=FALSE)
if (tmpins->flags & IEF_PLUS_OPCODE) {
rip--;
RM1=*rip++ - tmpins->opcode[tmpins->opcode_cnt-1]+REX_b;
RM1=*rip++ - tmpins->opcode[tmpins->opcode_count-1]+REX_b;
ptr=NULL;
if (ARGT_R8<=arg1<=ARGT_R64) {
if (arg1_size==8) {
@ -582,7 +582,7 @@ U0 Ui(U8 *buf,U8 **_rip,I64 seg_size=64,I64 *_jmp_dst=NULL,Bool just_ins=FALSE)
break;
case ARGT_STI:
rip--;
CatPrint(arg1_st,"%Z",*rip++ - tmpins->opcode[tmpins->opcode_cnt-1],
CatPrint(arg1_st,"%Z",*rip++ - tmpins->opcode[tmpins->opcode_count-1],
"ST_FSTK_REGS");
break;
}
@ -621,7 +621,7 @@ U0 Ui(U8 *buf,U8 **_rip,I64 seg_size=64,I64 *_jmp_dst=NULL,Bool just_ins=FALSE)
break;
case ARGT_STI:
rip--;
CatPrint(arg2_st,"%Z",*rip++ -tmpins->opcode[tmpins->opcode_cnt-1],
CatPrint(arg2_st,"%Z",*rip++ -tmpins->opcode[tmpins->opcode_count-1],
"ST_FSTK_REGS");
break;
}
@ -650,14 +650,14 @@ U0 Ui(U8 *buf,U8 **_rip,I64 seg_size=64,I64 *_jmp_dst=NULL,Bool just_ins=FALSE)
*_rip=rip;
}
U8 *U(U8 *rip,I64 cnt=20,I64 seg_size=64)
U8 *U(U8 *rip,I64 count=20,I64 seg_size=64)
{//Unassembles a num of insts.
I64 i;
U8 buf[1024];
if (seg_size==16)
PrintWarn("16-bit unassembly is not well supported.\n");
"$$HL,1$$";
for (i=0;i<cnt;i++) {
for (i=0;i<count;i++) {
Ui(buf,&rip,seg_size);
"%s",buf;
}
@ -665,10 +665,10 @@ U8 *U(U8 *rip,I64 cnt=20,I64 seg_size=64)
return rip;
}
I64 Un(U8 *rip,I64 cnt=0x80,I64 seg_size=64)
I64 Un(U8 *rip,I64 count=0x80,I64 seg_size=64)
{//Unassembles a num of bytes
I64 i=0;
U8 buf[1024],*end_rip=rip(I64)+cnt;
U8 buf[1024],*end_rip=rip(I64)+count;
if (seg_size==16)
PrintWarn("16-bit unassembly is not well supported.\n");
"$$HL,1$$";

View File

@ -377,7 +377,7 @@ $FG,5$$TX+CX,"Test"$$FG$
* $LK,"DriveMap",A="MN:DriveMap"$() in $LK,"MountFile",A="MN:MountFile"$().
* Return ress for $LK,"GrBlot",A="MN:GrBlot"$, $LK,"GrRect",A="MN:GrRect"$, $LK,"GrPutChar",A="MN:GrPutChar"$?
* Collision cnts for $LK,"GrBlot",A="MN:GrBlot"$, $LK,"GrRect",A="MN:GrRect"$, $LK,"GrPutChar",A="MN:GrPutChar"$?
* Collision counts for $LK,"GrBlot",A="MN:GrBlot"$, $LK,"GrRect",A="MN:GrRect"$, $LK,"GrPutChar",A="MN:GrPutChar"$?
* $LK,"GetStr",A="MN:GetStr"$() or $LK,"GetChar",A="MN:GetChar"$() in $LK,"OSInstall",A="FI:::/Misc/OSInstall.HC"$ didn't like focus change.

View File

@ -228,7 +228,7 @@ U0 MakeStaffDistro()
Drive('C');
}
I64 UpdateLineCnts()
I64 UpdateLineCounts()
{
I64 res;
@ -301,8 +301,8 @@ U0 TOSRegen2()
WinMax;
DiskCheckAll;
TOSProgress("Update Line Cnts");
UpdateLineCnts;
TOSProgress("Update Line Counts");
UpdateLineCounts;
TOSProgress("Copy C to D");
TOSCopyDrive('C','D');
@ -362,7 +362,7 @@ U0 TOSRegen2()
TOSProgress("Done");
SettingsPop;
"F2(\"/Home\") Cnt\t:%d\n",slash_home;
"F2(\"/Home\") Count\t:%d\n",slash_home;
"Elapsed Time\t:%5.3fs\n",tS-progress4_t0;
ProgressBarsRst("ZenithOS/TOSRegen");
}

View File

@ -99,16 +99,16 @@ public U0 DiskCheckAll()
public CDoc *DC2Doc(CDC *dc,I64 dx=0,I64 dy=0,I64 *_total_score=NULL)
{//Use OCR to make a text DolDoc from CDC.
U8 byte_bit_cnts[256];
U8 byte_bit_counts[256];
I64 i,j,*ptr,row,col,ch,best_ch,score,best_score,
cur_char_image,diff_image,total_score=0;
CDoc *doc=DocNew;
MemSet(byte_bit_cnts,0,sizeof(byte_bit_cnts));
MemSet(byte_bit_counts,0,sizeof(byte_bit_counts));
for (i=0;i<256;i++)
for (j=0;j<7;j++)
if (Bt(&i,j))
byte_bit_cnts[i]++;
byte_bit_counts[i]++;
for (row=0;row<dc->height/FONT_HEIGHT;row++) {
for (col=0;col<dc->width/FONT_WIDTH;col++) {
@ -126,7 +126,7 @@ public CDoc *DC2Doc(CDC *dc,I64 dx=0,I64 dy=0,I64 *_total_score=NULL)
diff_image=*ptr++ ^ cur_char_image;
score=0;
for (i=0;i<8;i++)
score+=byte_bit_cnts[diff_image.u8[i]];
score+=byte_bit_counts[diff_image.u8[i]];
if (score<best_score) {
best_score=score;
best_ch=ch;

View File

@ -35,7 +35,7 @@ _BEEPS::
//_extern binds a asm sym to a function.
//My convention is to put an underscore
//on C callable asm routines.
_extern _BEEPS U0 Beeps(I64 cnt);
_extern _BEEPS U0 Beeps(I64 count);
I64 AsmAndC1()
{
@ -62,7 +62,7 @@ I64 AsmAndC1()
PUSH RAX
CALL Snd
MOV RCX,cnts.time_stamp_freq>>3 //JIT Const. Simple delay loop
MOV RCX,counts.time_stamp_freq>>3 //JIT Const. Simple delay loop
@@10: LOOP @@10
POP RCX

View File

@ -6,7 +6,7 @@ it from the cmd line.
*/
//This is to demo glbl var access.
//Glbs defined elsewhere can accessed too, like cnts.jiffies.
//Glbs defined elsewhere can accessed too, like counts.jiffies.
I64 glbl_ona=Freq2Ona(400),glbl_ona_step=10,glbl_ona_base=Freq2Ona(100);
asm {
@ -24,7 +24,7 @@ _BEEPS2::
MOV RBP,RSP
MOV RCX,U64 SF_ARG1[RBP] //$LK,"SF_ARG1",A="FF:::/Kernel/KernelA.HH,SF_ARG1"$
PUSH U64 [&cnts.jiffies]
PUSH U64 [&counts.jiffies]
@@05: PUSH RCX
//U0 $LK,"Beep",A="MN:Beep"$(I8 ona=62,Bool busy=FALSE)
@ -40,7 +40,7 @@ _BEEPS2::
POP RSI
POP RAX
SUB RAX,U64 [&cnts.jiffies]
SUB RAX,U64 [&counts.jiffies]
NEG RAX
CALL PUT_HEX_U64
MOV RAX,'\n'
@ -52,7 +52,7 @@ _BEEPS2::
//My convention is to put an underscore
//on C callable asm routines.
_extern _BEEPS2 U0 Beeps2(I64 cnt);
_extern _BEEPS2 U0 Beeps2(I64 count);
U0 AsmAndC2()
{
@ -73,7 +73,7 @@ U0 AsmAndC2()
ADD RAX,U64 [&glbl_ona_base] //Intentionally evaluated at run time
PUSH RAX
CALL &Snd //We can skip IMPORT with & if JIT compiling.
MOV RCX,cnts.time_stamp_freq>>3 //JIT Const. Simple delay loop.
MOV RCX,counts.time_stamp_freq>>3 //JIT Const. Simple delay loop.
@@10: LOOP @@10
POP RCX

View File

@ -14,7 +14,7 @@ U0 AsmAndC3()
STC
ADC AL,0 //Round-about way to make the not-special constant, 0x42.
CALL PUT_HEX_U8
MOV RCX,cnts.time_stamp_freq>>5 //JIT Const. Simple delay loop.
MOV RCX,counts.time_stamp_freq>>5 //JIT Const. Simple delay loop.
@@1: LOOP @@1
'\n';
}

View File

@ -1,10 +1,10 @@
//Shows the $LK,"Carry",A="MN:Carry"$ function. It holds the CPU carry flag.
//$LK,"U",A="MN:U"$() Unassemble to make sure it is right.
U0 BigCnt()
U0 BigCount()
{
U64 lo=0,hi=0;
"BigCnt\n";
"BigCount\n";
while (hi<0x10) {
lo+=1<<58;
hi+=Carry;
@ -12,7 +12,7 @@ U0 BigCnt()
}
}
BigCnt;
BigCount;
U0 BigShift()
{

View File

@ -29,7 +29,7 @@ ClickCallBack;
I64 MyLeftCB2(CDoc *,CDocEntry *)
{
return cnts.jiffies;
return counts.jiffies;
}
U0 PopUpJiffiesCallBack(I64 i)

View File

@ -14,7 +14,7 @@ output $LK,"Silent",A="MN:Silent"$().
U0 UnusedDefineScan()
{
CDoc *old_put_doc,*old_display_doc,*doc;
I64 i,cnt=0;
I64 i,count=0;
CHashTable *table;
CHash *tmph;
CDocEntry *doc_e,*doc_e2;
@ -27,7 +27,7 @@ U0 UnusedDefineScan()
tmph=table->body[i];
while (tmph) {
if (tmph->type&HTT_DEFINE_STR)
cnt++;
count++;
tmph=tmph->next;
}
}
@ -35,7 +35,7 @@ U0 UnusedDefineScan()
}
progress1=0;
progress1_max=cnt;
progress1_max=count;
StrCpy(progress1_desc,"Define Scan");
table=Fs->hash_table;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -4,7 +4,7 @@ RegDft("ZenithOS/RawHide","F64 best_score=9999;\n");
RegExe("ZenithOS/RawHide");
F64 t0,tf;
I64 outside_cnt;
I64 outside_count;
#define MAP_WIDTH 1000
#define MAP_HEIGHT 1000
@ -257,7 +257,7 @@ U0 DrawIt(CTask *task,CDC *dc)
}
GrPrint(dc,-task->scroll_x,-task->scroll_y,
"Outside:%03d Time:%7.2fs Best:%7.2fs",
outside_cnt,t,best_score);
outside_count,t,best_score);
}
U0 BuddySel(I64 i)
@ -328,8 +328,8 @@ Bool CheckMap(I64 x,I64 y)
U0 AnimateTask(CTask *parent)
{
I64 i,cx,cy,cursor_x,cursor_y,dd,ddx,ddy,cnt,max_speed=I64_MAX,updates=0,
my_outside_cnt;
I64 i,cx,cy,cursor_x,cursor_y,dd,ddx,ddy,count,max_speed=I64_MAX,updates=0,
my_outside_count;
F64 f,d,dx,dy,s,stress;
Animal *tmpa,*tmpa1;
while (TRUE) {
@ -338,8 +338,8 @@ U0 AnimateTask(CTask *parent)
cy=(MAP_HEIGHT-parent->pix_height)/2;
cursor_x=ms.pos.x+cx-parent->pix_left-parent->scroll_x;
cursor_y=ms.pos.y+cy-parent->pix_top -parent->scroll_y;
cnt=0;stress=0;
my_outside_cnt=0;
count=0;stress=0;
my_outside_count=0;
if (cursor_x<FENCE_WIDTH && cursor_y<FENCE_HEIGHT)
gate_t=tS;
RedrawGate;
@ -409,17 +409,17 @@ U0 AnimateTask(CTask *parent)
tmpa->y -=tmpa->dy;
tmpa->dy=-tmpa->dy;
}
cnt++;
count++;
if (tmpa->x>>32>=FENCE_WIDTH || tmpa->y>>32>=FENCE_HEIGHT)
my_outside_cnt++;
my_outside_count++;
}
}
outside_cnt=my_outside_cnt;
outside_count=my_outside_count;
if (!(updates&15))
RiverDropsNext(parent);
if (!tf && !outside_cnt) {
if (!tf && !outside_count) {
tf=tS;
music.mute=TRUE;
Snd(86);Sleep(200);Snd;Sleep(100);
@ -432,8 +432,8 @@ U0 AnimateTask(CTask *parent)
updates++;
if (cnt)
stress/=cnt;
if (count)
stress/=count;
else
stress=0;
if (stress>100.0) {
@ -501,7 +501,7 @@ U0 ReInit()
a[i].frame0=RandU16&3;
BuddySel(i);
}
outside_cnt=ANIMALS_NUM;
outside_count=ANIMALS_NUM;
gate_t=0;
gate_é=0;
t0=tS;

Binary file not shown.

View File

@ -148,7 +148,7 @@ class Bird
Bird *next,*last;
CD3I64 p;
F64 é;
} b_head[mp_cnt];
} b_head[mp_count];
class Obj
{
@ -162,7 +162,7 @@ class Panel
{//Polygon or Obj
Panel *next;
CD3I32 *pts;
I64 cnt;
I64 count;
U16 update,num_sides;
CColorROPU32 color;
Obj *next_obj,*last_obj;
@ -274,8 +274,8 @@ U0 MPDoPanels(CTask *task)
Panel *tmpp,*start_ptr=NULL,*end_ptr=NULL;
CD3I32 *poly;
Obj *tmpo;
lo=Gs->num*(MAP_HEIGHT-1)/mp_cnt;
hi=(Gs->num+1)*(MAP_HEIGHT-1)/mp_cnt;
lo=Gs->num*(MAP_HEIGHT-1)/mp_count;
hi=(Gs->num+1)*(MAP_HEIGHT-1)/mp_count;
for (threshold=8;threshold>=1;threshold--)
for (j=lo;j<hi;j++) {
for (i=0;i<MAP_WIDTH-1;i++) {
@ -438,8 +438,8 @@ for each spot.
MemSet(panels,0,sizeof(panels));
CalcNormals;
panel_head=NULL;
mp.init_not_done_flags=1<<mp_cnt-1;
for (i=0;i<mp_cnt;i++)
mp.init_not_done_flags=1<<mp_count-1;
for (i=0;i<mp_count;i++)
Spawn(&MPDoPanels,Fs,"Do Panels",i);
while (mp.init_not_done_flags)
Sleep(1);
@ -660,20 +660,20 @@ U0 MPDrawIt(CTask *task,CDC *dc)
xh2>>=1; yh2>>=1;
w_on_map=FALSE;
dd_old=I64_MAX;
for (strip_width=0;cnts.jiffies<update_jiffy_limit;strip_width++) {
for (strip_width=0;counts.jiffies<update_jiffy_limit;strip_width++) {
x1h=x1wa;
y1h=y1wa;
h_on_map=FALSE;
for (j=0;j<strip_height && cnts.jiffies<update_jiffy_limit;j++) {
for (j=0;j<strip_height && counts.jiffies<update_jiffy_limit;j++) {
x1=x1h>>8; y1=y1h>>8;
if (0<=x1<MAP_WIDTH && 0<=y1<MAP_HEIGHT) {
if ((tmpp=panels[y1][x1]) && tmpp->update!=update) {
tmpp->update=update;
if (tmpp->cnt>8*(1.1-Gs->idle_factor)) {
if (tmpp->count>8*(1.1-Gs->idle_factor)) {
dc->color=tmpp->color;
tmpp->cnt=GrFillPoly3(dc,tmpp->num_sides,tmpp->pts);
tmpp->count=GrFillPoly3(dc,tmpp->num_sides,tmpp->pts);
} else
tmpp->cnt++;
tmpp->count++;
tmpo=tmpp->next_obj;
while (tmpo!=&tmpp->next_obj) {
Sprite3(dc,tmpo->p.x,tmpo->p.y,tmpo->p.z,tmpo->img);
@ -859,7 +859,7 @@ U0 Core0Talons()
I64 i,xx,yy,elev,height,cx=Fs->pix_width>>1,cy=Fs->pix_height>>1;
F64 min_strip_width,tt;
update_jiffy_limit=cnts.jiffies+JIFFY_FREQ/40;
update_jiffy_limit=counts.jiffies+JIFFY_FREQ/40;
xx=x/(MAP_SCALE*COORDINATE_SCALE);
yy=y/(MAP_SCALE*COORDINATE_SCALE);
@ -887,13 +887,13 @@ U0 Core0Talons()
}
} else {
DCDepthBufRst(dc);
mp.update_not_done_flags=1<<mp_cnt-1;
mp.update_not_done_flags=1<<mp_count-1;
MPDrawIt(Fs,dc);
while (mp.update_not_done_flags)
Sleep(1);
min_strip_width=F64_MAX;
for (i=0;i<mp_cnt;i++)
for (i=0;i<mp_count;i++)
min_strip_width=Min(min_strip_width,32.0*mp.strip_width[i]/(i+32.0));
strip_height=ClampI64(
strip_height*Clamp(0.25*min_strip_width/strip_height,0.9,1.1),
@ -1028,7 +1028,7 @@ U0 AnimateTask(I64)
speed=Clamp(speed+(0.0005-0.0002*Abs(è)/(ã/4)),0.1,5.0);
}
for (i=0;i<mp_cnt;i++) {
for (i=0;i<mp_count;i++) {
tmpb=b_head[i].next;
while (tmpb!=&b_head[i]) {
tmpb->p.x+=10*ms/1000*MAP_SCALE*Cos(tmpb->é);
@ -1047,7 +1047,7 @@ U0 AnimateTask(I64)
U0 MPEnd()
{
update_jiffy_limit=0;
mp.app_not_done_flags=1<<mp_cnt-1-1;
mp.app_not_done_flags=1<<mp_count-1-1;
mp.app_done=TRUE;
//Wait for all cores to exit
while (mp.app_not_done_flags)
@ -1119,7 +1119,7 @@ U0 Init()
yy=y/(MAP_SCALE*COORDINATE_SCALE);
z+=elevations[yy][xx]*COORDINATE_SCALE;
for (i=0;i<mp_cnt;i++)
for (i=0;i<mp_count;i++)
QueueInit(&b_head[i]);
for (i=0;i<B_NUM;i++) {
@ -1129,10 +1129,10 @@ U0 Init()
tmpb->p.z=BIRD_ELEVATION*MAP_SCALE+
elevations[tmpb->p.y/MAP_SCALE][tmpb->p.x/MAP_SCALE];
tmpb->é=2*ã*Rand;
QueueInsert(tmpb,b_head[i%mp_cnt].last);
QueueInsert(tmpb,b_head[i%mp_count].last);
}
for (i=1;i<mp_cnt;i++)
for (i=1;i<mp_count;i++)
Spawn(&CoreAPTalonsTask,Fs,"AP Talons",i);
Fs->task_end_cb=&TaskEndCB;
game_t0=tS;
@ -1150,7 +1150,7 @@ U0 CleanUp()
Free(tmpp);
tmpp=tmpp1;
}
for (i=0;i<mp_cnt;i++) {
for (i=0;i<mp_count;i++) {
QueueDel(&b_head[i]);
QueueInit(&b_head[i]);
}

View File

@ -296,8 +296,8 @@ U0 InitTrack()
CoupleEnds;
tmpt=track_head.next;
for (i=0;i<mp_cnt;i++) {
j=(i+1)*track_head.last->num/mp_cnt+1;
for (i=0;i<mp_count;i++) {
j=(i+1)*track_head.last->num/mp_count+1;
track_start[i]=tmpt;
while (tmpt!=&track_head && tmpt->num!=j)
tmpt=tmpt->next;
@ -378,7 +378,7 @@ U0 MPUpdateWin(CDC *dc2)
}
dc->flags|=DCF_TRANSFORMATION;
for (i=Gs->num;i<BUSHES_NUM;i+=mp_cnt) {
for (i=Gs->num;i<BUSHES_NUM;i+=mp_count) {
x=b[i].p.x-c[0].p.x; y=b[i].p.y-c[0].p.y; z=b[i].p.z-c[0].p.z;
Mat4x4MulXYZ(r,&x,&y,&z);
if (z>0) {
@ -394,7 +394,7 @@ U0 MPUpdateWin(CDC *dc2)
dc->flags&=~(DCF_SYMMETRY|DCF_JUST_MIRROR);
}
}
for (i=Gs->num+1;i<CARS_NUM;i+=mp_cnt) {
for (i=Gs->num+1;i<CARS_NUM;i+=mp_count) {
tmpc=&c[i];
x=tmpc->p.x-c[0].p.x; y=tmpc->p.y-c[0].p.y; z=tmpc->p.z-c[0].p.z;
Mat4x4MulXYZ(r,&x,&y,&z);
@ -455,8 +455,8 @@ U0 DrawIt(CTask *task,CDC *dc)
GrFloodFill(dc,s*x+cx,15+HORIZON_DIP*Sin(dip_é));
}
mp_not_done_flags=1<<mp_cnt-1;
for (i=0;i<mp_cnt;i++)
mp_not_done_flags=1<<mp_count-1;
for (i=0;i<mp_count;i++)
JobQueue(&MPUpdateWin,dc,i);
while (mp_not_done_flags)
Yield;

View File

@ -99,7 +99,7 @@ U64 snow_x,snow_y,new_snow_mS;
CDC *snow_tile;
I64 king_x,king_y,king_mS,king_phase,
not_stopped_cnt;
not_stopped_count;
F64 king_timeout,king_é,t0,tf,door_open_t0;
I64 animate_mS,animate_phase;
@ -218,7 +218,7 @@ U0 DrawIt(CTask *task,CDC *dc)
}
dc->color=LTBLUE;
GrPrint(dc,0,0,"Freezing Peasants:%d Time:%3.2f Best:%3.2f",
not_stopped_cnt,tt-t0,best_score);
not_stopped_count,tt-t0,best_score);
}
U0 StepNew(CTask *task,I64 x,I64 y,F64 é,Bool left_right,Bool king)
@ -356,7 +356,7 @@ U0 AnimateTask(I64)
tmps=tmps1;
}
not_stopped_cnt=0;
not_stopped_count=0;
tmpp=peasant_head.next;
while (tmpp!=&peasant_head) {
if (tmpp->stopped) {
@ -388,12 +388,12 @@ U0 AnimateTask(I64)
if (!animate_mS && animate_phase&1)
StepNew(Fs->parent_task,tmpp->x,tmpp->y,tmpp->é,
animate_phase&2,FALSE);
not_stopped_cnt++;
not_stopped_count++;
}
}
tmpp=tmpp->next;
}
if (!not_stopped_cnt && !tf) {
if (!not_stopped_count && !tf) {
tf=tS;
music.mute=TRUE;
Snd(86);Sleep(200);Snd;Sleep(100);

Binary file not shown.

View File

@ -12,7 +12,7 @@ U0 DrawIt(CTask *,CDC *dc2)
U0 AnimateTask(I64)
{
I64 x,y,x1,y1,cnt,next_dc;
I64 x,y,x1,y1,count,next_dc;
while (TRUE) {
next_dc=cur_dc^1;
start_over:
@ -20,20 +20,20 @@ start_over:
DCClear(dc[next_dc]);
for (y=1;y<Fs->parent_task->pix_height-1;y++) {
for (x=1;x<Fs->parent_task->pix_width-1;x++) {
cnt=0;
count=0;
for (y1=y-1;y1<=y+1;y1++)
for (x1=x-1;x1<=x+1;x1++)
if (GrPeek(dc[cur_dc],x1,y1)==GREEN)
cnt++;
count++;
if (restart) goto start_over;
if (GrPeek(dc[cur_dc],x,y)==GREEN) {
if (cnt==3) {
if (count==3) {
dc[next_dc]->color=GREEN;
GrPlot(dc[next_dc],x,y);
}
} else {
// if (cnt==3) {//Use this for the classic rules
if (cnt==2) {
// if (count==3) {//Use this for the classic rules
if (count==2) {
dc[next_dc]->color=GREEN;
GrPlot(dc[next_dc],x,y);
}
@ -48,7 +48,7 @@ start_over:
public U0 Life()
{
I64 message_code,cnt,x1,y1,x2,y2,arg1,arg2;
I64 message_code,count,x1,y1,x2,y2,arg1,arg2;
dc[0]=DCNew(GR_WIDTH,GR_HEIGHT);
dc[1]=DCNew(GR_WIDTH,GR_HEIGHT);
@ -71,7 +71,7 @@ public U0 Life()
case MESSAGE_MS_L_DOWN:
x1=arg1; y1=arg2;
x2=arg1; y2=arg2;
cnt=0;
count=0;
while (message_code!=MESSAGE_MS_L_UP) {
restart=TRUE;
dc[cur_dc]->color=GREEN;

View File

@ -8,18 +8,18 @@ class Photon
{
Photon *next,*last;
CD3 p,v,n,p_normal_inhibit;
} p_root[mp_cnt];
} p_root[mp_count];
I64 p_root_locks;
#define ANIMATE_JIFFIES (JIFFY_FREQ*0.01)
I64 master_sleep_jiffy;
CTask *animate_tasks[mp_cnt];
CTask *animate_tasks[mp_count];
#define LENS_COLOR WHITE
#define MIRROR_COLOR DKGRAY
CDC *map;
I64 photon_cnt,mirror_cnt,snell_cnt,normal_inhibit,zero_normal;
I64 photon_count,mirror_count,snell_count,normal_inhibit,zero_normal;
Bool full_speed,show_normals;
U8 *bmp_refract,*bmp_reflect;
@ -45,7 +45,7 @@ U0 BmpLine(U8 *bmp,F64 x1,F64 y1,F64 x2,F64 y2)
Photon *PhotonNew()
{
I64 num=photon_cnt++%mp_cnt;
I64 num=photon_count++%mp_count;
Photon *res=CAlloc(sizeof(Photon));
while (LBts(&p_root_locks,num))
Yield;
@ -65,9 +65,9 @@ U0 DrawIt(CTask *,CDC *dc)
bmp_mem,bmp_mem/1024/1024,bmp_scale,
map->width,map->height,bmp_width,bmp_height);
GrPrint(dc,0,FONT_HEIGHT,
"PhotonCnt:%d MirrorCnt:%d SnellCnt:%d SnellInhibit:%d ZeroNormal:%d",
photon_cnt,mirror_cnt,snell_cnt,normal_inhibit,zero_normal);
for (i=0;i<mp_cnt;i++) {
"PhotonCount:%d MirrorCount:%d SnellCount:%d SnellInhibit:%d ZeroNormal:%d",
photon_count,mirror_count,snell_count,normal_inhibit,zero_normal);
for (i=0;i<mp_count;i++) {
while (LBts(&p_root_locks,i))
Yield;
tmpp=p_root[i].next;
@ -236,7 +236,7 @@ U0 Mirror(Photon *tmpp)
é$SY,3$n$SY,0$=Arg(tmpp->n.x,tmpp->n.y);
D3Equ(&tmpp->v,Cos(2*é$SY,3$n$SY,0$+ã-é),Sin(2*é$SY,3$n$SY,0$+ã-é));
lock {mirror_cnt++;}
lock {mirror_count++;}
}
U0 SnellsLaw(Photon *tmpp,I64 last,I64 next)
@ -264,15 +264,15 @@ U0 SnellsLaw(Photon *tmpp,I64 last,I64 next)
é=é$SY,3$n$SY,0$-é2;
D3Equ(&tmpp->v,Cos(é),Sin(é));
lock {snell_cnt++;}
lock {snell_count++;}
}
U0 AnimateTask(I64)
{
while (TRUE) {
master_sleep_jiffy+=ANIMATE_JIFFIES;
if (cnts.jiffies>=master_sleep_jiffy)
master_sleep_jiffy=cnts.jiffies+ANIMATE_JIFFIES;
if (counts.jiffies>=master_sleep_jiffy)
master_sleep_jiffy=counts.jiffies+ANIMATE_JIFFIES;
SleepUntil(master_sleep_jiffy);
}
}
@ -338,11 +338,11 @@ U0 MPAnimateTask(I64)
}
tmpp=tmpp->next;
if (cnts.jiffies>=timeout_jiffy)
if (counts.jiffies>=timeout_jiffy)
break;
}
LBtr(&p_root_locks,Gs->num);
if (cnts.jiffies>=timeout_jiffy) {
if (counts.jiffies>=timeout_jiffy) {
Sleep(1);
timeout_jiffy=master_sleep_jiffy+ANIMATE_JIFFIES;
}
@ -359,11 +359,11 @@ U0 MPAnimateTask(I64)
U0 Init()
{
I64 i;
master_sleep_jiffy=cnts.jiffies;
master_sleep_jiffy=counts.jiffies;
full_speed=show_normals=FALSE;
photon_cnt=mirror_cnt=snell_cnt=normal_inhibit=zero_normal=0;
photon_count=mirror_count=snell_count=normal_inhibit=zero_normal=0;
map=DCNew(Fs->pix_width,Fs->pix_height);
for (i=0;i<mp_cnt;i++) {
for (i=0;i<mp_count;i++) {
while (LBts(&p_root_locks,i))
Yield;
QueueInit(&p_root[i]);
@ -391,7 +391,7 @@ U0 Init()
U0 CleanUp()
{
I64 i;
for (i=0;i<mp_cnt;i++) {
for (i=0;i<mp_count;i++) {
while (LBts(&p_root_locks,i))
Yield;
QueueDel(&p_root[i],TRUE);
@ -452,7 +452,7 @@ U0 LTMenuSet(I64 mode)
#define PTS_NUM 1024
U0 LightTable()
{
I64 message_code,mode=LTM_REFLECT_LINE,i,cnt,arg1,arg2,x1,y1,x2,y2;
I64 message_code,mode=LTM_REFLECT_LINE,i,count,arg1,arg2,x1,y1,x2,y2;
CD3I32 *c=MAlloc(PTS_NUM*sizeof(CD3I32));
p_root_locks=0;
@ -500,7 +500,7 @@ U0 LightTable()
Init;
Fs->draw_it=&DrawIt;
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
for (i=0;i<mp_cnt;i++)
for (i=0;i<mp_count;i++)
animate_tasks[i]=Spawn(&MPAnimateTask,NULL,"MPAnimate",i);
try {
while (TRUE) {
@ -558,37 +558,37 @@ lt_restart:
break;
case LTM_REFLECT_SPLINE:
case LTM_REFRACT_SPLINE:
cnt=0;
count=0;
if (mode==LTM_REFLECT_SPLINE)
map->color=ROP_XOR+MIRROR_COLOR;
else
map->color=ROP_XOR+LENS_COLOR;
do {
c[cnt].x=arg1; c[cnt].y=arg2; c[cnt].z=0;
Gr2BSpline(map,c,cnt+1);
c[count].x=arg1; c[count].y=arg2; c[count].z=0;
Gr2BSpline(map,c,count+1);
message_code=GetMessage(&arg1,&arg2,1<<MESSAGE_KEY_DOWN+1<<MESSAGE_MS_L_UP+
1<<MESSAGE_MS_MOVE+1<<MESSAGE_MS_R_UP);
Gr2BSpline(map,c,cnt+1);
Gr2BSpline(map,c,count+1);
if (message_code==MESSAGE_KEY_DOWN)
goto lt_restart;
else if (message_code==MESSAGE_MS_L_UP) {
Sweep(100,90,100);
cnt++;
count++;
}
} while (cnt<PTS_NUM-1 && message_code!=MESSAGE_MS_R_UP);
} while (count<PTS_NUM-1 && message_code!=MESSAGE_MS_R_UP);
if (mode==LTM_REFLECT_SPLINE)
map->color=MIRROR_COLOR;
else
map->color=LENS_COLOR;
Gr2BSpline3(map,c,cnt);
for (i=0;i<cnt;i++) {
Gr2BSpline3(map,c,count);
for (i=0;i<count;i++) {
c[i].x*=bmp_scale;
c[i].y*=bmp_scale;
}
if (mode==LTM_REFLECT_SPLINE)
BSpline2(bmp_reflect,c,cnt,&BmpPlot);
BSpline2(bmp_reflect,c,count,&BmpPlot);
else
BSpline2(bmp_refract,c,cnt,&BmpPlot);
BSpline2(bmp_refract,c,count,&BmpPlot);
mode=LTM_REFLECT_LINE;
LTMenuSet(mode);
break;
@ -640,7 +640,7 @@ lt_done:
PutExcept;
Free(c);
SettingsPop;
for (i=0;i<mp_cnt;i++)
for (i=0;i<mp_count;i++)
Kill(animate_tasks[i]);
CleanUp;
MenuPop;

Binary file not shown.

View File

@ -47,7 +47,7 @@ F64 MPDraw(CTask *task)
{
Complex xx;
I64 x,y,w=task->pix_width,h=task->pix_height,cx=w/2,cy=h/2,
lo=Gs->num*h/mp_cnt,hi=(Gs->num+1)*h/mp_cnt;
lo=Gs->num*h/mp_count,hi=(Gs->num+1)*h/mp_count;
F64 yy,y_total=0;
CDC *dc=DCAlias(,task);
for (y=lo;y<hi;y++) {
@ -70,10 +70,10 @@ U0 Draw()
I64 i,w=Fs->pix_width,h=Fs->pix_height,cx=w/2,cy=h/2;
CDC *dc=DCAlias;
while (TRUE) {
for (i=0;i<mp_cnt;i++)
for (i=0;i<mp_count;i++)
tmpm[i]=JobQueue(&MPDraw,Fs,i,0);
y_total=0;
for (i=0;i<mp_cnt;i++)
for (i=0;i<mp_count;i++)
y_total+=JobResGet(tmpm[i])(F64);
if (!y_total) break;

View File

@ -65,8 +65,8 @@ U0 PredatorPrey()
GrLine(dc,OX,0,OX,GR_HEIGHT-FONT_HEIGHT-1);
GrLine(dc,0,OY,GR_WIDTH-1,OY);
while (!ScanChar) {
mp_not_done_flags=1<<mp_cnt-1;
for (i=0;i<mp_cnt;i++)
mp_not_done_flags=1<<mp_count-1;
for (i=0;i<mp_count;i++)
JobQueue(&PlotTrajectory,Fs,i);
do Yield;
while (mp_not_done_flags);

Binary file not shown.

View File

@ -2,7 +2,7 @@
public U0 SpeedLineDemo()
{
I64 message_code,cnt,x1,y1,x2,y2,arg1,arg2,color=BLACK;
I64 message_code,count,x1,y1,x2,y2,arg1,arg2,color=BLACK;
CDC *dc=DCAlias;
dc->color=color;
@ -26,7 +26,7 @@ public U0 SpeedLineDemo()
case MESSAGE_MS_L_DOWN:
x1=arg1; y1=arg2;
x2=arg1; y2=arg2;
cnt=0;
count=0;
while (message_code!=MESSAGE_MS_L_UP) {
dc->thick=0.04*ms.speed;
GrLine3(dc,x1,y1,0,x2,y2,0);

Binary file not shown.

View File

@ -1,6 +1,6 @@
//See $LK,"PCI",A="HI:PCI"$.
#if mp_cnt>1
#if mp_count>1
#define DEST_CPU 1
#else
#define DEST_CPU 0
@ -56,7 +56,7 @@ U0 Main()
Sleep(1000);
"The keyboard and timer seem to be active.\n"
"IntA:%d IntB:%d IntC:%d IntD:%d\n\n"
"IntB is my keybaord and regs a single KEY-UP.\n"
"IntB is my keyboard and regs a single KEY-UP.\n"
"Rerun and press a few keys.\n",
progress1,progress2,progress3,progress4;

View File

@ -45,7 +45,7 @@ class PowPrime
class Prime
{
U32 prime,pow_cnt;
U32 prime,pow_count;
PowPrime *pp;
};
@ -110,7 +110,7 @@ PowPrime *PowPrimesNew(I64 N,I64 sqrt_primes,Prime *primes,I64 *_num_powprimes)
pp->sumfact=sf;
j*=p->prime;
pp++;
p->pow_cnt++;
p->pow_count++;
}
p++;
}
@ -259,32 +259,32 @@ class RangeJob
I64 num,lo,hi,N,sqrt_primes,cbrt_primes;
Prime *primes;
CJob *cmd;
} rj[mp_cnt];
} rj[mp_count];
I64 TestCoreSubRange(RangeJob *r)
{
I64 i,j,m,n,n2,sf,res=0,range=r->hi-r->lo,
*sumfacts=MAlloc(range*sizeof(I64)),
*residue =MAlloc(range*sizeof(I64));
U16 *pow_cnt =MAlloc(range*sizeof(U16));
U16 *pow_count =MAlloc(range*sizeof(U16));
Prime *p=r->primes;
PowPrime *pp;
MemSetI64(sumfacts,1,range);
for (n=r->lo;n<r->hi;n++)
residue[n-r->lo]=n;
for (j=0;j<r->sqrt_primes;j++) {
MemSet(pow_cnt,0,range*sizeof(U16));
MemSet(pow_count,0,range*sizeof(U16));
m=1;
for (i=0;i<p->pow_cnt;i++) {
for (i=0;i<p->pow_count;i++) {
m*=p->prime;
n=m-r->lo%m;
while (n<range) {
pow_cnt[n]++;
pow_count[n]++;
n+=m;
}
}
for (n=0;n<range;n++)
if (i=pow_cnt[n]) {
if (i=pow_count[n]) {
pp=&p->pp[i-1];
sumfacts[n]*=pp->sumfact;
residue [n]/=pp->n;
@ -307,7 +307,7 @@ I64 TestCoreSubRange(RangeJob *r)
}
}
}
Free(pow_cnt);
Free(pow_count);
Free(residue);
Free(sumfacts);
return res;
@ -340,7 +340,7 @@ I64 MagicPairs(I64 N)
F64 t0=tS;
I64 res=0;
I64 sqrt_primes,cbrt_primes,num_powprimes,
i,k,n=(N-1)/mp_cnt+1;
i,k,n=(N-1)/mp_count+1;
Prime *primes=PrimesNew(N,&sqrt_primes,&cbrt_primes);
PowPrime *powprimes=PowPrimesNew(N,sqrt_primes,primes,&num_powprimes);
@ -350,7 +350,7 @@ I64 MagicPairs(I64 N)
*progress1_desc=0;
progress1_max=N;
k=2;
for (i=0;i<mp_cnt;i++) {
for (i=0;i<mp_count;i++) {
rj[i].doc=DocPut;
rj[i].num=i;
rj[i].lo=k;
@ -361,9 +361,9 @@ I64 MagicPairs(I64 N)
rj[i].sqrt_primes=sqrt_primes;
rj[i].cbrt_primes=cbrt_primes;
rj[i].primes=primes;
rj[i].cmd=JobQueue(&TestCoreRange,&rj[i],mp_cnt-1-i,0);
rj[i].cmd=JobQueue(&TestCoreRange,&rj[i],mp_count-1-i,0);
}
for (i=0;i<mp_cnt;i++)
for (i=0;i<mp_count;i++)
res+=JobResGet(rj[i].cmd);
Free(powprimes);
Free(primes);

View File

@ -26,7 +26,7 @@ U0 UnlockedInc()
tmpm1=JobQueue(&MPUnlockedInc,NULL,1,0);
JobResGet(tmpm0);
JobResGet(tmpm1);
"Correct Cnt:%X Actual Cnt:%X\n",CNT*2,glbl;
"Correct Count:%X Actual Count:%X\n",CNT*2,glbl;
}
U0 MPLockedInc(I64)
@ -45,7 +45,7 @@ U0 LockedInc()
tmpm1=JobQueue(&MPLockedInc,NULL,1,0);
JobResGet(tmpm0);
JobResGet(tmpm1);
"Correct Cnt:%X Actual Cnt:%X\n",CNT*2,glbl;
"Correct Count:%X Actual Count:%X\n",CNT*2,glbl;
}
UnlockedInc;

View File

@ -1,36 +1,36 @@
I64 mp_n;
I64 MPSum(I64 my_mp_cnt)
I64 MPSum(I64 my_mp_count)
{//We could use the formula n*(n+1)/2
I64 lo=mp_n*Gs->num/my_mp_cnt,
hi=mp_n*(Gs->num+1)/my_mp_cnt,
I64 lo=mp_n*Gs->num/my_mp_count,
hi=mp_n*(Gs->num+1)/my_mp_count,
res=0,i;
for (i=lo;i<hi;i++)
res+=i;
return res;
}
I64 Sum(I64 n,I64 my_mp_cnt)
I64 Sum(I64 n,I64 my_mp_count)
{
CJob *tmpm[MP_PROCESSORS_NUM];
I64 res=0,i;
mp_n=n+1;
for (i=0;i<my_mp_cnt;i++)
tmpm[i]=JobQueue(&MPSum,my_mp_cnt,i,0);
for (i=0;i<my_mp_cnt;i++)
for (i=0;i<my_mp_count;i++)
tmpm[i]=JobQueue(&MPSum,my_mp_count,i,0);
for (i=0;i<my_mp_count;i++)
res+=JobResGet(tmpm[i]);
return res;
}
#define SAMPLE_SIZE 100
F64 Test(I64 n,I64 my_mp_cnt)
F64 Test(I64 n,I64 my_mp_count)
{
I64 i,val=0;
F64 start,end;
start=tS;
for (i=0;i<SAMPLE_SIZE;i++)
val+=Sum(n,my_mp_cnt);
val+=Sum(n,my_mp_count);
end=tS;
"Val:%,d\n",val/SAMPLE_SIZE;
"$$RED$$N:%12,d Time:%10.8f$$FG$$\n",n,(end-start)/SAMPLE_SIZE;
@ -53,7 +53,7 @@ U0 MPAdd()
for (i=0,n=VAL_MIN;i<TESTS_NUM;i++,n*=10) {
t1=Test(n,1);
t2=Test(n,mp_cnt);
t2=Test(n,mp_count);
ress[i]=t2*100.0/t1;
"$$GREEN$$%8.4f%%$$FG$$\n\n",ress[i];
}

View File

@ -9,7 +9,7 @@ U0 MPPrintDemo()
{
I64 i;
for (i=0;i<500;i++)
JobQueue(&Job,DocPut,i%mp_cnt);
JobQueue(&Job,DocPut,i%mp_count);
Sleep(500);
"$$FG$$\n";
}

View File

@ -6,10 +6,10 @@ for sorting. Then, it merge sorts them.
#define NUM 1000000
I64 my_mp_cnt=1<<Bsr(mp_cnt);//Power of 2
I64 my_mp_count=1<<Bsr(mp_count);//Power of 2
I32 *arg1,*arg2;
I32 *b[my_mp_cnt],bn[my_mp_cnt];
I32 *b[my_mp_count],bn[my_mp_count];
I64 mp_not_done_flags;
I64 Compare(I32 *e1,I32 *e2)
@ -93,7 +93,7 @@ U0 MPRadixSortDemo(I64 dummy=0)
"Time:%9.6f\n",tS-t0;
D(arg2+NUM/4);
for (i=0;i<my_mp_cnt;i++) {
for (i=0;i<my_mp_count;i++) {
//$WW,0$We must do full size, just in case.
//There will be uneven split between cores
//depending on the distribution of rand numbers.
@ -101,23 +101,23 @@ U0 MPRadixSortDemo(I64 dummy=0)
bn[i]=0;
}
if (my_mp_cnt<2) throw('MultCore');
if (my_mp_count<2) throw('MultCore');
"$$GREEN$$MP Radix QSortU32$$FG$$\n";
t0=tS;
k1=32-Bsr(my_mp_cnt);
k2=my_mp_cnt/2;
k1=32-Bsr(my_mp_count);
k2=my_mp_count/2;
for (i=0;i<NUM;i++) {
j=arg1[i]>>k1+k2; //This is a preliminary radix sort.
b[j][bn[j]++]=arg1[i];
}
mp_not_done_flags=1<<my_mp_cnt-1;
for (i=0;i<my_mp_cnt;i++)
mp_not_done_flags=1<<my_mp_count-1;
for (i=0;i<my_mp_count;i++)
Spawn(&MPSort,NULL,NULL,i);
while (mp_not_done_flags)
Yield;
j=0;
for (i=0;i<my_mp_cnt;i++) {
for (i=0;i<my_mp_count;i++) {
MemCpy(&arg2[j],b[i],bn[i]*sizeof(I32));
j+=bn[i];
}
@ -126,7 +126,7 @@ U0 MPRadixSortDemo(I64 dummy=0)
Free(arg1);
Free(arg2);
for (i=0;i<my_mp_cnt;i++)
for (i=0;i<my_mp_count;i++)
Free(b[i]);
}

View File

@ -37,10 +37,10 @@ U0 PDAnswer(U8 *a,I64 len)
U0 MPPalindrome(I64 dummy=0)
{
no_warn dummy;
U8 *src=buf+BORDER_CHARS+size*Gs->num/mp_cnt,
U8 *src=buf+BORDER_CHARS+size*Gs->num/mp_count,
*f,*b;
I64 len,best=0,
my_size=(size+mp_cnt-1)/mp_cnt;
my_size=(size+mp_count-1)/mp_count;
while (my_size--) {
//Odd
@ -83,8 +83,8 @@ U0 Palindrome(U8 *filename)
PDNormalize;
doc=DocPut;
mp_not_done_flags=1<<mp_cnt-1;
for (i=0;i<mp_cnt;i++)
mp_not_done_flags=1<<mp_count-1;
for (i=0;i<mp_count;i++)
JobQueue(&MPPalindrome,NULL,i);
while (mp_not_done_flags)
Yield;

View File

@ -1,11 +1,11 @@
U8 *master_bitmap;
I64 prime_range,my_mp_cnt,pending;
I64 prime_range,my_mp_count,pending;
U0 PrimesJob(I64 i)
{
I64 j,k,l=Sqrt(prime_range),
lo=i*prime_range/my_mp_cnt,
hi=(i+1)*prime_range/my_mp_cnt,
lo=i*prime_range/my_mp_count,
hi=(i+1)*prime_range/my_mp_count,
lo2=lo+sys_cache_line_width,
hi2=hi-sys_cache_line_width;
if (lo2>hi2) lo2=hi2;
@ -35,20 +35,20 @@ U0 PrimesJob(I64 i)
lock pending--;
}
I64 Primes(I64 range,I64 _my_mp_cnt)
I64 Primes(I64 range,I64 _my_mp_count)
{
I64 i,prime_cnt=0;
I64 i,prime_count=0;
F64 t0=tS,tf;
prime_range=range;
if (_my_mp_cnt<=mp_cnt)
my_mp_cnt=_my_mp_cnt;
if (_my_mp_count<=mp_count)
my_mp_count=_my_mp_count;
else
my_mp_cnt=mp_cnt;
my_mp_count=mp_count;
master_bitmap=CAlloc((prime_range+7)/8+1);
Bts(master_bitmap,0);
Bts(master_bitmap,1);
pending=my_mp_cnt;
for (i=0;i<my_mp_cnt;i++)
pending=my_mp_count;
for (i=0;i<my_mp_count;i++)
JobQueue(&PrimesJob,i,i);
while (pending)
Yield;
@ -56,20 +56,20 @@ I64 Primes(I64 range,I64 _my_mp_cnt)
for (i=0;i<prime_range;i++)
if (!Bt(master_bitmap,i))
prime_cnt++;
prime_count++;
for (i=MaxI64(prime_range-100,0);i<prime_range;i++)
if (!Bt(master_bitmap,i))
"%d ",i;
"\n$$RED$$CPUs:%d PrimeRange:%,d PrimeCnt:%,d Time:%9.7,f$$FG$$\n",
my_mp_cnt,prime_range,prime_cnt,tf-t0;
"\n$$RED$$CPUs:%d PrimeRange:%,d PrimeCount:%,d Time:%9.7,f$$FG$$\n",
my_mp_count,prime_range,prime_count,tf-t0;
Free(master_bitmap);
return prime_cnt;
return prime_count;
}
Primes(100,1);
Primes(100,mp_cnt);
Primes(100,mp_count);
Primes(1000000,1);
Primes(1000000,mp_cnt);
Primes(1000000,mp_count);

View File

@ -5,8 +5,8 @@ I64 mp_not_done_flags,grand_total;
U0 MPRoutine(CDoc *doc)
{
I64 i,sum=0,
lo=NUM*Gs->num/mp_cnt, //This is how to divide a job
hi=NUM*(Gs->num+1)/mp_cnt;
lo=NUM*Gs->num/mp_count, //This is how to divide a job
hi=NUM*(Gs->num+1)/mp_count;
for (i=lo;i<hi;i++)
sum+=i;
DocPrint(doc,"Core#%d:%d-%d:%d\n",Gs->num,lo,hi-1,sum);
@ -18,8 +18,8 @@ U0 Main()
{
I64 i;
grand_total=0;
mp_not_done_flags=1<<mp_cnt-1;
for (i=0;i<mp_cnt;i++)
mp_not_done_flags=1<<mp_count-1;
for (i=0;i<mp_count;i++)
Spawn(&MPRoutine,DocPut,NULL,i);
while (mp_not_done_flags)
Yield;

View File

@ -17,7 +17,7 @@ class LinkStruct
{
LinkStruct *left,*right;
U8 *link,*file;
I64 cnt;
I64 count;
};
class BlockedStruct
@ -262,7 +262,7 @@ U0 LinkTreeAdd(LinkStruct **_root,LogStruct *tmplg)
}
if (root=*_root) {
if (!(i=StrCmp(tmplg->link,root->link)))
root->cnt++;
root->count++;
else if (i<0)
LinkTreeAdd(&root->left,tmplg);
else
@ -270,7 +270,7 @@ U0 LinkTreeAdd(LinkStruct **_root,LogStruct *tmplg)
} else {
tmplk=CAlloc(sizeof(LinkStruct));
tmplk->link=tmplg->link;
tmplk->cnt=1;
tmplk->count=1;
*_root=tmplk;
}
}
@ -285,7 +285,7 @@ U0 FileTreeAdd(LinkStruct **_root,LogStruct *tmplg)
}
if (root=*_root) {
if (!(i=StrCmp(tmplg->file,root->file)))
root->cnt++;
root->count++;
else if (i<0)
FileTreeAdd(&root->left,tmplg);
else
@ -293,7 +293,7 @@ U0 FileTreeAdd(LinkStruct **_root,LogStruct *tmplg)
} else {
tmplk=CAlloc(sizeof(LinkStruct));
tmplk->file=tmplg->file;
tmplk->cnt=1;
tmplk->count=1;
*_root=tmplk;
}
}
@ -311,7 +311,7 @@ U0 LinkTreeTraverse(LinkStruct *root)
{
if (root) {
LinkTreeTraverse(root->left);
"%3d:%$$Q\n",root->cnt,root->link;
"%3d:%$$Q\n",root->count,root->link;
LinkTreeTraverse(root->right);
}
}
@ -329,16 +329,16 @@ U0 FileTreeTraverse(LinkStruct *root)
{
if (root) {
FileTreeTraverse(root->left);
"%3d:%$$Q\n",root->cnt,root->file;
"%3d:%$$Q\n",root->count,root->file;
FileTreeTraverse(root->right);
}
}
U0 DownLoadRep(LogStruct *head,CDate dstart,CDate dend)
{
I64 i,j,cnt,dups,
hours_start,hours_end,*hour_cnts,*dup_cnts,
days_start,days_end,*day_cnts,*day_dup_cnts;
I64 i,j,count,dups,
hours_start,hours_end,*hour_counts,*dup_counts,
days_start,days_end,*day_counts,*day_dup_counts;
LogStruct *tmplg=head->next,*dup_head=NULL;
LinkStruct *link_root=NULL;
CDateStruct ds;
@ -349,20 +349,20 @@ U0 DownLoadRep(LogStruct *head,CDate dstart,CDate dend)
days_start=(dstart+local_time_offset)>>32;
days_end =(dend+local_time_offset)>>32;
hour_cnts=CAlloc((hours_end-hours_start+1)*sizeof(I64));
dup_cnts =CAlloc((hours_end-hours_start+1)*sizeof(I64));
day_cnts =CAlloc((days_end-days_start+1)*sizeof(I64));
day_dup_cnts=CAlloc((days_end-days_start+1)*sizeof(I64));
dups=cnt=0;
hour_counts=CAlloc((hours_end-hours_start+1)*sizeof(I64));
dup_counts =CAlloc((hours_end-hours_start+1)*sizeof(I64));
day_counts =CAlloc((days_end-days_start+1)*sizeof(I64));
day_dup_counts=CAlloc((days_end-days_start+1)*sizeof(I64));
dups=count=0;
while (tmplg!=head) {
if (IsKeeper(tmplg,dstart,dend) && IsDownLoad(tmplg)) {
i=tmplg->datetime*24;
hour_cnts[i.u32[1]-hours_start]++;
day_cnts[(tmplg->datetime+local_time_offset)>>32-days_start]++;
cnt++;
hour_counts[i.u32[1]-hours_start]++;
day_counts[(tmplg->datetime+local_time_offset)>>32-days_start]++;
count++;
if (IPNumTreeAdd(&dup_head,tmplg)) {
day_dup_cnts[(tmplg->datetime+local_time_offset)>>32-days_start]++;
dup_cnts[i.u32[1]-hours_start]++;
day_dup_counts[(tmplg->datetime+local_time_offset)>>32-days_start]++;
dup_counts[i.u32[1]-hours_start]++;
dups++;
}
LinkTreeAdd(&link_root,tmplg);
@ -373,10 +373,10 @@ U0 DownLoadRep(LogStruct *head,CDate dstart,CDate dend)
"\n\nDownloads of /TOS_Distro.ISO\n";
for (i=dstart;i<=dend;i+=1<<32)
"%DDups:%5dTotal:%5dUniques:%5d\n",i,
day_dup_cnts[(i+local_time_offset)>>32-days_start],
day_cnts[(i+local_time_offset)>>32-days_start],
day_cnts[(i+local_time_offset)>>32-days_start]-
day_dup_cnts[(i+local_time_offset)>>32-days_start];
day_dup_counts[(i+local_time_offset)>>32-days_start],
day_counts[(i+local_time_offset)>>32-days_start],
day_counts[(i+local_time_offset)>>32-days_start]-
day_dup_counts[(i+local_time_offset)>>32-days_start];
"\n\nDownloads of /TOS_Distro.ISO\n"
"'-' is a dup.'+' is not a dup.\n";
@ -387,23 +387,23 @@ U0 DownLoadRep(LogStruct *head,CDate dstart,CDate dend)
for (;i<=hours_end;i++) {
Date2Struct(&ds,i<<32/24+local_time_offset);
"%D %02d: ",i<<32/24,ds.hour;
for (j=0;j<dup_cnts[i-hours_start];j++)
for (j=0;j<dup_counts[i-hours_start];j++)
'-';
for (;j<hour_cnts[i-hours_start];j++)
for (;j<hour_counts[i-hours_start];j++)
'+';
'\n';
}
"Total:%dDups:%dUniques:%d\n",cnt,dups,cnt-dups;
"Total:%dDups:%dUniques:%d\n",count,dups,count-dups;
"\n\nDownloads of /TOS_Distro.ISO\n";
LinkTreeTraverse(link_root);
'\n';
LinkTreeDel(link_root);
Free(hour_cnts);
Free(dup_cnts);
Free(day_cnts);
Free(day_dup_cnts);
Free(hour_counts);
Free(dup_counts);
Free(day_counts);
Free(day_dup_counts);
}
U0 FileRep(LogStruct *head,CDate dstart,CDate dend)
@ -423,9 +423,9 @@ U0 FileRep(LogStruct *head,CDate dstart,CDate dend)
U0 IndexRep(LogStruct *head,CDate dstart,CDate dend)
{
I64 i,j,cnt,dups,
hours_start,hours_end,*hour_cnts,*dup_cnts,
days_start,days_end,*day_cnts,*day_dup_cnts;
I64 i,j,count,dups,
hours_start,hours_end,*hour_counts,*dup_counts,
days_start,days_end,*day_counts,*day_dup_counts;
LogStruct *tmplg=head->next,*dup_head=NULL;
LinkStruct *link_root=NULL;
CDateStruct ds;
@ -436,20 +436,20 @@ U0 IndexRep(LogStruct *head,CDate dstart,CDate dend)
days_start=(dstart+local_time_offset)>>32;
days_end =(dend+local_time_offset)>>32;
hour_cnts=CAlloc((hours_end-hours_start+1)*sizeof(I64));
dup_cnts =CAlloc((hours_end-hours_start+1)*sizeof(I64));
day_cnts =CAlloc((days_end-days_start+1)*sizeof(I64));
day_dup_cnts=CAlloc((days_end-days_start+1)*sizeof(I64));
dups=cnt=0;
hour_counts=CAlloc((hours_end-hours_start+1)*sizeof(I64));
dup_counts =CAlloc((hours_end-hours_start+1)*sizeof(I64));
day_counts =CAlloc((days_end-days_start+1)*sizeof(I64));
day_dup_counts=CAlloc((days_end-days_start+1)*sizeof(I64));
dups=count=0;
while (tmplg!=head) {
if (IsKeeper(tmplg,dstart,dend) && IsIndex(tmplg)) {
i=tmplg->datetime*24;
hour_cnts[i.u32[1]-hours_start]++;
day_cnts[(tmplg->datetime+local_time_offset)>>32-days_start]++;
cnt++;
hour_counts[i.u32[1]-hours_start]++;
day_counts[(tmplg->datetime+local_time_offset)>>32-days_start]++;
count++;
if (IPNumTreeAdd(&dup_head,tmplg)) {
day_dup_cnts[(tmplg->datetime+local_time_offset)>>32-days_start]++;
dup_cnts[i.u32[1]-hours_start]++;
day_dup_counts[(tmplg->datetime+local_time_offset)>>32-days_start]++;
dup_counts[i.u32[1]-hours_start]++;
dups++;
}
LinkTreeAdd(&link_root,tmplg);
@ -461,10 +461,10 @@ U0 IndexRep(LogStruct *head,CDate dstart,CDate dend)
"'-' is a dup.'+' is not a dup.\n";
for (i=dstart;i<=dend;i+=1<<32)
"%DDups:%5dTotal:%5dUniques:%5d\n",i,
day_dup_cnts[(i+local_time_offset)>>32-days_start],
day_cnts[(i+local_time_offset)>>32-days_start],
day_cnts[(i+local_time_offset)>>32-days_start]-
day_dup_cnts[(i+local_time_offset)>>32-days_start];
day_dup_counts[(i+local_time_offset)>>32-days_start],
day_counts[(i+local_time_offset)>>32-days_start],
day_counts[(i+local_time_offset)>>32-days_start]-
day_dup_counts[(i+local_time_offset)>>32-days_start];
"\n\nHits on /index.html\n";
if (hours_end-hours_start>=HOURS_MAX)
@ -474,23 +474,23 @@ U0 IndexRep(LogStruct *head,CDate dstart,CDate dend)
for (;i<=hours_end;i++) {
Date2Struct(&ds,i<<32/24+local_time_offset);
"%D %02d: ",i<<32/24,ds.hour;
for (j=0;j<dup_cnts[i-hours_start];j++)
for (j=0;j<dup_counts[i-hours_start];j++)
'-';
for (;j<hour_cnts[i-hours_start];j++)
for (;j<hour_counts[i-hours_start];j++)
'+';
'\n';
}
"Total:%dDups:%dUniques:%d\n",cnt,dups,cnt-dups;
"Total:%dDups:%dUniques:%d\n",count,dups,count-dups;
"\n\nHits on /index.html\n";
LinkTreeTraverse(link_root);
'\n';
LinkTreeDel(link_root);
Free(hour_cnts);
Free(dup_cnts);
Free(day_cnts);
Free(day_dup_cnts);
Free(hour_counts);
Free(dup_counts);
Free(day_counts);
Free(day_dup_counts);
}
U0 WebLogRep(U8 *mask,U8 *output_filename)

View File

@ -11,4 +11,4 @@ $FG$Bit operations are "atomic", no interrupt between the reading and writing th
$FG,5$These don't take a pointer, but the actual field.$FG$
$FG,2$Bsf$FG$: Bit Scan Fwd (Pos of first low one bit or -1)
$FG,2$Bsr$FG$: Bit Scan Rev (Pos of first high one bit or -1)
$FG,2$BCnt$FG$: Bit Cnt (Cnt of set bits)
$FG,2$BCount$FG$: Bit Count (Count of set bits)

View File

@ -118,9 +118,9 @@ U0 CommPutS(I64 port,U8 *st)
CommPutChar(port,b);
}
public U0 CommPutBlk(I64 port,U8 *buf,I64 cnt)
public U0 CommPutBlk(I64 port,U8 *buf,I64 count)
{
while (cnt--)
while (count--)
CommPutChar(port,*buf++);
}

View File

@ -29,7 +29,7 @@ $FG,2$Clip$FG$ Clipboard
$FG,2$Clus$FG$ Cluster
$FG,2$Cmd$FG$ Command
$FG,2$Comp$FG$ Compiler
$FG,2$Cnt$FG$ Count
$FG,2$Count$FG$ Count
$FG,2$Const$FG$ Consant
$FG,2$Cont$FG$ Continue
$FG,2$Ctrl$FG$ Control. The ctrl key is indicated with "$FG,2$^$FG$" in documentation.

View File

@ -1 +1 @@
$WW,1$Intel/AMD have an inst that returns the num of CPU cycles since boot. This is not a steady, calibrated real time value. ZenithOS measures it and you can convert with $LK,"cnts.time_stamp_freq",A="MN:CCntsGlobals"$, a value continuously calibrated from other cnts.
$WW,1$Intel/AMD have an inst that returns the num of CPU cycles since boot. This is not a steady, calibrated real time value. ZenithOS measures it and you can convert with $LK,"counts.time_stamp_freq",A="MN:CCountsGlobals"$, a value continuously calibrated from other counts.

View File

@ -1 +1 @@
$WW,1$The HPET, high precision event timer, is read with $LK,"HPET",A="MN:HPET"$() and has a frequency of $LK,"cnts.HPET_freq",A="MN:CCntsGlobals"$. A typical freq value is 14.3 Mhz It might not be available on all systems.
$WW,1$The HPET, high precision event timer, is read with $LK,"HPET",A="MN:HPET"$() and has a frequency of $LK,"counts.HPET_freq",A="MN:CCountsGlobals"$. A typical freq value is 14.3 Mhz It might not be available on all systems.

View File

@ -1,7 +1,7 @@
$WW,1$One jiffy is one time slice. $LK,"cnts.jiffies",A="MN:CCntsGlobals"$ returns time slices since boot.
$WW,1$One jiffy is one time slice. $LK,"counts.jiffies",A="MN:CCountsGlobals"$ returns time slices since boot.
$LK,"SysTimerRead",A="MN:SysTimerRead"$ reads the timer ticks since boot. It's not as fast as $LK,"GetTSC",A="MN:GetTSC"$.
Use $LK,"JIFFY_FREQ",A="MN:JIFFY_FREQ"$ to convert $LK,"cnts.jiffies",A="MN:CCntsGlobals"$.
Use $LK,"JIFFY_FREQ",A="MN:JIFFY_FREQ"$ to convert $LK,"counts.jiffies",A="MN:CCountsGlobals"$.
Use $LK,"SYS_TIMER_FREQ",A="MN:SYS_TIMER_FREQ"$ to convert $LK,"SysTimerRead",A="MN:SysTimerRead"$.

View File

@ -125,7 +125,7 @@ $FG,2$Merge(\"C:/*\",\"D:/*\",\"+r+d\");$FG$ to check my changes.
* The editor's sel-text mechanism allows for disjoint portions of sel text. This is a feature, not a bug -- you can cut-and-paste disjoint text.
* $LK,"cnts.time_stamp_freq",A="MN:CCntsGlobals"$ is continuously calibrated. Be careful because expressions might decrease. Take a snap-shot, like this: $FG,2$timeout=$LK,"GetTSC",A="MN:GetTSC"$+$LK,"cnts.time_stamp_freq",A="MN:CCntsGlobals"$ x seconds;$FG$ and compare against $LK,"GetTSC",A="MN:GetTSC"$(). I recommend just using $LK,"tS",A="MN:tS"$ or $LK,"cnts.jiffies",A="MN:CCntsGlobals"$.
* $LK,"counts.time_stamp_freq",A="MN:CCountsGlobals"$ is continuously calibrated. Be careful because expressions might decrease. Take a snap-shot, like this: $FG,2$timeout=$LK,"GetTSC",A="MN:GetTSC"$+$LK,"counts.time_stamp_freq",A="MN:CCountsGlobals"$ x seconds;$FG$ and compare against $LK,"GetTSC",A="MN:GetTSC"$(). I recommend just using $LK,"tS",A="MN:tS"$ or $LK,"counts.jiffies",A="MN:CCountsGlobals"$.
* Use $LK,"HeapLog",A="MN:HeapLog"$(), $LK,"HeapLogAddrRep",A="MN:HeapLogAddrRep"$() and $LK,"HeapLogSizeRep",A="MN:HeapLogSizeRep"$() to find leaks. Don't be confused by $LK,"CDoc",A="MN:CDoc"$ allocations. Those are generated when text is written to the cmd line buffer.

Binary file not shown.

View File

@ -1,19 +1,19 @@
U0 ATABlkSel(CBlkDev *bd,I64 blk,I64 cnt)
U0 ATABlkSel(CBlkDev *bd,I64 blk,I64 count)
{
if (bd->type!=BDT_ATAPI && bd->base1)
OutU8(bd->base1+ATAR1_CTRL,0x8);
if (bd->flags & BDF_EXT_SIZE) { //48 Bit LBA?
OutU8(bd->base0+ATAR0_NSECT,cnt.u8[1]);
OutU8(bd->base0+ATAR0_NSECT,count.u8[1]);
OutU8(bd->base0+ATAR0_SECT,blk.u8[3]);
OutU8(bd->base0+ATAR0_LCYL,blk.u8[4]);
OutU8(bd->base0+ATAR0_HCYL,blk.u8[5]);
OutU8(bd->base0+ATAR0_NSECT,cnt);
OutU8(bd->base0+ATAR0_NSECT,count);
OutU8(bd->base0+ATAR0_SECT,blk);
OutU8(bd->base0+ATAR0_LCYL,blk.u8[1]);
OutU8(bd->base0+ATAR0_HCYL,blk.u8[2]);
OutU8(bd->base0+ATAR0_SEL,0xEF|bd->unit<<4);
} else { //28 Bit LBA
OutU8(bd->base0+ATAR0_NSECT,cnt);
OutU8(bd->base0+ATAR0_NSECT,count);
OutU8(bd->base0+ATAR0_SECT,blk);
OutU8(bd->base0+ATAR0_LCYL,blk.u8[1]);
OutU8(bd->base0+ATAR0_HCYL,blk.u8[2]);
@ -64,13 +64,13 @@ U0 ATACmd(CBlkDev *bd,U8 cmd)
PortNop;
}
Bool ATAGetRes(CBlkDev *bd,F64 timeout,U8 *buf,I64 cnt,
Bool ATAGetRes(CBlkDev *bd,F64 timeout,U8 *buf,I64 count,
I64 _avail,Bool one_read)
{
I64 avail,overflow;
bd->flags&=~BDF_LAST_WAS_WRITE;
MemSet(buf,0,cnt);
while (cnt>0) {
MemSet(buf,0,count);
while (count>0) {
if (!ATAWaitDRQ(bd,timeout))
return FALSE;
if (_avail)
@ -78,16 +78,16 @@ Bool ATAGetRes(CBlkDev *bd,F64 timeout,U8 *buf,I64 cnt,
else
avail=InU8(bd->base0+ATAR0_HCYL)<<8+InU8(bd->base0+ATAR0_LCYL);
if (avail) {
if (avail>cnt) {
overflow=avail-cnt;
avail=cnt;
if (avail>count) {
overflow=avail-count;
avail=count;
} else
overflow=0;
if (avail&2)
RepInU16(buf,avail>>1,bd->base0+ATAR0_DATA);
else
RepInU32(buf,avail>>2,bd->base0+ATAR0_DATA);
cnt-=avail;
count-=avail;
buf+=avail;
while (overflow>0) {
InU16(bd->base0+ATAR0_DATA);
@ -350,18 +350,18 @@ Bool ATAPIWaitReady(CBlkDev *bd,F64 timeout)
return FALSE;
}
U0 ATAReadBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 cnt)
U0 ATAReadBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 count)
{
I64 retries=3;
Bool unlock=BlkDevLock(bd);
retry:
ATABlkSel(bd,blk,cnt);
ATABlkSel(bd,blk,count);
if (bd->flags & BDF_EXT_SIZE)
ATACmd(bd,ATA_READ_MULTI_EXT);
else
ATACmd(bd,ATA_READ_MULTI);
if (!ATAGetRes(bd,tS+1.0,buf,cnt*bd->blk_size,BLK_SIZE,FALSE)) {
if (!ATAGetRes(bd,tS+1.0,buf,count*bd->blk_size,BLK_SIZE,FALSE)) {
if (retries--) {
ATAWaitNotBUSY(bd,0);
goto retry;
@ -369,7 +369,7 @@ U0 ATAReadBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 cnt)
throw('BlkDev');
}
blkdev.read_cnt+=(cnt*bd->blk_size)>>BLK_SIZE_BITS;
blkdev.read_count+=(count*bd->blk_size)>>BLK_SIZE_BITS;
if (unlock) BlkDevUnlock(bd);
}
@ -386,10 +386,10 @@ I64 ATAProbe(I64 base0,I64 base1,I64 unit)
}
Bool ATAPIReadBlks2(CBlkDev *bd,F64 timeout,U8 *buf,
I64 native_blk, I64 cnt,Bool lock)
I64 native_blk, I64 count,Bool lock)
{
Bool res=FALSE,unlock;
if (cnt<=0)
if (count<=0)
return FALSE;
if (lock)
unlock=BlkDevLock(bd);
@ -402,9 +402,9 @@ Bool ATAPIReadBlks2(CBlkDev *bd,F64 timeout,U8 *buf,
OutU8(bd->base0+ATAR0_HCYL,bd->blk_size.u8[1]);
ATACmd(bd,ATA_PACKET);
if (ATAPIWritePktWord(bd,timeout,0xA800,
native_blk.u16[1],native_blk,cnt.u16[1],cnt,0) &&
ATAGetRes(bd,timeout,buf,cnt*bd->blk_size,0,FALSE)) {
blkdev.read_cnt+=(cnt*bd->blk_size)>>BLK_SIZE_BITS;
native_blk.u16[1],native_blk,count.u16[1],count,0) &&
ATAGetRes(bd,timeout,buf,count*bd->blk_size,0,FALSE)) {
blkdev.read_count+=(count*bd->blk_size)>>BLK_SIZE_BITS;
res=TRUE;
}
}
@ -413,13 +413,13 @@ Bool ATAPIReadBlks2(CBlkDev *bd,F64 timeout,U8 *buf,
return res;
}
U0 ATAPIReadBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 cnt)
U0 ATAPIReadBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 count)
{
CDrive *dv=Letter2Drive(bd->first_drv_let);
I64 retry,spc=bd->blk_size>>BLK_SIZE_BITS,n,blk2,
l2=bd->max_reads<<1+spc<<1;
U8 *dvd_buf=MAlloc(l2<<BLK_SIZE_BITS);
if (cnt>0) {
if (count>0) {
if (blk<=bd->max_reads)
blk2=0;
else
@ -437,17 +437,17 @@ U0 ATAPIReadBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 cnt)
ATAPIReadBlks2(bd,0,dvd_buf,blk2/spc,n,TRUE);
if (bd->flags & BDF_READ_CACHE)
DiskCacheAdd(dv,dvd_buf,blk2,n*spc);
MemCpy(buf,dvd_buf+(blk-blk2)<<BLK_SIZE_BITS,cnt<<BLK_SIZE_BITS);
MemCpy(buf,dvd_buf+(blk-blk2)<<BLK_SIZE_BITS,count<<BLK_SIZE_BITS);
}
Free(dvd_buf);
}
Bool ATARBlks(CDrive *dv,U8 *buf, I64 blk, I64 cnt)
Bool ATARBlks(CDrive *dv,U8 *buf, I64 blk, I64 count)
{
I64 n;
CBlkDev *bd=dv->bd;
while (cnt>0) {
n=cnt;
while (count>0) {
n=count;
if (n>bd->max_reads)
n=bd->max_reads;
if (bd->type==BDT_ATAPI)
@ -456,25 +456,25 @@ Bool ATARBlks(CDrive *dv,U8 *buf, I64 blk, I64 cnt)
ATAReadBlks(bd,buf,blk,n);
buf+=n<<BLK_SIZE_BITS;
blk+=n;
cnt-=n;
count-=n;
}
return TRUE;
}
U0 ATAWriteBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 cnt)
U0 ATAWriteBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 count)
{//For low level disk access.
//Use BlkWrite() instead.
I64 i,U32s_avail,sects_avail,retries=3;
F64 timeout;
Bool unlock=BlkDevLock(bd);
retry:
ATABlkSel(bd,blk,cnt);
ATABlkSel(bd,blk,count);
if (bd->flags&BDF_EXT_SIZE)
ATACmd(bd,ATA_WRITE_MULTI_EXT);
else
ATACmd(bd,ATA_WRITE_MULTI);
bd->flags|=BDF_LAST_WAS_WRITE;
while (cnt>0) {
while (count>0) {
timeout=tS+1.0;
while (TRUE) {
i=InU8(bd->base0+ATAR0_STAT);
@ -494,7 +494,7 @@ retry:
U32s_avail=sects_avail<<BLK_SIZE_BITS>>2;
RepOutU32(buf,U32s_avail,bd->base0+ATAR0_DATA);
buf+=U32s_avail<<2;
cnt-=sects_avail;
count-=sects_avail;
retries=3;
}
ATAWaitNotBUSY(bd,0);
@ -535,7 +535,7 @@ U0 ATAPIClose(CBlkDev *bd,I64 close_field=0x200,I64 track=0)
ATAWaitNotBUSY(bd,0);
}
U0 ATAPIWriteBlks(CBlkDev *bd,U8 *buf, I64 native_blk, I64 cnt)
U0 ATAPIWriteBlks(CBlkDev *bd,U8 *buf, I64 native_blk, I64 count)
{
I64 U32s_avail;
U8 *buf2;
@ -550,7 +550,7 @@ U0 ATAPIWriteBlks(CBlkDev *bd,U8 *buf, I64 native_blk, I64 cnt)
else
OutU8(bd->base0+ATAR0_SEL,0xE0|bd->unit<<4);
OutU8(bd->base0+ATAR0_CMD,ATA_PACKET);
ATAPIWritePktWord(bd,0,0x0400,native_blk.u16[1],native_blk,cnt.u16[1],cnt,0);
ATAPIWritePktWord(bd,0,0x0400,native_blk.u16[1],native_blk,count.u16[1],count,0);
bd->flags|=BDF_LAST_WAS_WRITE;
ATAWaitNotBUSY(bd,0);
@ -563,8 +563,8 @@ U0 ATAPIWriteBlks(CBlkDev *bd,U8 *buf, I64 native_blk, I64 cnt)
OutU8(bd->base0+ATAR0_LCYL,bd->blk_size);
OutU8(bd->base0+ATAR0_HCYL,bd->blk_size.u8[1]);
ATACmd(bd,ATA_PACKET);
ATAPIWritePktWord(bd,0,0xAA00,native_blk.u16[1],native_blk,cnt.u16[1],cnt,0);
buf2=buf+bd->blk_size*cnt;
ATAPIWritePktWord(bd,0,0xAA00,native_blk.u16[1],native_blk,count.u16[1],count,0);
buf2=buf+bd->blk_size*count;
while (buf<buf2) {
ATAWaitDRQ(bd,0);
U32s_avail=(InU8(bd->base0+ATAR0_HCYL)<<8+InU8(bd->base0+ATAR0_LCYL))>>2;
@ -573,13 +573,13 @@ U0 ATAPIWriteBlks(CBlkDev *bd,U8 *buf, I64 native_blk, I64 cnt)
if (U32s_avail) {
RepOutU32(buf,U32s_avail,bd->base0+ATAR0_DATA);
buf+=U32s_avail<<2;
blkdev.write_cnt+=U32s_avail>>(BLK_SIZE_BITS-2);
blkdev.write_count+=U32s_avail>>(BLK_SIZE_BITS-2);
}
}
ATAWaitNotBUSY(bd,0);
}
Bool ATAWBlks(CDrive *dv,U8 *buf, I64 blk, I64 cnt)
Bool ATAWBlks(CDrive *dv,U8 *buf, I64 blk, I64 count)
{
I64 n,spc;
CBlkDev *bd=dv->bd;
@ -589,8 +589,8 @@ Bool ATAWBlks(CDrive *dv,U8 *buf, I64 blk, I64 cnt)
unlock=BlkDevLock(bd);
ATAPIWaitReady(bd,0);
}
while (cnt>0) {
n=cnt;
while (count>0) {
n=count;
if (n>bd->max_writes)
n=bd->max_writes;
if (bd->type==BDT_ATAPI)
@ -599,8 +599,8 @@ Bool ATAWBlks(CDrive *dv,U8 *buf, I64 blk, I64 cnt)
ATAWriteBlks(bd,buf,blk,n);
buf+=n<<BLK_SIZE_BITS;
blk+=n;
cnt-=n;
blkdev.write_cnt+=n;
count-=n;
blkdev.write_count+=n;
}
if (bd->type==BDT_ATAPI) {
ATAPISync(bd);

View File

@ -133,7 +133,7 @@ Bool ATARepExitAllApplications()
public I64 ATARep(Bool pmt=TRUE,Bool just_ide=FALSE,CATARep **_head=NULL)
{//Report possible ATA devices by probing. Hard disks and CD/DVDs.
I64 d1,d2,i,j,k,cnt=0,unlock_flags=0,num_hints=0;
I64 d1,d2,i,j,k,count=0,unlock_flags=0,num_hints=0;
#assert BLKDEVS_NUM<=64
if (_head) *_head=NULL;
@ -154,7 +154,7 @@ public I64 ATARep(Bool pmt=TRUE,Bool just_ide=FALSE,CATARep **_head=NULL)
break;
"\nSubcode:0x%X Bus:0x%X Dev:0x%X Fun:0x%X\n",k,j.u8[2],j.u8[1],j.u8[0];
cnt++;
count++;
d1=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x10);
d2=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x14);
@ -178,7 +178,7 @@ public I64 ATARep(Bool pmt=TRUE,Bool just_ide=FALSE,CATARep **_head=NULL)
}
}
}
if (!cnt) {
if (!count) {
d1=0x1F0; d2=0x3F6;
ATARepEntry(d1,d2,0,"Primary IDE",_head,&num_hints);
ATARepEntry(d1,d2,1,"Primary IDE",_head,&num_hints);
@ -288,6 +288,6 @@ I64 MountIDEAuto()
tmpha=tmpha->next;
}
LinkedLstDel(head);
blkdev.mount_ide_auto_cnt=res;
blkdev.mount_ide_auto_count=res;
return res;
}

View File

@ -1,22 +1,22 @@
#define ZERO_BUF_SIZE 2048
U0 BlkWriteZero(CDrive *dv,I64 blk,I64 cnt)
{//Fill blk cnt with zeros in Drive.
U0 BlkWriteZero(CDrive *dv,I64 blk,I64 count)
{//Fill blk count with zeros in Drive.
I64 n;
U8 *z=CAlloc(ZERO_BUF_SIZE<<BLK_SIZE_BITS);
Bool show_progress;
if (cnt>ZERO_BUF_SIZE && dv->bd->type!=BDT_RAM) {
progress1=0; progress1_max=cnt;
if (count>ZERO_BUF_SIZE && dv->bd->type!=BDT_RAM) {
progress1=0; progress1_max=count;
StrCpy(progress1_desc,"Zeroing");
show_progress=TRUE;
} else
show_progress=FALSE;
while (cnt>0) {
n=cnt;
while (count>0) {
n=count;
if (n>ZERO_BUF_SIZE)
n=ZERO_BUF_SIZE;
BlkWrite(dv,z,blk,n);
blk+=n;
cnt-=n;
count-=n;
if (show_progress)
progress1+=n;
Yield; //Prevent locking
@ -28,37 +28,37 @@ U0 BlkWriteZero(CDrive *dv,I64 blk,I64 cnt)
}
}
Bool BlkRead(CDrive *dv,U8 *buf, I64 blk, I64 cnt)
{//Read blk cnt from Drive to buf.
Bool BlkRead(CDrive *dv,U8 *buf, I64 blk, I64 count)
{//Read blk count from Drive to buf.
Bool res=TRUE,unlock;
CBlkDev *bd=dv->bd;
if (cnt<=0) return TRUE;
if (count<=0) return TRUE;
DriveCheck(dv);
try {
unlock=DriveLock(dv);
BlkDevInit(bd);
if (dv->drv_offset && blk<dv->drv_offset ||
blk+cnt>dv->drv_offset+dv->size)
blk+count>dv->drv_offset+dv->size)
throw('Drive');
if (bd->flags & BDF_READ_CACHE)
RCache(dv,&buf,&blk,&cnt);
if (cnt>0) {
RCache(dv,&buf,&blk,&count);
if (count>0) {
switch (bd->type) {
case BDT_RAM:
MemCpy(buf,bd->RAM_dsk+blk<<BLK_SIZE_BITS,cnt<<BLK_SIZE_BITS);
MemCpy(buf,bd->RAM_dsk+blk<<BLK_SIZE_BITS,count<<BLK_SIZE_BITS);
break;
case BDT_ISO_FILE_READ:
case BDT_ISO_FILE_WRITE:
FBlkRead(bd->file_dsk,buf,blk,cnt);
FBlkRead(bd->file_dsk,buf,blk,count);
break;
case BDT_ATA:
case BDT_ATAPI:
res=ATARBlks(dv,buf,blk,cnt);
res=ATARBlks(dv,buf,blk,count);
break;
}
bd->last_time=tS;
if (bd->flags & BDF_READ_CACHE)
DiskCacheAdd(dv,buf,blk,cnt);
DiskCacheAdd(dv,buf,blk,count);
}
if (unlock)
DriveUnlock(dv);
@ -68,11 +68,11 @@ Bool BlkRead(CDrive *dv,U8 *buf, I64 blk, I64 cnt)
return res;
}
Bool BlkWrite(CDrive *dv,U8 *buf, I64 blk, I64 cnt)
{//Write blk cnt from buf to Drive.
Bool BlkWrite(CDrive *dv,U8 *buf, I64 blk, I64 count)
{//Write blk count from buf to Drive.
Bool res=TRUE,unlock;
CBlkDev *bd=dv->bd;
if (cnt<=0) return TRUE;
if (count<=0) return TRUE;
DriveCheck(dv);
try {
unlock=DriveLock(dv);
@ -80,25 +80,25 @@ Bool BlkWrite(CDrive *dv,U8 *buf, I64 blk, I64 cnt)
if (bd->flags&BDF_READ_ONLY && !(bd->flags & BDF_READ_ONLY_OVERRIDE))
throw('BlkDev');
if (dv->drv_offset && blk<dv->drv_offset ||
blk+cnt>dv->drv_offset+dv->size)
blk+count>dv->drv_offset+dv->size)
throw('Drive');
if (cnt>0) {
if (count>0) {
switch (bd->type) {
case BDT_RAM:
MemCpy(bd->RAM_dsk+blk<<BLK_SIZE_BITS,buf,cnt<<BLK_SIZE_BITS);
MemCpy(bd->RAM_dsk+blk<<BLK_SIZE_BITS,buf,count<<BLK_SIZE_BITS);
break;
case BDT_ISO_FILE_READ:
case BDT_ISO_FILE_WRITE:
FBlkWrite(bd->file_dsk,buf,blk,cnt);
FBlkWrite(bd->file_dsk,buf,blk,count);
break;
case BDT_ATA:
case BDT_ATAPI:
res=ATAWBlks(dv,buf,blk,cnt);
res=ATAWBlks(dv,buf,blk,count);
break;
}
bd->last_time=tS;
if (bd->flags & BDF_READ_CACHE)
DiskCacheAdd(dv,buf,blk,cnt);
DiskCacheAdd(dv,buf,blk,count);
}
if (unlock)
DriveUnlock(dv);

View File

@ -69,18 +69,18 @@ U0 DVDImageRead(U8 dvd_drv_let,U8 *out_name)
U8 *buf=MAlloc(COPY_BUF_BLKS<<BLK_SIZE_BITS),
*out_name2=ExtDft(out_name,"ISO");
CFile *f=FOpen(out_name2,"w");
I64 n,spc=bd->blk_size>>BLK_SIZE_BITS,blk=0,cnt,retry;
I64 n,spc=bd->blk_size>>BLK_SIZE_BITS,blk=0,count,retry;
BlkDevInit(bd);
if (bd->type!=BDT_ATAPI)
throw('BlkDev');
if (!out_name)
out_name=blkdev.dft_iso_filename;
cnt=CeilU64(dv->size,spc);
while (cnt>0) {
if (cnt>COPY_BUF_BLKS)
count=CeilU64(dv->size,spc);
while (count>0) {
if (count>COPY_BUF_BLKS)
n=COPY_BUF_BLKS;
else
n=cnt;
n=count;
if (n>bd->max_reads)
n=bd->max_reads;
@ -94,7 +94,7 @@ U0 DVDImageRead(U8 dvd_drv_let,U8 *out_name)
ATAPIReadBlks2(bd,0,buf,blk/spc,n/spc,TRUE);
FBlkWrite(f,buf,blk,n);
cnt-=n;
count-=n;
blk+=n;
}
FClose(f);
@ -105,7 +105,7 @@ U0 DVDImageRead(U8 dvd_drv_let,U8 *out_name)
class CDualBuf
{
U8 *buf0,*buf1;
I64 in_buf,out_buf,cnt;
I64 in_buf,out_buf,count;
U8 *filename;
CBlkDev *dvd_bd;
};
@ -113,17 +113,17 @@ class CDualBuf
U0 DVDImageWriteTask(CDualBuf *d)
{
U8 *buf;
I64 n,blk=0,cnt=d->cnt;
I64 n,blk=0,count=d->count;
CFile *f;
if (FileAttr(d->filename)&RS_ATTR_CONTIGUOUS)
f=FOpen(d->filename,"rc");
else
f=FOpen(d->filename,"r");
while (cnt>0) {
if (cnt>COPY_BUF_BLKS)
while (count>0) {
if (count>COPY_BUF_BLKS)
n=COPY_BUF_BLKS;
else
n=cnt;
n=count;
if (n>d->dvd_bd->max_writes)
n=d->dvd_bd->max_writes;
if (d->in_buf&1)
@ -134,7 +134,7 @@ U0 DVDImageWriteTask(CDualBuf *d)
Yield;
FBlkRead(f,buf,blk,n);
d->in_buf++;
cnt-=n;
count-=n;
blk+=n;
}
FClose(f);
@ -144,7 +144,7 @@ U0 DVDImageWrite(U8 dvd_drv_let,U8 *in_name=NULL,I64 media_type=MT_DVD)
{//Write CD/DVD ISO file to disk.
CDualBuf *d=CAlloc(sizeof(CDualBuf));
U8 *buf,*in_name2,*in_name3;
I64 i,n,spc,blk=0,cnt;
I64 i,n,spc,blk=0,count;
CDrive *dv=Letter2Drive(dvd_drv_let);
CBlkDev *bd=dv->bd,*bd2;
CTask *task;
@ -159,7 +159,7 @@ U0 DVDImageWrite(U8 dvd_drv_let,U8 *in_name=NULL,I64 media_type=MT_DVD)
Free(d);
return;
}
cnt=(FSize(f)+BLK_SIZE-1)>>BLK_SIZE_BITS;
count=(FSize(f)+BLK_SIZE-1)>>BLK_SIZE_BITS;
FClose(f);
if (bd->type!=BDT_ATAPI)
throw('BlkDev');
@ -175,14 +175,14 @@ U0 DVDImageWrite(U8 dvd_drv_let,U8 *in_name=NULL,I64 media_type=MT_DVD)
bd->flags|=BDF_READ_ONLY_OVERRIDE;
BlkDevInit(bd);
spc=bd->blk_size>>BLK_SIZE_BITS;
if (dv->size<cnt)
dv->size=cnt;
if (dv->size<count)
dv->size=count;
d->filename=in_name2;
d->dvd_bd=bd;
d->buf0=MAlloc(COPY_BUF_BLKS<<BLK_SIZE_BITS);
d->buf1=MAlloc(COPY_BUF_BLKS<<BLK_SIZE_BITS);
d->cnt=cnt;
d->count=count;
task=Spawn(&DVDImageWriteTask,d,"Write CD/DVD");
while (d->in_buf<=d->out_buf)
@ -191,13 +191,13 @@ U0 DVDImageWrite(U8 dvd_drv_let,U8 *in_name=NULL,I64 media_type=MT_DVD)
BlkDevLock(bd);
ATAPIWaitReady(bd,0);
progress1=0; progress1_max=cnt;
progress1=0; progress1_max=count;
StrCpy(progress1_desc,"Writing");
while (cnt>0) {
if (cnt>COPY_BUF_BLKS)
while (count>0) {
if (count>COPY_BUF_BLKS)
n=COPY_BUF_BLKS;
else
n=cnt;
n=count;
if (n>bd->max_writes)
n=bd->max_writes;
if (d->out_buf&1)
@ -208,7 +208,7 @@ U0 DVDImageWrite(U8 dvd_drv_let,U8 *in_name=NULL,I64 media_type=MT_DVD)
Yield;
ATAPIWriteBlks(bd,buf,blk/spc,(n+spc-1)/spc);
d->out_buf++;
cnt-=n;
count-=n;
blk+=n;
progress1+=n;
}

View File

@ -6,7 +6,7 @@ I64 FSize(CFile *f)
return 0;
}
CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0)
CFile *FOpen(U8 *filename,U8 *flags,I64 count=0)
{//Allows flags "r","w","w+". "c" for contiguous.
//(It uses $LK,"StrOcc",A="MN:StrOcc"$() for 'w', 'r', '+', 'c')
CFile *f=CAlloc(sizeof(CFile));
@ -16,8 +16,8 @@ CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0)
f->clus=INVALID_CLUS;
f->fblk_num=0;
if (cnt>0)
f->max_blk=cnt-1;
if (count>0)
f->max_blk=count-1;
else
f->max_blk=I64_MAX;
f->file_clus_num=INVALID_CLUS;
@ -47,10 +47,10 @@ CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0)
f->flags|=FF_NEW_FILE;
if (dirc=DirContextNew(full_name)) {
StrCpy(f->de.name,dirc->mask);
if (cnt>0) {//We pre-alloc the whole thing.
if (count>0) {//We pre-alloc the whole thing.
f->de.clus=ClusAlloc(f->dv,0,
(cnt+f->dv->spc-1)/f->dv->spc,contiguous);
f->de.size=cnt<<BLK_SIZE_BITS;
(count+f->dv->spc-1)/f->dv->spc,contiguous);
f->de.size=count<<BLK_SIZE_BITS;
DirNew(dirc->dv,Fs->cur_dir,&f->de,TRUE);
f->flags&=~FF_NEW_FILE;
}
@ -126,20 +126,20 @@ I64 FSetClus(CFile *f,I64 c,I64 blk,Bool read)
return c;
}
Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
{//Read [nth,n+cnt) blks of file.
Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 count=1)
{//Read [nth,n+count) blks of file.
CDrive *dv=f->dv;
I64 spc=dv->spc,i,j,c=f->de.clus;
if (!f || !dv) return FALSE;
if (blk==FFB_NEXT_BLK)
blk=f->fblk_num;
if (blk+cnt-1>f->max_blk)
if (blk+count-1>f->max_blk)
return FALSE;
if (cnt<=0) return TRUE;
if (count<=0) return TRUE;
if (f->flags & FF_CONTIGUOUS) {
BlkRead(dv,buf,Clus2Blk(dv,c)+blk,cnt);
blk+=cnt;
BlkRead(dv,buf,Clus2Blk(dv,c)+blk,count);
blk+=count;
} else {
i=blk/spc;
if (0<=f->file_clus_num<=i) {
@ -151,48 +151,48 @@ Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
if (i=blk%spc) {
c=FSetClus(f,c,blk,TRUE);
if (cnt<spc-i)
j=cnt;
if (count<spc-i)
j=count;
else
j=spc-i;
MemCpy(buf,f->clus_buf+i<<BLK_SIZE_BITS,j<<BLK_SIZE_BITS);
buf+=j<<BLK_SIZE_BITS;
cnt-=j;
count-=j;
blk+=j;
}
while (cnt>=spc) {
while (count>=spc) {
c=FSetClus(f,c,blk,TRUE);
MemCpy(buf,f->clus_buf,spc<<BLK_SIZE_BITS);
buf+=spc<<BLK_SIZE_BITS;
cnt-=spc;
count-=spc;
blk+=spc;
}
if (cnt>0) {
if (count>0) {
c=FSetClus(f,c,blk,TRUE);
MemCpy(buf,f->clus_buf,cnt<<BLK_SIZE_BITS);
buf+=cnt<<BLK_SIZE_BITS;
blk+=cnt;
MemCpy(buf,f->clus_buf,count<<BLK_SIZE_BITS);
buf+=count<<BLK_SIZE_BITS;
blk+=count;
}
}
f->fblk_num=blk;
return TRUE;
}
Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
{//Write [nth,n+cnt) blks of file.
Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 count=1)
{//Write [nth,n+count) blks of file.
CDrive *dv=f->dv;
I64 spc=dv->spc,i,j,c=f->de.clus,c1;
if (!f || !dv) return FALSE;
if (blk==FFB_NEXT_BLK)
blk=f->fblk_num;
if (blk+cnt-1>f->max_blk)
if (blk+count-1>f->max_blk)
return FALSE;
if (!(f->flags & FF_WRITE))
return FALSE;
if (cnt<=0) return TRUE;
if (count<=0) return TRUE;
if (f->flags & FF_CONTIGUOUS) {
BlkWrite(dv,buf,Clus2Blk(dv,c)+blk,cnt);
blk+=cnt;
BlkWrite(dv,buf,Clus2Blk(dv,c)+blk,count);
blk+=count;
} else {
if (!c) {
c=ClusAlloc(dv,0,1,FALSE);
@ -220,42 +220,42 @@ Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
if (i=blk%spc) {
FSetClus(f,c,blk,TRUE);
if (cnt<spc-i)
j=cnt;
if (count<spc-i)
j=count;
else
j=spc-i;
MemCpy(f->clus_buf+BLK_SIZE*i,buf,j<<BLK_SIZE_BITS);
f->flags|=FF_BUF_DIRTY;
buf+=j<<BLK_SIZE_BITS;
cnt-=j;
count-=j;
blk+=j;
if (cnt>0) {
if (count>0) {
c1=c;
c=ClusNumNext(dv,c1,1);
if (c==INVALID_CLUS)
c=ClusAlloc(dv,c1,1,FALSE);
}
}
while (cnt>=spc) {
while (count>=spc) {
FSetClus(f,c,blk,FALSE);
MemCpy(f->clus_buf,buf,spc<<BLK_SIZE_BITS);
f->flags|=FF_BUF_DIRTY;
buf+=spc<<BLK_SIZE_BITS;
cnt-=spc;
count-=spc;
blk+=spc;
if (cnt>0) {
if (count>0) {
c1=c;
c=ClusNumNext(dv,c1,1);
if (c==INVALID_CLUS)
c=ClusAlloc(dv,c1,1,FALSE);
}
}
if (cnt>0) {
if (count>0) {
FSetClus(f,c,blk,TRUE);
MemCpy(f->clus_buf,buf,cnt<<BLK_SIZE_BITS);
MemCpy(f->clus_buf,buf,count<<BLK_SIZE_BITS);
f->flags|=FF_BUF_DIRTY;
buf+=cnt<<BLK_SIZE_BITS;
blk+=cnt;
buf+=count<<BLK_SIZE_BITS;
blk+=count;
}
if (f->de.size<blk<<BLK_SIZE_BITS)
f->de.size=blk<<BLK_SIZE_BITS;

View File

@ -1,7 +1,7 @@
U0 DiskCacheInit(I64 size_in_U8s)
{
CCacheBlk *tmpc;
I64 i,cnt;
I64 i,count;
while (LBts(&sys_semas[SEMA_DSK_CACHE],0))
Yield;
@ -17,9 +17,9 @@ U0 DiskCacheInit(I64 size_in_U8s)
blkdev.cache_base=AMAlloc(size_in_U8s);
QueueInit(blkdev.cache_ctrl);
cnt=MSize(blkdev.cache_base)/sizeof(CCacheBlk);
blkdev.cache_size=cnt*BLK_SIZE;
for (i=0;i<cnt;i++) {
count=MSize(blkdev.cache_base)/sizeof(CCacheBlk);
blkdev.cache_size=count*BLK_SIZE;
for (i=0;i<count;i++) {
tmpc=blkdev.cache_base+i;
QueueInsert(tmpc,blkdev.cache_ctrl->last_lru);
tmpc->next_hash=tmpc->last_hash=tmpc;
@ -73,13 +73,13 @@ CCacheBlk *DiskCacheFind(CDrive *dv,I64 blk)
return NULL;
}
U0 DiskCacheAdd(CDrive *dv,U8 *buf, I64 blk, I64 cnt)
U0 DiskCacheAdd(CDrive *dv,U8 *buf, I64 blk, I64 count)
{
CCacheBlk *tmpc;
if (blkdev.cache_base) {
while (LBts(&sys_semas[SEMA_DSK_CACHE],0))
Yield;
while (cnt-->0) {
while (count-->0) {
if (!(tmpc=DiskCacheFind(dv,blk)))
tmpc=blkdev.cache_ctrl->next_lru;
DiskCacheQueueRemove(tmpc);
@ -116,27 +116,27 @@ U0 DiskCacheInvalidate2(CDrive *dv)
}
}
U0 RCache(CDrive *dv,U8 **_buf, I64 *_blk, I64 *_cnt)
U0 RCache(CDrive *dv,U8 **_buf, I64 *_blk, I64 *_count)
{
CCacheBlk *tmpc;
if (blkdev.cache_base) {
while (LBts(&sys_semas[SEMA_DSK_CACHE],0))
Yield;
//fetch leading blks from cache
while (*_cnt>0) {
while (*_count>0) {
if (tmpc=DiskCacheFind(dv,*_blk)) {
MemCpy(*_buf,&tmpc->body,BLK_SIZE);
*_cnt-=1;
*_count-=1;
*_buf+=BLK_SIZE;
*_blk+=1;
} else
break;
}
//fetch trailing blks from cache
while (*_cnt>0) {
if (tmpc=DiskCacheFind(dv,*_blk+*_cnt-1)) {
MemCpy(*_buf+(*_cnt-1)<<BLK_SIZE_BITS,&tmpc->body,BLK_SIZE);
*_cnt-=1;
while (*_count>0) {
if (tmpc=DiskCacheFind(dv,*_blk+*_count-1)) {
MemCpy(*_buf+(*_count-1)<<BLK_SIZE_BITS,&tmpc->body,BLK_SIZE);
*_count-=1;
} else
break;
}

View File

@ -1,16 +1,16 @@
I64 ClusNumNext(CDrive *dv,I64 c,I64 cnt=1)
{//Return next cnt'th clus in chain.
I64 ClusNumNext(CDrive *dv,I64 c,I64 count=1)
{//Return next count'th clus in chain.
Bool unlock;
DriveCheck(dv);
if (cnt<=0) return c;
if (count<=0) return c;
try {
unlock=DriveLock(dv);
switch (dv->fs_type) {
case FSt_REDSEA:
c+=cnt;
c+=count;
break;
case FSt_FAT32:
while (cnt-->0 && 0<c<0x0FFFFFF8) {
while (count-->0 && 0<c<0x0FFFFFF8) {
DriveFATBlkSet(dv,c);
c=dv->cur_fat_blk[c & (BLK_SIZE/4-1)];
}
@ -78,9 +78,9 @@ I64 ClusBlkRead(CDrive *dv,U8 *buf,I64 c,I64 blks)
return c;
}
I64 ClusRead(CDrive *dv,U8 *buf,I64 c,I64 cnt)
{//Read clus cnt from drv to buf.
return ClusBlkRead(dv,buf,c,cnt*dv->spc);
I64 ClusRead(CDrive *dv,U8 *buf,I64 c,I64 count)
{//Read clus count from drv to buf.
return ClusBlkRead(dv,buf,c,count*dv->spc);
}
I64 ClusBlkWrite(CDrive *dv,U8 *buf,I64 c,I64 blks)
@ -120,25 +120,25 @@ I64 ClusBlkWrite(CDrive *dv,U8 *buf,I64 c,I64 blks)
return c;
}
I64 ClusWrite(CDrive *dv,U8 *buf,I64 c,I64 cnt)
{//Write clus cnt from buf to drv.
return ClusBlkWrite(dv,buf,c,cnt*dv->spc);
I64 ClusWrite(CDrive *dv,U8 *buf,I64 c,I64 count)
{//Write clus count from buf to drv.
return ClusBlkWrite(dv,buf,c,count*dv->spc);
}
I64 ClusAlloc(CDrive *dv,I64 c=0,I64 cnt=1,Bool contiguous=FALSE)
{//Alloc clus cnt into chain.
I64 ClusAlloc(CDrive *dv,I64 c=0,I64 count=1,Bool contiguous=FALSE)
{//Alloc clus count into chain.
//c=0 means first clus in chain
DriveCheck(dv);
if (cnt<=0) return c;
if (count<=0) return c;
switch (dv->fs_type) {
case FSt_REDSEA:
return RedSeaAllocClus(dv,cnt);
return RedSeaAllocClus(dv,count);
case FSt_FAT32:
if (contiguous) {
if (c) throw('File');
return FAT32AllocContiguousClus(dv,cnt);
return FAT32AllocContiguousClus(dv,count);
} else
return FAT32AllocClus(dv,c,cnt);
return FAT32AllocClus(dv,c,count);
default:
throw('Drive');
}

Some files were not shown because too many files have changed in this diff Show More