mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2025-06-06 15:54:47 +00:00
Que -> Queue
This commit is contained in:
parent
aedb86f72d
commit
2d10181de5
Binary file not shown.
@ -30,7 +30,7 @@ U0 BgtIns(CBgtEntry *tmpb)
|
||||
CBgtEntry *tmpb1=b_head.next;
|
||||
while (tmpb1!=&b_head && tmpb1->date<tmpb->date)
|
||||
tmpb1=tmpb1->next;
|
||||
QueIns(tmpb,tmpb1->last);
|
||||
QueueInsert(tmpb,tmpb1->last);
|
||||
}
|
||||
|
||||
class CBgtEntryForm
|
||||
|
@ -8,10 +8,10 @@ U0 BgtDataRead()
|
||||
U8 **s=StrFileRead(bgt_string_file,&max_num);
|
||||
|
||||
MemSet(&b_head,0,sizeof(CBgtEntry));
|
||||
QueInit(&b_head);
|
||||
QueueInit(&b_head);
|
||||
b_head.date=Now;
|
||||
MemSet(&t_head,0,sizeof(CBgtTemplate));
|
||||
QueInit(&t_head);
|
||||
QueueInit(&t_head);
|
||||
t_head.b.date=Now;
|
||||
|
||||
if (ptr=b=FileRead(bgt_data_file,&size)) {
|
||||
@ -22,7 +22,7 @@ U0 BgtDataRead()
|
||||
tmpb->credit=StrNew(s[tmpb->credit_idx]);
|
||||
tmpb->debit =StrNew(s[tmpb->debit_idx]);
|
||||
tmpb->desc =StrNew(s[tmpb->desc_idx]);
|
||||
QueIns(tmpb,b_head.last);
|
||||
QueueInsert(tmpb,b_head.last);
|
||||
ptr+=BE_SIZE;
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ U0 BgtDataRead()
|
||||
tmpt->b.credit=StrNew(s[tmpt->b.credit_idx]);
|
||||
tmpt->b.debit =StrNew(s[tmpt->b.debit_idx]);
|
||||
tmpt->b.desc =StrNew(s[tmpt->b.desc_idx]);
|
||||
QueIns(tmpt,t_head.last);
|
||||
QueueInsert(tmpt,t_head.last);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,17 +14,17 @@ Bool BgtPutKey(CDoc *doc,U8 *,I64 ch,I64 sc)
|
||||
tmpb=doc_ce->user_data;
|
||||
if (tmpt=tmpb->template) {
|
||||
if (tmpt1=BgtTemplatePmt(tmpt)) {
|
||||
QueRem(tmpt);
|
||||
QueueRem(tmpt);
|
||||
BgtTemplatePurge(tmpt);
|
||||
BgtEntryDel2(&tmpt->b);
|
||||
Free(tmpt);
|
||||
QueIns(tmpt1,t_head.last);
|
||||
QueueInsert(tmpt1,t_head.last);
|
||||
BgtTemplateExpand(tmpt1);
|
||||
BgtRegen;
|
||||
}
|
||||
} else {
|
||||
if (tmpb1=BgtEntryPmt(tmpb)) {
|
||||
QueRem(tmpb);
|
||||
QueueRem(tmpb);
|
||||
BgtEntryDel(tmpb);
|
||||
BgtIns(tmpb1);
|
||||
BgtRegen;
|
||||
@ -37,10 +37,10 @@ Bool BgtPutKey(CDoc *doc,U8 *,I64 ch,I64 sc)
|
||||
doc_ce->type_u8==DOCT_MENU_VAL) {
|
||||
tmpb=doc_ce->user_data;
|
||||
if (tmpt=tmpb->template) {
|
||||
QueRem(tmpt);
|
||||
QueueRem(tmpt);
|
||||
BgtTemplateDel(tmpt);
|
||||
} else {
|
||||
QueRem(tmpb);
|
||||
QueueRem(tmpb);
|
||||
BgtEntryDel(tmpb);
|
||||
}
|
||||
BgtRegen;
|
||||
@ -69,7 +69,7 @@ Bool BgtPutKey(CDoc *doc,U8 *,I64 ch,I64 sc)
|
||||
return TRUE;
|
||||
case 't':
|
||||
if (tmpt1=BgtTemplatePmt) {
|
||||
QueIns(tmpt1,t_head.last);
|
||||
QueueInsert(tmpt1,t_head.last);
|
||||
BgtTemplateExpand(tmpt1);
|
||||
BgtRegen;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ U0 BgtTemplatePurge(CBgtTemplate *tmpt)
|
||||
while (tmpb!=&b_head) {
|
||||
tmpb1=tmpb->next;
|
||||
if (tmpb->template==tmpt) {
|
||||
QueRem(tmpb);
|
||||
QueueRem(tmpb);
|
||||
BgtEntryDel2(tmpb);
|
||||
Free(tmpb);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ CTask *JukeReward(U8 *msg)
|
||||
TaskWait(res);
|
||||
|
||||
res->border_src =BDS_CONST;
|
||||
res->border_attr=LTGRAY<<4+DrvTextAttrGet(':')&15;
|
||||
res->border_attr=LTGRAY<<4+DriveTextAttrGet(':')&15;
|
||||
res->text_attr =LTGRAY<<4+BLUE;
|
||||
res->win_inhibit=WIG_NO_FOCUS_TASK_DFT;
|
||||
WinHorz(Fs->win_right+2,TEXT_COLS-2,res);
|
||||
|
@ -77,13 +77,13 @@ CCtrl *TempoNew()
|
||||
c->update_derived_vals=&UpdateDerivedTempoCtrl;
|
||||
c->left=396;
|
||||
c->top=96;
|
||||
QueIns(c,Fs->last_ctrl);
|
||||
QueueInsert(c,Fs->last_ctrl);
|
||||
TaskDerivedValsUpdate;
|
||||
return c;
|
||||
}
|
||||
|
||||
U0 TempoDel(CCtrl *c)
|
||||
{
|
||||
QueRem(c);
|
||||
QueueRem(c);
|
||||
Free(c);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ U0 PsmSongDel(PsmNote *head)
|
||||
PsmNoteDel(tmpn);
|
||||
tmpn=tmpn1;
|
||||
}
|
||||
QueInit(head);
|
||||
QueueInit(head);
|
||||
}
|
||||
|
||||
U0 PsmCutToClip()
|
||||
@ -36,9 +36,9 @@ U0 PsmCutToClip()
|
||||
if (tmpn->flags&PSMF_SEL) {
|
||||
if (psm.cur_note==tmpn)
|
||||
psm.cur_note=tmpn->next;
|
||||
QueRem(tmpn);
|
||||
QueueRem(tmpn);
|
||||
tmpn->flags&=~PSMF_SEL;
|
||||
QueIns(tmpn,psm.clip.last);
|
||||
QueueInsert(tmpn,psm.clip.last);
|
||||
}
|
||||
tmpn=tmpn1;
|
||||
}
|
||||
@ -50,7 +50,7 @@ U0 PsmPasteClip()
|
||||
tmpn=psm.clip.next;
|
||||
while (tmpn!=&psm.clip) {
|
||||
tmpn1=PsmNoteCopy(tmpn);
|
||||
QueIns(tmpn1,psm.cur_note->last);
|
||||
QueueInsert(tmpn1,psm.cur_note->last);
|
||||
tmpn=tmpn->next;
|
||||
}
|
||||
}
|
||||
@ -64,7 +64,7 @@ U0 PsmCopyToClip()
|
||||
if (tmpn->flags&PSMF_SEL) {
|
||||
tmpn->flags&=~PSMF_SEL;
|
||||
tmpn1=PsmNoteCopy(tmpn);
|
||||
QueIns(tmpn1,psm.clip.last);
|
||||
QueueInsert(tmpn1,psm.clip.last);
|
||||
}
|
||||
tmpn=tmpn->next;
|
||||
}
|
||||
@ -129,7 +129,7 @@ U0 PsmLoadSongStr(U8 *st,I64 *psm_octave,F64 *psm_duration)
|
||||
else
|
||||
tmpn1->meter_bottom=4;
|
||||
PsmSetWidth(tmpn1);
|
||||
QueIns(tmpn1,psm.head.last);
|
||||
QueueInsert(tmpn1,psm.head.last);
|
||||
}
|
||||
while (*st=='(') {
|
||||
Bts(&tmpn->flags,PSMf_TIE);
|
||||
@ -192,7 +192,7 @@ U0 PsmLoadSongStr(U8 *st,I64 *psm_octave,F64 *psm_duration)
|
||||
tmpn->duration=i;
|
||||
tmpn->type=PSMT_NOTE;
|
||||
PsmSetWidth(tmpn);
|
||||
QueIns(tmpn,psm.cur_note->last);
|
||||
QueueInsert(tmpn,psm.cur_note->last);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,11 +90,11 @@ U0 PsmRightClick(I64 x,I64 y)
|
||||
break;
|
||||
case PSMR_INS_NOTE:
|
||||
tmpn1=PsmNoteCopy(tmpn);
|
||||
QueIns(tmpn1,tmpn);
|
||||
QueueInsert(tmpn1,tmpn);
|
||||
break;
|
||||
case PSMR_DELETE_NOTE:
|
||||
psm.cur_note=tmpn->next;
|
||||
QueRem(tmpn);
|
||||
QueueRem(tmpn);
|
||||
PsmNoteDel(tmpn);
|
||||
break;
|
||||
}
|
||||
@ -138,7 +138,7 @@ U0 PsmLeftClickPickNoteBox(I64 duration)
|
||||
tmpn->ona=Note2Ona(n,o);
|
||||
tmpn->duration=duration;
|
||||
PsmSetWidth(tmpn);
|
||||
QueIns(tmpn,tmpn1);
|
||||
QueueInsert(tmpn,tmpn1);
|
||||
psm.cur_note=tmpn->next;
|
||||
}
|
||||
DrawDC2;
|
||||
@ -167,7 +167,7 @@ U0 PsmLeftClickPickMeterBox(I64 top,I64 bottom)
|
||||
tmpn->meter_top=top;
|
||||
tmpn->meter_bottom=bottom;
|
||||
PsmSetWidth(tmpn);
|
||||
QueIns(tmpn,tmpn1);
|
||||
QueueInsert(tmpn,tmpn1);
|
||||
psm.cur_note=tmpn->next;
|
||||
}
|
||||
DrawDC2;
|
||||
@ -548,7 +548,7 @@ mo_got_msg:
|
||||
tmpn=psm.cur_note;
|
||||
psm.cur_note=tmpn->next;
|
||||
if (tmpn!=&psm.head) {
|
||||
QueRem(tmpn);
|
||||
QueueRem(tmpn);
|
||||
PsmNoteDel(tmpn);
|
||||
}
|
||||
}
|
||||
@ -692,7 +692,7 @@ mo_got_msg:
|
||||
case CH_BACKSPACE:
|
||||
tmpn=psm.cur_note->last;
|
||||
if (tmpn!=&psm.head) {
|
||||
QueRem(tmpn);
|
||||
QueueRem(tmpn);
|
||||
PsmNoteDel(tmpn);
|
||||
}
|
||||
if (col) {
|
||||
@ -759,7 +759,7 @@ mo_got_msg:
|
||||
tmpn->duration=PsmCvtDuration(
|
||||
music.tempo*(evt_time-note_down_time));
|
||||
PsmSetWidth(tmpn);
|
||||
QueIns(tmpn,psm.cur_note->last);
|
||||
QueueInsert(tmpn,psm.cur_note->last);
|
||||
}
|
||||
if (!is_null) {
|
||||
note_down_time=tS;
|
||||
|
@ -78,7 +78,7 @@ MyMass *PlaceMass(I64 x, I64 y)
|
||||
tmpm->radius=MASS_RADIUS;
|
||||
tmpm->cost=25.0*COST_SCALE;
|
||||
tmpm->color=YELLOW;
|
||||
QueIns(tmpm,ode->last_mass);
|
||||
QueueInsert(tmpm,ode->last_mass);
|
||||
return tmpm;
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ U0 MoveMass(MyMass *tmpm,I64 x, I64 y)
|
||||
|
||||
U0 DelSpring(MySpring *tmps)
|
||||
{
|
||||
QueRem(tmps);
|
||||
QueueRem(tmps);
|
||||
Free(tmps);
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ U0 DelMass(MyMass *tmpm)
|
||||
DelSpring(tmps);
|
||||
tmps=tmps1;
|
||||
}
|
||||
QueRem(tmpm);
|
||||
QueueRem(tmpm);
|
||||
Free(tmpm);
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ U0 PlaceSpring(MyMass *tmpm1,MyMass *tmpm2)
|
||||
tmps->flags|=SSF_NO_COMPRESSION;
|
||||
break;
|
||||
}
|
||||
QueIns(tmps,ode->last_spring);
|
||||
QueueInsert(tmps,ode->last_spring);
|
||||
}
|
||||
|
||||
U0 AnimateTask(SpanAnimateStruct *a)
|
||||
|
@ -5,16 +5,16 @@ CMathODE *SpanNew()
|
||||
ode->drag_v2=0.002;
|
||||
ode->drag_v3=0.00001;
|
||||
ode->acceleration_limit=5e3;
|
||||
QueIns(ode,Fs->last_ode);
|
||||
QueueInsert(ode,Fs->last_ode);
|
||||
return ode;
|
||||
}
|
||||
|
||||
U0 SpanDel(CMathODE *ode)
|
||||
{
|
||||
if (ode) {
|
||||
QueRem(ode);
|
||||
QueDel(&ode->next_mass,TRUE);
|
||||
QueDel(&ode->next_spring,TRUE);
|
||||
QueueRem(ode);
|
||||
QueueDel(&ode->next_mass,TRUE);
|
||||
QueueDel(&ode->next_spring,TRUE);
|
||||
ODEDel(ode);
|
||||
}
|
||||
}
|
||||
@ -98,14 +98,14 @@ U0 SpanLoad(CMathODE *ode,U8 *src)
|
||||
tmpm=CAlloc(sizeof(MyMass));
|
||||
MemCpy(&tmpm->start,src,M_SIZE);
|
||||
src+=M_SIZE;
|
||||
QueIns(tmpm,ode->last_mass);
|
||||
QueueInsert(tmpm,ode->last_mass);
|
||||
}
|
||||
|
||||
for (i=0;i<h.num_springs;i++) {
|
||||
tmps=CAlloc(sizeof(MySpring));
|
||||
MemCpy(&tmps->start,src,S_SIZE);
|
||||
src+=S_SIZE;
|
||||
QueIns(tmps,ode->last_spring);
|
||||
QueueInsert(tmps,ode->last_spring);
|
||||
tmps->end1=MassFindNum(ode,tmps->end1_num);
|
||||
tmps->end2=MassFindNum(ode,tmps->end2_num);
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ MyMass *PlaceMass(I64 x, I64 y)
|
||||
tmpm->drag_profile_factor=100.0;
|
||||
tmpm->x=x;
|
||||
tmpm->y=y;
|
||||
QueIns(tmpm,ode->last_mass);
|
||||
QueueInsert(tmpm,ode->last_mass);
|
||||
return tmpm;
|
||||
}
|
||||
|
||||
@ -245,7 +245,7 @@ MySpring *PlaceSpring(MyMass *tmpm1,MyMass *tmpm2,I64 type)
|
||||
else
|
||||
tmps->const=2500000/Sqr(d);
|
||||
tmps->action_key=next_action_key;
|
||||
QueIns(tmps,ode->last_spring);
|
||||
QueueInsert(tmps,ode->last_spring);
|
||||
return tmps;
|
||||
}
|
||||
|
||||
@ -280,7 +280,7 @@ U0 BreakConnectors()
|
||||
tmps1=tmps->next;
|
||||
if (tmps->type==EMD_CONNECTOR &&
|
||||
Bt(kbd.down_bitmap,action_scan_codes[tmps->action_key-'0'])) {
|
||||
QueRem(tmps);
|
||||
QueueRem(tmps);
|
||||
Free(tmps);
|
||||
}
|
||||
tmps=tmps1;
|
||||
@ -304,15 +304,15 @@ U0 Init()
|
||||
ode->acceleration_limit=5e3;
|
||||
ode->drag_v2=0.000002;
|
||||
ode->drag_v3=0.0000001;
|
||||
QueIns(ode,Fs->last_ode);
|
||||
QueueInsert(ode,Fs->last_ode);
|
||||
}
|
||||
|
||||
U0 CleanUp()
|
||||
{
|
||||
if (ode) {
|
||||
QueRem(ode);
|
||||
QueDel(&ode->next_mass,TRUE);
|
||||
QueDel(&ode->next_spring,TRUE);
|
||||
QueueRem(ode);
|
||||
QueueDel(&ode->next_mass,TRUE);
|
||||
QueueDel(&ode->next_spring,TRUE);
|
||||
ODEDel(ode);
|
||||
ode=NULL;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ U0 TimeFileRead(TimeEntry *header)
|
||||
buf=FileRead(TIME_FILENAME);
|
||||
if (!buf)
|
||||
buf=CAlloc(1);
|
||||
QueInit(header);
|
||||
QueueInit(header);
|
||||
ptr=buf;
|
||||
while (type=*ptr++) {
|
||||
tmpt=CAlloc(sizeof(TimeEntry));
|
||||
@ -28,7 +28,7 @@ U0 TimeFileRead(TimeEntry *header)
|
||||
tmpt->datetime=*ptr(CDate *)++;
|
||||
tmpt->desc=StrNew(ptr);
|
||||
ptr+=StrLen(ptr)+1;
|
||||
QueIns(tmpt,header->last);
|
||||
QueueInsert(tmpt,header->last);
|
||||
}
|
||||
Free(buf);
|
||||
}
|
||||
@ -126,7 +126,7 @@ public U0 PunchOut()
|
||||
"\nEnter Description.\nPress <ESC> when done.\n";
|
||||
if (!(tmpt->desc=GetStr(,,GSF_WITH_NEW_LINE)))
|
||||
tmpt->desc=CAlloc(1);
|
||||
QueIns(tmpt,header->last);
|
||||
QueueInsert(tmpt,header->last);
|
||||
TimeFileWrite(header);
|
||||
}
|
||||
TimeEntriesDel(header);
|
||||
@ -144,7 +144,7 @@ public U0 PunchIn()
|
||||
"\nEnter Description.\nPress <ESC> when done.\n";
|
||||
if (!(tmpt->desc=GetStr(,,GSF_WITH_NEW_LINE)))
|
||||
tmpt->desc=CAlloc(1);
|
||||
QueIns(tmpt,header->last);
|
||||
QueueInsert(tmpt,header->last);
|
||||
TimeFileWrite(header);
|
||||
}
|
||||
TimeEntriesDel(header);
|
||||
|
@ -378,7 +378,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
DCDepthBufAlloc(dc);
|
||||
mp_not_done_flags=1<<mp_cnt-1;
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
JobQue(&MPMenDraw,dc,i);
|
||||
JobQueue(&MPMenDraw,dc,i);
|
||||
while (mp_not_done_flags)
|
||||
Yield;
|
||||
Free(dc->depth_buf);
|
||||
|
@ -98,7 +98,7 @@ U0 IndirectAdd(Unit *tmpu,I64 row,I64 col)
|
||||
tmpi->attacker=tmpu;
|
||||
tmpi->row=row;
|
||||
tmpi->col=col;
|
||||
QueIns(tmpi,indirect_head.last);
|
||||
QueueInsert(tmpi,indirect_head.last);
|
||||
}
|
||||
|
||||
Bool BulletPlot(U0,I64 x,I64 y,I64)
|
||||
@ -271,7 +271,7 @@ U0 IndirectResolveAll()
|
||||
Yield;
|
||||
indirect_explosion=FALSE;
|
||||
|
||||
QueRem(tmpi);
|
||||
QueueRem(tmpi);
|
||||
Free(tmpi);
|
||||
tmpi=tmpi1;
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ U0 Init()
|
||||
y0=FONT_HEIGHT;
|
||||
}
|
||||
InitUnits;
|
||||
QueInit(&indirect_head);
|
||||
QueueInit(&indirect_head);
|
||||
turn=0;
|
||||
fire_radius=0;
|
||||
show_vis_row=-1;
|
||||
@ -364,7 +364,7 @@ U0 Init()
|
||||
|
||||
U0 CleanUp()
|
||||
{
|
||||
QueDel(&indirect_head,TRUE);
|
||||
QueueDel(&indirect_head,TRUE);
|
||||
}
|
||||
|
||||
U0 PlayerPick(U8 *dirname,I64 player)
|
||||
|
@ -176,7 +176,7 @@ $LK,"MAlloc",A="MN:MAlloc"$() would probably be the better choice.
|
||||
|
||||
res=FALSE;
|
||||
for (i=0;i<cnt;i++)
|
||||
cmd[i]=JobQue(&MPVisRecalc,&job[i],i,0);
|
||||
cmd[i]=JobQueue(&MPVisRecalc,&job[i],i,0);
|
||||
for (i=0;i<cnt;i++)
|
||||
if (JobResGet(cmd[i]))
|
||||
res=TRUE;
|
||||
@ -217,7 +217,7 @@ U0 VisRecalcMap(I64 row,I64 col)
|
||||
job[i].lo=k;
|
||||
}
|
||||
for (i=0;i<cnt;i++)
|
||||
cmd[i]=JobQue(&MPVisRecalcMap,&job[i],i,0);
|
||||
cmd[i]=JobQueue(&MPVisRecalcMap,&job[i],i,0);
|
||||
for (i=0;i<cnt;i++)
|
||||
JobResGet(cmd[i]);
|
||||
}
|
||||
|
@ -168,8 +168,8 @@ U0 MissileNew(Ship *tmpsp,I64 n)
|
||||
D3SubEqu(&tmpmi->p_back.x ,D3MulEqu(D3Copy(&p1,&p),MISSILE_LEN/2-1));
|
||||
D3Copy(&tmpmi->p_front.DxDt,&tmpsp->p[n].DxDt);
|
||||
D3Copy(&tmpmi->p_back.DxDt,&tmpsp->p[n].DxDt);
|
||||
QueIns(&tmpmi->p_front,ode->last_mass);
|
||||
QueIns(&tmpmi->p_back, ode->last_mass);
|
||||
QueueInsert(&tmpmi->p_front,ode->last_mass);
|
||||
QueueInsert(&tmpmi->p_back, ode->last_mass);
|
||||
|
||||
tmpmi->s[0].end1=&tmpmi->p_front;
|
||||
tmpmi->s[0].end2=&tmpmi->p_back;
|
||||
@ -187,11 +187,11 @@ U0 MissileNew(Ship *tmpsp,I64 n)
|
||||
tmpmi->s[i].strength =20000;
|
||||
tmpmi->s[i].color=BLACK;
|
||||
tmpmi->s[i].rest_len=D3Dist(&tmpmi->s[i].end1->x,&tmpmi->s[i].end2->x);
|
||||
QueIns(&tmpmi->s[i],ode->last_spring);
|
||||
QueueInsert(&tmpmi->s[i],ode->last_spring);
|
||||
}
|
||||
tmpmi->img=$IB,"<7>",BI=7$;
|
||||
tmpmi->active=TRUE;
|
||||
QueIns(tmpmi,missile_head.last);
|
||||
QueueInsert(tmpmi,missile_head.last);
|
||||
}
|
||||
|
||||
Ship *ShipNew(I64 x,I64 y,I64 type)
|
||||
@ -222,7 +222,7 @@ Ship *ShipNew(I64 x,I64 y,I64 type)
|
||||
else
|
||||
tmpsp->p[i].radius=4;
|
||||
tmpsp->p[i].drag_profile_factor=3;
|
||||
QueIns(&tmpsp->p[i],ode->last_mass);
|
||||
QueueInsert(&tmpsp->p[i],ode->last_mass);
|
||||
}
|
||||
tmpsp->p[3].mass/=10.0;
|
||||
tmpsp->p[4].mass/=10.0;
|
||||
@ -252,7 +252,7 @@ Ship *ShipNew(I64 x,I64 y,I64 type)
|
||||
tmpsp->s[i].color=LTCYAN;
|
||||
else
|
||||
tmpsp->s[i].color=LTGRAY;
|
||||
QueIns(&tmpsp->s[i],ode->last_spring);
|
||||
QueueInsert(&tmpsp->s[i],ode->last_spring);
|
||||
}
|
||||
MissileNew(tmpsp,0);
|
||||
MissileNew(tmpsp,1);
|
||||
@ -274,7 +274,7 @@ Ship *ShipNew(I64 x,I64 y,I64 type)
|
||||
tmpsp->p[i].type=MT_ENEMY_SHIP;
|
||||
tmpsp->p[i].radius=7;
|
||||
tmpsp->p[i].drag_profile_factor=3;
|
||||
QueIns(&tmpsp->p[i],ode->last_mass);
|
||||
QueueInsert(&tmpsp->p[i],ode->last_mass);
|
||||
}
|
||||
|
||||
tmpsp->springs=3;
|
||||
@ -291,7 +291,7 @@ Ship *ShipNew(I64 x,I64 y,I64 type)
|
||||
tmpsp->s[i].const=10000;
|
||||
tmpsp->s[i].strength =20000;
|
||||
tmpsp->s[i].color=BLACK;
|
||||
QueIns(&tmpsp->s[i],ode->last_spring);
|
||||
QueueInsert(&tmpsp->s[i],ode->last_spring);
|
||||
}
|
||||
remaining++;
|
||||
break;
|
||||
@ -314,7 +314,7 @@ Ship *ShipNew(I64 x,I64 y,I64 type)
|
||||
tmpsp->p[i].type=MT_ENEMY_SHIP;
|
||||
tmpsp->p[i].radius=6;
|
||||
tmpsp->p[i].drag_profile_factor=5;
|
||||
QueIns(&tmpsp->p[i],ode->last_mass);
|
||||
QueueInsert(&tmpsp->p[i],ode->last_mass);
|
||||
}
|
||||
|
||||
tmpsp->springs=7;
|
||||
@ -342,12 +342,12 @@ Ship *ShipNew(I64 x,I64 y,I64 type)
|
||||
tmpsp->s[i].color=LTPURPLE;
|
||||
else
|
||||
tmpsp->s[i].color=BLACK;
|
||||
QueIns(&tmpsp->s[i],ode->last_spring);
|
||||
QueueInsert(&tmpsp->s[i],ode->last_spring);
|
||||
}
|
||||
remaining++;
|
||||
break;
|
||||
}
|
||||
QueIns(tmpsp,ship_head.last);
|
||||
QueueInsert(tmpsp,ship_head.last);
|
||||
return tmpsp;
|
||||
}
|
||||
|
||||
@ -355,11 +355,11 @@ U0 MissileDel(Missile *tmpmi)
|
||||
{
|
||||
I64 i;
|
||||
if (tmpmi->active) {
|
||||
QueRem(tmpmi);
|
||||
QueueRem(tmpmi);
|
||||
for(i=0;i<5;i++)
|
||||
QueRem(&tmpmi->s[i]);
|
||||
QueRem(&tmpmi->p_front);
|
||||
QueRem(&tmpmi->p_back);
|
||||
QueueRem(&tmpmi->s[i]);
|
||||
QueueRem(&tmpmi->p_front);
|
||||
QueueRem(&tmpmi->p_back);
|
||||
tmpmi->active=FALSE;
|
||||
}
|
||||
}
|
||||
@ -369,12 +369,12 @@ U0 ShipDel(Ship *tmpsp)
|
||||
I64 i;
|
||||
if (!tmpsp) return;
|
||||
for (i=0;i<tmpsp->masses;i++)
|
||||
QueRem(&tmpsp->p[i]);
|
||||
QueueRem(&tmpsp->p[i]);
|
||||
for (i=0;i<tmpsp->springs;i++)
|
||||
QueRem(&tmpsp->s[i]);
|
||||
QueueRem(&tmpsp->s[i]);
|
||||
for (i=0;i<2;i++)
|
||||
MissileDel(&tmpsp->missiles[i]);
|
||||
QueRem(tmpsp);
|
||||
QueueRem(tmpsp);
|
||||
Free(tmpsp);
|
||||
remaining--;
|
||||
}
|
||||
@ -418,7 +418,7 @@ I64 Tweaked()
|
||||
U0 AllDel(CMathODE *ode)
|
||||
{
|
||||
Ship *tmpsp,*tmpsp1;
|
||||
QueRem(ode);
|
||||
QueueRem(ode);
|
||||
tmpsp=ship_head.next;
|
||||
while (tmpsp!=&ship_head) {
|
||||
tmpsp1=tmpsp->next;
|
||||
@ -426,7 +426,7 @@ U0 AllDel(CMathODE *ode)
|
||||
tmpsp=tmpsp1;
|
||||
}
|
||||
human=NULL;
|
||||
QueDel(&shot_head,TRUE);
|
||||
QueueDel(&shot_head,TRUE);
|
||||
ODEDel(ode);
|
||||
}
|
||||
|
||||
@ -1080,8 +1080,8 @@ Shot *ShotNew(I64 type,CD3 *_p,CD3 *_v,F64 r,F64 fuse_time,
|
||||
if (_p_gun_offset)
|
||||
D3AddEqu(&tmps->p.x,_p_gun_offset);
|
||||
D3Copy(&tmps->p.DxDt,_v);
|
||||
QueIns(&tmps->p,ode->last_mass);
|
||||
QueIns(tmps,shot_head.last);
|
||||
QueueInsert(&tmps->p,ode->last_mass);
|
||||
QueueInsert(tmps,shot_head.last);
|
||||
}
|
||||
|
||||
U0 SolarFlares()
|
||||
@ -1204,7 +1204,7 @@ U0 SplatNew(Shot *tmps,F64 die_time,F64 start,F64 end)
|
||||
Sin(start+é+(end-start)*i/tmps->splats);
|
||||
tmpm->DyDt+=50*Sqr(tmps->radius)*Rand*
|
||||
Cos(start+é+(end-start)*i/tmps->splats);
|
||||
QueIns(tmpm,ode->last_mass);
|
||||
QueueInsert(tmpm,ode->last_mass);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1218,8 +1218,8 @@ U0 ExpireShots()
|
||||
SplatNew(tmps,1.0,3*ã/8,5*ã/8);
|
||||
else
|
||||
SplatNew(tmps,.2,0,2*ã);
|
||||
QueRem(tmps);
|
||||
QueRem(&tmps->p);
|
||||
QueueRem(tmps);
|
||||
QueueRem(&tmps->p);
|
||||
Free(tmps);
|
||||
}
|
||||
tmps=tmps1;
|
||||
@ -1234,7 +1234,7 @@ U0 ExpireSplats()
|
||||
tmpm1=tmpm->next;
|
||||
if ((tmpm->type==MT_ION || tmpm->type==MT_ANTIMATTER_SPLAT) &&
|
||||
tS>tmpm->die_timeout) {
|
||||
QueRem(tmpm);
|
||||
QueueRem(tmpm);
|
||||
Free(tmpm);
|
||||
}
|
||||
tmpm=tmpm1;
|
||||
@ -1301,7 +1301,7 @@ U0 InitLevel()
|
||||
while (tmpm!=&ode->next_mass) {
|
||||
tmpm1=tmpm->next;
|
||||
if (tmpm->type==MT_ION || tmpm->type==MT_ANTIMATTER_SPLAT) {
|
||||
QueRem(tmpm);
|
||||
QueueRem(tmpm);
|
||||
Free(tmpm);
|
||||
}
|
||||
tmpm=tmpm1;
|
||||
@ -1327,9 +1327,9 @@ U0 Init()
|
||||
score=0;
|
||||
level=1;
|
||||
|
||||
QueInit(&ship_head);
|
||||
QueInit(&shot_head);
|
||||
QueInit(&missile_head);
|
||||
QueueInit(&ship_head);
|
||||
QueueInit(&shot_head);
|
||||
QueueInit(&missile_head);
|
||||
|
||||
for (i=0;i<STARS_NUM;i++) {
|
||||
stars_x[i]=RandU16%GR_WIDTH;
|
||||
@ -1390,7 +1390,7 @@ U0 XCaliber()
|
||||
ode->min_tolerance=1e-9;
|
||||
ode->drag_v3=0.00001;
|
||||
Init;
|
||||
QueIns(ode,Fs->last_ode);
|
||||
QueueInsert(ode,Fs->last_ode);
|
||||
ch=0;
|
||||
do {
|
||||
while (!game_over && !show_level_msg &&
|
||||
|
@ -142,13 +142,13 @@ CCtrl *CtrlPanelNew()
|
||||
c->draw_it=&DrawCtrlPanelCtrl;
|
||||
c->left_click=&LeftClickCtrlPanel;
|
||||
c->update_derived_vals=&UpdateDerivedCtrlPanelCtrl;
|
||||
QueIns(c,Fs->last_ctrl);
|
||||
QueueInsert(c,Fs->last_ctrl);
|
||||
TaskDerivedValsUpdate;
|
||||
return c;
|
||||
}
|
||||
|
||||
U0 CtrlPanelDel(CCtrl *c)
|
||||
{
|
||||
QueRem(c);
|
||||
QueueRem(c);
|
||||
Free(c);
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ U0 AOTGlblsResolve(CCmpCtrl *cc,CAOT *tmpaot)
|
||||
tmpie->str=StrNew(tmpex->str);
|
||||
do {
|
||||
tmpie1=tmpie->next;
|
||||
QueIns(tmpie,tmpaot->last_ie);
|
||||
QueueInsert(tmpie,tmpaot->last_ie);
|
||||
} while (tmpie=tmpie1);
|
||||
tmpex->ie_lst=NULL;
|
||||
}
|
||||
@ -178,7 +178,7 @@ U0 AOTGlblsResolve(CCmpCtrl *cc,CAOT *tmpaot)
|
||||
tmpie->type++;
|
||||
tmpie->str=StrNew(tmpex->str);
|
||||
tmpie->src_link=StrNew(tmpex->src_link);
|
||||
QueIns(tmpie,tmpaot->last_ie);
|
||||
QueueInsert(tmpie,tmpaot->last_ie);
|
||||
}
|
||||
}
|
||||
tmpex=tmpex->next;
|
||||
|
@ -337,7 +337,7 @@ U0 ICBrBitOps(CIntermediateCode *tmpi,I64 rip,
|
||||
}
|
||||
}
|
||||
|
||||
U0 ICQueInit(CIntermediateCode *tmpi,I64 rip2)
|
||||
U0 ICQueueInit(CIntermediateCode *tmpi,I64 rip2)
|
||||
{
|
||||
I64 r1;
|
||||
if (tmpi->arg1.type==MDF_REG+RT_I64)
|
||||
@ -351,7 +351,7 @@ U0 ICQueInit(CIntermediateCode *tmpi,I64 rip2)
|
||||
ICMov(tmpi,MDF_DISP+RT_I64,r1,sizeof(U8 *),MDF_REG+RT_I64,r1,0,rip2);
|
||||
}
|
||||
|
||||
U0 ICQueIns(CIntermediateCode *tmpi,I64 rip2)
|
||||
U0 ICQueueIns(CIntermediateCode *tmpi,I64 rip2)
|
||||
{
|
||||
I64 r1,r2;
|
||||
if (tmpi->arg2.type==MDF_REG+RT_I64 && tmpi->arg2.reg!=REG_RDX)
|
||||
@ -375,7 +375,7 @@ U0 ICQueIns(CIntermediateCode *tmpi,I64 rip2)
|
||||
ICMov(tmpi,MDF_DISP+RT_I64,REG_RBX,sizeof(U8 *),MDF_REG+RT_I64,r2,0,rip2);
|
||||
}
|
||||
|
||||
U0 ICQueInsRev(CIntermediateCode *tmpi,I64 rip2)
|
||||
U0 ICQueueInsRev(CIntermediateCode *tmpi,I64 rip2)
|
||||
{
|
||||
I64 r1,r2;
|
||||
if (tmpi->arg2.type==MDF_REG+RT_I64 && tmpi->arg2.reg!=REG_RDX)
|
||||
@ -399,7 +399,7 @@ U0 ICQueInsRev(CIntermediateCode *tmpi,I64 rip2)
|
||||
ICMov(tmpi,MDF_DISP+RT_I64,r1,sizeof(U8 *),MDF_REG+RT_I64,r2,0,rip2);
|
||||
}
|
||||
|
||||
U0 ICQueRem(CIntermediateCode *tmpi,I64 rip2)
|
||||
U0 ICQueueRem(CIntermediateCode *tmpi,I64 rip2)
|
||||
{
|
||||
I64 r1;
|
||||
if (tmpi->arg1.type==MDF_REG+RT_I64)
|
||||
|
@ -119,7 +119,7 @@ U0 MapFileWrite(CHashTable *h,U8 *map_name,U8 drv_let)
|
||||
MemCpy(tmpb->data,dbg_info,size);
|
||||
tmpb->num=doc->cur_bin_num++;
|
||||
tmpb->use_cnt=1;
|
||||
QueIns(tmpb,doc->bin_head.last);
|
||||
QueueInsert(tmpb,doc->bin_head.last);
|
||||
} else
|
||||
dbg_info=NULL;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ U8 *LexStmt2Bin(CCmpCtrl *cc,I64 *_type,I64 cmp_flags=0)
|
||||
}
|
||||
} //TODO: else del misc?
|
||||
} else //TODO: too dangerous to del Misc?
|
||||
QueDel(&cc->coc.coc_head.next);
|
||||
QueueDel(&cc->coc.coc_head.next);
|
||||
if (cc->aot_depth==2) {
|
||||
tmpcbh=COCPopNoFree(cc);
|
||||
COCAppend(cc,tmpcbh);
|
||||
@ -44,9 +44,9 @@ CAOT *CmpJoin(CCmpCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=0)
|
||||
CAOT *res=CAlloc(sizeof(CAOT)),*parent;
|
||||
if (parent=cc->aot) {
|
||||
res->parent_aot=parent;
|
||||
QueIns(res,parent->last);
|
||||
QueueInsert(res,parent->last);
|
||||
} else
|
||||
QueInit(res);
|
||||
QueueInit(res);
|
||||
cc->aot=res;
|
||||
|
||||
res->next_ie=res->last_ie=&res->next_ie;
|
||||
@ -86,7 +86,7 @@ CAOT *CmpJoin(CCmpCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=0)
|
||||
tmpie=CAlloc(sizeof(CAOTImportExport));
|
||||
tmpie->type=IET_MAIN;
|
||||
tmpie->rip=buf;
|
||||
QueIns(tmpie,res->last_ie);
|
||||
QueueInsert(tmpie,res->last_ie);
|
||||
}
|
||||
if (cmp_flags&CMPF_ASM_BLK)
|
||||
break;
|
||||
@ -161,11 +161,11 @@ CAOT *CmpBuf(U8 *buf,U8 *map_name=NULL,
|
||||
CAOT *res=NULL;
|
||||
cc=CmpCtrlNew(buf,CCF_DONT_FREE_BUF);
|
||||
cc->flags|=CCF_AOT_COMPILE;
|
||||
QueIns(cc,Fs->last_cc);
|
||||
QueueInsert(cc,Fs->last_cc);
|
||||
res=CmpJoin(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;
|
||||
QueRem(cc);
|
||||
QueueRem(cc);
|
||||
if (res)
|
||||
CmpCtrlDel(cc);
|
||||
return res;
|
||||
@ -295,7 +295,7 @@ U0 CmpFixUpJITAsm(CCmpCtrl *cc,CAOT *tmpaot)
|
||||
Free(str);
|
||||
if (!cc->aot_depth && Bt(&cc->opts,OPTf_TRACE))
|
||||
Un(rip2,tmpaot->aot_U8s,64);
|
||||
QueRem(tmpaot);
|
||||
QueueRem(tmpaot);
|
||||
Free(tmpaot);
|
||||
}
|
||||
|
||||
@ -331,7 +331,7 @@ U0 CmpFixUpAOTAsm(CCmpCtrl *cc,CAOT *tmpaot)
|
||||
tmpie=tmpaot->next_ie;
|
||||
while (tmpie!=&tmpaot->next_ie) {
|
||||
tmpie1=tmpie->next;
|
||||
QueRem(tmpie);
|
||||
QueueRem(tmpie);
|
||||
if (IET_REL_I0<=tmpie->type<=IET_IMM_I64) {
|
||||
if (tmpie->str) {
|
||||
if (tmpie->flags&IEF_GOTO_LABEL) {
|
||||
@ -410,7 +410,7 @@ U0 CmpFixUpAOTAsm(CCmpCtrl *cc,CAOT *tmpaot)
|
||||
break;
|
||||
}
|
||||
tmpie->aot=NULL;
|
||||
QueIns(tmpie,tmpaot->parent_aot->last_ie);
|
||||
QueueInsert(tmpie,tmpaot->parent_aot->last_ie);
|
||||
}
|
||||
tmpie=tmpie1;
|
||||
}
|
||||
@ -494,7 +494,7 @@ I64 Cmp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
|
||||
while (tmpie!=&tmpaot->next_ie) {
|
||||
tmpie1=tmpie->next;
|
||||
if (!tmpie->type || IET_REL32_EXPORT<=tmpie->type<=IET_IMM64_EXPORT) {
|
||||
QueRem(tmpie);
|
||||
QueueRem(tmpie);
|
||||
*ptr++=tmpie->type;
|
||||
*ptr(U32 *)++=tmpie->rip;
|
||||
if (tmpie->str) {
|
||||
@ -514,7 +514,7 @@ I64 Cmp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
|
||||
tmpie=tmpaot->next_ie;
|
||||
while (tmpie!=&tmpaot->next_ie) {
|
||||
tmpie1=tmpie->next;
|
||||
QueRem(tmpie);
|
||||
QueueRem(tmpie);
|
||||
*ptr++=tmpie->type;
|
||||
if (tmpie->aot)
|
||||
tmpie->rip+=tmpie->aot->rip2;
|
||||
@ -556,7 +556,7 @@ I64 Cmp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
|
||||
FileWrite(fbuf2,bfh,size);
|
||||
Free(bfh);
|
||||
Free(tmpaot->buf);
|
||||
QueDel(tmpaot);
|
||||
QueueDel(tmpaot);
|
||||
Free(tmpaot);
|
||||
}
|
||||
Free(patch_table);
|
||||
@ -585,7 +585,7 @@ I64 ExePutS(U8 *buf,U8 *filename=NULL,
|
||||
MemCpy(&cc->htc,htc,sizeof(CLexHashTableContext));
|
||||
}
|
||||
}
|
||||
QueIns(cc,Fs->last_cc);
|
||||
QueueInsert(cc,Fs->last_cc);
|
||||
try {
|
||||
Lex(cc);
|
||||
res=ExeCmdLine(cc);
|
||||
@ -596,7 +596,7 @@ I64 ExePutS(U8 *buf,U8 *filename=NULL,
|
||||
res=0;
|
||||
}
|
||||
}
|
||||
QueRem(cc);
|
||||
QueueRem(cc);
|
||||
if (okay)
|
||||
CmpCtrlDel(cc); //TODO: can crash
|
||||
return res;
|
||||
@ -637,10 +637,10 @@ I64 ExePutS2(U8 *buf,U8 *filename=NULL,I64 ccf_flags=0)
|
||||
cc=CmpCtrlNew(buf,ccf_flags|CCF_DONT_FREE_BUF,filename);
|
||||
if (Fs->last_cc!=&Fs->next_cc)
|
||||
cc->opts=Fs->last_cc->opts;
|
||||
QueIns(cc,Fs->last_cc);
|
||||
QueueInsert(cc,Fs->last_cc);
|
||||
Lex(cc);
|
||||
res=ExeCmdLine(cc);
|
||||
QueRem(cc);
|
||||
QueueRem(cc);
|
||||
CmpCtrlDel(cc);
|
||||
return res;
|
||||
}
|
||||
@ -692,7 +692,7 @@ U0 CInit()
|
||||
{
|
||||
CmpLoadDefines;
|
||||
CmpFillTables;
|
||||
QueInit(&cmp.ic_nop);
|
||||
QueueInit(&cmp.ic_nop);
|
||||
cmp.ic_nop.ic_class=cmp.internal_types[RT_I64];
|
||||
cmp.ic_nop.ic_code=IC_NOP1;
|
||||
AsmHashLoad;
|
||||
|
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -32,7 +32,7 @@ CCmpCtrl *CmpCtrlNew(U8 *buf=NULL,I64 flags=0,U8 *filename=NULL)
|
||||
//new names are used. See $LK,"Psalmody CmpCtrlNew",A="FF:::/Apps/Psalmody/PsalmodyFile.HC,CmpCtrlNew"$.
|
||||
CCmpCtrl *cc=CAlloc(sizeof(CCmpCtrl));
|
||||
CLexFile *tmpf;
|
||||
QueInit(cc);
|
||||
QueueInit(cc);
|
||||
cc->flags=flags;
|
||||
cc->opts=1<<OPTf_WARN_UNUSED_VAR|1<<OPTf_WARN_HEADER_MISMATCH;
|
||||
cc->htc.hash_mask=HTG_TYPE_MASK-HTT_IMPORT_SYS_SYM;
|
||||
@ -43,7 +43,7 @@ CCmpCtrl *CmpCtrlNew(U8 *buf=NULL,I64 flags=0,U8 *filename=NULL)
|
||||
else
|
||||
cc->char_bmp_alpha_numeric=char_bmp_alpha_numeric;
|
||||
tmpf=LexFilePush(cc);
|
||||
QueInit(&cc->next_stream_blk);
|
||||
QueueInit(&cc->next_stream_blk);
|
||||
if (filename)
|
||||
tmpf->full_name=FileNameAbs(filename);
|
||||
else
|
||||
@ -271,21 +271,21 @@ U0 LexSkipEol(CCmpCtrl *cc)
|
||||
U8 *LexFirstRem(CCmpCtrl *cc,U8 *marker,I64 _len=NULL)
|
||||
{//$LK,"LexGetChar",A="MN:LexGetChar"$() chars making str until marker.
|
||||
U8 *res,*ptr;
|
||||
CQueVectU8 *tmpv=QueVectU8New;
|
||||
CQueueVectU8 *tmpv=QueueVectU8New;
|
||||
I64 i,len=0;
|
||||
while (TRUE) {
|
||||
i=LexGetChar(cc);
|
||||
if (!i||StrOcc(marker,i))
|
||||
break;
|
||||
QueVectU8Put(tmpv,len++,i);
|
||||
QueueVectU8Put(tmpv,len++,i);
|
||||
}
|
||||
if (i)
|
||||
Bts(&cc->flags,CCf_USE_LAST_U16);
|
||||
res=ptr=MAlloc(len+1);
|
||||
for (i=0;i<len;i++)
|
||||
*ptr++=QueVectU8Get(tmpv,i);
|
||||
*ptr++=QueueVectU8Get(tmpv,i);
|
||||
*ptr=0;
|
||||
QueVectU8Del(tmpv);
|
||||
QueueVectU8Del(tmpv);
|
||||
if (_len) *_len=len;
|
||||
return res;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ U0 OptSetNOP2(CIntermediateCode *tmpi,I64 stk_delta=1)
|
||||
|
||||
CIntermediateCode *OptFree(CIntermediateCode *tmpi)
|
||||
{//We might access freed entries in CICTreeLinks
|
||||
QueRem(tmpi);
|
||||
QueueRem(tmpi);
|
||||
Free(tmpi);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -891,16 +891,16 @@ cc->pass==10 is final pass, code is placed into buf.
|
||||
ICSwap(tmpi,rip2);
|
||||
break;
|
||||
case IC_QUE_INIT:
|
||||
ICQueInit(tmpi,rip2);
|
||||
ICQueueInit(tmpi,rip2);
|
||||
break;
|
||||
case IC_QUE_INS:
|
||||
ICQueIns(tmpi,rip2);
|
||||
ICQueueIns(tmpi,rip2);
|
||||
break;
|
||||
case IC_QUE_INS_REV:
|
||||
ICQueInsRev(tmpi,rip2);
|
||||
ICQueueInsRev(tmpi,rip2);
|
||||
break;
|
||||
case IC_QUE_REM:
|
||||
ICQueRem(tmpi,rip2);
|
||||
ICQueueRem(tmpi,rip2);
|
||||
break;
|
||||
case IC_STRLEN:
|
||||
ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
|
||||
|
@ -92,15 +92,15 @@ CIntermediateCode *ICAdd(CCmpCtrl *cc,
|
||||
flags|=ICF_LOCK;
|
||||
tmpi->ic_flags=flags;
|
||||
tmpi->ic_line=cc->last_line_num;
|
||||
QueIns(tmpi,cc->coc.coc_head.last);
|
||||
QueueInsert(tmpi,cc->coc.coc_head.last);
|
||||
return tmpi;
|
||||
}
|
||||
|
||||
U0 COCInit(CCmpCtrl *cc)
|
||||
{
|
||||
CCodeCtrl *tmpcbh=&cc->coc;
|
||||
QueInit(&tmpcbh->coc_head.next);
|
||||
QueInit(&tmpcbh->coc_next_misc);
|
||||
QueueInit(&tmpcbh->coc_head.next);
|
||||
QueueInit(&tmpcbh->coc_next_misc);
|
||||
tmpcbh->coc_head.ic_code=IC_END;
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ CCodeMisc *COCMiscNew(CCmpCtrl *cc,I64 ty)
|
||||
CCodeMisc *res=CAlloc(sizeof(CCodeMisc));
|
||||
res->addr=INVALID_PTR;
|
||||
res->type=ty;
|
||||
QueIns(res,cc->coc.coc_last_misc);
|
||||
QueueInsert(res,cc->coc.coc_last_misc);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ U0 COCDel(CCmpCtrl *cc,CCodeCtrl *coc)
|
||||
{
|
||||
CCodeMisc *cm,*cm1;
|
||||
U8 *undef=NULL;
|
||||
QueDel(&coc->coc_head.next);
|
||||
QueueDel(&coc->coc_head.next);
|
||||
cm=coc->coc_next_misc;
|
||||
while (cm!=&coc->coc_next_misc) {
|
||||
cm1=cm->next;
|
||||
|
@ -591,7 +591,7 @@ U0 PrsSwitch(CCmpCtrl *cc,I64 try_cnt)
|
||||
else
|
||||
LexExcept(cc,"Expecting '(' or '[' at ");
|
||||
Lex(cc);
|
||||
QueInit(&head);
|
||||
QueueInit(&head);
|
||||
|
||||
head.last->lb_break=COCMiscNew(cc,CMT_LABEL);
|
||||
head.last->lb_break->use_cnt++;
|
||||
@ -630,7 +630,7 @@ sw_cont:
|
||||
else
|
||||
LexExcept(cc,"Expecting ':' at ");
|
||||
tmpss=MAlloc(sizeof(CSubSwitch));
|
||||
QueIns(tmpss,head.last);
|
||||
QueueInsert(tmpss,head.last);
|
||||
head.last->lb_break=COCMiscNew(cc,CMT_LABEL);
|
||||
head.last->lb_break->use_cnt++;
|
||||
lb_fwd_case=COCMiscNew(cc,CMT_LABEL);
|
||||
@ -751,7 +751,7 @@ sw_sub_end:
|
||||
Lex(cc);
|
||||
break;
|
||||
} else {
|
||||
QueRem(tmpss);
|
||||
QueueRem(tmpss);
|
||||
Free(tmpss);
|
||||
if (PrsKeyWord(cc)!=KW_END)
|
||||
LexExcept(cc,"Missing 'end' at ");
|
||||
@ -807,9 +807,9 @@ U0 PrsStreamBlk(CCmpCtrl *cc)
|
||||
CLexHashTableContext *htc=MAlloc(sizeof(CLexHashTableContext));
|
||||
CStreamBlk *tmpe=MAlloc(sizeof(CStreamBlk));
|
||||
tmpe->body=StrNew("");
|
||||
QueIns(tmpe,cc->last_stream_blk);
|
||||
QueueInsert(tmpe,cc->last_stream_blk);
|
||||
COCPush(cc);
|
||||
QueInit(&cc->coc.coc_next_misc);
|
||||
QueueInit(&cc->coc.coc_next_misc);
|
||||
|
||||
MemCpy(htc,&cc->htc,sizeof(CLexHashTableContext));
|
||||
htc->old_flags=cc->flags;
|
||||
@ -830,7 +830,7 @@ U0 PrsStreamBlk(CCmpCtrl *cc)
|
||||
htc->old_flags & (CCF_ASM_EXPRESSIONS|CCF_EXE_BLK|CCF_AOT_COMPILE);
|
||||
Free(htc);
|
||||
COCPop(cc);
|
||||
QueRem(tmpe);
|
||||
QueueRem(tmpe);
|
||||
if (*tmpe->body)
|
||||
LexIncludeStr(cc,"StreamBlk",tmpe->body,FALSE);
|
||||
else
|
||||
|
@ -82,7 +82,7 @@ U0 PrsVarInit(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,CArrayDim *tmpad,
|
||||
tmpie=CAlloc(sizeof(CAOTImportExport));
|
||||
tmpie->type=IET_MAIN;
|
||||
tmpie->rip=cc->aotc->rip;
|
||||
QueIns(tmpie,cc->aot->last_ie);
|
||||
QueueInsert(tmpie,cc->aot->last_ie);
|
||||
for (i=0;i<size;i++)
|
||||
AOTStoreCodeU8(cc,machine_code[i]);
|
||||
Free(machine_code);
|
||||
@ -157,13 +157,13 @@ U0 PrsVarInit2(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,
|
||||
Lex(cc);
|
||||
}
|
||||
if (tmpad1->cnt<0) {//[]
|
||||
QueInit(&head);
|
||||
QueueInit(&head);
|
||||
cnt=0;
|
||||
while (cc->token!='}') {
|
||||
tmpvi=MAlloc(offset(CVI2.base)+tmpad1->total_cnt*tmpc->size);
|
||||
_b=&tmpvi->base;
|
||||
PrsVarInit2(cc,&_b,tmpc,tmpad1,data_addr_rip,_base,data_heap,pass);
|
||||
QueIns(tmpvi,head.last);
|
||||
QueueInsert(tmpvi,head.last);
|
||||
if (cc->token==',')
|
||||
Lex(cc);
|
||||
cnt++;
|
||||
@ -233,7 +233,7 @@ U0 PrsStaticInit(CCmpCtrl *cc,CMemberLst *tmpm,I64 pass)
|
||||
tmpie=CAlloc(sizeof(CAOTImportExport));
|
||||
tmpie->type=IET_MAIN;
|
||||
tmpie->rip=cc->aotc->rip;
|
||||
QueIns(tmpie,cc->aot->last_ie);
|
||||
QueueInsert(tmpie,cc->aot->last_ie);
|
||||
for (i=0;i<size;i++)
|
||||
AOTStoreCodeU8(cc,machine_code[i]);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ U0 StartUpTasks()
|
||||
"AutoComplete Time:%7.3fs\n",tS;
|
||||
}
|
||||
|
||||
if (DrvIsWritable(':')) {
|
||||
if (DriveIsWritable(':')) {
|
||||
DelTree("::/Tmp/ScrnShots");
|
||||
DirMk("::/Tmp/ScrnShots");
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ U0 Tmp()
|
||||
if (RunFile("::/Misc/OSInstall",,FALSE)) {
|
||||
Del("C:/Home/DoDistro.HC");
|
||||
Del("D:/Home/DoDistro.HC");
|
||||
OnceDrv('C',"\"\n\nRun TOSStaffIns;\n\n\n\";");
|
||||
OnceDrv('D',""); //This command uses cached Registry file.
|
||||
OnceDrive('C',"\"\n\nRun TOSStaffIns;\n\n\n\";");
|
||||
OnceDrive('D',""); //This command uses cached Registry file.
|
||||
if (PressAKey!=CH_SHIFT_ESC)
|
||||
Reboot; //Too dangerous for amateurs until reboot.
|
||||
}
|
||||
|
Binary file not shown.
@ -138,8 +138,8 @@ $FG,5$$TX+CX,"TODO? Meh"$$FG$
|
||||
|
||||
* Finish Pilgrim game.
|
||||
|
||||
* Compiler: PtrArith MUL SIZE -->QueIns(MUL)?
|
||||
* Compiler: QueRem(IC_NOP)?
|
||||
* Compiler: PtrArith MUL SIZE -->QueueInsert(MUL)?
|
||||
* Compiler: QueueRem(IC_NOP)?
|
||||
|
||||
* Fix Chess game so not isometric view.
|
||||
|
||||
@ -376,7 +376,7 @@ $ID,-5$
|
||||
$FG,5$$TX+CX,"Test"$$FG$
|
||||
* $LK,"SpriteBitMap",A="FI:::/Zenith/Gr/SpriteBitMap.HC"$: Grabscroll?
|
||||
|
||||
* $LK,"DrvMap",A="MN:DrvMap"$() in $LK,"MountFile",A="MN:MountFile"$().
|
||||
* $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"$?
|
||||
@ -391,14 +391,14 @@ $FG,5$$TX+CX,"Test"$$FG$
|
||||
|
||||
* $LK,"FileMgr",A="MN:FileMgr"$() help link scrolls out of window.
|
||||
|
||||
* $LK,"MsHardDrvrInstall",A="MN:MsHardDrvrInstall"$() throws exceptions? Doesn't work? Why mouse $LK,"0x9FC30",A="FF:::/Kernel/SerialDev/Mouse.HC,9FC"$?
|
||||
* $LK,"MsHardDriverInstall",A="MN:MsHardDriverInstall"$() throws exceptions? Doesn't work? Why mouse $LK,"0x9FC30",A="FF:::/Kernel/SerialDev/Mouse.HC,9FC"$?
|
||||
|
||||
* VirtualBox MP reboot?
|
||||
|
||||
* Compiler: Err/Warn line nums?
|
||||
* Asm branch-out-of-range warn by one line?
|
||||
|
||||
* Make sure queue links safe in one direction. Task $LK,"QueIns",A="MN:QueIns"$ and $LK,"QueRem",A="MN:QueRem"$ for multicore cycling fwd through tasks.
|
||||
* Make sure queue links safe in one direction. Task $LK,"QueueInsert",A="MN:QueueInsert"$ and $LK,"QueueRem",A="MN:QueueRem"$ for multicore cycling fwd through tasks.
|
||||
|
||||
* Test removable media id and $LK,"RS_ATTR_RESIDENT",A="MN:RS_ATTR_RESIDENT"$. $LK,"Touch",A="MN:Touch"$("","+T");
|
||||
|
||||
|
@ -6,29 +6,29 @@
|
||||
#define MAKE_DBG 0
|
||||
#define MAKE_STAFF 1
|
||||
|
||||
public U8 TOSGetDrv()
|
||||
public U8 TOSGetDrive()
|
||||
{//Pmt for drv let.
|
||||
I64 res;
|
||||
"Drive (%s):",TOS_HDS;
|
||||
res=Let2Let(GetChar);
|
||||
res=Letter2Letter(GetChar);
|
||||
'\n';
|
||||
return res;
|
||||
}
|
||||
|
||||
public U0 TOSBootHDIns(U8 drv_let=0)
|
||||
{//Make Compiler and Kernel. Reinstall Kernel.
|
||||
drv_let=Let2Let(drv_let);
|
||||
drv_let=Letter2Letter(drv_let);
|
||||
In(TOS_CFG);
|
||||
BootHDIns(drv_let);
|
||||
if (StrOcc(TOS_MASTER_BOOT_DRVS,drv_let))
|
||||
BootMHDIns(drv_let);
|
||||
}
|
||||
|
||||
public U0 TOSCopyDrv(U8 src,U8 dst)
|
||||
public U0 TOSCopyDrive(U8 src,U8 dst)
|
||||
{//Fmt dst and copy entire drv.
|
||||
U8 buf_s[STR_LEN],buf_d[STR_LEN];
|
||||
src=Let2Let(src);
|
||||
dst=Let2Let(dst);
|
||||
src=Letter2Letter(src);
|
||||
dst=Letter2Letter(dst);
|
||||
|
||||
if (dst=='D')
|
||||
Fmt(dst,,FALSE,FSt_FAT32);
|
||||
@ -44,14 +44,14 @@ public U0 TOSCopyDrv(U8 src,U8 dst)
|
||||
TOSBootHDIns(dst);
|
||||
}
|
||||
|
||||
public U0 TOSPmtAndCopyDrv()
|
||||
public U0 TOSPmtAndCopyDrive()
|
||||
{//Pmt for drv lets. Then, Fmt dst and copy entire drv.
|
||||
I64 src,dst;
|
||||
"$$RED$$\nCopy Src Drive:\n$$FG$$";
|
||||
src=TOSGetDrv;
|
||||
src=TOSGetDrive;
|
||||
"$$RED$$\nCopy Dst Drive:\n$$FG$$";
|
||||
dst=TOSGetDrv;
|
||||
TOSCopyDrv(src,dst);
|
||||
dst=TOSGetDrive;
|
||||
TOSCopyDrive(src,dst);
|
||||
}
|
||||
|
||||
U0 DistroPrep()
|
||||
@ -89,11 +89,11 @@ U0 DistroPrep()
|
||||
U0 DebugDistroFilePrep()
|
||||
{
|
||||
CBlkDev *bd;
|
||||
if (!Let2Drv('A',FALSE)) {
|
||||
if (!Letter2Drive('A',FALSE)) {
|
||||
In(CFG_DBG_DISTRO "\n");
|
||||
Mount;
|
||||
}
|
||||
bd=Let2BlkDev('A');
|
||||
bd=Letter2BlkDev('A');
|
||||
Fmt('A',,FALSE,FSt_REDSEA);
|
||||
|
||||
DirMk("A:/Compiler");
|
||||
@ -305,7 +305,7 @@ U0 TOSRegen2()
|
||||
UpdateLineCnts;
|
||||
|
||||
TOSProgress("Copy C to D");
|
||||
TOSCopyDrv('C','D');
|
||||
TOSCopyDrive('C','D');
|
||||
|
||||
TOSProgress("Make Standard Distro ISO");
|
||||
MakeStdDistro;
|
||||
|
@ -11,7 +11,7 @@ I64 CopyVideo()
|
||||
Silent(old_silent);
|
||||
SndShift(&scrncast.snd_head,0.185);
|
||||
AUWrite("D:/Tmp/AUDIO",&scrncast.snd_head,scrncast.t0_now,scrncast.t0_tS);
|
||||
QueDel(&scrncast.snd_head,TRUE);
|
||||
QueueDel(&scrncast.snd_head,TRUE);
|
||||
GR2MV("D:/Tmp/VID%03d.MV","B:/Tmp","+d");
|
||||
return res;
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
U0 RawAccess(I64 drv_let=0)
|
||||
{
|
||||
CDrv *dv=Let2Drv(drv_let);
|
||||
CBlkDev *bd=Let2BlkDev(drv_let);
|
||||
CDrive *dv=Letter2Drive(drv_let);
|
||||
CBlkDev *bd=Letter2BlkDev(drv_let);
|
||||
I64 blk,old_offset,old_size;
|
||||
U8 *buf=MAlloc(BLK_SIZE);
|
||||
|
||||
DrvRep;
|
||||
DriveRep;
|
||||
PressAKey;
|
||||
|
||||
ClassRep(dv);
|
||||
@ -37,5 +37,5 @@ U0 RawAccess(I64 drv_let=0)
|
||||
|
||||
RawAccess;
|
||||
|
||||
//See $LK,"BlkRead",A="MN:BlkRead"$(), $LK,"BlkWrite",A="MN:BlkWrite"$(), $LK,"DrvLock",A="MN:DrvLock"$(), $LK,"DriveUnlock",A="MN:DriveUnlock"$()
|
||||
//See $LK,"BlkRead",A="MN:BlkRead"$(), $LK,"BlkWrite",A="MN:BlkWrite"$(), $LK,"DriveLock",A="MN:DriveLock"$(), $LK,"DriveUnlock",A="MN:DriveUnlock"$()
|
||||
//$LK,"DBlk",A="MN:DBlk"$(), $LK,"DClus",A="MN:DClus"$(), $LK,"BlkDevLock",A="MN:BlkDevLock"$() and $LK,"BlkDevUnlock",A="MN:BlkDevUnlock"$().
|
||||
|
@ -1,12 +1,12 @@
|
||||
U0 UnusedSpaceRep()
|
||||
{
|
||||
I64 i;
|
||||
CDrv *dv;
|
||||
CDrive *dv;
|
||||
for (i=0;i<26;i++)
|
||||
if ((dv=Let2Drv(i+'A',FALSE)) &&
|
||||
if ((dv=Letter2Drive(i+'A',FALSE)) &&
|
||||
(dv->fs_type==FSt_FAT32 || dv->fs_type==FSt_REDSEA))
|
||||
"%C: %7.3f%% Free\n",
|
||||
Drv2Let(dv),DrvUnused(Drv2Let(dv))*100.0/(dv->size*BLK_SIZE);
|
||||
Drive2Letter(dv),DriveUnused(Drive2Letter(dv))*100.0/(dv->size*BLK_SIZE);
|
||||
}
|
||||
|
||||
UnusedSpaceRep;
|
||||
|
@ -9,7 +9,7 @@ public U0 DocProfile(U8 *filename,I64 flags)
|
||||
CDoc *doc=DocRead(filename,flags);
|
||||
|
||||
//doc->head which is equ to doc is the
|
||||
//header of the CQue and represents the end-of-file marker.
|
||||
//header of the CQueue and represents the end-of-file marker.
|
||||
CDocEntry *doc_e=doc->head.next;
|
||||
while (doc_e!=doc) {
|
||||
cmd_stats[doc_e->type_u8]++;
|
||||
|
Binary file not shown.
Binary file not shown.
@ -121,7 +121,7 @@ U0 ObjDel(Obj *tmpo)
|
||||
else {
|
||||
if (tmpo->squadron>=0)
|
||||
SquadronRem(tmpo);
|
||||
QueRem(tmpo);
|
||||
QueueRem(tmpo);
|
||||
if (tmpo->squadron>=0)
|
||||
LBts(&squadrons[tmpo->squadron].dead_mask,tmpo->member_num);
|
||||
num_alive[tmpo->player]--;
|
||||
@ -279,8 +279,8 @@ U0 Init()
|
||||
w=Fs->pix_width,h=Fs->pix_height;
|
||||
Squadron *tmps;
|
||||
Obj *tmpo,*tmpo1;
|
||||
QueInit(&obj_head);
|
||||
QueInit(&torpedo_head);
|
||||
QueueInit(&obj_head);
|
||||
QueueInit(&torpedo_head);
|
||||
|
||||
next_noise=tS;
|
||||
Fs->scroll_x=0;
|
||||
@ -309,7 +309,7 @@ U0 Init()
|
||||
tmpo1->torpedos =tmpo1->max_torpedos=0;
|
||||
tmpo1->torpedos_range =0.0;
|
||||
tmpo1->next_action_time=0;
|
||||
QueIns(tmpo1,obj_head.last);
|
||||
QueueInsert(tmpo1,obj_head.last);
|
||||
}
|
||||
|
||||
for (ship=0;ship<num_carriers[player];ship++) {
|
||||
@ -330,7 +330,7 @@ U0 Init()
|
||||
tmpo1->torpedos =tmpo1->max_torpedos=0;
|
||||
tmpo1->torpedos_range =0.0;
|
||||
tmpo1->next_action_time=0;
|
||||
QueIns(tmpo1,obj_head.last);
|
||||
QueueInsert(tmpo1,obj_head.last);
|
||||
|
||||
for (squadron=0;squadron<num_squadrons_per_carrier[player];
|
||||
squadron++,num_squadrons++) {
|
||||
@ -349,7 +349,7 @@ U0 Init()
|
||||
tmpo->ship_guns=0; tmpo->ship_guns_range=0.0;
|
||||
tmpo->torpedos =tmpo->max_torpedos=1;
|
||||
tmpo->torpedos_range =20.0;
|
||||
QueIns(tmpo,obj_head.last);
|
||||
QueueInsert(tmpo,obj_head.last);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -374,8 +374,8 @@ U0 Init()
|
||||
|
||||
U0 CleanUp()
|
||||
{
|
||||
QueDel(&obj_head,TRUE);
|
||||
QueDel(&torpedo_head,TRUE);
|
||||
QueueDel(&obj_head,TRUE);
|
||||
QueueDel(&torpedo_head,TRUE);
|
||||
Free(squadrons);
|
||||
}
|
||||
|
||||
@ -639,7 +639,7 @@ U0 Combat(F64 period)
|
||||
tmpo1->death_time=tmpt->timeout=tS+d;
|
||||
tmpt->target=tmpo1;
|
||||
tmpt->é=Arg(tmpo1->x-tmpo->x,tmpo1->y-tmpo->y);
|
||||
QueIns(tmpt,torpedo_head.last);
|
||||
QueueInsert(tmpt,torpedo_head.last);
|
||||
Sweep(2000,86,53);
|
||||
} else if (tmpo->ship_guns>0 && d<tmpo->ship_guns_range) {
|
||||
tmpo->flags|=OF_SHOOTING;
|
||||
@ -727,7 +727,7 @@ U0 AnimateTask(I64)
|
||||
if (Rand<0.333333)
|
||||
tmpo->fuel*=0.75*Rand+0.25;
|
||||
}
|
||||
QueRem(tmpt);
|
||||
QueueRem(tmpt);
|
||||
Free(tmpt);
|
||||
} else {
|
||||
tmpt->x+=tmpt->speed*Cos(tmpt->é)*period;
|
||||
|
@ -64,7 +64,7 @@ U0 PlaceMass(I64 x, I64 y)
|
||||
tmpm->x=x;
|
||||
tmpm->y=y;
|
||||
tmpm->radius=10*(Rand+0.25);
|
||||
QueIns(tmpm,ode->last_mass);
|
||||
QueueInsert(tmpm,ode->last_mass);
|
||||
}
|
||||
|
||||
U0 PlaceSpring(MyMass *tmpm1,MyMass *tmpm2)
|
||||
@ -74,7 +74,7 @@ U0 PlaceSpring(MyMass *tmpm1,MyMass *tmpm2)
|
||||
tmps->end2=tmpm2;
|
||||
tmps->const=10000;
|
||||
tmps->rest_len=100;
|
||||
QueIns(tmps,ode->last_spring);
|
||||
QueueInsert(tmps,ode->last_spring);
|
||||
}
|
||||
|
||||
U0 Init()
|
||||
@ -85,14 +85,14 @@ U0 Init()
|
||||
ode->drag_v3=0.00001;
|
||||
ode->acceleration_limit=5e3;
|
||||
|
||||
QueIns(ode,Fs->last_ode);
|
||||
QueueInsert(ode,Fs->last_ode);
|
||||
}
|
||||
|
||||
U0 CleanUp()
|
||||
{
|
||||
QueRem(ode);
|
||||
QueDel(&ode->next_mass,TRUE);
|
||||
QueDel(&ode->next_spring,TRUE);
|
||||
QueueRem(ode);
|
||||
QueueDel(&ode->next_mass,TRUE);
|
||||
QueueDel(&ode->next_spring,TRUE);
|
||||
ODEDel(ode);
|
||||
}
|
||||
|
||||
|
@ -136,8 +136,8 @@ U0 RiverDropsDel()
|
||||
{
|
||||
while (LBts(&rd_lock,0))
|
||||
Yield;
|
||||
QueDel(&rd_head,TRUE);
|
||||
QueInit(&rd_head);
|
||||
QueueDel(&rd_head,TRUE);
|
||||
QueueInit(&rd_head);
|
||||
LBtr(&rd_lock,0);
|
||||
}
|
||||
|
||||
@ -150,7 +150,7 @@ U0 RiverDropsNext(CTask *mem_task)
|
||||
while (tmpr!=&rd_head) {
|
||||
tmpr1=tmpr->next;
|
||||
if (++tmpr->y>=MAP_HEIGHT-MAP_BORDER) {
|
||||
QueRem(tmpr);
|
||||
QueueRem(tmpr);
|
||||
Free(tmpr);
|
||||
} else {
|
||||
do {
|
||||
@ -171,7 +171,7 @@ U0 RiverDropsNext(CTask *mem_task)
|
||||
tmpr->y=MAP_BORDER;
|
||||
tmpr->dx=0;
|
||||
tmpr->dy=0;
|
||||
QueIns(tmpr,rd_head.last);
|
||||
QueueInsert(tmpr,rd_head.last);
|
||||
LBtr(&rd_lock,0);
|
||||
}
|
||||
|
||||
@ -512,7 +512,7 @@ U0 Init()
|
||||
{
|
||||
RiverNew;
|
||||
rd_lock=0;
|
||||
QueInit(&rd_head);
|
||||
QueueInit(&rd_head);
|
||||
map_dc=DCNew(MAP_WIDTH,MAP_HEIGHT);
|
||||
a=MAlloc(ANIMALS_NUM*sizeof(Animal));
|
||||
ReInit;
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -295,7 +295,7 @@ U0 MPDoPanels(CTask *task)
|
||||
} while (cont);
|
||||
if (w>=threshold || h>=threshold) {
|
||||
tmpp=CAlloc(sizeof(Panel),task);
|
||||
QueInit(&tmpp->next_obj);
|
||||
QueueInit(&tmpp->next_obj);
|
||||
l=elevations[j][i];
|
||||
if (l<=WATER_ELEVATION*MAP_SCALE &&
|
||||
elevations[j][i+w-1]<=WATER_ELEVATION*MAP_SCALE &&
|
||||
@ -318,7 +318,7 @@ U0 MPDoPanels(CTask *task)
|
||||
tmpo->img=$IB,"<1>",BI=1$; //Fish
|
||||
tmpo->p.z=WATER_ELEVATION*MAP_SCALE;
|
||||
}
|
||||
QueIns(tmpo,tmpp->last_obj);
|
||||
QueueInsert(tmpo,tmpp->last_obj);
|
||||
}
|
||||
} else {
|
||||
if (l<ROCK_ELEVATION*MAP_SCALE) {
|
||||
@ -333,7 +333,7 @@ U0 MPDoPanels(CTask *task)
|
||||
tmpo->p.z=l;
|
||||
tmpo->img=landscape_large_imgs[2]; //Tree
|
||||
tmpo->fish=FALSE;
|
||||
QueIns(tmpo,tmpp->last_obj);
|
||||
QueueInsert(tmpo,tmpp->last_obj);
|
||||
}
|
||||
} else if (l<SNOW_ELEVATION*MAP_SCALE) {
|
||||
if (!(RandU16&3)) {
|
||||
@ -1010,7 +1010,7 @@ U0 AnimateTask(I64)
|
||||
if (game_tf-game_t0<best_score)
|
||||
best_score=game_tf-game_t0;
|
||||
}
|
||||
QueRem(tmpo);
|
||||
QueueRem(tmpo);
|
||||
Free(tmpo);
|
||||
music.mute=TRUE;
|
||||
Snd(74); Sleep(200); Snd;
|
||||
@ -1120,7 +1120,7 @@ U0 Init()
|
||||
z+=elevations[yy][xx]*COORDINATE_SCALE;
|
||||
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
QueInit(&b_head[i]);
|
||||
QueueInit(&b_head[i]);
|
||||
|
||||
for (i=0;i<B_NUM;i++) {
|
||||
tmpb=MAlloc(sizeof(Bird));
|
||||
@ -1129,7 +1129,7 @@ U0 Init()
|
||||
tmpb->p.z=BIRD_ELEVATION*MAP_SCALE+
|
||||
elevations[tmpb->p.y/MAP_SCALE][tmpb->p.x/MAP_SCALE];
|
||||
tmpb->é=2*ã*Rand;
|
||||
QueIns(tmpb,b_head[i%mp_cnt].last);
|
||||
QueueInsert(tmpb,b_head[i%mp_cnt].last);
|
||||
}
|
||||
|
||||
for (i=1;i<mp_cnt;i++)
|
||||
@ -1145,14 +1145,14 @@ U0 CleanUp()
|
||||
MPEnd;
|
||||
while (tmpp) {
|
||||
tmpp1=tmpp->next;
|
||||
QueDel(&tmpp->next_obj);
|
||||
QueueDel(&tmpp->next_obj);
|
||||
Free(tmpp->pts);
|
||||
Free(tmpp);
|
||||
tmpp=tmpp1;
|
||||
}
|
||||
for (i=0;i<mp_cnt;i++) {
|
||||
QueDel(&b_head[i]);
|
||||
QueInit(&b_head[i]);
|
||||
QueueDel(&b_head[i]);
|
||||
QueueInit(&b_head[i]);
|
||||
}
|
||||
DCDel(main_dc);
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ U0 TrackSlice(F64 *_x,F64 *_z,F64
|
||||
tmpt->num=track_head.last->num+1;
|
||||
tmpt->d =track_head.last->d+d;
|
||||
|
||||
QueIns(tmpt,track_head.last);
|
||||
QueueInsert(tmpt,track_head.last);
|
||||
|
||||
if (tmpt->num&1)
|
||||
tmpt->c=RED;
|
||||
@ -270,7 +270,7 @@ U0 InitTrack()
|
||||
F64 x,z,é,d;
|
||||
|
||||
MemSet(&track_head,0,sizeof(Track));
|
||||
QueInit(&track_head);
|
||||
QueueInit(&track_head);
|
||||
|
||||
t_minx=t_minz=I64_MAX;
|
||||
t_maxx=t_maxz=I64_MIN;
|
||||
@ -457,7 +457,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
|
||||
mp_not_done_flags=1<<mp_cnt-1;
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
JobQue(&MPUpdateWin,dc,i);
|
||||
JobQueue(&MPUpdateWin,dc,i);
|
||||
while (mp_not_done_flags)
|
||||
Yield;
|
||||
|
||||
@ -631,7 +631,7 @@ U0 CleanUp()
|
||||
{
|
||||
while (mp_not_done_flags)
|
||||
Yield;
|
||||
QueDel(&track_head,TRUE);
|
||||
QueueDel(&track_head,TRUE);
|
||||
DCDel(track_map);
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ U0 StepNew(CTask *task,I64 x,I64 y,F64
|
||||
tmps->x=x;
|
||||
tmps->y=y;
|
||||
tmps->t0=tS;
|
||||
QueIns(tmps,king_step_head.last);
|
||||
QueueInsert(tmps,king_step_head.last);
|
||||
}
|
||||
|
||||
if (left_right) {
|
||||
@ -238,23 +238,23 @@ U0 StepNew(CTask *task,I64 x,I64 y,F64
|
||||
tmps->x=x-3.5*Sin(é)+2.0*Cos(é);
|
||||
tmps->y=y+3.5*Cos(é)+2.0*Sin(é);
|
||||
tmps->t0=tS;
|
||||
QueIns(tmps,step_head.last);
|
||||
QueueInsert(tmps,step_head.last);
|
||||
tmps=MAlloc(sizeof(Step),task);
|
||||
tmps->x=x-3.5*Sin(é)+5.0*Cos(é);
|
||||
tmps->y=y+3.5*Cos(é)+5.0*Sin(é);
|
||||
tmps->t0=tS;
|
||||
QueIns(tmps,step_head.last);
|
||||
QueueInsert(tmps,step_head.last);
|
||||
} else {
|
||||
tmps=MAlloc(sizeof(Step),task);
|
||||
tmps->x=x+3.5*Sin(é)+0.0*Cos(é);
|
||||
tmps->y=y-3.5*Cos(é)+0.0*Sin(é);
|
||||
tmps->t0=tS;
|
||||
QueIns(tmps,step_head.last);
|
||||
QueueInsert(tmps,step_head.last);
|
||||
tmps=MAlloc(sizeof(Step),task);
|
||||
tmps->x=x+3.5*Sin(é)+3.0*Cos(é);
|
||||
tmps->y=y-3.5*Cos(é)+3.0*Sin(é);
|
||||
tmps->t0=tS;
|
||||
QueIns(tmps,step_head.last);
|
||||
QueueInsert(tmps,step_head.last);
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,11 +275,11 @@ U0 Init()
|
||||
trees[i].fire_frame_idx=0;
|
||||
}
|
||||
|
||||
QueInit(&step_head);
|
||||
QueInit(&king_step_head);
|
||||
QueueInit(&step_head);
|
||||
QueueInit(&king_step_head);
|
||||
|
||||
SpriteExtents($IB,"<12>",BI=12$,&min_x,&max_x,&min_y,&max_y);
|
||||
QueInit(&peasant_head);
|
||||
QueueInit(&peasant_head);
|
||||
for (i=0;i<PEASANTS_NUM;i++) {
|
||||
tmpp=MAlloc(sizeof(Peasant));
|
||||
tmpp->x=RandU16%(w-2*BORDER-(max_x-min_x+1))+BORDER-min_x;
|
||||
@ -287,7 +287,7 @@ U0 Init()
|
||||
tmpp->é=ã*2*Rand;
|
||||
tmpp->door_opened_t0=0;
|
||||
tmpp->stopped=FALSE;
|
||||
QueIns(tmpp,peasant_head.last);
|
||||
QueueInsert(tmpp,peasant_head.last);
|
||||
}
|
||||
animate_phase=0;
|
||||
animate_mS=0;
|
||||
@ -305,9 +305,9 @@ U0 Init()
|
||||
U0 CleanUp()
|
||||
{
|
||||
DCDel(snow_tile);
|
||||
QueDel(&peasant_head,TRUE);
|
||||
QueDel(&step_head,TRUE);
|
||||
QueDel(&king_step_head,TRUE);
|
||||
QueueDel(&peasant_head,TRUE);
|
||||
QueueDel(&step_head,TRUE);
|
||||
QueueDel(&king_step_head,TRUE);
|
||||
}
|
||||
|
||||
U0 Follow(CTask *,Peasant *tmpp)
|
||||
@ -340,7 +340,7 @@ U0 AnimateTask(I64)
|
||||
while (tmps!=&step_head) {
|
||||
tmps1=tmps->next;
|
||||
if (tS-tmps->t0>5.0) {
|
||||
QueRem(tmps);
|
||||
QueueRem(tmps);
|
||||
Free(tmps);
|
||||
}
|
||||
tmps=tmps1;
|
||||
@ -350,7 +350,7 @@ U0 AnimateTask(I64)
|
||||
while (tmps!=&king_step_head) {
|
||||
tmps1=tmps->next;
|
||||
if (tS-tmps->t0>3.0) {
|
||||
QueRem(tmps);
|
||||
QueueRem(tmps);
|
||||
Free(tmps);
|
||||
}
|
||||
tmps=tmps1;
|
||||
|
@ -134,7 +134,7 @@ U0 Whap()
|
||||
for (i=0;i<BALLS_NUM;i++) {
|
||||
balls[i].mass=1.0;
|
||||
balls[i].drag_profile_factor=1.0;
|
||||
QueIns(&balls[i],ode->last_mass);
|
||||
QueueInsert(&balls[i],ode->last_mass);
|
||||
}
|
||||
balls[2].x=balls[1].x+15;
|
||||
balls[2].y=balls[1].y;
|
||||
@ -145,27 +145,27 @@ U0 Whap()
|
||||
springs[0].end2=&balls[2];
|
||||
springs[0].rest_len=15;
|
||||
springs[0].const=10000;
|
||||
QueIns(&springs[0],ode->last_spring);
|
||||
QueueInsert(&springs[0],ode->last_spring);
|
||||
springs[1].end1=&balls[1];
|
||||
springs[1].end2=&balls[3];
|
||||
springs[1].rest_len=15;
|
||||
springs[1].const=10000;
|
||||
QueIns(&springs[1],ode->last_spring);
|
||||
QueueInsert(&springs[1],ode->last_spring);
|
||||
springs[2].end1=&balls[2];
|
||||
springs[2].end2=&balls[3];
|
||||
springs[2].rest_len=sqrt2*15;
|
||||
springs[2].const=10000;
|
||||
QueIns(&springs[2],ode->last_spring);
|
||||
QueueInsert(&springs[2],ode->last_spring);
|
||||
|
||||
collision_t=0;
|
||||
QueIns(ode,Fs->last_ode);
|
||||
QueueInsert(ode,Fs->last_ode);
|
||||
|
||||
DocCursor;
|
||||
DocClear;
|
||||
Fs->draw_it=&DrawIt;
|
||||
GetChar;
|
||||
SettingsPop;
|
||||
QueRem(ode);
|
||||
QueueRem(ode);
|
||||
ODEDel(ode);
|
||||
MenuPop;
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
@ -49,7 +49,7 @@ Photon *PhotonNew()
|
||||
Photon *res=CAlloc(sizeof(Photon));
|
||||
while (LBts(&p_root_locks,num))
|
||||
Yield;
|
||||
QueIns(res,p_root[num].last);
|
||||
QueueInsert(res,p_root[num].last);
|
||||
LBtr(&p_root_locks,num);
|
||||
return res;
|
||||
}
|
||||
@ -366,7 +366,7 @@ U0 Init()
|
||||
for (i=0;i<mp_cnt;i++) {
|
||||
while (LBts(&p_root_locks,i))
|
||||
Yield;
|
||||
QueInit(&p_root[i]);
|
||||
QueueInit(&p_root[i]);
|
||||
LBtr(&p_root_locks,i);
|
||||
}
|
||||
//x*y=bmp_mem*8
|
||||
@ -394,7 +394,7 @@ U0 CleanUp()
|
||||
for (i=0;i<mp_cnt;i++) {
|
||||
while (LBts(&p_root_locks,i))
|
||||
Yield;
|
||||
QueDel(&p_root[i],TRUE);
|
||||
QueueDel(&p_root[i],TRUE);
|
||||
LBtr(&p_root_locks,i);
|
||||
}
|
||||
DCDel(map);
|
||||
|
Binary file not shown.
@ -71,7 +71,7 @@ U0 Draw()
|
||||
CDC *dc=DCAlias;
|
||||
while (TRUE) {
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
tmpm[i]=JobQue(&MPDraw,Fs,i,0);
|
||||
tmpm[i]=JobQueue(&MPDraw,Fs,i,0);
|
||||
y_total=0;
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
y_total+=JobResGet(tmpm[i])(F64);
|
||||
|
@ -67,7 +67,7 @@ U0 PredatorPrey()
|
||||
while (!ScanChar) {
|
||||
mp_not_done_flags=1<<mp_cnt-1;
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
JobQue(&PlotTrajectory,Fs,i);
|
||||
JobQueue(&PlotTrajectory,Fs,i);
|
||||
do Yield;
|
||||
while (mp_not_done_flags);
|
||||
}
|
||||
|
Binary file not shown.
@ -82,14 +82,14 @@ CCtrl *SliderNew()
|
||||
c->draw_it=&DrawCtrlSlider;
|
||||
c->left_click=&LeftClickSlider;
|
||||
c->update_derived_vals=&UpdateDerivedCtrlSlider;
|
||||
QueIns(c,Fs->last_ctrl);
|
||||
QueueInsert(c,Fs->last_ctrl);
|
||||
TaskDerivedValsUpdate;
|
||||
return c;
|
||||
}
|
||||
|
||||
U0 SliderDel(CCtrl *c)
|
||||
{
|
||||
QueRem(c);
|
||||
QueueRem(c);
|
||||
Free(c);
|
||||
}
|
||||
|
||||
|
Binary file not shown.
@ -93,14 +93,14 @@ CCtrl *SliderNew()
|
||||
c->draw_it=&DrawCtrlSlider;
|
||||
c->left_click=&LeftClickSlider;
|
||||
c->update_derived_vals=&UpdateDerivedCtrlSlider;
|
||||
QueIns(c,sys_winmgr_task->last_ctrl);
|
||||
QueueInsert(c,sys_winmgr_task->last_ctrl);
|
||||
TaskDerivedValsUpdate;
|
||||
return c;
|
||||
}
|
||||
|
||||
U0 SliderDel(CCtrl *c)
|
||||
{
|
||||
QueRem(c);
|
||||
QueueRem(c);
|
||||
Free(c->state);
|
||||
Free(c);
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ I64 MagicPairs(I64 N)
|
||||
rj[i].sqrt_primes=sqrt_primes;
|
||||
rj[i].cbrt_primes=cbrt_primes;
|
||||
rj[i].primes=primes;
|
||||
rj[i].cmd=JobQue(&TestCoreRange,&rj[i],mp_cnt-1-i,0);
|
||||
rj[i].cmd=JobQueue(&TestCoreRange,&rj[i],mp_cnt-1-i,0);
|
||||
}
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
res+=JobResGet(rj[i].cmd);
|
||||
|
@ -22,8 +22,8 @@ U0 UnlockedInc()
|
||||
{
|
||||
CJob *tmpm0,*tmpm1;
|
||||
glbl=0;
|
||||
tmpm0=JobQue(&MPUnlockedInc,NULL,0,0);
|
||||
tmpm1=JobQue(&MPUnlockedInc,NULL,1,0);
|
||||
tmpm0=JobQueue(&MPUnlockedInc,NULL,0,0);
|
||||
tmpm1=JobQueue(&MPUnlockedInc,NULL,1,0);
|
||||
JobResGet(tmpm0);
|
||||
JobResGet(tmpm1);
|
||||
"Correct Cnt:%X Actual Cnt:%X\n",CNT*2,glbl;
|
||||
@ -41,8 +41,8 @@ U0 LockedInc()
|
||||
{
|
||||
CJob *tmpm0,*tmpm1;
|
||||
glbl=0;
|
||||
tmpm0=JobQue(&MPLockedInc,NULL,0,0);
|
||||
tmpm1=JobQue(&MPLockedInc,NULL,1,0);
|
||||
tmpm0=JobQueue(&MPLockedInc,NULL,0,0);
|
||||
tmpm1=JobQueue(&MPLockedInc,NULL,1,0);
|
||||
JobResGet(tmpm0);
|
||||
JobResGet(tmpm1);
|
||||
"Correct Cnt:%X Actual Cnt:%X\n",CNT*2,glbl;
|
||||
|
@ -16,7 +16,7 @@ I64 Sum(I64 n,I64 my_mp_cnt)
|
||||
I64 res=0,i;
|
||||
mp_n=n+1;
|
||||
for (i=0;i<my_mp_cnt;i++)
|
||||
tmpm[i]=JobQue(&MPSum,my_mp_cnt,i,0);
|
||||
tmpm[i]=JobQueue(&MPSum,my_mp_cnt,i,0);
|
||||
for (i=0;i<my_mp_cnt;i++)
|
||||
res+=JobResGet(tmpm[i]);
|
||||
return res;
|
||||
|
@ -9,7 +9,7 @@ U0 MPPrintDemo()
|
||||
{
|
||||
I64 i;
|
||||
for (i=0;i<500;i++)
|
||||
JobQue(&Job,DocPut,i%mp_cnt);
|
||||
JobQueue(&Job,DocPut,i%mp_cnt);
|
||||
Sleep(500);
|
||||
"$$FG$$\n";
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ U0 Palindrome(U8 *filename)
|
||||
doc=DocPut;
|
||||
mp_not_done_flags=1<<mp_cnt-1;
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
JobQue(&MPPalindrome,NULL,i);
|
||||
JobQueue(&MPPalindrome,NULL,i);
|
||||
while (mp_not_done_flags)
|
||||
Yield;
|
||||
|
||||
|
@ -49,7 +49,7 @@ I64 Primes(I64 range,I64 _my_mp_cnt)
|
||||
Bts(master_bitmap,1);
|
||||
pending=my_mp_cnt;
|
||||
for (i=0;i<my_mp_cnt;i++)
|
||||
JobQue(&PrimesJob,i,i);
|
||||
JobQueue(&PrimesJob,i,i);
|
||||
while (pending)
|
||||
Yield;
|
||||
tf=tS;
|
||||
|
@ -31,13 +31,13 @@ U0 Init()
|
||||
ode->drag_v3=0.00001;
|
||||
ode->acceleration_limit=5e3;
|
||||
|
||||
QueIns(ode,Fs->last_ode);
|
||||
QueueInsert(ode,Fs->last_ode);
|
||||
}
|
||||
|
||||
U0 CleanUp()
|
||||
{
|
||||
QueRem(ode);
|
||||
QueDel(&ode->next_mass,TRUE);
|
||||
QueDel(&ode->next_spring,TRUE);
|
||||
QueueRem(ode);
|
||||
QueueDel(&ode->next_mass,TRUE);
|
||||
QueueDel(&ode->next_spring,TRUE);
|
||||
ODEDel(ode);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ U0 PrsSingleLogFile(LogStruct *head,U8 *name,CDate *_dstart,CDate *_dend)
|
||||
tmplg->link=StrNew(src);
|
||||
src=++src2;
|
||||
|
||||
QueIns(tmplg,head->last);
|
||||
QueueInsert(tmplg,head->last);
|
||||
} else if (!StrNCmp(src,"HEAD ",5)) {
|
||||
LogStructDel(tmplg);
|
||||
} else
|
||||
@ -132,7 +132,7 @@ LogStruct *PrsLogFiles(U8 *files_find_mask,CDate *_dstart,CDate *_dend)
|
||||
{
|
||||
LogStruct *head=CAlloc(sizeof(LogStruct));
|
||||
CDirEntry *tmpde=FilesFind(files_find_mask),*tmpde1=tmpde;
|
||||
QueInit(head);
|
||||
QueueInit(head);
|
||||
while (tmpde) {
|
||||
PrsSingleLogFile(head,tmpde->full_name,_dstart,_dend);
|
||||
tmpde=tmpde->next;
|
||||
@ -155,7 +155,7 @@ U0 BlockedStructAdd(BlockedStruct *head,U32 ip_num)
|
||||
{
|
||||
BlockedStruct *tmpb=CAlloc(sizeof(BlockedStruct));
|
||||
tmpb->ip_num=ip_num;
|
||||
QueIns(tmpb,head->last);
|
||||
QueueInsert(tmpb,head->last);
|
||||
}
|
||||
|
||||
Bool IsBlocked(BlockedStruct *head,U32 ip_num)
|
||||
@ -174,7 +174,7 @@ U0 BlockIPNuip(LogStruct *head)
|
||||
BlockedStruct blocked_head;
|
||||
LogStruct *tmplg=head->next,*tmplg1;
|
||||
|
||||
QueInit(&blocked_head);
|
||||
QueueInit(&blocked_head);
|
||||
|
||||
BlockedStructAdd(&blocked_head,68<<24+227<<16+61<<8+6);
|
||||
|
||||
@ -191,13 +191,13 @@ U0 BlockIPNuip(LogStruct *head)
|
||||
while (tmplg!=head) {
|
||||
tmplg1=tmplg->next;
|
||||
if (IsBlocked(&blocked_head,tmplg->ip_num)) {
|
||||
QueRem(tmplg);
|
||||
QueueRem(tmplg);
|
||||
LogStructDel(tmplg);
|
||||
}
|
||||
tmplg=tmplg1;
|
||||
}
|
||||
|
||||
QueDel(&blocked_head);
|
||||
QueueDel(&blocked_head);
|
||||
}
|
||||
|
||||
Bool IsDownLoad(LogStruct *tmplg)
|
||||
|
@ -12,7 +12,7 @@ The file compression scheme in ZenithOS only works on whole file operations and
|
||||
|
||||
I don't want to spoil fun, so of course I offer a way to get awesome performance that is, ironically, superior. $LK,"FBlkRead",A="MN:FBlkRead"$() and $LK,"FBlkWrite",A="MN:FBlkWrite"$() allow you to read a block offset from the start of a file. Since files are all contiguous, this is incredibly efficient. You just have to declare the desired file size when you create it with $LK,"FOpen",A="MN:FOpen"$() and cannot change it. See $LK,"::/Demo/Disk/DataBase.HC"$.
|
||||
|
||||
If you like, you are encouraged to to do raw $LK,"BlkRead",A="MN:BlkRead"$() and $LK,"BlkWrite",A="MN:BlkWrite"$() directly on a drive. Just get a pointer to a $LK,"CDrv",A="MN:CDrv"$ with $LK,"Let2Drv",A="MN:Let2Drv"$() and you are on your way! Your computer is supposed to be a fun toy! You can make an entire partition used for a database, or invent a file system.
|
||||
If you like, you are encouraged to to do raw $LK,"BlkRead",A="MN:BlkRead"$() and $LK,"BlkWrite",A="MN:BlkWrite"$() directly on a drive. Just get a pointer to a $LK,"CDrive",A="MN:CDrive"$ with $LK,"Letter2Drive",A="MN:Letter2Drive"$() and you are on your way! Your computer is supposed to be a fun toy! You can make an entire partition used for a database, or invent a file system.
|
||||
|
||||
On the whole, the $LK,"RedSea",A="FI:::/Doc/RedSea.DD"$ file system with its whole-file-only limitation bring beautiful harmony. It beautifully captures the spirit of ZenithOS with simplicity and, ironic speed, since contiguous is fastest.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
$WW,1$$FG,5$$TX+CX,"Frequently Asked Questions"$$FG$
|
||||
$WW,1$$FG,5$$TX+CX,"Frequently Asked Queuestions"$$FG$
|
||||
|
||||
$TR,"How come it is public domain, not GPL?"$
|
||||
$ID,2$I, $FG,2$Terry A. Davis$FG$, wrote all of ZenithOS over the past $TX,"13.8",D="DD_TEMPLEOS_AGE"$ years (full-time). It can run on some bare metal 64-bit PC's from about 2005-2010 with no layering, libraries, tools, modules or anything from other sources. Otherwise, you run it in a virtual machine, like $FG,2$VMware$FG$, $FG,2$QEMU$FG$ or $FG,2$VirtualBox$FG$. It is independent and stands alone. It has no networking, so it certainly doesn't call home. 100% of the src code is including on all distro's, from the kernel to the compiler to the boot loaders! See $LK,"::/Doc/Credits.DD"$.
|
||||
|
@ -2,8 +2,8 @@ File
|
||||
{
|
||||
Rename(,'r');
|
||||
DirMk(,'d');
|
||||
FmtDrv(,'f');
|
||||
UnmountDrv(,'u');
|
||||
FmtDrive(,'f');
|
||||
UnmountDrive(,'u');
|
||||
Abort(,CH_SHIFT_ESC);
|
||||
Exit(,CH_ESC);
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ $FG,2$Prt$FG$ Partition
|
||||
$FG,2$FunSeg$FG$ Program Section
|
||||
$FG,2$Pt$FG$ Point
|
||||
$FG,2$Ptr$FG$ Pointer
|
||||
$FG,2$Que$FG$ Queue
|
||||
$FG,2$Queue$FG$ Queue
|
||||
$FG,2$Rand$FG$ Random
|
||||
$FG,2$Ref$FG$ Reference
|
||||
$FG,2$Reg$FG$ Register, Registry, Regular
|
||||
@ -284,5 +284,5 @@ $ID,2$When two parts of a program have a common low-level routine, that routine
|
||||
$ID,-2$$TR,"user_data"$
|
||||
$ID,2$Many operating system structures have space set aside for you to store values. You are on your own managing these with multiple applications and libraries.
|
||||
$ID,-2$$TR,"Multicore Core0/CoreAP"$
|
||||
$ID,2$Core0, has the $LK,"Zenith Task",A="FF:::/Doc/Glossary.DD,Zenith Task"$$FG$, and it is the master. The $FG,2$application processors$FG$ have an executive $LK,"Seth Tasks",A="FF:::/Doc/Glossary.DD,Seth Tasks"$ and are the slave processors. Only $FG,2$Core0$FG$ tasks can have windows and can launch applications. Slave cores are used if the application explicitly $LK,"Spawn",A="MN:Spawn"$s() a task or $LK,"JobQue",A="MN:JobQue"$() a job on them.
|
||||
$ID,2$Core0, has the $LK,"Zenith Task",A="FF:::/Doc/Glossary.DD,Zenith Task"$$FG$, and it is the master. The $FG,2$application processors$FG$ have an executive $LK,"Seth Tasks",A="FF:::/Doc/Glossary.DD,Seth Tasks"$ and are the slave processors. Only $FG,2$Core0$FG$ tasks can have windows and can launch applications. Slave cores are used if the application explicitly $LK,"Spawn",A="MN:Spawn"$s() a task or $LK,"JobQueue",A="MN:JobQueue"$() a job on them.
|
||||
$ID,-2$
|
||||
|
BIN
src/Doc/Job.DD
BIN
src/Doc/Job.DD
Binary file not shown.
@ -6,7 +6,7 @@ Only tasks on $FG,2$Core0$FG$ can have windows, but other cores can help render
|
||||
|
||||
Each core has an executive $LK,"Seth Task",A="FF:::/Doc/Glossary.DD,Seth Tasks"$ which is the father of all tasks on that core. $LK,"Zenith",A="FF:::/Doc/Glossary.DD,Zenith Task"$ is the $LK,"Seth Task",A="FF:::/Doc/Glossary.DD,Seth Tasks"$ on $FG,2$Core0$FG$.
|
||||
|
||||
You give a job to a $LK,"Seth Task",A="FF:::/Doc/Glossary.DD,Seth Tasks"$ with $LK,"JobQue",A="MN:JobQue"$() and get the result with $LK,"JobResGet",A="MN:JobResGet"$(). You spawn a task on any core with $LK,"Spawn",A="MN:Spawn"$().
|
||||
You give a job to a $LK,"Seth Task",A="FF:::/Doc/Glossary.DD,Seth Tasks"$ with $LK,"JobQueue",A="MN:JobQueue"$() and get the result with $LK,"JobResGet",A="MN:JobResGet"$(). You spawn a task on any core with $LK,"Spawn",A="MN:Spawn"$().
|
||||
|
||||
Note: You must use the $FG,2$LOCK$FG$ asm prefix when changing shared structures in a multicore environment. The $LK,"LBts",A="MN:LBts"$(), $LK,"LBtr",A="MN:LBtr"$() and $LK,"LBtc",A="MN:LBtc"$() insts have $FG,2$LOCK$FG$ prefixes. The compiler has a $FG,2$lock{}$FG$ feature but it doesn't work well. See $LK,"::/Demo/MultiCore/Lock.HC"$.
|
||||
|
||||
|
@ -2,7 +2,7 @@ $FG,5$$TX+CX,"Quirks"$$FG$
|
||||
|
||||
$WW,1$* You run a risk of problems if you do file operations on the same files simultaneously because there is $BK,1$no file sharing/locking mechanism$BK,0$. Generally, the last write wins.
|
||||
|
||||
* When using $FG,2$FAT32$FG$, ZenithOS does not generate unique short-entry names, the ones with the $FG,2$~$FG$s. Not all $FG,2$FAT32$FG$ filenames are valid ZenithOS names and it will complain. Do not access $FG,2$FAT32$FG$ drives not dedicated to ZenithOS. Disable them with $LK,"DrvEnable",A="MN:DrvEnable"$(OFF), or they will generate error messages. $FG,2$FAT32$FG$ involves a long and short name for each file.
|
||||
* When using $FG,2$FAT32$FG$, ZenithOS does not generate unique short-entry names, the ones with the $FG,2$~$FG$s. Not all $FG,2$FAT32$FG$ filenames are valid ZenithOS names and it will complain. Do not access $FG,2$FAT32$FG$ drives not dedicated to ZenithOS. Disable them with $LK,"DriveEnable",A="MN:DriveEnable"$(OFF), or they will generate error messages. $FG,2$FAT32$FG$ involves a long and short name for each file.
|
||||
|
||||
* The stk does not grow because virtual mem is not used. I recommend allocating large local vars from the heap. You can change $LK,"MEM_DFT_STK",A="MN:MEM_DFT_STK"$ and recompile $FG,2$Kernel$FG$ or request more when doing a $LK,"Spawn",A="MN:Spawn"$().
|
||||
|
||||
|
@ -6,7 +6,7 @@ U0 MakeMyISO(U8 *_out_iso_filename)
|
||||
{//Does everything with current drive.
|
||||
//If you have not recompiled $FG,2$Kernel$FG$ and defined your CD/DVD drive, use $LK,"Mount",A="MN:Mount"$.
|
||||
U8 *out_iso_filename=FileNameAbs(_out_iso_filename);
|
||||
if (!DrvIsWritable) {
|
||||
if (!DriveIsWritable) {
|
||||
"Drive must be writable. Install on Hard drive, first.\n";
|
||||
return;
|
||||
}
|
||||
|
BIN
src/Kernel.BIN.C
BIN
src/Kernel.BIN.C
Binary file not shown.
@ -415,7 +415,7 @@ Bool ATAPIReadBlks2(CBlkDev *bd,F64 timeout,U8 *buf,
|
||||
|
||||
U0 ATAPIReadBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 cnt)
|
||||
{
|
||||
CDrv *dv=Let2Drv(bd->first_drv_let);
|
||||
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);
|
||||
@ -442,7 +442,7 @@ U0 ATAPIReadBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 cnt)
|
||||
Free(dvd_buf);
|
||||
}
|
||||
|
||||
Bool ATARBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
Bool ATARBlks(CDrive *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
{
|
||||
I64 n;
|
||||
CBlkDev *bd=dv->bd;
|
||||
@ -579,7 +579,7 @@ U0 ATAPIWriteBlks(CBlkDev *bd,U8 *buf, I64 native_blk, I64 cnt)
|
||||
ATAWaitNotBUSY(bd,0);
|
||||
}
|
||||
|
||||
Bool ATAWBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
Bool ATAWBlks(CDrive *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
{
|
||||
I64 n,spc;
|
||||
CBlkDev *bd=dv->bd;
|
||||
|
@ -204,12 +204,12 @@ CATARep *ATARepFind(CATARep *haystack_head,I64 needle_num)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CATARep *ATAIDDrvs(CATARep *head,CATARep **_ata_drv,CATARep **_atapi_drv)
|
||||
CATARep *ATAIDDrives(CATARep *head,CATARep **_ata_drv,CATARep **_atapi_drv)
|
||||
{//This is for when trying to sort-out main hard drives and CD/DVD drives.
|
||||
CATARep *res=NULL,*tmpha=head,*ata_drv=NULL,*atapi_drv=NULL;
|
||||
CBlkDev *bd;
|
||||
Bool was_silent=Silent,ins_found=FALSE;
|
||||
bd=Let2BlkDev(':',FALSE);
|
||||
bd=Letter2BlkDev(':',FALSE);
|
||||
Silent(was_silent);
|
||||
while (tmpha) {
|
||||
if (!res && bd && bd->type==tmpha->type) {
|
||||
@ -267,7 +267,7 @@ I64 MountIDEAuto()
|
||||
I64 res=0;
|
||||
CATARep *head=NULL,*ata_drv=NULL,*atapi_drv=NULL,*tmpha;
|
||||
ATARep(FALSE,TRUE,&head);
|
||||
ATAIDDrvs(head,&ata_drv,&atapi_drv);
|
||||
ATAIDDrives(head,&ata_drv,&atapi_drv);
|
||||
if (ata_drv && ATAMount(blkdev.first_hd_drv_let,BDT_ATA,
|
||||
ata_drv->base0,ata_drv->base1,ata_drv->unit))
|
||||
res++;
|
||||
|
@ -7,7 +7,7 @@ U0 BlkDevLockFwdingSet(CBlkDev *bd)
|
||||
break;
|
||||
case BDT_ISO_FILE_READ:
|
||||
case BDT_ISO_FILE_WRITE:
|
||||
bd->lock_fwding=Let2BlkDev(*bd->file_dsk_name);
|
||||
bd->lock_fwding=Letter2BlkDev(*bd->file_dsk_name);
|
||||
break;
|
||||
case BDT_ATA:
|
||||
case BDT_ATAPI:
|
||||
@ -29,15 +29,15 @@ I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
|
||||
{//It will mount just one partition of prt_num>=0.
|
||||
//When repartitioing whole drive, whole_drv=TRUE.
|
||||
I64 i,j,ext_base,offset,res=0,num=0;
|
||||
CDrv *dv;
|
||||
CDrive *dv;
|
||||
CRedSeaBoot br;
|
||||
CMasterBoot mbr;
|
||||
|
||||
bd->bd_signature=BD_SIGNATURE_VAL;
|
||||
if (make_free)
|
||||
dv=DrvMakeFreeSlot(bd->first_drv_let);
|
||||
dv=DriveMakeFreeSlot(bd->first_drv_let);
|
||||
else
|
||||
dv=DrvMakeFreeSlot(DrvNextFreeLet(bd->first_drv_let));
|
||||
dv=DriveMakeFreeSlot(DriveNextFreeLet(bd->first_drv_let));
|
||||
dv->bd=bd;
|
||||
dv->drv_offset=bd->drv_offset;
|
||||
dv->size=bd->max_blk+1-bd->drv_offset;
|
||||
@ -87,9 +87,9 @@ I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
|
||||
for (i=0;i<4 && (prt_num<0 || num<=prt_num);i++) {
|
||||
if (mbr.p[i].type) {
|
||||
if (make_free)
|
||||
dv=DrvMakeFreeSlot(bd->first_drv_let+res);
|
||||
dv=DriveMakeFreeSlot(bd->first_drv_let+res);
|
||||
else
|
||||
dv=DrvMakeFreeSlot(DrvNextFreeLet(bd->first_drv_let+res));
|
||||
dv=DriveMakeFreeSlot(DriveNextFreeLet(bd->first_drv_let+res));
|
||||
dv->bd=bd;
|
||||
dv->drv_offset=mbr.p[i].offset+offset;
|
||||
dv->size =mbr.p[i].size;
|
||||
@ -138,7 +138,7 @@ I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
|
||||
num++;
|
||||
}
|
||||
}
|
||||
if (Let2BlkDevType(bd->first_drv_let+res)!=bd->type)
|
||||
if (Letter2BlkDevType(bd->first_drv_let+res)!=bd->type)
|
||||
break;
|
||||
if (j<0)
|
||||
break;
|
||||
@ -167,10 +167,10 @@ I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
|
||||
return res;
|
||||
}
|
||||
|
||||
Bool DrvEnable(U8 drv_let,Bool val)
|
||||
Bool DriveEnable(U8 drv_let,Bool val)
|
||||
{//Can unmount or remount, but not mount the first time.
|
||||
CDrv *dv;
|
||||
if (dv=Let2Drv(drv_let,FALSE))
|
||||
CDrive *dv;
|
||||
if (dv=Letter2Drive(drv_let,FALSE))
|
||||
return !LBEqu(&dv->fs_type,FStf_DISABLE,!val);
|
||||
else
|
||||
return FALSE;
|
||||
@ -227,7 +227,7 @@ U0 BlkDevsInitAll()
|
||||
CBlkDev *bd;
|
||||
I64 i;
|
||||
blkdev.blkdevs=CAlloc(sizeof(CBlkDev)*BLKDEVS_NUM);
|
||||
blkdev.drvs=CAlloc(sizeof(CDrv)*DRVS_NUM);
|
||||
blkdev.drvs=CAlloc(sizeof(CDrive)*DRVS_NUM);
|
||||
for (i=0;i<DRVS_NUM;i++)
|
||||
blkdev.let_to_drv[i]=&blkdev.drvs[i];
|
||||
#exe {
|
||||
|
@ -1,5 +1,5 @@
|
||||
#define ZERO_BUF_SIZE 2048
|
||||
U0 BlkWriteZero(CDrv *dv,I64 blk,I64 cnt)
|
||||
U0 BlkWriteZero(CDrive *dv,I64 blk,I64 cnt)
|
||||
{//Fill blk cnt with zeros in Drive.
|
||||
I64 n;
|
||||
U8 *z=CAlloc(ZERO_BUF_SIZE<<BLK_SIZE_BITS);
|
||||
@ -28,14 +28,14 @@ U0 BlkWriteZero(CDrv *dv,I64 blk,I64 cnt)
|
||||
}
|
||||
}
|
||||
|
||||
Bool BlkRead(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
Bool BlkRead(CDrive *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
{//Read blk cnt from Drive to buf.
|
||||
Bool res=TRUE,unlock;
|
||||
CBlkDev *bd=dv->bd;
|
||||
if (cnt<=0) return TRUE;
|
||||
DrvCheck(dv);
|
||||
DriveCheck(dv);
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
unlock=DriveLock(dv);
|
||||
BlkDevInit(bd);
|
||||
if (dv->drv_offset && blk<dv->drv_offset ||
|
||||
blk+cnt>dv->drv_offset+dv->size)
|
||||
@ -68,14 +68,14 @@ Bool BlkRead(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
return res;
|
||||
}
|
||||
|
||||
Bool BlkWrite(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
Bool BlkWrite(CDrive *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
{//Write blk cnt from buf to Drive.
|
||||
Bool res=TRUE,unlock;
|
||||
CBlkDev *bd=dv->bd;
|
||||
if (cnt<=0) return TRUE;
|
||||
DrvCheck(dv);
|
||||
DriveCheck(dv);
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
unlock=DriveLock(dv);
|
||||
BlkDevInit(bd);
|
||||
if (bd->flags&BDF_READ_ONLY && !(bd->flags & BDF_READ_ONLY_OVERRIDE))
|
||||
throw('BlkDev');
|
||||
|
@ -32,7 +32,7 @@ Bool BlkDevInit(CBlkDev *bd)
|
||||
{
|
||||
CDirEntry de;
|
||||
U8 buf[STR_LEN];
|
||||
CDrv *dv=Let2Drv(bd->first_drv_let);
|
||||
CDrive *dv=Letter2Drive(bd->first_drv_let);
|
||||
Bool res=FALSE;
|
||||
if (!LBts(&bd->flags,BDf_INITIALIZED)) {
|
||||
bd->flags|=BDF_INIT_IN_PROGRESS;
|
||||
@ -126,7 +126,7 @@ CBlkDev *BlkDevNextFreeSlot(U8 first_drv_let,I64 type)
|
||||
{//Locate free slot for new BlkDev, like during $LK,"Mount",A="MN:Mount"$().
|
||||
I64 i=0;
|
||||
CBlkDev *res;
|
||||
if (Let2BlkDevType(first_drv_let)!=type)
|
||||
if (Letter2BlkDevType(first_drv_let)!=type)
|
||||
throw('BlkDev');
|
||||
do {
|
||||
res=&blkdev.blkdevs[i];
|
||||
@ -158,7 +158,7 @@ CBlkDev *BlkDevNextFreeSlot(U8 first_drv_let,I64 type)
|
||||
|
||||
U0 BlkDevDel(CBlkDev *bd)
|
||||
{//Delete BlkDev
|
||||
DrvBlkDevDel(bd);
|
||||
DriveBlkDevDel(bd);
|
||||
FClose(bd->file_dsk);
|
||||
Free(bd->file_dsk_name);
|
||||
Free(bd->dev_id_record);
|
||||
@ -177,10 +177,10 @@ CBlkDev *BlkDevCheck(CBlkDev *bd,Bool except=TRUE)
|
||||
return bd;
|
||||
}
|
||||
|
||||
CBlkDev *Let2BlkDev(U8 drv_let=0,Bool except=TRUE)
|
||||
CBlkDev *Letter2BlkDev(U8 drv_let=0,Bool except=TRUE)
|
||||
{//Drive letter to BlkDev ptr.
|
||||
CDrv *dv;
|
||||
if (dv=Let2Drv(drv_let,except))
|
||||
CDrive *dv;
|
||||
if (dv=Letter2Drive(drv_let,except))
|
||||
return BlkDevCheck(dv->bd,except);
|
||||
else
|
||||
return NULL;
|
||||
|
@ -1,4 +1,4 @@
|
||||
Bool ISOInit(CDrv *dv,I64 blk)
|
||||
Bool ISOInit(CDrive *dv,I64 blk)
|
||||
{
|
||||
CBlkDev *bd=dv->bd;
|
||||
I64 spc=bd->blk_size>>BLK_SIZE_BITS,i=blk/spc,drv_offset=0;
|
||||
@ -8,7 +8,7 @@ Bool ISOInit(CDrv *dv,I64 blk)
|
||||
U8 buf[8];
|
||||
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
unlock=DriveLock(dv);
|
||||
dv->fs_type=FSt_ISO9660;
|
||||
dv->spc=spc;
|
||||
dv->data_area=dv->root_clus=dv->drv_offset=bd->drv_offset=dv->size=0;
|
||||
@ -64,7 +64,7 @@ di_done:
|
||||
|
||||
U0 DVDImageRead(U8 dvd_drv_let,U8 *out_name)
|
||||
{//Read entire CD/DVD image into ISO file.
|
||||
CDrv *dv=Let2Drv(dvd_drv_let);
|
||||
CDrive *dv=Letter2Drive(dvd_drv_let);
|
||||
CBlkDev *bd=dv->bd;
|
||||
U8 *buf=MAlloc(COPY_BUF_BLKS<<BLK_SIZE_BITS),
|
||||
*out_name2=ExtDft(out_name,"ISO");
|
||||
@ -145,7 +145,7 @@ U0 DVDImageWrite(U8 dvd_drv_let,U8 *in_name=NULL,I64 media_type=MT_DVD)
|
||||
CDualBuf *d=CAlloc(sizeof(CDualBuf));
|
||||
U8 *buf,*in_name2,*in_name3;
|
||||
I64 i,n,spc,blk=0,cnt;
|
||||
CDrv *dv=Let2Drv(dvd_drv_let);
|
||||
CDrive *dv=Letter2Drive(dvd_drv_let);
|
||||
CBlkDev *bd=dv->bd,*bd2;
|
||||
CTask *task;
|
||||
CFile *f;
|
||||
@ -163,7 +163,7 @@ U0 DVDImageWrite(U8 dvd_drv_let,U8 *in_name=NULL,I64 media_type=MT_DVD)
|
||||
FClose(f);
|
||||
if (bd->type!=BDT_ATAPI)
|
||||
throw('BlkDev');
|
||||
bd2=Let2BlkDev(*in_name2);
|
||||
bd2=Letter2BlkDev(*in_name2);
|
||||
while (bd2->lock_fwding)
|
||||
bd2=bd2->lock_fwding; //If two blkdevs on same controller, use one lock
|
||||
if ((bd2->type==BDT_ATA || bd2->type==BDT_ATAPI) &&
|
||||
|
@ -22,7 +22,7 @@ CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0)
|
||||
f->max_blk=I64_MAX;
|
||||
f->file_clus_num=INVALID_CLUS;
|
||||
full_name=FileNameAbs(filename);
|
||||
f->dv=Let2Drv(*full_name);
|
||||
f->dv=Letter2Drive(*full_name);
|
||||
if (f->dv->fs_type==FSt_REDSEA)
|
||||
contiguous=TRUE;
|
||||
if (contiguous) {
|
||||
@ -98,7 +98,7 @@ U0 FClose(CFile *f)
|
||||
|
||||
I64 FSetClus(CFile *f,I64 c,I64 blk,Bool read)
|
||||
{
|
||||
CDrv *dv=f->dv;
|
||||
CDrive *dv=f->dv;
|
||||
I64 i;
|
||||
if (f->clus!=c) {
|
||||
if (f->flags & FF_BUF_DIRTY) {
|
||||
@ -128,7 +128,7 @@ I64 FSetClus(CFile *f,I64 c,I64 blk,Bool read)
|
||||
|
||||
Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
|
||||
{//Read [nth,n+cnt) blks of file.
|
||||
CDrv *dv=f->dv;
|
||||
CDrive *dv=f->dv;
|
||||
I64 spc=dv->spc,i,j,c=f->de.clus;
|
||||
if (!f || !dv) return FALSE;
|
||||
if (blk==FFB_NEXT_BLK)
|
||||
@ -180,7 +180,7 @@ Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
|
||||
|
||||
Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
|
||||
{//Write [nth,n+cnt) blks of file.
|
||||
CDrv *dv=f->dv;
|
||||
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)
|
||||
|
@ -15,13 +15,13 @@ U0 DiskCacheInit(I64 size_in_U8s)
|
||||
} else {
|
||||
blkdev.cache_ctrl=ACAlloc(offset(CCacheBlk.body));
|
||||
blkdev.cache_base=AMAlloc(size_in_U8s);
|
||||
QueInit(blkdev.cache_ctrl);
|
||||
QueueInit(blkdev.cache_ctrl);
|
||||
|
||||
cnt=MSize(blkdev.cache_base)/sizeof(CCacheBlk);
|
||||
blkdev.cache_size=cnt*BLK_SIZE;
|
||||
for (i=0;i<cnt;i++) {
|
||||
tmpc=blkdev.cache_base+i;
|
||||
QueIns(tmpc,blkdev.cache_ctrl->last_lru);
|
||||
QueueInsert(tmpc,blkdev.cache_ctrl->last_lru);
|
||||
tmpc->next_hash=tmpc->last_hash=tmpc;
|
||||
tmpc->dv=NULL;
|
||||
tmpc->blk=0;
|
||||
@ -43,17 +43,17 @@ I64 DiskCacheHash(I64 blk)
|
||||
return blkdev.cache_hash_table(U8 *)+i<<4-offset(CCacheBlk.next_hash);
|
||||
}
|
||||
|
||||
U0 DiskCacheQueRem(CCacheBlk *tmpc)
|
||||
U0 DiskCacheQueueRem(CCacheBlk *tmpc)
|
||||
{
|
||||
QueRem(tmpc);
|
||||
QueueRem(tmpc);
|
||||
tmpc->next_hash->last_hash=tmpc->last_hash;
|
||||
tmpc->last_hash->next_hash=tmpc->next_hash;
|
||||
}
|
||||
|
||||
U0 DiskCacheQueIns(CCacheBlk *tmpc)
|
||||
U0 DiskCacheQueueIns(CCacheBlk *tmpc)
|
||||
{
|
||||
CCacheBlk *tmp_n,*tmp_l;
|
||||
QueIns(tmpc,blkdev.cache_ctrl->last_lru);
|
||||
QueueInsert(tmpc,blkdev.cache_ctrl->last_lru);
|
||||
tmp_l=DiskCacheHash(tmpc->blk);
|
||||
tmp_n=tmp_l->next_hash;
|
||||
tmpc->last_hash=tmp_l;
|
||||
@ -61,7 +61,7 @@ U0 DiskCacheQueIns(CCacheBlk *tmpc)
|
||||
tmp_l->next_hash=tmp_n->last_hash=tmpc;
|
||||
}
|
||||
|
||||
CCacheBlk *DiskCacheFind(CDrv *dv,I64 blk)
|
||||
CCacheBlk *DiskCacheFind(CDrive *dv,I64 blk)
|
||||
{
|
||||
CCacheBlk *tmpc,*tmpc1=DiskCacheHash(blk);
|
||||
tmpc=tmpc1->next_hash;
|
||||
@ -73,7 +73,7 @@ CCacheBlk *DiskCacheFind(CDrv *dv,I64 blk)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
U0 DiskCacheAdd(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
U0 DiskCacheAdd(CDrive *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
{
|
||||
CCacheBlk *tmpc;
|
||||
if (blkdev.cache_base) {
|
||||
@ -82,11 +82,11 @@ U0 DiskCacheAdd(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
while (cnt-->0) {
|
||||
if (!(tmpc=DiskCacheFind(dv,blk)))
|
||||
tmpc=blkdev.cache_ctrl->next_lru;
|
||||
DiskCacheQueRem(tmpc);
|
||||
DiskCacheQueueRem(tmpc);
|
||||
MemCpy(&tmpc->body,buf,BLK_SIZE);
|
||||
tmpc->dv=dv;
|
||||
tmpc->blk=blk;
|
||||
DiskCacheQueIns(tmpc);
|
||||
DiskCacheQueueIns(tmpc);
|
||||
blk++;
|
||||
buf+=BLK_SIZE;
|
||||
}
|
||||
@ -94,7 +94,7 @@ U0 DiskCacheAdd(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
}
|
||||
}
|
||||
|
||||
U0 DiskCacheInvalidate2(CDrv *dv)
|
||||
U0 DiskCacheInvalidate2(CDrive *dv)
|
||||
{
|
||||
CCacheBlk *tmpc,*tmpc1;
|
||||
if (blkdev.cache_base) {
|
||||
@ -104,11 +104,11 @@ U0 DiskCacheInvalidate2(CDrv *dv)
|
||||
while (tmpc!=blkdev.cache_ctrl) {
|
||||
tmpc1=tmpc->last_lru;
|
||||
if (tmpc->dv==dv) {
|
||||
DiskCacheQueRem(tmpc);
|
||||
DiskCacheQueueRem(tmpc);
|
||||
tmpc->dv=NULL;
|
||||
tmpc->blk=0;
|
||||
tmpc->next_hash=tmpc->last_hash=tmpc;
|
||||
QueIns(tmpc,blkdev.cache_ctrl->last_lru);
|
||||
QueueInsert(tmpc,blkdev.cache_ctrl->last_lru);
|
||||
}
|
||||
tmpc=tmpc1;
|
||||
}
|
||||
@ -116,7 +116,7 @@ U0 DiskCacheInvalidate2(CDrv *dv)
|
||||
}
|
||||
}
|
||||
|
||||
U0 RCache(CDrv *dv,U8 **_buf, I64 *_blk, I64 *_cnt)
|
||||
U0 RCache(CDrive *dv,U8 **_buf, I64 *_blk, I64 *_cnt)
|
||||
{
|
||||
CCacheBlk *tmpc;
|
||||
if (blkdev.cache_base) {
|
||||
|
@ -1,17 +1,17 @@
|
||||
I64 ClusNumNext(CDrv *dv,I64 c,I64 cnt=1)
|
||||
I64 ClusNumNext(CDrive *dv,I64 c,I64 cnt=1)
|
||||
{//Return next cnt'th clus in chain.
|
||||
Bool unlock;
|
||||
DrvCheck(dv);
|
||||
DriveCheck(dv);
|
||||
if (cnt<=0) return c;
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
unlock=DriveLock(dv);
|
||||
switch (dv->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
c+=cnt;
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
while (cnt-->0 && 0<c<0x0FFFFFF8) {
|
||||
DrvFATBlkSet(dv,c);
|
||||
DriveFATBlkSet(dv,c);
|
||||
c=dv->cur_fat_blk[c & (BLK_SIZE/4-1)];
|
||||
}
|
||||
if (!(0<c<0x0FFFFFF8))
|
||||
@ -28,9 +28,9 @@ I64 ClusNumNext(CDrv *dv,I64 c,I64 cnt=1)
|
||||
return c;
|
||||
}
|
||||
|
||||
I64 Clus2Blk(CDrv *dv,I64 c)
|
||||
I64 Clus2Blk(CDrive *dv,I64 c)
|
||||
{//Drive clus num to blk num.
|
||||
DrvCheck(dv);
|
||||
DriveCheck(dv);
|
||||
switch (dv->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
return c;
|
||||
@ -41,14 +41,14 @@ I64 Clus2Blk(CDrv *dv,I64 c)
|
||||
}
|
||||
}
|
||||
|
||||
I64 ClusBlkRead(CDrv *dv,U8 *buf,I64 c,I64 blks)
|
||||
I64 ClusBlkRead(CDrive *dv,U8 *buf,I64 c,I64 blks)
|
||||
{//Accepts blk count, so padding on last clus is not read.
|
||||
I64 i;
|
||||
Bool unlock;
|
||||
DrvCheck(dv);
|
||||
DriveCheck(dv);
|
||||
if (blks<=0) return c;
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
unlock=DriveLock(dv);
|
||||
switch (dv->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
BlkRead(dv,buf,c,blks);
|
||||
@ -78,19 +78,19 @@ I64 ClusBlkRead(CDrv *dv,U8 *buf,I64 c,I64 blks)
|
||||
return c;
|
||||
}
|
||||
|
||||
I64 ClusRead(CDrv *dv,U8 *buf,I64 c,I64 cnt)
|
||||
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 ClusBlkWrite(CDrv *dv,U8 *buf,I64 c,I64 blks)
|
||||
I64 ClusBlkWrite(CDrive *dv,U8 *buf,I64 c,I64 blks)
|
||||
{//Accepts blk count, so padding on last clus is not written.
|
||||
I64 i;
|
||||
Bool unlock;
|
||||
DrvCheck(dv);
|
||||
DriveCheck(dv);
|
||||
if (blks<=0) return c;
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
unlock=DriveLock(dv);
|
||||
switch (dv->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
BlkWrite(dv,buf,c,blks);
|
||||
@ -120,15 +120,15 @@ I64 ClusBlkWrite(CDrv *dv,U8 *buf,I64 c,I64 blks)
|
||||
return c;
|
||||
}
|
||||
|
||||
I64 ClusWrite(CDrv *dv,U8 *buf,I64 c,I64 cnt)
|
||||
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 ClusAlloc(CDrv *dv,I64 c=0,I64 cnt=1,Bool contiguous=FALSE)
|
||||
I64 ClusAlloc(CDrive *dv,I64 c=0,I64 cnt=1,Bool contiguous=FALSE)
|
||||
{//Alloc clus cnt into chain.
|
||||
//c=0 means first clus in chain
|
||||
DrvCheck(dv);
|
||||
DriveCheck(dv);
|
||||
if (cnt<=0) return c;
|
||||
switch (dv->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
|
@ -1,4 +1,4 @@
|
||||
Bool DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain=TRUE)
|
||||
Bool DirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain=TRUE)
|
||||
{//Makes a directory entry in the directory from a $LK,"CDirEntry",A="MN:CDirEntry"$ node.
|
||||
switch (dv->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
|
@ -10,7 +10,7 @@ Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE)
|
||||
{//Change directory. Optionally, make directories, too.
|
||||
I64 maxlen,cur_dir_clus=0;
|
||||
U8 *chg_to_buf,*new_cur_dir,*buf;
|
||||
CDrv *dv;
|
||||
CDrive *dv;
|
||||
Bool res=TRUE;
|
||||
if (!dirname)
|
||||
dirname="~";
|
||||
@ -18,9 +18,9 @@ Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE)
|
||||
return TRUE;
|
||||
if (dirname[1]==':') {
|
||||
if (*dirname==':') {
|
||||
if (Fs->cur_dv!=Let2Drv(':') && !Drive(*dirname))
|
||||
if (Fs->cur_dv!=Letter2Drive(':') && !Drive(*dirname))
|
||||
return FALSE;
|
||||
} else if (Fs->cur_dv!=Let2Drv(*dirname) && !Drive(*dirname))
|
||||
} else if (Fs->cur_dv!=Letter2Drive(*dirname) && !Drive(*dirname))
|
||||
return FALSE;
|
||||
dirname+=2;
|
||||
}
|
||||
@ -48,7 +48,7 @@ Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE)
|
||||
Free(new_cur_dir);
|
||||
new_cur_dir=MAlloc(StrLen(blkdev.home_dir+2)+1+StrLen(chg_to_buf)+1);
|
||||
StrCpy(new_cur_dir,blkdev.home_dir+2);
|
||||
if (Fs->cur_dv!=Let2Drv('~') && !Drive('~'))
|
||||
if (Fs->cur_dv!=Letter2Drive('~') && !Drive('~'))
|
||||
return FALSE;
|
||||
} else if (StrCmp(buf,".") && *buf) {
|
||||
dv=Fs->cur_dv;
|
||||
|
@ -6,7 +6,7 @@ U0 DirContextDel(CDirContext *dirc,Bool restore=TRUE)
|
||||
bd=dirc->old_dv->bd;
|
||||
if (!(bd->flags & BDF_INIT_IN_PROGRESS)) {
|
||||
if (dirc->old_dir) {
|
||||
Drive(Drv2Let(dirc->old_dv));
|
||||
Drive(Drive2Letter(dirc->old_dv));
|
||||
Cd(dirc->old_dir);
|
||||
}
|
||||
} else {
|
||||
@ -32,14 +32,14 @@ CDirContext *DirContextNew(U8 *_mask,Bool make_mask=FALSE,
|
||||
mask=MStrUtil(_mask,SUF_REM_LEADING|SUF_REM_TRAILING|SUF_REM_CTRL_CHARS);
|
||||
tmp_mask=mask;
|
||||
if (*mask && mask[1]==':') {
|
||||
if (Fs->cur_dv!=Let2Drv(*mask) && !Drive(*mask))
|
||||
if (Fs->cur_dv!=Letter2Drive(*mask) && !Drive(*mask))
|
||||
valid=FALSE;
|
||||
mask+=2;
|
||||
}
|
||||
if (*mask=='~' && Fs->cur_dv!=Let2Drv('~') && !Drive('~'))
|
||||
if (*mask=='~' && Fs->cur_dv!=Letter2Drive('~') && !Drive('~'))
|
||||
valid=FALSE;
|
||||
dirc->dv=Fs->cur_dv;
|
||||
DrvCheck(dirc->dv);
|
||||
DriveCheck(dirc->dv);
|
||||
buf=MAlloc(mask_len+2);
|
||||
StrCpy(buf,mask);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
Bool DrvLock(CDrv *dv)
|
||||
Bool DriveLock(CDrive *dv)
|
||||
{//Make this task have exclusive access to drv & BlkDev.
|
||||
DrvCheck(dv);
|
||||
DriveCheck(dv);
|
||||
BlkDevLock(dv->bd);
|
||||
if (!Bt(&dv->locked_flags,DVlf_LOCKED) || dv->owning_task!=Fs) {
|
||||
while (LBts(&dv->locked_flags,DVlf_LOCKED))
|
||||
@ -11,9 +11,9 @@ Bool DrvLock(CDrv *dv)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Bool DriveUnlock(CDrv *dv,Bool rst=FALSE)
|
||||
Bool DriveUnlock(CDrive *dv,Bool rst=FALSE)
|
||||
{//Release exclusive lock on access to drv & BlkDev.
|
||||
DrvCheck(dv);
|
||||
DriveCheck(dv);
|
||||
if (Bt(&dv->locked_flags,DVlf_LOCKED) && dv->owning_task==Fs) {
|
||||
BlkDevUnlock(dv->bd,rst);
|
||||
dv->owning_task=NULL;
|
||||
@ -24,10 +24,10 @@ Bool DriveUnlock(CDrv *dv,Bool rst=FALSE)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
U0 DrvsRelease()
|
||||
U0 DrivesRelease()
|
||||
{//When task dies, release all owned drvs.
|
||||
I64 i;
|
||||
CDrv *dv;
|
||||
CDrive *dv;
|
||||
for (i=0;i<DRVS_NUM;i++) {
|
||||
dv=&blkdev.drvs[i];
|
||||
if (dv->owning_task==Fs && dv->dv_signature==DRV_SIGNATURE_VAL)
|
||||
@ -35,28 +35,28 @@ U0 DrvsRelease()
|
||||
}
|
||||
}
|
||||
|
||||
CDrv *DrvMakeFreeSlot(U8 drv_let)
|
||||
CDrive *DriveMakeFreeSlot(U8 drv_let)
|
||||
{//Make a slot free for a new drv, like during $LK,"Mount",A="MN:Mount"$().
|
||||
//!!! drv_let is not a $LK,"remapped",A="MN:DrvMap"$ drv.
|
||||
I64 i=Let2Let(drv_let)-'A';
|
||||
CDrv *res;
|
||||
//!!! drv_let is not a $LK,"remapped",A="MN:DriveMap"$ drv.
|
||||
I64 i=Letter2Letter(drv_let)-'A';
|
||||
CDrive *res;
|
||||
if (!(0<=i<DRVS_NUM))
|
||||
throw('Drive');
|
||||
res=&blkdev.drvs[i];
|
||||
MemSet(res,0,sizeof(CDrv));
|
||||
MemSet(res,0,sizeof(CDrive));
|
||||
res->drv_let='A'+i;
|
||||
return res;
|
||||
}
|
||||
|
||||
U8 DrvNextFreeLet(U8 first_drv_let='C')
|
||||
U8 DriveNextFreeLet(U8 first_drv_let='C')
|
||||
{//Locate free slot for new drv, like during $LK,"Mount",A="MN:Mount"$().
|
||||
//!!! first_drv_let is not a $LK,"remapped",A="MN:DrvMap"$ drv.
|
||||
I64 i=Let2Let(first_drv_let)-'A',type=Let2BlkDevType(first_drv_let);
|
||||
//!!! first_drv_let is not a $LK,"remapped",A="MN:DriveMap"$ drv.
|
||||
I64 i=Letter2Letter(first_drv_let)-'A',type=Letter2BlkDevType(first_drv_let);
|
||||
if (!(0<=i<DRVS_NUM))
|
||||
throw('Drive');
|
||||
do
|
||||
if (blkdev.drvs[i].dv_signature!=DRV_SIGNATURE_VAL) {
|
||||
if (Let2BlkDevType(i+'A')!=type)
|
||||
if (Letter2BlkDevType(i+'A')!=type)
|
||||
throw('Drive');
|
||||
else
|
||||
return i+'A';
|
||||
@ -66,29 +66,29 @@ U8 DrvNextFreeLet(U8 first_drv_let='C')
|
||||
return 0; //Never gets here.
|
||||
}
|
||||
|
||||
U0 DrvDel(CDrv *dv)
|
||||
U0 DriveDel(CDrive *dv)
|
||||
{//Delete drv
|
||||
if (dv->fs_type==FSt_REDSEA && dv->next_free)
|
||||
RedSeaFreeFreeLst(dv);
|
||||
Free(dv->cur_fat_blk);
|
||||
Free(dv->fis);
|
||||
MemSet(dv,0,sizeof(CDrv));
|
||||
MemSet(dv,0,sizeof(CDrive));
|
||||
}
|
||||
|
||||
U0 DrvBlkDevDel(CBlkDev *bd)
|
||||
U0 DriveBlkDevDel(CBlkDev *bd)
|
||||
{//Delete drv's of BlkDev
|
||||
I64 i;
|
||||
CDrv *dv;
|
||||
CDrive *dv;
|
||||
for (i=0;i<DRVS_NUM;i++) {
|
||||
dv=&blkdev.drvs[i];
|
||||
if (dv->bd==bd)
|
||||
DrvDel(dv);
|
||||
DriveDel(dv);
|
||||
}
|
||||
}
|
||||
|
||||
U0 DrvFATBlkAlloc(CDrv *dv)
|
||||
U0 DriveFATBlkAlloc(CDrive *dv)
|
||||
{
|
||||
DrvCheck(dv);
|
||||
DriveCheck(dv);
|
||||
Free(dv->cur_fat_blk);
|
||||
dv->cur_fat_blk=AMAlloc(BLK_SIZE);
|
||||
dv->cur_fat_blk_num=0;
|
||||
@ -96,7 +96,7 @@ U0 DrvFATBlkAlloc(CDrv *dv)
|
||||
BlkRead(dv,dv->cur_fat_blk,dv->fat1,1);
|
||||
}
|
||||
|
||||
U0 DrvFATBlkClean(CDrv *dv,I64 fat_sel=3)
|
||||
U0 DriveFATBlkClean(CDrive *dv,I64 fat_sel=3)
|
||||
{
|
||||
if ((dv->fs_type==FSt_FAT32 || dv->fs_type==FSt_REDSEA) &&
|
||||
Bt(&dv->fat_blk_dirty,0)) {
|
||||
@ -114,7 +114,7 @@ U0 DrvFATBlkClean(CDrv *dv,I64 fat_sel=3)
|
||||
}
|
||||
}
|
||||
|
||||
U0 DrvFATBlkSet(CDrv *dv,I64 c,I64 fat_sel=3)
|
||||
U0 DriveFATBlkSet(CDrive *dv,I64 c,I64 fat_sel=3)
|
||||
{
|
||||
I64 fat_blk_num;
|
||||
if (c==INVALID_CLUS)
|
||||
@ -130,7 +130,7 @@ U0 DrvFATBlkSet(CDrv *dv,I64 c,I64 fat_sel=3)
|
||||
throw('Drive');
|
||||
}
|
||||
if (fat_blk_num!=dv->cur_fat_blk_num) {
|
||||
DrvFATBlkClean(dv,fat_sel);
|
||||
DriveFATBlkClean(dv,fat_sel);
|
||||
dv->cur_fat_blk_num=fat_blk_num;
|
||||
if (fat_sel==3 || !fat_sel)
|
||||
BlkRead(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
|
||||
@ -139,7 +139,7 @@ U0 DrvFATBlkSet(CDrv *dv,I64 c,I64 fat_sel=3)
|
||||
}
|
||||
}
|
||||
|
||||
CDrv *DrvCheck(CDrv *dv,Bool except=TRUE)
|
||||
CDrive *DriveCheck(CDrive *dv,Bool except=TRUE)
|
||||
{//Check for valid drv. Throw exception.
|
||||
if (!dv || dv->dv_signature!=DRV_SIGNATURE_VAL) {
|
||||
if (except)
|
||||
@ -150,18 +150,18 @@ CDrv *DrvCheck(CDrv *dv,Bool except=TRUE)
|
||||
return dv;
|
||||
}
|
||||
|
||||
U8 Drv2Let(CDrv *dv=NULL)
|
||||
U8 Drive2Letter(CDrive *dv=NULL)
|
||||
{//Drive ptr to Drive letter.
|
||||
if (!dv)
|
||||
dv=Fs->cur_dv;
|
||||
DrvCheck(dv);
|
||||
DriveCheck(dv);
|
||||
return dv->drv_let;
|
||||
}
|
||||
|
||||
U8 Let2Let(U8 drv_let=0)
|
||||
U8 Letter2Letter(U8 drv_let=0)
|
||||
{//Drive letter to Drive letter.
|
||||
if (!drv_let)
|
||||
drv_let=Drv2Let(Fs->cur_dv);
|
||||
drv_let=Drive2Letter(Fs->cur_dv);
|
||||
else if (drv_let==':')
|
||||
drv_let=blkdev.boot_drv_let;
|
||||
else if (drv_let=='~')
|
||||
@ -169,9 +169,9 @@ U8 Let2Let(U8 drv_let=0)
|
||||
return ToUpper(drv_let);
|
||||
}
|
||||
|
||||
I64 Let2BlkDevType(U8 drv_let)
|
||||
I64 Letter2BlkDevType(U8 drv_let)
|
||||
{//Drive letter to BlkDev Type. drv_let=0 not allowed. See $LK,"BDT_NULL",A="MN:BDT_NULL"$.
|
||||
drv_let=Let2Let(drv_let);
|
||||
drv_let=Letter2Letter(drv_let);
|
||||
if ('A'<=drv_let<='B')
|
||||
return BDT_RAM;
|
||||
if ('C'<=drv_let<='L')
|
||||
@ -185,13 +185,13 @@ I64 Let2BlkDevType(U8 drv_let)
|
||||
return BDT_NULL;
|
||||
}
|
||||
|
||||
CDrv *Let2Drv(U8 drv_let=0,Bool except=TRUE)
|
||||
CDrive *Letter2Drive(U8 drv_let=0,Bool except=TRUE)
|
||||
{//Drive letter to Drive ptr.
|
||||
CDrv *dv;
|
||||
CDrive *dv;
|
||||
if (!drv_let)
|
||||
dv=Fs->cur_dv;
|
||||
else {
|
||||
drv_let=Let2Let(drv_let);
|
||||
drv_let=Letter2Letter(drv_let);
|
||||
if (!('A'<=drv_let<='Z')) {
|
||||
if (except)
|
||||
throw('Drive');
|
||||
@ -200,13 +200,13 @@ CDrv *Let2Drv(U8 drv_let=0,Bool except=TRUE)
|
||||
}
|
||||
dv=blkdev.let_to_drv[drv_let-'A'];
|
||||
}
|
||||
return DrvCheck(dv,except);
|
||||
return DriveCheck(dv,except);
|
||||
}
|
||||
|
||||
CBlkDev *DrvIsWritable(U8 drv_let=0,Bool except=FALSE)
|
||||
CBlkDev *DriveIsWritable(U8 drv_let=0,Bool except=FALSE)
|
||||
{//Is drive writable?
|
||||
CBlkDev *bd;
|
||||
if (!(bd=Let2BlkDev(drv_let,except)) || bd->flags & BDF_READ_ONLY) {
|
||||
if (!(bd=Letter2BlkDev(drv_let,except)) || bd->flags & BDF_READ_ONLY) {
|
||||
if (except)
|
||||
throw('Drive');
|
||||
else
|
||||
@ -215,13 +215,13 @@ CBlkDev *DrvIsWritable(U8 drv_let=0,Bool except=FALSE)
|
||||
return bd;
|
||||
}
|
||||
|
||||
U0 DiskCacheInvalidate(CDrv *dv)
|
||||
U0 DiskCacheInvalidate(CDrive *dv)
|
||||
{//Needed for removable media. Called by $LK,"DiskChg",A="MN:DiskChg"$().
|
||||
Bool unlock;
|
||||
CBlkDev *bd=dv->bd;
|
||||
DrvCheck(dv);
|
||||
DriveCheck(dv);
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
unlock=DriveLock(dv);
|
||||
BlkDevInit(bd);
|
||||
if (bd->flags & BDF_READ_CACHE)
|
||||
DiskCacheInvalidate2(dv);
|
||||
@ -236,7 +236,7 @@ U0 DiskCacheInvalidate(CDrv *dv)
|
||||
|
||||
U0 DiskChg(U8 drv_let=0)
|
||||
{//Change disk. (Needed for removable media.)
|
||||
CDrv *dv=Let2Drv(drv_let);
|
||||
CDrive *dv=Letter2Drive(drv_let);
|
||||
CBlkDev *bd=dv->bd;
|
||||
if (!(bd->flags&BDF_INITIALIZED))
|
||||
BlkDevInit(bd);
|
||||
@ -249,9 +249,9 @@ U0 DiskChg(U8 drv_let=0)
|
||||
RedSeaFreeFreeLst(dv);
|
||||
}
|
||||
|
||||
Bool DrvMap(U8 drv_let,CDrv *dv)
|
||||
Bool DriveMap(U8 drv_let,CDrive *dv)
|
||||
{//Make drive letter map to another.
|
||||
drv_let=Let2Let(drv_let);
|
||||
drv_let=Letter2Letter(drv_let);
|
||||
if ('A'<=drv_let<='Z') {
|
||||
blkdev.let_to_drv[drv_let-'A']=dv;
|
||||
dv->drv_let=drv_let;
|
||||
@ -262,12 +262,12 @@ Bool DrvMap(U8 drv_let,CDrv *dv)
|
||||
|
||||
Bool Drive(U8 drv_let)
|
||||
{//Change drive. You can set drive with $LK,"Cd",A="MN:Cd"$() as well.
|
||||
CDrv *dv=Let2Drv(drv_let);
|
||||
CDrive *dv=Letter2Drive(drv_let);
|
||||
CBlkDev *bd;
|
||||
bd=BlkDevCheck(dv->bd);
|
||||
if (dv!=Fs->cur_dv) {
|
||||
if (bd->flags & BDF_REMOVABLE && !(bd->flags & BDF_INITIALIZED))
|
||||
DiskChg(Drv2Let(dv));
|
||||
DiskChg(Drive2Letter(dv));
|
||||
if (bd->type==BDT_RAM ||
|
||||
bd->type==BDT_ISO_FILE_READ || bd->type==BDT_ISO_FILE_WRITE)
|
||||
BlkDevInit(bd);
|
||||
@ -285,9 +285,9 @@ Bool Drive(U8 drv_let)
|
||||
}
|
||||
}
|
||||
|
||||
U8 *DrvSerialNum(U8 drv_let=0)
|
||||
U8 *DriveSerialNum(U8 drv_let=0)
|
||||
{//20 bytes max.
|
||||
CBlkDev *bd=Let2BlkDev(drv_let);
|
||||
CBlkDev *bd=Letter2BlkDev(drv_let);
|
||||
U16 *st,*res=NULL;
|
||||
I64 i;
|
||||
if (bd->dev_id_record) {
|
||||
@ -300,9 +300,9 @@ U8 *DrvSerialNum(U8 drv_let=0)
|
||||
return res;
|
||||
}
|
||||
|
||||
U8 *DrvModelNum(U8 drv_let=0)
|
||||
U8 *DriveModelNum(U8 drv_let=0)
|
||||
{//40 bytes max.
|
||||
CBlkDev *bd=Let2BlkDev(drv_let);
|
||||
CBlkDev *bd=Letter2BlkDev(drv_let);
|
||||
U16 *st,*res=NULL;
|
||||
I64 i;
|
||||
if (bd->dev_id_record) {
|
||||
@ -318,19 +318,19 @@ U8 *DrvModelNum(U8 drv_let=0)
|
||||
U8 blkdev_text_attr[BDT_TYPES_NUM]={BLACK,LTCYAN,WHITE,LTGREEN,LTRED,LTBLUE};
|
||||
U8 drv_text_attr[3]={BLACK,BLUE,RED};
|
||||
|
||||
U8 DrvTextAttrGet(U8 drv_let=0)
|
||||
U8 DriveTextAttrGet(U8 drv_let=0)
|
||||
{//Get color of drive.
|
||||
drv_let=Let2Let(drv_let);
|
||||
drv_let=Letter2Letter(drv_let);
|
||||
if ('A'<=drv_let<='Z')
|
||||
return blkdev_text_attr[Let2BlkDevType(drv_let)]<<4|
|
||||
return blkdev_text_attr[Letter2BlkDevType(drv_let)]<<4|
|
||||
drv_text_attr[drv_let%sizeof(drv_text_attr)];
|
||||
else
|
||||
return BLACK<<4|WHITE;
|
||||
}
|
||||
|
||||
U0 DrvRep()
|
||||
U0 DriveRep()
|
||||
{//Drive report.
|
||||
CDrv *dv;
|
||||
CDrive *dv;
|
||||
CBlkDev *bd;
|
||||
I64 ch,i,drv_let,attr;
|
||||
U8 *st;
|
||||
@ -338,22 +338,22 @@ U0 DrvRep()
|
||||
for (i=0,dv=blkdev.drvs;i<DRVS_NUM;i++,dv++) {
|
||||
if (dv->dv_signature==DRV_SIGNATURE_VAL) {
|
||||
bd=dv->bd;
|
||||
drv_let=Drv2Let(dv);
|
||||
drv_let=Drive2Letter(dv);
|
||||
if (Bt(&dv->fs_type,FStf_DISABLE))
|
||||
ch='-';
|
||||
else if (drv_let==blkdev.boot_drv_let)
|
||||
ch=':';
|
||||
else
|
||||
ch='+';
|
||||
attr=DrvTextAttrGet(drv_let);
|
||||
attr=DriveTextAttrGet(drv_let);
|
||||
"$$FG,%d$$$$BG,%d$$%C %-8Z %-10Z %04X %04X %02X\n",
|
||||
attr&15,attr>>4,drv_let,dv->fs_type&FSG_TYPE_MASK,"ST_DRV_TYPES",
|
||||
bd->type,"ST_BLKDEV_TYPES",bd->base0,bd->base1,bd->unit;
|
||||
if (st=DrvModelNum(drv_let)) {
|
||||
if (st=DriveModelNum(drv_let)) {
|
||||
"Model#:%s\n",st;
|
||||
Free(st);
|
||||
}
|
||||
if (st=DrvSerialNum(drv_let)) {
|
||||
if (st=DriveSerialNum(drv_let)) {
|
||||
"Serial#:%s\n",st;
|
||||
Free(st);
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
CDirEntry *FilesFind2(U8 *files_find_mask,I64 fuf_flags)
|
||||
{
|
||||
CDrv *dv=Fs->cur_dv;
|
||||
CDrive *dv=Fs->cur_dv;
|
||||
CDirEntry *res=NULL;
|
||||
DrvCheck(dv);
|
||||
DriveCheck(dv);
|
||||
switch (dv->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
res=RedSeaFilesFind(files_find_mask,fuf_flags);
|
||||
@ -61,7 +61,7 @@ Bool FileFind(U8 *filename,CDirEntry *_de=NULL,I64 fuf_flags=0)
|
||||
Bool res=FALSE,old_silent;
|
||||
if (fuf_flags&~FUG_FILE_FIND)
|
||||
throw('FUF');
|
||||
if (!filename || *filename && filename[1]==':' && !Let2Drv(*filename,FALSE))
|
||||
if (!filename || *filename && filename[1]==':' && !Letter2Drive(*filename,FALSE))
|
||||
return FALSE;
|
||||
altname=ToggleZorNotZ(filename);
|
||||
if (fuf_flags&FUF_Z_OR_NOT_Z)
|
||||
@ -94,9 +94,9 @@ Bool FileFind(U8 *filename,CDirEntry *_de=NULL,I64 fuf_flags=0)
|
||||
if (res && _de) {
|
||||
if (StrCmp(Fs->cur_dir,"/"))
|
||||
full_name=MStrPrint("%C:%s/%s",
|
||||
Drv2Let(Fs->cur_dv),Fs->cur_dir,de.name);
|
||||
Drive2Letter(Fs->cur_dv),Fs->cur_dir,de.name);
|
||||
else
|
||||
full_name=MStrPrint("%C:/%s",Drv2Let(Fs->cur_dv),de.name);
|
||||
full_name=MStrPrint("%C:/%s",Drive2Letter(Fs->cur_dv),de.name);
|
||||
}
|
||||
DirContextDel(dirc);
|
||||
}
|
||||
@ -131,10 +131,10 @@ Bool FileFind(U8 *filename,CDirEntry *_de=NULL,I64 fuf_flags=0)
|
||||
if (res && _de) {
|
||||
if (StrCmp(Fs->cur_dir,"/"))
|
||||
full_name=MStrPrint("%C:%s/%s",
|
||||
Drv2Let(Fs->cur_dv),Fs->cur_dir,de.name);
|
||||
Drive2Letter(Fs->cur_dv),Fs->cur_dir,de.name);
|
||||
else
|
||||
full_name=MStrPrint("%C:/%s",
|
||||
Drv2Let(Fs->cur_dv),de.name);
|
||||
Drive2Letter(Fs->cur_dv),de.name);
|
||||
}
|
||||
DirContextDel(dirc);
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
Bool DrvTypeSet(U8 drv_let,I64 type=FSt_REDSEA)
|
||||
Bool DriveTypeSet(U8 drv_let,I64 type=FSt_REDSEA)
|
||||
{//Very dangerous
|
||||
I64 i,j,ext_base,drv_num,offset,cur_type;
|
||||
CMasterBoot mbr;
|
||||
CBlkDev *bd;
|
||||
drv_let=Let2Let(drv_let);
|
||||
bd=Let2BlkDev(drv_let);
|
||||
drv_let=Letter2Letter(drv_let);
|
||||
bd=Letter2BlkDev(drv_let);
|
||||
drv_num=bd->first_drv_let-'A';
|
||||
switch (bd->type) {
|
||||
case BDT_ATA:
|
||||
@ -58,7 +58,7 @@ U0 Fmt(I64 drv_let,Bool quick=TRUE,Bool confirm=TRUE,I64 type=FSt_FAT32)
|
||||
//quick=FALSE means fill entire drive with zeros.
|
||||
//Choose $LK,"FSt_FAT32",A="MN:FSt_FAT32"$ or $LK,"FSt_REDSEA",A="MN:FSt_REDSEA"$.
|
||||
//You don't format a CD/DVD with this.
|
||||
CDrv *dv=Let2Drv(drv_let);
|
||||
CDrive *dv=Letter2Drive(drv_let);
|
||||
Bool old_silent=IsSilent;
|
||||
if (confirm && !AreYouSure)
|
||||
return;
|
||||
@ -73,7 +73,7 @@ U0 Fmt(I64 drv_let,Bool quick=TRUE,Bool confirm=TRUE,I64 type=FSt_FAT32)
|
||||
Drive(drv_let);
|
||||
Silent(old_silent);
|
||||
FAT32Fmt(drv_let,quick);
|
||||
DiskCacheInvalidate(Let2Drv(drv_let));
|
||||
DiskCacheInvalidate(Letter2Drive(drv_let));
|
||||
Drive(drv_let);
|
||||
break;
|
||||
}
|
||||
@ -83,7 +83,7 @@ U0 Fmt(I64 drv_let,Bool quick=TRUE,Bool confirm=TRUE,I64 type=FSt_FAT32)
|
||||
Drive(drv_let);
|
||||
Silent(old_silent);
|
||||
RedSeaFmt(drv_let,quick);
|
||||
DiskCacheInvalidate(Let2Drv(drv_let));
|
||||
DiskCacheInvalidate(Letter2Drive(drv_let));
|
||||
Drive(drv_let);
|
||||
break;
|
||||
default:
|
||||
|
@ -113,7 +113,7 @@ U8 *DirNameAbs(U8 *_dirname)
|
||||
return StrNew(_dirname);
|
||||
free_dirname=dirname=MStrUtil(_dirname,
|
||||
SUF_REM_LEADING|SUF_REM_TRAILING|SUF_REM_CTRL_CHARS);
|
||||
*drv=Drv2Let;
|
||||
*drv=Drive2Letter;
|
||||
drv[1]=':';
|
||||
drv[2]=0;
|
||||
if (*dirname && dirname[1]==':') {
|
||||
@ -285,7 +285,7 @@ U8 *DirCur(CTask *task=NULL,CTask *mem_task=NULL)
|
||||
if (!task->cur_dir)
|
||||
return NULL;
|
||||
st=MAlloc(StrLen(task->cur_dir)+3,mem_task);
|
||||
*st=Drv2Let(task->cur_dv);
|
||||
*st=Drive2Letter(task->cur_dv);
|
||||
st[1]=':';
|
||||
StrCpy(st+2,task->cur_dir);
|
||||
return st;
|
||||
|
@ -7,15 +7,15 @@ Bool CFileNameTo(U8 *dst,U8 *src)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
I64 Name2DirClus(CDrv *dv,U8 *dirname)
|
||||
I64 Name2DirClus(CDrive *dv,U8 *dirname)
|
||||
{
|
||||
Bool cont=TRUE,unlock;
|
||||
I64 cur_dir_clus;
|
||||
CDirEntry de;
|
||||
U8 *buf=StrNew(dirname),*buf2=StrNew(dirname);
|
||||
DrvCheck(dv);
|
||||
DriveCheck(dv);
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
unlock=DriveLock(dv);
|
||||
cur_dir_clus=dv->root_clus;
|
||||
while (*buf && cont) {
|
||||
StrFirstRem(buf,"/",buf2);
|
||||
@ -47,15 +47,15 @@ I64 Name2DirClus(CDrv *dv,U8 *dirname)
|
||||
return cur_dir_clus;
|
||||
}
|
||||
|
||||
I64 Name2ParentDirClus(CDrv *dv,U8 *dirname)
|
||||
I64 Name2ParentDirClus(CDrive *dv,U8 *dirname)
|
||||
{
|
||||
Bool cont=TRUE,unlock;
|
||||
I64 cur_dir_clus,cur_dir_clus2;
|
||||
CDirEntry de;
|
||||
U8 *buf=StrNew(dirname),*buf2=StrNew(dirname);
|
||||
DrvCheck(dv);
|
||||
DriveCheck(dv);
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
unlock=DriveLock(dv);
|
||||
cur_dir_clus=cur_dir_clus2=dv->root_clus;
|
||||
while (*buf && cont) {
|
||||
cur_dir_clus2=cur_dir_clus;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user