TempleOSCDV5.01.ISO
This commit is contained in:
1 parent
f6eacf7744
commit
320c7ee98a
219 files changed
+5211
-4853
No files matched your search
Binary file not shown.
@@ -204,7 +204,7 @@ public I64 DelTree(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=MIN_I64)
|
||||
U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=I64_MIN)
|
||||
{
|
||||
CDrv *dv=Let2Drv(*filename);
|
||||
CDirEntry de;
|
||||
@@ -219,7 +219,7 @@ U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=MIN_I64)
|
||||
if (!*cur_dir)
|
||||
StrCpy(cur_dir,"/");
|
||||
ScanFlags(&de.attr,Define("ST_FILE_ATTRS"),attr);
|
||||
if (cdt==MIN_I64)
|
||||
if (cdt==I64_MIN)
|
||||
de.datetime=Now;
|
||||
else
|
||||
de.datetime=cdt;
|
||||
@@ -230,7 +230,7 @@ U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=MIN_I64)
|
||||
Free(cur_dir);
|
||||
}
|
||||
public U0 Touch(U8 *files_find_mask="*",U8 *attr="+?",
|
||||
U8 *fu_flags=NULL,CDate cdt=MIN_I64)
|
||||
U8 *fu_flags=NULL,CDate cdt=I64_MIN)
|
||||
{/*Touch file attributes and DateTime.
|
||||
Default lists attributes.
|
||||
attr: "+?" =show current
|
||||
|
||||
@@ -353,7 +353,7 @@ public U0 DskView(U8 drv_let=0)
|
||||
GrCircle(dc,h>>1,v>>1,radius);
|
||||
|
||||
j=1;
|
||||
for (i=0;i<NUM_DRVS;i++) {
|
||||
for (i=0;i<DRVS_NUM;i++) {
|
||||
dv=&blkdev.drvs[i];
|
||||
if (bd==dv->bd && dv->fs_type) {
|
||||
sect_start=-(dv->drv_offset*2*ã/(bd->max_blk+1));
|
||||
|
||||
+50
-34
@@ -207,15 +207,15 @@ U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_head,I64 mode)
|
||||
break;
|
||||
case FM_PICK_FILE:
|
||||
DocPrint(doc,"$$PURPLE$$Pick file and press <ESC>\n\n");
|
||||
doc->flags|=DOCF_MIN_SIZE;
|
||||
doc->flags|=DOCF_SIZE_MIN;
|
||||
break;
|
||||
case FM_PICK_DIR:
|
||||
DocPrint(doc,"$$PURPLE$$Pick directory and press <ESC>\n\n");
|
||||
doc->flags|=DOCF_MIN_SIZE;
|
||||
doc->flags|=DOCF_SIZE_MIN;
|
||||
break;
|
||||
}
|
||||
DocPrint(doc,"$$LTBLUE$$");
|
||||
for (i=0;i<NUM_DRVS;i++) {
|
||||
for (i=0;i<DRVS_NUM;i++) {
|
||||
dv=&blkdev.drvs[i];
|
||||
if (dv->bd->type==BDT_ATAPI) {
|
||||
if (dv->bd->flags&BDF_INITIALIZED)
|
||||
@@ -388,7 +388,7 @@ U0 FMFmtDrv(CDoc *doc)
|
||||
Free(st);
|
||||
}
|
||||
|
||||
U0 FMMakeISO(CDoc *doc)
|
||||
U0 FMMakeISO(CDoc *doc,I64 type)
|
||||
{
|
||||
CDocEntry *doc_ce=doc->cur_entry;
|
||||
CDirEntry *tmpde;
|
||||
@@ -402,12 +402,19 @@ U0 FMMakeISO(CDoc *doc)
|
||||
tmpde=tmpde->parent;
|
||||
if (tmpde && *tmpde->full_name) {
|
||||
Silent;
|
||||
if (tmpde->full_name[StrLen(tmpde->full_name)-1]=='/')
|
||||
st=MStrPrint("%s*",tmpde->full_name);
|
||||
else
|
||||
st=MStrPrint("%s/*",tmpde->full_name);
|
||||
ISO9660ISO(,st);
|
||||
Free(st);
|
||||
switch (type) {
|
||||
case FSt_REDSEA:
|
||||
RedSeaISO(,tmpde->full_name);
|
||||
break;
|
||||
case FSt_ISO9660:
|
||||
if (tmpde->full_name[StrLen(tmpde->full_name)-1]=='/')
|
||||
st=MStrPrint("%s*",tmpde->full_name);
|
||||
else
|
||||
st=MStrPrint("%s/*",tmpde->full_name);
|
||||
ISO9660ISO(,st);
|
||||
Free(st);
|
||||
break;
|
||||
}
|
||||
Silent(OFF);
|
||||
}
|
||||
}
|
||||
@@ -486,32 +493,35 @@ U0 FMCopy(CDoc *doc)
|
||||
#define FMR_PASTE 6
|
||||
#define FMR_CHG_DSK 7
|
||||
#define FMR_FORMAT 8
|
||||
#define FMR_MOUNT_ISO 9
|
||||
#define FMR_MOUNT_REDSEA_ISO_C 9
|
||||
#define FMR_UNMOUNT 10
|
||||
#define FMR_MAKE_ISO 11
|
||||
#define FMR_BURN_ISO 12
|
||||
#define FMR_HELP 13
|
||||
#define FMR_MAKE_REDSEA_ISO_C 11
|
||||
#define FMR_MAKE_ISO9660 12
|
||||
#define FMR_BURN_ISO 13
|
||||
#define FMR_HELP 14
|
||||
|
||||
I64 PopUpFMRight(U8 *header=NULL,U8 *footer=NULL)
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
if (header) DocPrint(doc,"%s",header);
|
||||
DocPrint(doc,"$$CM+LX,1,1 $$$$BT,\"INCLUDE \",LE=FMR_INCLUDE$$"
|
||||
"$$CM+LX,27,0$$$$BT,\"ADAM INCLUDE \",LE=FMR_ADAM_INCLUDE$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"DELETE \",LE=FMR_DELETE$$"
|
||||
"$$CM+LX,27,0$$$$BT,\"RENAME \",LE=FMR_RENAME$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"MAKE DIRECTORY \",LE=FMR_MKDIR$$"
|
||||
"$$CM+LX,27,0$$$$BT,\"PLAIN-TEXT EDIT \",LE=FMR_PLAIN$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"PASTE CLIPBOARD FILES \",LE=FMR_PASTE$$"
|
||||
"$$CM+LX,27,0$$$$BT,\"CHANGE DISK(MOUNT IT) \",LE=FMR_CHG_DSK$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"FORMAT \",LE=FMR_FORMAT$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"MOUNT ISO.C FILE \",LE=FMR_MOUNT_ISO$$"
|
||||
"$$CM+LX,27,0$$$$BT,\"UNMOUNT \",LE=FMR_UNMOUNT$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"MAKE ISO (CD/DVD) FILE\",LE=FMR_MAKE_ISO$$"
|
||||
"$$CM+LX,27,0$$$$BT,\"BURN ISO (CD/DVD) FILE\",LE=FMR_BURN_ISO$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"HELP \",LE=FMR_HELP$$"
|
||||
"$$CM+LX,27,0$$$$BT,\"CANCEL \",LE=DOCM_CANCEL$$\n");
|
||||
DocPrint(doc,"$$CM+LX,1,1 $$$$BT,\"INCLUDE \",LE=FMR_INCLUDE$$"
|
||||
"$$CM+LX,29,0$$$$BT,\"ADAM INCLUDE \",LE=FMR_ADAM_INCLUDE$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"DELETE \",LE=FMR_DELETE$$"
|
||||
"$$CM+LX,29,0$$$$BT,\"RENAME \",LE=FMR_RENAME$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"MAKE DIRECTORY \",LE=FMR_MKDIR$$"
|
||||
"$$CM+LX,29,0$$$$BT,\"PLAIN-TEXT EDIT \",LE=FMR_PLAIN$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"PASTE CLIPBOARD FILES \",LE=FMR_PASTE$$"
|
||||
"$$CM+LX,29,0$$$$BT,\"CHANGE DISK(MOUNT IT) \",LE=FMR_CHG_DSK$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"FORMAT \",LE=FMR_FORMAT$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"MOUNT ISO.C FILE \","
|
||||
"LE=FMR_MOUNT_REDSEA_ISO_C$$"
|
||||
"$$CM+LX,29,0$$$$BT,\"UNMOUNT \",LE=FMR_UNMOUNT$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"MAKE ISO.C (CD/DVD) FILE\",LE=FMR_MAKE_REDSEA_ISO_C$$"
|
||||
"$$CM+LX,29,0$$$$BT,\"MAKE ISO (CD/DVD) FILE \",LE=FMR_MAKE_ISO9660$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"BURN ISO (CD/DVD) FILE \",LE=FMR_BURN_ISO$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"HELP \",LE=FMR_HELP$$"
|
||||
"$$CM+LX,29,0$$$$BT,\"CANCEL \",LE=DOCM_CANCEL$$\n");
|
||||
if (footer) DocPrint(doc,"%s",footer);
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
@@ -543,18 +553,21 @@ U0 FMRightClick()
|
||||
Msg(MSG_KEY_DOWN,0,SC_INS+SCF_SHIFT);
|
||||
break;
|
||||
case FMR_CHG_DSK:
|
||||
Msg(MSG_KEY_DOWN,'m',0);
|
||||
Msg(MSG_KEY_DOWN,'c',0);
|
||||
break;
|
||||
case FMR_FORMAT:
|
||||
Msg(MSG_KEY_DOWN,'f',0);
|
||||
break;
|
||||
case FMR_MOUNT_ISO:
|
||||
case FMR_MOUNT_REDSEA_ISO_C:
|
||||
Msg(MSG_KEY_DOWN,'i',0);
|
||||
break;
|
||||
case FMR_UNMOUNT:
|
||||
Msg(MSG_KEY_DOWN,'u',0);
|
||||
break;
|
||||
case FMR_MAKE_ISO:
|
||||
case FMR_MAKE_REDSEA_ISO_C:
|
||||
Msg(MSG_KEY_DOWN,'m',0);
|
||||
break;
|
||||
case FMR_MAKE_ISO9660:
|
||||
Msg(MSG_KEY_DOWN,'M',0);
|
||||
break;
|
||||
case FMR_BURN_ISO:
|
||||
@@ -702,7 +715,7 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
case CH_CTRLY:
|
||||
FMDelete(doc);
|
||||
break;
|
||||
case 'm':
|
||||
case 'c':
|
||||
FMChgDsk(doc);
|
||||
break;
|
||||
case 'i':
|
||||
@@ -712,7 +725,10 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
FMUnmount(doc);
|
||||
break;
|
||||
case 'M':
|
||||
FMMakeISO(doc);
|
||||
FMMakeISO(doc,FSt_ISO9660);
|
||||
break;
|
||||
case 'm':
|
||||
FMMakeISO(doc,FSt_REDSEA);
|
||||
break;
|
||||
case 'B':
|
||||
FMBurnISO(doc);
|
||||
|
||||
@@ -33,7 +33,7 @@ U8 Mount2(U8 boot_drv_let,CDoc *_doc,Bool _caller_is_prtdsk)
|
||||
make_free=TRUE;
|
||||
}
|
||||
unit=0;
|
||||
prt_num=MIN_I64;
|
||||
prt_num=I64_MIN;
|
||||
switch (type) {
|
||||
case BDT_RAM:
|
||||
"Addr of RAM disk ($$PURPLE$$<ENTER>$$FG$$ to MAlloc):";
|
||||
|
||||
+1
-1
@@ -239,7 +239,7 @@ public U0 FunRep(U8 *st,U8 *rbp=NULL,I64 max_depth=2,CTask *task=NULL)
|
||||
} else {
|
||||
tmpm=tmpf->member_lst_and_root;
|
||||
while (tmpm) {
|
||||
if (0<=tmpm->reg<NUM_REGS)
|
||||
if (0<=tmpm->reg<REG_REGS_NUM)
|
||||
"%08Z %s\n",tmpm->reg,"ST_U64_REGS",tmpm->str;
|
||||
else
|
||||
"%08tX %s\n",tmpm->offset,tmpm->str;
|
||||
|
||||
+3
-3
@@ -9,10 +9,10 @@ U0 LoadDocDefines()
|
||||
(Now-Str2Date("8/1/2003"))/ToF64(1<<32)/CDATE_YEAR_DAYS);
|
||||
|
||||
//This is cut and replaced when I generate a distro.
|
||||
//See $LK,"DD_TEMPLEOS_LOC",A="FF:::/Demo/AcctExample/TOSDistro.HC,DD_TEMPLEOS_LOC"$.
|
||||
//See $LK,"DD_TEMPLEOS_LOC",A="FF:::/Demo/AcctExample/TOS/TOSDistro.HC,DD_TEMPLEOS_LOC"$.
|
||||
$TR-C,"LineRep"$
|
||||
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","119,466");
|
||||
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","81,791");
|
||||
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","119,710");
|
||||
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","81,944");
|
||||
$ID,-4$
|
||||
DefinePrint("DD_KERNEL","%08X",bfh);
|
||||
bfh(I64)+=bfh->file_size-1;
|
||||
|
||||
+6
-4
@@ -33,7 +33,7 @@ extern Bool DocHighlightCursor(Bool show=OFF,CDoc *doc=NULL);
|
||||
extern U0 DocInsDoc(CDoc *doc=NULL,CDoc *doc2);
|
||||
extern U0 DocInsEntry(CDoc *doc,CDocEntry *doc_e);
|
||||
extern Bool DocLock(CDoc *doc);
|
||||
extern I64 DocMax(I64 i=MAX_I64);
|
||||
extern I64 DocMax(I64 i=I64_MAX);
|
||||
extern CDoc *DocNew(U8 *filename=NULL,CTask *task=NULL);
|
||||
extern CDocEntry *DocPrint(CDoc *doc=NULL,U8 *fmt,...);
|
||||
extern CDoc *DocPut(CTask *task=NULL);
|
||||
@@ -50,7 +50,7 @@ extern U0 EdCodeTools(CDoc *doc);
|
||||
extern U8 *EdSprite(I64 bin_num);
|
||||
extern I64 ExeDoc(CDoc *doc,I64 ccf_flags=0);
|
||||
extern I64 FindWiz();
|
||||
extern I64 GetI64(U8 *msg=NULL,I64 dft=0,I64 lo=MIN_I64,I64 hi=MAX_I64);
|
||||
extern I64 GetI64(U8 *msg=NULL,I64 dft=0,I64 lo=I64_MIN,I64 hi=I64_MAX);
|
||||
extern Bool GrPlot0(CDC *dc,I64 x,I64 y);
|
||||
extern I64 ISO9660ISO(U8 *_filename=NULL,U8 *src_files_find_mask,
|
||||
U8 *fu_flags=NULL,U8 *_stage2_filename=NULL);
|
||||
@@ -69,8 +69,8 @@ extern I64 PopUpColorLighting(U8 *header=NULL);
|
||||
extern I64 PopUpFile(U8 *filename,
|
||||
Bool warn_ext=TRUE,CTask *parent=NULL,CTask **_pu_task=NULL);
|
||||
extern Bool PopUpForm(U8 *_d,U8 *class_name=lastclass,
|
||||
I64 dof_flags=DOF_MIN_SIZE,U8 *header=NULL,U8 *footer=NULL);
|
||||
extern I64 PopUpGetI64(U8 *msg,I64 dft,I64 lo=MIN_I64,I64 hi=MAX_I64);
|
||||
I64 dof_flags=DOF_SIZE_MIN,U8 *header=NULL,U8 *footer=NULL);
|
||||
extern I64 PopUpGetI64(U8 *msg,I64 dft,I64 lo=I64_MIN,I64 hi=I64_MAX);
|
||||
extern U8 *PopUpGetStr(U8 *header=NULL);
|
||||
extern I64 PopUpMenu(CDoc *doc,I64 dof_flags=0);
|
||||
extern Bool PopUpNoYes(U8 *header=NULL,U8 *footer=NULL);
|
||||
@@ -78,6 +78,8 @@ extern Bool PopUpOk(U8 *header=NULL,U8 *footer=NULL);
|
||||
extern I64 PopUpRangeI64(
|
||||
I64 lo,I64 hi,I64 step=1,U8 *header=NULL,U8 *footer=NULL);
|
||||
extern Bool PopUpTransform(I64 *r);
|
||||
extern I64 RedSeaISO(U8 *_iso_filename=NULL,U8 *_src_dir,
|
||||
U8 *_stage2_filename=NULL);
|
||||
extern U0 Refresh(I64 cnt=1,Bool force=FALSE);
|
||||
extern U0 RegOneTimePopUp(I64 flag_num,U8 *msg);
|
||||
extern Bool RegWrite(U8 *path,U8 *fmt,...);
|
||||
|
||||
+4
-4
@@ -326,11 +326,11 @@ wh_done:
|
||||
|
||||
#help_index "Info;Hash;Cmd Line (Typically)"
|
||||
|
||||
#define HDR_MAX 16
|
||||
#define HDR_NUM 16
|
||||
public I64 HashDepthRep(CHashTable *table=NULL)
|
||||
{//Hash table linked-list chain depth report.
|
||||
//Histogram of collision count.
|
||||
I64 i,j,longest=0,cnt=0,a[HDR_MAX];
|
||||
I64 i,j,longest=0,cnt=0,a[HDR_NUM];
|
||||
CHash *tmph;
|
||||
if (!table) table=Fs->hash_table;
|
||||
MemSet(a,0,sizeof(a));
|
||||
@@ -338,7 +338,7 @@ public I64 HashDepthRep(CHashTable *table=NULL)
|
||||
tmph=table->body[i];
|
||||
if (tmph) {
|
||||
j=LinkedLstCnt(tmph);
|
||||
if (j<HDR_MAX)
|
||||
if (j<HDR_NUM)
|
||||
a[j]++;
|
||||
cnt+=j;
|
||||
if (j>longest)
|
||||
@@ -346,7 +346,7 @@ public I64 HashDepthRep(CHashTable *table=NULL)
|
||||
}
|
||||
}
|
||||
"Histogram\n";
|
||||
for (i=0;i<HDR_MAX;i++)
|
||||
for (i=0;i<HDR_NUM;i++)
|
||||
if (a[i])
|
||||
"%02d:%d\n",i,a[i];
|
||||
"Size:%d Count:%d Longest:%d\n",
|
||||
|
||||
+3
-3
@@ -156,7 +156,7 @@ public U0 ODERenum(CMathODE *ode)
|
||||
public CMass *MassFind(CMathODE *ode,F64 x,F64 y,F64 z=0)
|
||||
{//Search for mass nearest to x,y,z.
|
||||
CMass *tmpm,*best_mass=NULL;
|
||||
F64 dd,best_dd=MAX_F64;
|
||||
F64 dd,best_dd=F64_MAX;
|
||||
|
||||
tmpm=ode->next_mass;
|
||||
while (tmpm!=&ode->next_mass) {
|
||||
@@ -173,7 +173,7 @@ public CMass *MassFind(CMathODE *ode,F64 x,F64 y,F64 z=0)
|
||||
public CSpring *SpringFind(CMathODE *ode,F64 x,F64 y,F64 z=0)
|
||||
{//Find spring midpoint nearest x,y,z.
|
||||
CSpring *tmps,*best_spring=NULL;
|
||||
F64 dd,best_dd=MAX_F64;
|
||||
F64 dd,best_dd=F64_MAX;
|
||||
|
||||
tmps=ode->next_spring;
|
||||
while (tmps!=&ode->next_spring) {
|
||||
@@ -195,7 +195,7 @@ public U0 MassOrSpringFind(
|
||||
{//Find spring or mass nearest x,y,z.
|
||||
CMass *tmpm,*best_mass=NULL;
|
||||
CSpring *tmps,*best_spring=NULL;
|
||||
F64 dd,best_dd=MAX_F64;
|
||||
F64 dd,best_dd=F64_MAX;
|
||||
|
||||
tmpm=ode->next_mass;
|
||||
while (tmpm!=&ode->next_mass) {
|
||||
|
||||
+35
-14
@@ -1,4 +1,4 @@
|
||||
#help_index "Misc/Registry"
|
||||
#help_index "Registry"
|
||||
#define REGISTRY_FILENAME "~/Registry.HC.Z"
|
||||
CDoc *sys_registry_doc=NULL;
|
||||
I64 sys_msg_flags[1]={0};
|
||||
@@ -145,7 +145,8 @@ U0 RegInit()
|
||||
}
|
||||
}
|
||||
|
||||
#help_index "Boot/Once;Misc/Once"
|
||||
#help_index "Boot/Once;Registry/Once"
|
||||
#help_file "::/Doc/Once"
|
||||
|
||||
public U0 AOnceFlush()
|
||||
{//Flush AOnce() buf.
|
||||
@@ -158,51 +159,71 @@ public U0 OnceFlush()
|
||||
}
|
||||
|
||||
public U0 AOnce(U8 *fmt,...)
|
||||
{//Writes Adam code to $LK,"Registry",A="FI:~/Registry.HC"$ to be executed next boot.
|
||||
{//Add Adam code to $LK,"~/Registry.HC"$, executed next boot.
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
if (!Bt(&sys_run_level,RLf_ONCE_ADAM))
|
||||
AOnceFlush;
|
||||
RegAppend("Once/Adam","%s\n",buf);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
public U0 Once(U8 *fmt,...)
|
||||
{//Writes User code to $LK,"Registry",A="FI:~/Registry.HC"$ to be executed next boot.
|
||||
{//Add User code to $LK,"~/Registry.HC"$, executed next boot.
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
if (!Bt(&sys_run_level,RLf_ONCE_USER))
|
||||
OnceFlush;
|
||||
RegAppend("Once/User","%s\n",buf);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
public U0 AOnceDrv(U8 drv_let=0,U8 *fmt,...)
|
||||
{//Writes Adam code to drv $LK,"Registry",A="FI:~/Registry.HC"$ to be executed next boot.
|
||||
{//Add Adam code to drv $LK,"~/Registry.HC"$, executed next boot.
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
I64 old_drv_let=*sys_registry_doc->filename.name;
|
||||
if (drv_let)
|
||||
*sys_registry_doc->filename.name=drv_let;
|
||||
if (!Bt(&sys_run_level,RLf_ONCE_ADAM))
|
||||
AOnceFlush;
|
||||
RegAppend("Once/Adam","%s\n",buf);
|
||||
Free(buf);
|
||||
*sys_registry_doc->filename.name=old_drv_let;
|
||||
}
|
||||
|
||||
public U0 OnceDrv(U8 drv_let=0,U8 *fmt,...)
|
||||
{//Writes User code to drv $LK,"Registry",A="FI:~/Registry.HC"$ to be executed next boot.
|
||||
{//Add User code to drv $LK,"~/Registry.HC"$, executed next boot.
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
I64 old_drv_let=*sys_registry_doc->filename.name;
|
||||
if (drv_let)
|
||||
*sys_registry_doc->filename.name=drv_let;
|
||||
if (!Bt(&sys_run_level,RLf_ONCE_USER))
|
||||
OnceFlush;
|
||||
RegAppend("Once/User","%s\n",buf);
|
||||
Free(buf);
|
||||
*sys_registry_doc->filename.name=old_drv_let;
|
||||
}
|
||||
|
||||
public U0 OnceExe()
|
||||
{//Execute Once code. This goes in $LK,"~/Once.HC"$.
|
||||
RegDft("Once/Adam","");
|
||||
if (RegCnt("Once/Adam")>2) {
|
||||
Adam("RegExe(\"Once/Adam\");");
|
||||
{//Execute Once code. Call goes in $LK,"~/Once.HC"$.
|
||||
try {
|
||||
|
||||
RegDft("Once/Adam","");
|
||||
if (RegCnt("Once/Adam")>2) {
|
||||
Adam("RegExe(\"Once/Adam\");");
|
||||
AOnceFlush;
|
||||
}
|
||||
LBts(&sys_run_level,RLf_ONCE_ADAM);
|
||||
|
||||
RegDft("Once/User","");
|
||||
if (RegCnt("Once/User")>2) {
|
||||
RegExe("Once/User");
|
||||
OnceFlush;
|
||||
}
|
||||
LBts(&sys_run_level,RLf_ONCE_USER);
|
||||
|
||||
} catch {
|
||||
AOnceFlush;
|
||||
}
|
||||
RegDft("Once/User","");
|
||||
if (RegCnt("Once/User")>2) {
|
||||
RegExe("Once/User");
|
||||
LBts(&sys_run_level,RLf_ONCE_ADAM);
|
||||
OnceFlush;
|
||||
LBts(&sys_run_level,RLf_ONCE_USER);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ U0 ACDDictWordsAdd(U8 *st)
|
||||
I64 i;
|
||||
U8 *ptr;
|
||||
if (st && *st && (ptr=ACDWordPtAt(st))) {
|
||||
for (i=0;i<ACD_MAX_FILLINS;i++) {
|
||||
for (i=0;i<ACD_FILLINS_NUM;i++) {
|
||||
if (*ptr++!=ACD_WORD_CHAR)
|
||||
break;
|
||||
if (i) '\n';
|
||||
@@ -21,7 +21,7 @@ U0 ACDocRst(I64 left,I64 top)
|
||||
{
|
||||
CDoc *doc=DocPut;
|
||||
DocRst(doc,TRUE);
|
||||
doc->flags|=DOCF_MIN_SIZE;
|
||||
doc->flags|=DOCF_SIZE_MIN;
|
||||
Fs->border_src=BDS_CONST;
|
||||
Fs->border_attr=LTGRAY<<4+DrvTextAttrGet(':')&15;
|
||||
Fs->text_attr =LTGRAY<<4+BLUE;
|
||||
@@ -63,7 +63,7 @@ I64 ACPriorWordInStr(U8 *src,U8 *dst,I64 len,I64 buf_size)
|
||||
U0 ACFillInAdd(CHashAC *tmpw)
|
||||
{
|
||||
I64 k;
|
||||
if (ac.num_fillins<AC_MAX_FILLINS ||
|
||||
if (ac.num_fillins<AC_FILLINS_NUM ||
|
||||
tmpw->hits>ac.fillin_hits[ac.num_fillins-1]) {
|
||||
for (k=ac.num_fillins-1;k>=0;k--) {
|
||||
if (tmpw->hits<=ac.fillin_hits[k])
|
||||
@@ -75,7 +75,7 @@ U0 ACFillInAdd(CHashAC *tmpw)
|
||||
}
|
||||
ac.fillin_matches[k+1]=tmpw;
|
||||
ac.fillin_hits[k+1] =tmpw->hits;
|
||||
if (ac.num_fillins<AC_MAX_FILLINS)
|
||||
if (ac.num_fillins<AC_FILLINS_NUM)
|
||||
ac.num_fillins++;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -210,11 +210,11 @@ public U0 MemPageRep()
|
||||
else
|
||||
"$$RED$$2MEG$$FG$$ pages\n";
|
||||
"PML2\t :%010X 2MEG :%08X\n",
|
||||
*MEM_PML2(U64 *),*MEM_NUM_2MEG(U64 *);
|
||||
*MEM_PML2(U64 *),*MEM_2MEG_NUM(U64 *);
|
||||
"PML3\t :%010X 1GIG :%08X\n",
|
||||
*MEM_PML3(U64 *),*MEM_NUM_1GIG(U64 *);
|
||||
*MEM_PML3(U64 *),*MEM_1GIG_NUM(U64 *);
|
||||
"PML4\t :%010X 512GIG:%08X\n",
|
||||
*MEM_PML4(U64 *),*MEM_NUM_512GIG(U64 *);
|
||||
*MEM_PML4(U64 *),*MEM_512GIG_NUM(U64 *);
|
||||
"FIXED_AREA:%010X\n",SYS_FIXED_AREA;
|
||||
"HEAP_BASE :%010X\nHEAP_LIMIT:%010X\n",mem_heap_base,mem_heap_limit;
|
||||
}
|
||||
@@ -46,7 +46,7 @@ U0 DocBinsValidate(CDoc *doc)
|
||||
if (doc_e->de_flags & DOCEF_HAS_BIN) {
|
||||
if (b=doc_e->bin_data=DocBinFindNum(doc,doc_e->bin_num)) {
|
||||
if (doc_e->de_flags & DOCEF_BIN_PTR_LINK)
|
||||
b->tmp_use_cnt=MAX_I32;
|
||||
b->tmp_use_cnt=I32_MAX;
|
||||
if (!b->use_cnt++)
|
||||
b->renum_num=++renum_num;
|
||||
doc_e->bin_num=b->renum_num;
|
||||
|
||||
@@ -18,14 +18,14 @@ public I64 EdCurU8(CDoc *doc)
|
||||
return res;
|
||||
}
|
||||
|
||||
public U0 EdCursorLeft(CDoc *doc,I64 sc=MIN_I64)
|
||||
public U0 EdCursorLeft(CDoc *doc,I64 sc=I64_MIN)
|
||||
{//Move cursor left. Might need a call to $LK,"DocRecalc",A="MN:DocRecalc"$().
|
||||
//See $LK,"EdRenumAsm",A="MN:EdRenumAsm"$ for an example.
|
||||
U8 *dst;
|
||||
Bool unlock=DocLock(doc);
|
||||
CDocEntry *doc_ce=doc->cur_entry,*original_ce=doc_ce,*doc_ne;
|
||||
I64 cc=doc->cur_col,y=doc_ce->y;
|
||||
if (sc!=MIN_I64) sc=sc.u32[0];
|
||||
if (sc!=I64_MIN) sc=sc.u32[0];
|
||||
if (sc>=0 && sc&SCF_CTRL) {
|
||||
while (doc_ce->last!=doc && (doc_ce->last->y==y ||
|
||||
doc_ce->de_flags & (DOCEF_SKIP|DOCEF_FILTER_SKIP)))
|
||||
@@ -90,14 +90,14 @@ public U0 EdCursorLeft(CDoc *doc,I64 sc=MIN_I64)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
public U0 EdCursorRight(CDoc *doc,I64 sc=MIN_I64)
|
||||
public U0 EdCursorRight(CDoc *doc,I64 sc=I64_MIN)
|
||||
{//Move cursor right. Might need a call to $LK,"DocRecalc",A="MN:DocRecalc"$().
|
||||
//See $LK,"EdRenumAsm",A="MN:EdRenumAsm"$ for an example.
|
||||
Bool unlock=DocLock(doc);
|
||||
U8 *dst;
|
||||
CDocEntry *doc_ce=doc->cur_entry,*original_ce=doc_ce,*doc_ne;
|
||||
I64 cc=doc->cur_col,y=doc_ce->y,old_de_flags,old_color;
|
||||
if (sc!=MIN_I64) sc=sc.u32[0];
|
||||
if (sc!=I64_MIN) sc=sc.u32[0];
|
||||
if (sc>=0 && sc&SCF_CTRL) {
|
||||
while (doc_ce!=doc && doc_ce->next->y==y &&
|
||||
doc_ce->next->type_u8!=DOCT_SOFT_NEW_LINE && doc_ce->next!=doc &&
|
||||
@@ -166,7 +166,7 @@ public U0 EdCursorRight(CDoc *doc,I64 sc=MIN_I64)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
public U0 EdLineUp(CDoc *doc,I64 sc=MIN_I64)
|
||||
public U0 EdLineUp(CDoc *doc,I64 sc=I64_MIN)
|
||||
{//Move cursor up. Might need a call to $LK,"DocRecalc",A="MN:DocRecalc"$().
|
||||
//See $LK,"EdRenumAsm",A="MN:EdRenumAsm"$ for an example.
|
||||
Bool unlock=DocLock(doc);
|
||||
@@ -174,7 +174,7 @@ public U0 EdLineUp(CDoc *doc,I64 sc=MIN_I64)
|
||||
I64 y,x;
|
||||
CDocEntry *doc_ce=doc->cur_entry,*doc_ne;
|
||||
|
||||
if (sc!=MIN_I64) sc=sc.u32[0];
|
||||
if (sc!=I64_MIN) sc=sc.u32[0];
|
||||
if (doc_ce->type_u8==DOCT_HEX_ED) {
|
||||
doc->cur_col=doc->cur_col-doc_ce->hex_ed_width*3;
|
||||
if (doc->cur_col>=0) {
|
||||
@@ -277,14 +277,14 @@ public U0 EdLineUp(CDoc *doc,I64 sc=MIN_I64)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
public U0 EdLineDown(CDoc *doc,I64 sc=MIN_I64)
|
||||
public U0 EdLineDown(CDoc *doc,I64 sc=I64_MIN)
|
||||
{//Move cursor down. Might need a call to $LK,"DocRecalc",A="MN:DocRecalc"$().
|
||||
//See $LK,"EdRenumAsm",A="MN:EdRenumAsm"$ for an example.
|
||||
Bool unlock=DocLock(doc);
|
||||
U8 *dst;
|
||||
I64 y,x,old_de_flags=0,old_color;
|
||||
CDocEntry *doc_ce=doc->cur_entry,*doc_ne,*doc_ce2;
|
||||
if (sc!=MIN_I64) sc=sc.u32[0];
|
||||
if (sc!=I64_MIN) sc=sc.u32[0];
|
||||
if (doc_ce->type_u8==DOCT_HEX_ED) {
|
||||
doc->cur_col=doc->cur_col+doc_ce->hex_ed_width*3;
|
||||
if (doc->cur_col>=doc_ce->len*3) {
|
||||
|
||||
@@ -601,7 +601,7 @@ U0 EdPopUpChSC(I64 *_ch,I64 *_sc)
|
||||
{
|
||||
I64 sc;
|
||||
"Press A Key\n";
|
||||
DocPut->flags|=DOCF_MIN_SIZE;
|
||||
DocPut->flags|=DOCF_SIZE_MIN;
|
||||
do GetMsg(_ch,&sc,1<<MSG_KEY_DOWN);
|
||||
while (sc.u8[0]==SC_SHIFT || sc.u8[0]==SC_CTRL || sc.u8[0]==SC_ALT);
|
||||
*_sc=sc;
|
||||
|
||||
@@ -146,13 +146,13 @@ public Bool DocEd(CDoc *doc,I64 dof_flags=0)
|
||||
LBts(&Fs->display_flags,DISPLAYf_SHOW);
|
||||
WinZBufUpdate;
|
||||
}
|
||||
if (dof_flags&DOF_MIN_SIZE)
|
||||
doc->flags|=DOCF_MIN_SIZE;
|
||||
if (dof_flags&DOF_SIZE_MIN)
|
||||
doc->flags|=DOCF_SIZE_MIN;
|
||||
|
||||
DocUnlock(doc);
|
||||
if (!(dof_flags&DOF_DONT_WINMGR_SYNC)) {
|
||||
Refresh(2,TRUE);
|
||||
if (doc->flags&DOCF_MIN_SIZE)
|
||||
if (doc->flags&DOCF_SIZE_MIN)
|
||||
Refresh(2,TRUE);
|
||||
}
|
||||
res=View;
|
||||
@@ -178,7 +178,7 @@ public Bool DocEd(CDoc *doc,I64 dof_flags=0)
|
||||
}
|
||||
Free(old_task_title);
|
||||
DocDel(bdoc);
|
||||
if (dof_flags&DOF_MIN_SIZE) {
|
||||
if (dof_flags&DOF_SIZE_MIN) {
|
||||
WinHorz(old_left,old_right);
|
||||
WinVert(old_top,old_bottom);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public Bool DocLineNumGoTo(CDoc *doc,I64 line_num) //one based
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool DocFind(CDoc *haystack_doc,I64 start_line_num=MIN_I64,
|
||||
public Bool DocFind(CDoc *haystack_doc,I64 start_line_num=I64_MIN,
|
||||
U8 *needle,I64 match=1)
|
||||
{//Find str by searching tags. Move cur_entry & center.
|
||||
Bool res=FALSE,unlock;
|
||||
@@ -26,7 +26,7 @@ U8 *needle,I64 match=1)
|
||||
I64 i;
|
||||
if (haystack_doc) {
|
||||
unlock=DocLock(haystack_doc);
|
||||
if (start_line_num==MIN_I64) {
|
||||
if (start_line_num==I64_MIN) {
|
||||
res=TRUE;
|
||||
doc_e=haystack_doc->head.next;
|
||||
} else {
|
||||
|
||||
@@ -223,8 +223,8 @@ public Bool DocForm(U8 *_d,U8 *class_name=lastclass,
|
||||
doc->desc='Form';
|
||||
if (header) DocPrint(doc,"%s",header);
|
||||
doc->flags|=DOCF_OVERSTRIKE|DOCF_FORM;
|
||||
if (dof_flags&DOF_MIN_SIZE)
|
||||
doc->flags|=DOCF_MIN_SIZE;
|
||||
if (dof_flags&DOF_SIZE_MIN)
|
||||
doc->flags|=DOCF_SIZE_MIN;
|
||||
ml=tmpc->member_lst_and_root;
|
||||
while (ml) {
|
||||
if ((fmtstr=MemberMetaData("fmtstr",ml)) &&
|
||||
@@ -332,12 +332,12 @@ dm_restart:
|
||||
|
||||
public I64 PopUpMenu(CDoc *doc,I64 dof_flags=0)
|
||||
{//Run menu chooser doc in PopUp win task.
|
||||
doc->flags|=DOCF_MIN_SIZE | DOCF_FORM;
|
||||
doc->flags|=DOCF_SIZE_MIN | DOCF_FORM;
|
||||
return PopUpPrint("DocMenu(0x%X,0x%X);",doc,dof_flags);
|
||||
}
|
||||
|
||||
public Bool PopUpForm(U8 *_d,U8 *class_name=lastclass,
|
||||
I64 dof_flags=DOF_MIN_SIZE,U8 *header=NULL,U8 *footer=NULL)
|
||||
I64 dof_flags=DOF_SIZE_MIN,U8 *header=NULL,U8 *footer=NULL)
|
||||
{//See $LK,"::/Demo/DolDoc/Form.HC"$ and $LK,"::/Demo/LastClass.HC"$.
|
||||
return PopUpPrint("DocForm(0x%X,0x%X,0x%X,0x%X,0x%X);",_d,class_name,
|
||||
dof_flags,header,footer);
|
||||
|
||||
@@ -150,7 +150,7 @@ gs_done:
|
||||
}
|
||||
|
||||
#help_index "Keyboard Devices;Char/Input;StdIn"
|
||||
public I64 GetI64(U8 *msg=NULL,I64 dft=0,I64 lo=MIN_I64,I64 hi=MAX_I64)
|
||||
public I64 GetI64(U8 *msg=NULL,I64 dft=0,I64 lo=I64_MIN,I64 hi=I64_MAX)
|
||||
{//Prompt user for I64 expression.
|
||||
Bool okay;
|
||||
U8 *st;
|
||||
@@ -176,7 +176,7 @@ public I64 GetI64(U8 *msg=NULL,I64 dft=0,I64 lo=MIN_I64,I64 hi=MAX_I64)
|
||||
}
|
||||
}
|
||||
|
||||
public F64 GetF64(U8 *msg=NULL,F64 dft=0,F64 lo=MIN_F64,F64 hi=MAX_F64)
|
||||
public F64 GetF64(U8 *msg=NULL,F64 dft=0,F64 lo=F64_MIN,F64 hi=F64_MAX)
|
||||
{//Prompt user for F64 expression.
|
||||
Bool okay;
|
||||
U8 *st;
|
||||
@@ -202,12 +202,12 @@ public F64 GetF64(U8 *msg=NULL,F64 dft=0,F64 lo=MIN_F64,F64 hi=MAX_F64)
|
||||
}
|
||||
}
|
||||
|
||||
public CDate GetDate(U8 *msg=NULL,CDate dft=MIN_I64,
|
||||
CDate lo=MIN_I64,CDate hi=MAX_I64)
|
||||
public CDate GetDate(U8 *msg=NULL,CDate dft=I64_MIN,
|
||||
CDate lo=I64_MIN,CDate hi=I64_MAX)
|
||||
{//Prompt user for date expression. (Use $LK,"Now",A="MN:Now"$() if you want current time.)
|
||||
U8 *st;
|
||||
CDate res;
|
||||
if (dft==MIN_I64) dft=Now;
|
||||
if (dft==I64_MIN) dft=Now;
|
||||
while (TRUE) {
|
||||
if (msg)
|
||||
"" msg,dft,dft;
|
||||
|
||||
@@ -9,7 +9,7 @@ public I64 PopUpColor(U8 *header=NULL,
|
||||
DocPrint(doc,"%s",header);
|
||||
if (allow_transparent)
|
||||
DocPrint(doc,"$$MU,\"TRANSPARENT\",LE=TRANSPARENT$$\n");
|
||||
for (i=0;i<NUM_COLORS;i++)
|
||||
for (i=0;i<COLORS_NUM;i++)
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-8Z__\",LE=%d$$$$BG$$\n",i,i,"ST_COLORS",i);
|
||||
if (allow_dft)
|
||||
DocPrint(doc,"$$BG,WHITE$$$$MU,\"DEFAULT\",LE=DOC_DFT$$$$BG$$");
|
||||
@@ -33,14 +33,14 @@ public I64 PopUpColorLighting(U8 *header=NULL)
|
||||
"\n");
|
||||
DocPrint(doc,
|
||||
"\n$$LTPURPLE$$Single-Sided Full-Range Double-Sided Full-Range\n$$BLACK$$");
|
||||
for (i=0;i<NUM_COLORS/2;i++) {
|
||||
for (i=0;i<COLORS_NUM/2;i++) {
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$ ",i,i,"ST_COLORS",i);
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$\n",i,i,"ST_COLORS",
|
||||
ROPF_TWO_SIDED+i);
|
||||
}
|
||||
DocPrint(doc,
|
||||
"\n$$LTPURPLE$$Single-Sided Half-Range Double-Sided Half-Range\n$$BLACK$$");
|
||||
for (i=0;i<NUM_COLORS;i++) {
|
||||
for (i=0;i<COLORS_NUM;i++) {
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$ ",
|
||||
i,i,"ST_COLORS",ROPF_HALF_RANGE_COLOR+i);
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$\n",
|
||||
|
||||
+16
-11
@@ -1,5 +1,10 @@
|
||||
#help_index "DolDoc/Misc"
|
||||
|
||||
CColorROPU32 highlight_hash_type_colors[HTt_TYPES_NUM]=
|
||||
DOC_COLOR_EXPORT_SYS_SYM,0,DOC_COLOR_DEFINE_STR,DOC_COLOR_GLBL_VAR,
|
||||
DOC_COLOR_CLASS,DOC_COLOR_KEYWORD,DOC_COLOR_FUN,0,0,DOC_COLOR_KEYWORD,
|
||||
DOC_COLOR_KEYWORD,DOC_COLOR_KEYWORD,DOC_COLOR_REG,0,0,0,0};
|
||||
|
||||
U32 *DocHighlight(CDocEntry *doc_e,U8 *src,I64 len,I64 _tmp_u32_attr)
|
||||
{//Be aware of $LK,"::/Demo/ToHtmlToTXTDemo/ToHtml.HC"$.
|
||||
U32 *res=MAlloc((len+1)*sizeof(U32)),*dst=res;
|
||||
@@ -35,12 +40,12 @@ hl_normal:
|
||||
}
|
||||
break;
|
||||
case '\'':
|
||||
tmp_u32_attr=DOC_COLOR_QUOTE<<8|mask_tmp_u32_attr;
|
||||
tmp_u32_attr=DOC_COLOR_CHAR_CONST<<8|mask_tmp_u32_attr;
|
||||
*dst++=ch1+tmp_u32_attr;
|
||||
len--;
|
||||
goto hl_single_quote;
|
||||
case '\"':
|
||||
tmp_u32_attr=DOC_COLOR_QUOTE<<8|mask_tmp_u32_attr;
|
||||
tmp_u32_attr=DOC_COLOR_STR<<8|mask_tmp_u32_attr;
|
||||
*dst++=ch1+tmp_u32_attr;
|
||||
len--;
|
||||
goto hl_dbl_quote;
|
||||
@@ -71,13 +76,13 @@ hl_normal:
|
||||
}
|
||||
ch=*src;
|
||||
*src=0;
|
||||
if (tmph=HashFind(ptr,cmp.asm_hash,
|
||||
HTT_KEYWORD|HTT_ASM_KEYWORD|HTT_OPCODE|HTT_REG)) {
|
||||
if (tmph->type&(HTT_KEYWORD|HTT_ASM_KEYWORD|HTT_OPCODE))
|
||||
tmp_u32_attr=DOC_COLOR_KEYWORD<<8|mask_tmp_u32_attr;
|
||||
else
|
||||
tmp_u32_attr=DOC_COLOR_KEYWORD2<<8|mask_tmp_u32_attr;
|
||||
} else
|
||||
if (tmph=HashFind(ptr,adam_task->hash_table,
|
||||
HTT_EXPORT_SYS_SYM|HTT_DEFINE_STR|HTT_GLBL_VAR|HTT_CLASS|
|
||||
HTT_INTERNAL_TYPE|HTT_FUN|HTT_KEYWORD|HTT_ASM_KEYWORD|
|
||||
HTT_OPCODE|HTT_REG))
|
||||
tmp_u32_attr=highlight_hash_type_colors[HashTypeNum(tmph)]<<8|
|
||||
mask_tmp_u32_attr;
|
||||
else
|
||||
tmp_u32_attr=_tmp_u32_attr;
|
||||
while (ch1=*ptr++)
|
||||
*dst++=ch1+tmp_u32_attr;
|
||||
@@ -88,7 +93,7 @@ hl_normal_done:
|
||||
s->comment_depth=0;
|
||||
break;
|
||||
case DOCSS_SINGLE_QUOTE:
|
||||
tmp_u32_attr=DOC_COLOR_QUOTE<<8|mask_tmp_u32_attr;
|
||||
tmp_u32_attr=DOC_COLOR_CHAR_CONST<<8|mask_tmp_u32_attr;
|
||||
hl_single_quote:
|
||||
last_ch=0;
|
||||
while (len--) {
|
||||
@@ -105,7 +110,7 @@ hl_single_quote:
|
||||
s->comment_depth=0;
|
||||
break;
|
||||
case DOCSS_DBL_QUOTE:
|
||||
tmp_u32_attr=DOC_COLOR_QUOTE<<8|mask_tmp_u32_attr;
|
||||
tmp_u32_attr=DOC_COLOR_CHAR_CONST<<8|mask_tmp_u32_attr;
|
||||
hl_dbl_quote:
|
||||
last_ch=0;
|
||||
while (len--) {
|
||||
|
||||
@@ -42,11 +42,11 @@ U0 DocInit()
|
||||
}
|
||||
CmpCtrlDel(cc);
|
||||
|
||||
for (i=0;i<DOCT_NUM_TYPES;i++)
|
||||
for (i=0;i<DOCT_TYPES_NUM;i++)
|
||||
doldoc.dft_de_flags[i]&=~DOCG_BL_IV_UL;
|
||||
|
||||
doldoc.type_flags_form[0]=0;
|
||||
for (i=0;i<DOCT_NUM_TYPES;i++)
|
||||
for (i=0;i<DOCT_TYPES_NUM;i++)
|
||||
if (Bt(&doldoc.dft_de_flags[i],DOCEf_TAG) && i!=DOCT_TEXT || i==DOCT_HEX_ED)
|
||||
Bts(doldoc.type_flags_form,i);
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ I64 PopUpMacroMenu()
|
||||
"$$CM+LX,1,3$$$$BT,\"STOP\",LE=SM_STOP$$"
|
||||
"$$CM+LX,17,0$$$$BT,\"CANCEL\",LE=DOCM_CANCEL$$"
|
||||
"\n\n\n$$GREEN$$SHIFT-F2$$FG$$ will play macro.\n");
|
||||
doc->flags|=DOCF_MIN_SIZE | DOCF_FORM;
|
||||
doc->flags|=DOCF_SIZE_MIN | DOCF_FORM;
|
||||
StrPrint(buf,"DocMenu(%d);",doc);
|
||||
sys_macro_task=Spawn(&SrvCmdLine,NULL,"Macro Popup",,Fs);
|
||||
Fs->popup_task=sys_macro_task;
|
||||
|
||||
@@ -276,7 +276,7 @@ public U0 DocRst(CDoc *doc,Bool is_old)
|
||||
doc->dollar_buf_ptr=0;
|
||||
doc->cmd_U8=CH_SPACE;
|
||||
doc->page_line_num=0;
|
||||
doc->best_d=MAX_I64;
|
||||
doc->best_d=I64_MAX;
|
||||
|
||||
s=&doc->settings_head;
|
||||
s->left_margin=DOC_DFT;
|
||||
@@ -376,7 +376,7 @@ public CDoc *DocNew(U8 *filename=NULL,CTask *task=NULL)
|
||||
doc->left_click_link=&EdLeftClickLink;
|
||||
doc->dollar_buf_size=84;
|
||||
doc->dollar_buf=MAlloc(doc->dollar_buf_size,task);
|
||||
doc->max_entries=MAX_I64;
|
||||
doc->max_entries=I64_MAX;
|
||||
doc->win_task=task;
|
||||
doc->mem_task=task;
|
||||
DocRst(doc,FALSE);
|
||||
|
||||
@@ -47,7 +47,7 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||
U8 *buf,*buf2;
|
||||
|
||||
if (doc_e->type_u8==DOCT_FOREGROUND &&
|
||||
doc->flags&DOCF_COLOR_NAMES && 0<=attr<NUM_COLORS) {
|
||||
doc->flags&DOCF_COLOR_NAMES && 0<=attr<COLORS_NUM) {
|
||||
buf=StrNew(DefineSub(attr,"ST_COLORS"));
|
||||
attr=DOC_DFT;
|
||||
} else
|
||||
@@ -58,7 +58,7 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||
|
||||
de_flags=doc_e->de_flags&~(DOCG_BL_IV_UL|DOCEF_SEL|
|
||||
DOCEF_HIGHLIGHT|DOCEF_WORD_WRAP|DOCEF_SKIP|DOCEF_FILTER_SKIP);
|
||||
for (i=0;i<DOCEf_NUM_FLAGS;i++)
|
||||
for (i=0;i<DOCEf_FLAGS_NUM;i++)
|
||||
if (Bt(&f1,i)!=Bt(&de_flags,i)) {
|
||||
if (Bt(&de_flags,i)) {
|
||||
if (!(1<<i&DOCEG_HAS_ARG)) {
|
||||
@@ -92,7 +92,7 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||
case DOCT_BACKGROUND:
|
||||
case DOCT_DFT_FOREGROUND:
|
||||
case DOCT_DFT_BACKGROUND:
|
||||
if (doc->flags&DOCF_COLOR_NAMES && 0<=attr<NUM_COLORS) {
|
||||
if (doc->flags&DOCF_COLOR_NAMES && 0<=attr<COLORS_NUM) {
|
||||
buf2=MStrPrint("%s%Z,",buf,doc_e->attr,"ST_COLORS");
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
@@ -114,7 +114,7 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||
buf2=MStrPrint("%s%d,",buf,doc_e->attr);
|
||||
Free(buf); buf=buf2;
|
||||
}
|
||||
case DOCT_NUM_TYPES-1: //nobound switch
|
||||
case DOCT_TYPES_NUM-1: //nobound switch
|
||||
break;
|
||||
}
|
||||
de_flags=doc_e->de_flags & DOCEG_HAS_ARG;
|
||||
@@ -202,7 +202,7 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||
case DOCEf_USER_DATA:
|
||||
buf2=MStrPrint("%sU=0x%X,",buf,doc_e->user_data);
|
||||
break;
|
||||
case DOCEf_NUM_FLAGS-1: //nobound switch
|
||||
case DOCEf_FLAGS_NUM-1: //nobound switch
|
||||
break;
|
||||
}
|
||||
Free(buf); buf=buf2;
|
||||
@@ -285,7 +285,7 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
else
|
||||
doc_e->attr=attr;
|
||||
break;
|
||||
#assert DOCT_ERROR==DOCT_NUM_TYPES-1
|
||||
#assert DOCT_ERROR==DOCT_TYPES_NUM-1
|
||||
case DOCT_ERROR:
|
||||
goto pd_err;
|
||||
}
|
||||
@@ -460,7 +460,7 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_NUM_FLAGS-1: //nobound switch
|
||||
case DOCEf_FLAGS_NUM-1: //nobound switch
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public U8 *FileNameForm(U8 *dft=NULL,I64 dof_flags=0,CTask *mem_task=NULL)
|
||||
public U8 *PopUpFileName(U8 *dft=NULL,I64 dof_flags=0)
|
||||
{//Filename chooser. Uses form, not $LK,"FileMgr",A="MN:FileMgr"$().
|
||||
U8 *st=MStrPrint("FileNameForm(\"%Q\",0x%X,Fs->parent_task);",
|
||||
dft,dof_flags|DOF_MIN_SIZE),*res=PopUp(st,Fs);
|
||||
dft,dof_flags|DOF_SIZE_MIN),*res=PopUp(st,Fs);
|
||||
Free(st);
|
||||
return res;
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public U8 *PopUpGetStr(U8 *header=NULL)
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 PopUpGetI64(U8 *msg,I64 dft,I64 lo=MIN_I64,I64 hi=MAX_I64)
|
||||
public I64 PopUpGetI64(U8 *msg,I64 dft,I64 lo=I64_MIN,I64 hi=I64_MAX)
|
||||
{//Prompt for I64 text expression in PopUp win task.
|
||||
U8 *st=MStrPrint("GetI64(0x%X,0x%X,0x%X,0x%X);",msg,dft,lo,hi);
|
||||
I64 res=PopUp(st,Fs);
|
||||
@@ -192,7 +192,7 @@ public I64 PopUpGetI64(U8 *msg,I64 dft,I64 lo=MIN_I64,I64 hi=MAX_I64)
|
||||
return res;
|
||||
}
|
||||
|
||||
public F64 PopUpGetF64(U8 *msg,F64 dft,F64 lo=MIN_F64,F64 hi=MAX_F64)
|
||||
public F64 PopUpGetF64(U8 *msg,F64 dft,F64 lo=F64_MIN,F64 hi=F64_MAX)
|
||||
{//Prompt for F64 text expression in PopUp win task.
|
||||
U8 *st=MStrPrint("GetF64(0x%X,0x%X(F64),0x%X(F64),0x%X(F64));",msg,dft,lo,hi);
|
||||
F64 res=PopUp(st,Fs)(F64);
|
||||
|
||||
@@ -255,9 +255,9 @@ I64 DocTmpAttr(CDoc *doc,CDocEntry *doc_e,I64 cur_u8_attr)
|
||||
|
||||
public Bool DocRecalc(CDoc *doc,I64 recalc_flags=RECALCt_NORMAL)
|
||||
{//Recalc and fmt. Also used by WinMgr to draw on scrn.
|
||||
I64 i,ii,j,k,x,x0,y,y0,D,d2,col,col2,best_col=0,best_d=MAX_I64,xx,yy,zz,
|
||||
I64 i,ii,j,k,x,x0,y,y0,D,d2,col,col2,best_col=0,best_d=I64_MAX,xx,yy,zz,
|
||||
num_entries=0,i_jif,cur_u8_attr,tmp_u32_attr,
|
||||
cursor_y=MIN_I64,left_margin,right_margin,y_plot_top,y_plot_bottom,
|
||||
cursor_y=I64_MIN,left_margin,right_margin,y_plot_top,y_plot_bottom,
|
||||
top,left,bottom,right,width,height,scroll_x,scroll_y,pix_top,pix_left;
|
||||
CDocEntry reg *doc_e,reg *doc_e2,*best_doc_e,*next_clear_found=NULL,
|
||||
*added_cursor=NULL;
|
||||
@@ -422,8 +422,8 @@ public Bool DocRecalc(CDoc *doc,I64 recalc_flags=RECALCt_NORMAL)
|
||||
skipped_update= doc_e==doc && doc->head.next!=doc;
|
||||
|
||||
if (full_refresh) {
|
||||
doc->min_x=MAX_I32; doc->min_y=MAX_I32;
|
||||
doc->max_x=MIN_I32; doc->max_y=MIN_I32;
|
||||
doc->min_x=I32_MAX; doc->min_y=I32_MAX;
|
||||
doc->max_x=I32_MIN; doc->max_y=I32_MIN;
|
||||
}
|
||||
while (doc_e!=doc) {
|
||||
while (TRUE) {
|
||||
@@ -967,7 +967,7 @@ rc_adjust_xy:
|
||||
dc->flags|=DCF_DONT_DRAW;
|
||||
bptr=tmpb->data;
|
||||
ii=SpriteTypeMask(bptr);
|
||||
if (ii&1<<SPT_NUM_TYPES) {
|
||||
if (ii&1<<SPT_TYPES_NUM) {
|
||||
bptr=gr.empty_sprite;
|
||||
ii=SpriteTypeMask(bptr);
|
||||
}
|
||||
@@ -1042,7 +1042,7 @@ rc_adjust_xy:
|
||||
doc_e->de_flags&DOCEF_TAG && doc_e->tag)
|
||||
x-=StrLen(doc_e->tag);
|
||||
break;
|
||||
case DOCT_NUM_TYPES-1: //nobound switch
|
||||
case DOCT_TYPES_NUM-1: //nobound switch
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1178,7 +1178,7 @@ rc_skip:
|
||||
}
|
||||
}
|
||||
}
|
||||
if (doc->flags & DOCF_MIN_SIZE) {
|
||||
if (doc->flags & DOCF_SIZE_MIN) {
|
||||
if (Bt(&win_task->display_flags,DISPLAYf_NO_BORDER)) {
|
||||
if (left<0)
|
||||
left=0;
|
||||
|
||||
@@ -173,7 +173,7 @@ public U0 DocCollapse(Bool collapse=TRUE,CDoc *doc=NULL)
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Cmd Line (Typically);Cmd Line (Typically)"
|
||||
public I64 DocMax(I64 i=MAX_I64)
|
||||
public I64 DocMax(I64 i=I64_MAX)
|
||||
{//Set max document entries. (Cmd line buffer size.)
|
||||
//Adjusts the size of the cmd line buf.
|
||||
//Normally, the cmd line deletes entries
|
||||
|
||||
@@ -60,7 +60,7 @@ ft_done:
|
||||
|
||||
public Bool DocTreeMake(CDoc *doc,U8 *path)
|
||||
{//Make registry-like tree widget.
|
||||
I64 i=0,j=MIN_I64,k=0;
|
||||
I64 i=0,j=I64_MIN,k=0;
|
||||
U8 *st1=StrNew(path),
|
||||
*st2=MAlloc(StrLen(path)+1),
|
||||
*st3=StrNew(path);
|
||||
|
||||
@@ -21,13 +21,13 @@ See $LK,"::/Doc/DolDocOverview.DD"$
|
||||
public class CDolDocGlbls
|
||||
{
|
||||
CHashTable *hash;
|
||||
I64 dft_de_flags [DOCT_NUM_TYPES],
|
||||
type_flags_nontag_invis [(DOCT_NUM_TYPES+63)/64],
|
||||
type_flags_form [(DOCT_NUM_TYPES+63)/64],
|
||||
type_flags_data [(DOCT_NUM_TYPES+63)/64],
|
||||
type_flags_chk_dup [(DOCT_NUM_TYPES+63)/64],
|
||||
I64 dft_de_flags [DOCT_TYPES_NUM],
|
||||
type_flags_nontag_invis [(DOCT_TYPES_NUM+63)/64],
|
||||
type_flags_form [(DOCT_TYPES_NUM+63)/64],
|
||||
type_flags_data [(DOCT_TYPES_NUM+63)/64],
|
||||
type_flags_chk_dup [(DOCT_TYPES_NUM+63)/64],
|
||||
clean_scan_codes [4];
|
||||
I32 dft_type_flags [DOCT_NUM_TYPES];
|
||||
I32 dft_type_flags [DOCT_TYPES_NUM];
|
||||
} doldoc;
|
||||
MemSet(&doldoc,0,sizeof(CDolDocGlbls));
|
||||
|
||||
|
||||
+1
-1
@@ -19,8 +19,8 @@ MemSet(&god,0,sizeof(CGodGlbls));
|
||||
god.doodle_fifo =FifoU8New(2048*8);
|
||||
god.fifo =FifoU8New(2048*8);
|
||||
|
||||
extern U0 GodBiblePassage(I64 num_lines=20);
|
||||
extern U0 GodBitsIns(I64 num_bits,I64 n);
|
||||
extern U0 GodDoodle(U8 *hex=NULL);
|
||||
extern U0 GodBiblePassage(I64 num_lines=20);
|
||||
extern U0 GodSong();
|
||||
extern U0 GodWord(I64 bits=17,Bool show_num=FALSE);
|
||||
+1
-1
@@ -147,7 +147,7 @@ public class CSpritePtMeshU8s : CSpriteBase
|
||||
#define SPT_TEXT 27 //$LK,"CSpritePtStr",A="MN:CSpritePtStr"$
|
||||
#define SPT_TEXT_BOX 28 //$LK,"CSpritePtStr",A="MN:CSpritePtStr"$
|
||||
#define SPT_TEXT_DIAMOND 29 //$LK,"CSpritePtStr",A="MN:CSpritePtStr"$
|
||||
#define SPT_NUM_TYPES 30
|
||||
#define SPT_TYPES_NUM 30
|
||||
#define SPG_TYPE_MASK 0x7F
|
||||
|
||||
#help_index "Graphics/Sprite;Sprites;Sprites/Binary"
|
||||
|
||||
@@ -178,7 +178,7 @@ public Bool GrTextBox3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
|
||||
return ToBool(res);
|
||||
}
|
||||
|
||||
#define MAX_DIAMOND_SLOPE 2.75
|
||||
#define DIAMOND_SLOPE_MAX 2.75
|
||||
|
||||
public Bool GrTextDiamond3(CDC *dc=gr.dc,
|
||||
I64 x1,I64 y1,I64 z1,U8 *_s,I64 border=2)
|
||||
@@ -223,12 +223,12 @@ public Bool GrTextDiamond3(CDC *dc=gr.dc,
|
||||
do {
|
||||
dx_old=dx; dy_old=dy;
|
||||
m=ToF64(dx)/dy;
|
||||
if (m<1/MAX_DIAMOND_SLOPE) {
|
||||
dy=MaxI64(dy,Ceil(MAX_DIAMOND_SLOPE*dx));
|
||||
m=1/MAX_DIAMOND_SLOPE;
|
||||
} else if (m>MAX_DIAMOND_SLOPE) {
|
||||
dy=MaxI64(dy,Ceil(dx/MAX_DIAMOND_SLOPE));
|
||||
m=MAX_DIAMOND_SLOPE;
|
||||
if (m<1/DIAMOND_SLOPE_MAX) {
|
||||
dy=MaxI64(dy,Ceil(DIAMOND_SLOPE_MAX*dx));
|
||||
m=1/DIAMOND_SLOPE_MAX;
|
||||
} else if (m>DIAMOND_SLOPE_MAX) {
|
||||
dy=MaxI64(dy,Ceil(dx/DIAMOND_SLOPE_MAX));
|
||||
m=DIAMOND_SLOPE_MAX;
|
||||
}
|
||||
dx=MaxI64(dx,w+Ceil(m*AbsI64(y-y1)));
|
||||
dx=MaxI64(dx,w+Ceil(m*AbsI64(y+FONT_HEIGHT-y1)));
|
||||
|
||||
+15
-15
@@ -149,7 +149,7 @@ public U0 DCRst(CDC *dc)
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
dc->r_norm=GR_SCALE;
|
||||
dc->flags&=~(DCF_SYMMETRY|DCF_TRANSFORMATION|DCF_JUST_MIRROR);
|
||||
MemCpy(dc->palette,gr_palette_std,sizeof(CBGR48)*NUM_COLORS);
|
||||
MemCpy(dc->palette,gr_palette_std,sizeof(CBGR48)*COLORS_NUM);
|
||||
}
|
||||
|
||||
public U0 DCExtentsInit(CDC *dc=NULL)
|
||||
@@ -159,10 +159,10 @@ public U0 DCExtentsInit(CDC *dc=NULL)
|
||||
//You should clear the record flag yourself
|
||||
if (!dc) dc=gr.dc;
|
||||
dc->flags|=DCF_RECORD_EXTENTS;
|
||||
dc->min_x=MAX_I64;
|
||||
dc->max_x=MIN_I64;
|
||||
dc->min_y=MAX_I64;
|
||||
dc->max_y=MIN_I64;
|
||||
dc->min_x=I64_MAX;
|
||||
dc->max_x=I64_MIN;
|
||||
dc->min_y=I64_MAX;
|
||||
dc->max_y=I64_MIN;
|
||||
}
|
||||
|
||||
public CDC *DCAlias(CDC *dc=NULL,CTask *task=NULL)
|
||||
@@ -229,7 +229,7 @@ public I64 DCSize(CDC *dc)
|
||||
public I32 *DCDepthBufRst(CDC *dc)
|
||||
{//Reset device context depth buf to far away.
|
||||
if (dc->depth_buf)
|
||||
MemSetU32(dc->depth_buf,MAX_I32,dc->width_internal*dc->height);
|
||||
MemSetU32(dc->depth_buf,I32_MAX,dc->width_internal*dc->height);
|
||||
return dc->depth_buf;
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ public U8 *DCSave(CDC *dc,I64 *_size=NULL,I64 dcsf_flags=DCSF_COMPRESSED)
|
||||
U8 *res,*ptr,*body;
|
||||
CArcCompress *arc;
|
||||
I64 body_size=dc->width_internal*dc->height,total_size,flags;
|
||||
CBGR48 palette[NUM_COLORS];
|
||||
CBGR48 palette[COLORS_NUM];
|
||||
|
||||
if (dcsf_flags&DCSF_COMPRESSED) {
|
||||
arc=CompressBuf(dc->body,body_size);
|
||||
@@ -308,10 +308,10 @@ public U8 *DCSave(CDC *dc,I64 *_size=NULL,I64 dcsf_flags=DCSF_COMPRESSED)
|
||||
if (dcsf_flags&DCSF_PALETTE_GET)
|
||||
GrPaletteGet(palette);
|
||||
else
|
||||
MemCpy(palette,&dc->palette,NUM_COLORS*sizeof(CBGR48));
|
||||
if (MemCmp(palette,gr_palette_std,NUM_COLORS*sizeof(CBGR48))) {
|
||||
MemCpy(palette,&dc->palette,COLORS_NUM*sizeof(CBGR48));
|
||||
if (MemCmp(palette,gr_palette_std,COLORS_NUM*sizeof(CBGR48))) {
|
||||
flags|=DCF_PALETTE;
|
||||
total_size+=NUM_COLORS*sizeof(CBGR48);
|
||||
total_size+=COLORS_NUM*sizeof(CBGR48);
|
||||
}
|
||||
|
||||
ptr=res=MAlloc(total_size);
|
||||
@@ -323,8 +323,8 @@ public U8 *DCSave(CDC *dc,I64 *_size=NULL,I64 dcsf_flags=DCSF_COMPRESSED)
|
||||
|
||||
#assert offset(CDC.end)==offset(CDC.palette)
|
||||
if (flags&DCF_PALETTE) {
|
||||
MemCpy(ptr,palette,NUM_COLORS*sizeof(CBGR48));
|
||||
ptr+=NUM_COLORS*sizeof(CBGR48);
|
||||
MemCpy(ptr,palette,COLORS_NUM*sizeof(CBGR48));
|
||||
ptr+=COLORS_NUM*sizeof(CBGR48);
|
||||
}
|
||||
|
||||
MemCpy(ptr,body,body_size);
|
||||
@@ -349,10 +349,10 @@ public CDC *DCLoad(U8 *src,I64 *_size=NULL,CTask *task=NULL)
|
||||
ptr+=offset(CDC.end)-offset(CDC.start);
|
||||
|
||||
if (res->flags&DCF_PALETTE) {
|
||||
MemCpy(&res->palette,ptr,NUM_COLORS*sizeof(CBGR48));
|
||||
ptr+=NUM_COLORS*sizeof(CBGR48);
|
||||
MemCpy(&res->palette,ptr,COLORS_NUM*sizeof(CBGR48));
|
||||
ptr+=COLORS_NUM*sizeof(CBGR48);
|
||||
} else
|
||||
MemCpy(&res->palette,gr_palette_std,NUM_COLORS*sizeof(CBGR48));
|
||||
MemCpy(&res->palette,gr_palette_std,COLORS_NUM*sizeof(CBGR48));
|
||||
|
||||
body_size=res->width_internal*res->height;
|
||||
if (res->flags&DCF_COMPRESSED) {
|
||||
|
||||
+9
-9
@@ -25,16 +25,16 @@ public class CGrGlbls
|
||||
U0 (*fp_draw_grab_ms)(CDC *dc,I64 x,I64 y,Bool closed);
|
||||
U8 *empty_sprite; //Gets assigned $LK,"gr.empty_sprite",A="FF:::/Adam/AMouse.HC,empty_sprite"$
|
||||
|
||||
#define GR_NUM_PEN_BRUSHES 64
|
||||
CDC *pen_brushes[GR_NUM_PEN_BRUSHES],
|
||||
*collision_pen_brushes[GR_NUM_PEN_BRUSHES],
|
||||
*even_pen_brushes[GR_NUM_PEN_BRUSHES],
|
||||
*odd_pen_brushes[GR_NUM_PEN_BRUSHES];
|
||||
I8 circle_lo[GR_NUM_PEN_BRUSHES][GR_NUM_PEN_BRUSHES],
|
||||
circle_hi[GR_NUM_PEN_BRUSHES][GR_NUM_PEN_BRUSHES];
|
||||
#define GR_PEN_BRUSHES_NUM 64
|
||||
CDC *pen_brushes[GR_PEN_BRUSHES_NUM],
|
||||
*collision_pen_brushes[GR_PEN_BRUSHES_NUM],
|
||||
*even_pen_brushes[GR_PEN_BRUSHES_NUM],
|
||||
*odd_pen_brushes[GR_PEN_BRUSHES_NUM];
|
||||
I8 circle_lo[GR_PEN_BRUSHES_NUM][GR_PEN_BRUSHES_NUM],
|
||||
circle_hi[GR_PEN_BRUSHES_NUM][GR_PEN_BRUSHES_NUM];
|
||||
|
||||
#define GR_MAX_SCRN_ZOOM 8
|
||||
U8 *scrn_zoom_tables[GR_MAX_SCRN_ZOOM+1];
|
||||
#define GR_SCRN_ZOOM_MAX 8
|
||||
U8 *scrn_zoom_tables[GR_SCRN_ZOOM_MAX+1];
|
||||
I64 scrn_zoom,sx,sy;
|
||||
|
||||
//When zoomed, this keeps the mouse centered.
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ U0 GrSetUpTables()
|
||||
for (j=0;j<8;j++)
|
||||
gr.to_8_colors(U8 *)[k++]=i;
|
||||
|
||||
for (i=0;i<GR_NUM_PEN_BRUSHES;i++) {
|
||||
for (i=0;i<GR_PEN_BRUSHES_NUM;i++) {
|
||||
k=i+1;
|
||||
|
||||
rr=k*k;
|
||||
@@ -77,7 +77,7 @@ U0 GrSetUpTables()
|
||||
// MemSet(text.vga_alias,0,GR_HEIGHT*GR_WIDTH>>3);
|
||||
MemSet(gr.scrn_image->body,0,GR_WIDTH*GR_HEIGHT>>1);
|
||||
}
|
||||
for (i=1;i<=GR_MAX_SCRN_ZOOM;i++) {
|
||||
for (i=1;i<=GR_SCRN_ZOOM_MAX;i++) {
|
||||
dst=gr.scrn_zoom_tables[i]=MAlloc(256*i);
|
||||
for (j=0;j<256;j++) {
|
||||
m=0;
|
||||
|
||||
@@ -16,7 +16,7 @@ U0 GrPaletteIndicesSet()
|
||||
while (LBts(&sys_semas[SEMA_VGA],0))
|
||||
Yield;
|
||||
InU8(VGAP_INPUT_STAT); //Rsts attr index/data
|
||||
for (i=0;i<NUM_COLORS;i++) {
|
||||
for (i=0;i<COLORS_NUM;i++) {
|
||||
OutU8(VGAP_ATTR_INDEX,i);
|
||||
OutU8(VGAP_ATTR_DATA_WRITE,i);
|
||||
}
|
||||
@@ -61,13 +61,13 @@ public CBGR48 GrPaletteColorGet(I64 color_num)
|
||||
return res;
|
||||
}
|
||||
|
||||
public CBGR48 gr_palette_std[NUM_COLORS]={
|
||||
public CBGR48 gr_palette_std[COLORS_NUM]={
|
||||
0x000000000000,0x00000000AAAA,0x0000AAAA0000,0x0000AAAAAAAA,
|
||||
0xAAAA00000000,0xAAAA0000AAAA,0xAAAA55550000,0xAAAAAAAAAAAA,
|
||||
0x555555555555,0x55555555FFFF,0x5555FFFF5555,0x5555FFFFFFFF,
|
||||
0xFFFF55555555,0xFFFF5555FFFF,0xFFFFFFFF5555,0xFFFFFFFFFFFF};
|
||||
|
||||
public CBGR48 gr_palette_gray[NUM_COLORS]={
|
||||
public CBGR48 gr_palette_gray[COLORS_NUM]={
|
||||
0x000000000000,0x111111111111,0x222222222222,0x333333333333,
|
||||
0x444444444444,0x555555555555,0x666666666666,0x777777777777,
|
||||
0x888888888888,0x999999999999,0xAAAAAAAAAAAA,0xBBBBBBBBBBBB,
|
||||
@@ -76,14 +76,14 @@ public CBGR48 gr_palette_gray[NUM_COLORS]={
|
||||
public U0 GrPaletteGet(CBGR48 *bgr48)
|
||||
{//16 colors
|
||||
I64 i;
|
||||
for (i=0;i<NUM_COLORS;i++)
|
||||
for (i=0;i<COLORS_NUM;i++)
|
||||
bgr48[i]=GrPaletteColorGet(i);
|
||||
}
|
||||
|
||||
public U0 GrPaletteSet(CBGR48 *bgr48)
|
||||
{//16 colors
|
||||
I64 i;
|
||||
for (i=0;i<NUM_COLORS;i++)
|
||||
for (i=0;i<COLORS_NUM;i++)
|
||||
GrPaletteColorSet(i,bgr48[i]);
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -280,7 +280,7 @@ I64 GrFillSemiCircle(CDC *dc=gr.dc,I64 cx,I64 cy,I64 z=0,I64 diameter,I64 n)
|
||||
if (diameter>=1)
|
||||
switch (n) {
|
||||
case 0:
|
||||
if (diameter<GR_NUM_PEN_BRUSHES)
|
||||
if (diameter<GR_PEN_BRUSHES_NUM)
|
||||
for (i=0;i<r;i++)
|
||||
res+=GrHLine(dc,gr.circle_lo[diameter][i]+cx,
|
||||
gr.circle_hi[diameter][i]+cx,cy+i-r,z,z);
|
||||
@@ -293,7 +293,7 @@ I64 GrFillSemiCircle(CDC *dc=gr.dc,I64 cx,I64 cy,I64 z=0,I64 diameter,I64 n)
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (diameter<GR_NUM_PEN_BRUSHES)
|
||||
if (diameter<GR_PEN_BRUSHES_NUM)
|
||||
for (i=r+1;i<diameter;i++)
|
||||
res+=GrHLine(dc,gr.circle_lo[diameter][i]+cx,
|
||||
gr.circle_hi[diameter][i]+cx,cy+i-r,z,z);
|
||||
@@ -306,7 +306,7 @@ I64 GrFillSemiCircle(CDC *dc=gr.dc,I64 cx,I64 cy,I64 z=0,I64 diameter,I64 n)
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (diameter<GR_NUM_PEN_BRUSHES)
|
||||
if (diameter<GR_PEN_BRUSHES_NUM)
|
||||
for (i=0;i<r;i++)
|
||||
res+=GrVLine(dc,cx+i-r,gr.circle_lo[diameter][i]+cy,
|
||||
gr.circle_hi[diameter][i]+cy,z,z);
|
||||
@@ -319,7 +319,7 @@ I64 GrFillSemiCircle(CDC *dc=gr.dc,I64 cx,I64 cy,I64 z=0,I64 diameter,I64 n)
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (diameter<GR_NUM_PEN_BRUSHES)
|
||||
if (diameter<GR_PEN_BRUSHES_NUM)
|
||||
for (i=r+1;i<diameter;i++)
|
||||
res+=GrVLine(dc,cx+i-r,gr.circle_lo[diameter][i]+cy,
|
||||
gr.circle_hi[diameter][i]+cy,z,z);
|
||||
@@ -332,7 +332,7 @@ I64 GrFillSemiCircle(CDC *dc=gr.dc,I64 cx,I64 cy,I64 z=0,I64 diameter,I64 n)
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (diameter<GR_NUM_PEN_BRUSHES)
|
||||
if (diameter<GR_PEN_BRUSHES_NUM)
|
||||
for (i=0;i<r;i++)
|
||||
res+=GrHLine(dc,gr.circle_lo[diameter][i]+cx,
|
||||
gr.circle_hi[diameter][i]+cx,cy+i-r,z,z);
|
||||
@@ -345,7 +345,7 @@ I64 GrFillSemiCircle(CDC *dc=gr.dc,I64 cx,I64 cy,I64 z=0,I64 diameter,I64 n)
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (diameter<GR_NUM_PEN_BRUSHES)
|
||||
if (diameter<GR_PEN_BRUSHES_NUM)
|
||||
for (i=r+1;i<diameter;i++)
|
||||
res+=GrHLine(dc,gr.circle_lo[diameter][i]+cx,
|
||||
gr.circle_hi[diameter][i]+cx,cy+i-r,z,z);
|
||||
@@ -358,7 +358,7 @@ I64 GrFillSemiCircle(CDC *dc=gr.dc,I64 cx,I64 cy,I64 z=0,I64 diameter,I64 n)
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (diameter<GR_NUM_PEN_BRUSHES)
|
||||
if (diameter<GR_PEN_BRUSHES_NUM)
|
||||
for (i=0;i<r;i++)
|
||||
res+=GrVLine(dc,cx+i-r,gr.circle_lo[diameter][i]+cy,
|
||||
gr.circle_hi[diameter][i]+cy,z,z);
|
||||
@@ -371,7 +371,7 @@ I64 GrFillSemiCircle(CDC *dc=gr.dc,I64 cx,I64 cy,I64 z=0,I64 diameter,I64 n)
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if (diameter<GR_NUM_PEN_BRUSHES)
|
||||
if (diameter<GR_PEN_BRUSHES_NUM)
|
||||
for (i=r+1;i<diameter;i++)
|
||||
res+=GrVLine(dc,cx+i-r,gr.circle_lo[diameter][i]+cy,
|
||||
gr.circle_hi[diameter][i]+cy,z,z);
|
||||
@@ -391,7 +391,7 @@ public I64 GrFillCircle(CDC *dc=gr.dc,I64 cx,I64 cy,I64 z=0,I64 diameter)
|
||||
{//2D. Clipping but not transformation.
|
||||
I64 res=0,i,k,r=diameter>>1,rr;
|
||||
if (diameter>=1) {
|
||||
if (diameter<GR_NUM_PEN_BRUSHES)
|
||||
if (diameter<GR_PEN_BRUSHES_NUM)
|
||||
for (i=0;i<diameter;i++)
|
||||
res+=GrHLine(dc,gr.circle_lo[diameter][i]+cx,
|
||||
gr.circle_hi[diameter][i]+cx,cy+i-r,z,z);
|
||||
@@ -462,7 +462,7 @@ public Bool GrPlot3(CDC *dc=gr.dc,I64 x,I64 y,I64 z)
|
||||
dc->db_z=z;
|
||||
if (dc->brush || w<=0)
|
||||
GrPlot1(dc,x,y);
|
||||
else if (dc->pen_width<GR_NUM_PEN_BRUSHES) {
|
||||
else if (dc->pen_width<GR_PEN_BRUSHES_NUM) {
|
||||
if (dc->color.c0.rop!=ROPB_COLLISION)
|
||||
dc->color.c0.rop=ROPB_MONO;
|
||||
if (dc->depth_buf) {
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ U0 GrUpdateTasks()
|
||||
|
||||
U0 GrFixZoomScale()
|
||||
{
|
||||
gr.scrn_zoom=ClampI64(gr.scrn_zoom,1,GR_MAX_SCRN_ZOOM);
|
||||
gr.scrn_zoom=ClampI64(gr.scrn_zoom,1,GR_SCRN_ZOOM_MAX);
|
||||
if (gr.scrn_zoom==1) {
|
||||
gr.sx=0;
|
||||
gr.sy=0;
|
||||
|
||||
@@ -28,7 +28,7 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,
|
||||
CGrSym old_sym;
|
||||
MemCpy(&old_sym,&dc->sym,sizeof(CGrSym));
|
||||
if (dc->flags & DCF_LOCATE_NEAREST)
|
||||
dc->nearest_dist=MAX_I64;
|
||||
dc->nearest_dist=I64_MAX;
|
||||
while (tmpg->type&SPG_TYPE_MASK) {
|
||||
switch (tmpg->type&SPG_TYPE_MASK) {
|
||||
case SPT_COLOR:
|
||||
@@ -293,16 +293,16 @@ public U0 Sprite3ZB(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,F64
|
||||
public U0 SpriteExtents(U8 *elems,I64 *min_x=NULL,I64 *max_x=NULL,
|
||||
I64 *min_y=NULL,I64 *max_y=NULL)
|
||||
{//Ignores flood fills.
|
||||
CDC *dc=DCNew(MAX_I32,MAX_I32,Fs,TRUE);
|
||||
CDC *dc=DCNew(I32_MAX,I32_MAX,Fs,TRUE);
|
||||
DCExtentsInit(dc);
|
||||
Sprite3(dc,MAX_I32/2,MAX_I32/2,MAX_I32/2,elems);
|
||||
Sprite3(dc,I32_MAX/2,I32_MAX/2,I32_MAX/2,elems);
|
||||
if (dc->min_x<=dc->max_x) {
|
||||
dc->min_x-=MAX_I32/2;
|
||||
dc->max_x-=MAX_I32/2;
|
||||
dc->min_x-=I32_MAX/2;
|
||||
dc->max_x-=I32_MAX/2;
|
||||
}
|
||||
if (dc->min_y<=dc->max_y) {
|
||||
dc->min_y-=MAX_I32/2;
|
||||
dc->max_y-=MAX_I32/2;
|
||||
dc->min_y-=I32_MAX/2;
|
||||
dc->max_y-=I32_MAX/2;
|
||||
}
|
||||
if (min_x) *min_x=dc->min_x;
|
||||
if (max_x) *max_x=dc->max_x;
|
||||
|
||||
+2
-2
@@ -661,7 +661,7 @@ U0 SpriteSideBarTask(CTask *parent,CSprite **_head,I64 *_cur_elem_num)
|
||||
CDocEntry *doc_e;
|
||||
CDoc *doc=DocPut;
|
||||
Spawn(&SpriteSideBarTask2,parent,"CSpriteTask",,Fs);
|
||||
doc->flags|=DOCF_MIN_SIZE|DOCF_FORM;
|
||||
doc->flags|=DOCF_SIZE_MIN|DOCF_FORM;
|
||||
while (TRUE) {
|
||||
SpriteSideBarPickNew(doc,*_head,*_cur_elem_num);
|
||||
DocHighlightCursor(,doc);
|
||||
@@ -977,7 +977,7 @@ Bool SpriteSelUnselShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
||||
case SPED_UNSEL:
|
||||
case SPED_SHIFT_PTS:
|
||||
xx=arg1; yy=arg2;
|
||||
best_dd=MAX_I64;
|
||||
best_dd=I64_MAX;
|
||||
tmpes=head.next;
|
||||
while (tmpes!=&head) {
|
||||
switch (tmpes->type) {
|
||||
|
||||
@@ -76,7 +76,7 @@ CMeshEdTri *MeshTriNew(CMeshFrame *e,CColorROPU32 color,
|
||||
CMeshEdVertex *MeshVertexFindScrPt(CMeshFrame *e,I64 x,I64 y)
|
||||
{//Scrn coordinates
|
||||
CMeshEdVertex *res=NULL,*tmpv=e->vertex_head.next;
|
||||
I64 dd,dz,best_dd=MAX_I64,best_dz=MAX_I64;
|
||||
I64 dd,dz,best_dd=I64_MAX,best_dz=I64_MAX;
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
if (!(tmpv->flags&VF_IGNORE)) {
|
||||
dd=SqrI64(x-tmpv->pt.x)+SqrI64(y-tmpv->pt.y);
|
||||
@@ -1358,7 +1358,7 @@ me_clipboard_cut:
|
||||
p0b.y=ms.presnap.y;
|
||||
p0b.z=e.ms_z;
|
||||
adjusting_z=TRUE;
|
||||
Snd(ClampI64(Freq2Ona(3*e.ms_z+1500),0,MAX_I8));
|
||||
Snd(ClampI64(Freq2Ona(3*e.ms_z+1500),0,I8_MAX));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1432,7 +1432,7 @@ me_clipboard_cut:
|
||||
p0b.y=ms.presnap.y;
|
||||
p0b.z=e.ms_z;
|
||||
adjusting_z=TRUE;
|
||||
Snd(ClampI64(Freq2Ona(3*e.ms_z+1500),0,MAX_I8));
|
||||
Snd(ClampI64(Freq2Ona(3*e.ms_z+1500),0,I8_MAX));
|
||||
}
|
||||
break;
|
||||
case MSG_MS_R_UP:
|
||||
@@ -1472,7 +1472,7 @@ me_clipboard_cut:
|
||||
e.ms_z=RoundI64(Sign(p0b.y-ms.presnap.y)
|
||||
*Sqrt(Sqr(p0b.x-ms.presnap.x)+Sqr(p0b.y-ms.presnap.y))
|
||||
+p0b.z,e.cur_snap);
|
||||
Snd(ClampI64(Freq2Ona(3*e.ms_z+1500),0,MAX_I8));
|
||||
Snd(ClampI64(Freq2Ona(3*e.ms_z+1500),0,I8_MAX));
|
||||
}
|
||||
if (moving) {
|
||||
MeshCursorW(&e,Fs,&x,&y,&z);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
U8 polypt_map[9]={0,1,2,3,0,4,5,6,7};
|
||||
|
||||
I64 sprite_elem_base_sizes[SPT_NUM_TYPES]={
|
||||
I64 sprite_elem_base_sizes[SPT_TYPES_NUM]={
|
||||
sizeof(CSpriteBase), //SPT_END
|
||||
sizeof(CSpriteColor), //SPT_COLOR
|
||||
sizeof(CSpriteDitherColor), //SPT_DITHER_COLOR
|
||||
@@ -90,8 +90,8 @@ I64 SpriteTypeMask(U8 *elems)
|
||||
I64 res=0;
|
||||
CSprite *tmpg=elems-offset(CSprite.start);
|
||||
while (tmpg->type&SPG_TYPE_MASK) {
|
||||
if (tmpg->type&SPG_TYPE_MASK>=SPT_NUM_TYPES)
|
||||
return 1<<SPT_NUM_TYPES;
|
||||
if (tmpg->type&SPG_TYPE_MASK>=SPT_TYPES_NUM)
|
||||
return 1<<SPT_TYPES_NUM;
|
||||
Bts(&res,tmpg->type&SPG_TYPE_MASK);
|
||||
tmpg(U8 *)+=SpriteElemSize(tmpg);
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ public Bool HostChgDsk(U8 *iso_filename)
|
||||
WinBorder;
|
||||
WinMax;
|
||||
DocClear;
|
||||
"$$PURPLE$$$$TX+CX,\"Change CD/DVD\"$$$$FG$$\n\n\n\n";
|
||||
"$$PURPLE$$$$TX+CX,\"Set to %s\"$$$$FG$$\n\n\n\n",iso_filename;
|
||||
switch (ins_reg.host_vm) {
|
||||
case VM_VMWARE:
|
||||
if (IsDotC(iso_filename))
|
||||
|
||||
+3
-3
@@ -122,14 +122,14 @@ Bool InSetMsPlot(I64 mS,I64 x,I64 y,I64 z)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public U0 InSetMs(I64 mS=7,I64 x=MAX_I64,I64 y=MAX_I64,I64 z=MAX_I64,
|
||||
I64 l=MAX_I64,I64 r=MAX_I64)
|
||||
public U0 InSetMs(I64 mS=7,I64 x=I64_MAX,I64 y=I64_MAX,I64 z=I64_MAX,
|
||||
I64 l=I64_MAX,I64 r=I64_MAX)
|
||||
{//Move mouse to spot at certain speed.
|
||||
if (!(0<=x<GR_WIDTH))
|
||||
x=ms.pos.x;
|
||||
if (!(0<=y<GR_HEIGHT))
|
||||
y=ms.pos.y;
|
||||
if (z==MAX_I64)
|
||||
if (z==I64_MAX)
|
||||
z=ms.pos.z;
|
||||
if (!(FALSE<=l<=TRUE))
|
||||
l=ms.lb;
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
#help_index "Misc/Install Registration"
|
||||
#help_index "Registry/Install Registration"
|
||||
|
||||
public CInsReg ins_reg;
|
||||
MemSet(&ins_reg,0,sizeof(CInsReg));
|
||||
@@ -31,7 +31,7 @@ public Bool InsReg(U8 drv_let=0,I64 action=RR_REGISTER)
|
||||
if (drv_let)
|
||||
*sys_registry_doc->filename.name=drv_let;
|
||||
RegWrite("Adam/InsReg",
|
||||
"#help_index \"Misc/Install Registration\"\n"
|
||||
"#help_index \"Registry/Install Registration\"\n"
|
||||
"MemSet(&ins_reg,0,sizeof(CInsReg));\n"
|
||||
"ins_reg.registered=%d;\n"
|
||||
"ins_reg.host_os=%d;\n"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//See $LK,"Install Documentation",A="FI:::/Doc/Install.DD"$ or $LK,"Upgrading Documentation",A="FI:::/Doc/Upgrade.DD"$.
|
||||
//Study my account examples: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOSCfg.HC,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOSDistro.HC,1"$
|
||||
//Study my account examples: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOS/TOSCfg.HC,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOS/TOSDistro.HC,1"$
|
||||
|
||||
#include "BootDVD"
|
||||
#include "DskISORedSea"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//See $LK,"Install Documentation",A="FI:::/Doc/Install.DD"$ or $LK,"Upgrading Documentation",A="FI:::/Doc/Upgrade.DD"$.
|
||||
//Study my account examples: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOSCfg.HC,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOSDistro.HC,1"$
|
||||
//Study my account examples: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOS/TOSCfg.HC,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOS/TOSDistro.HC,1"$
|
||||
|
||||
#include "BootHD"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//See $LK,"Install Documentation",A="FI:::/Doc/Install.DD"$ or $LK,"Upgrading Documentation",A="FI:::/Doc/Upgrade.DD"$.
|
||||
//Study my account examples: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOSCfg.HC,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOSDistro.HC,1"$
|
||||
//Study my account examples: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOS/TOSCfg.HC,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOS/TOSDistro.HC,1"$
|
||||
|
||||
#include "BootMHD"
|
||||
#include "BootMHD2"
|
||||
|
||||
@@ -36,7 +36,7 @@ public U0 BootRAM(U8 *filename=NULL)
|
||||
CKernel *hi_image,*lo_image=mem_boot_base-sizeof(CBinFile),
|
||||
reg *sys_ram_reboot;
|
||||
if (!filename)
|
||||
filename="::/Kernel/" KERNEL_BIN_C;
|
||||
filename="::/" KERNEL_BIN_C;
|
||||
do if (!(hi_image=FileRead(filename,&size))) return;
|
||||
while (hi_image<0x100000); //If alloc from low 640K, just get another copy.
|
||||
|
||||
|
||||
@@ -142,43 +142,47 @@ public I64 RedSeaISO(U8 *_iso_filename=NULL,U8 *_src_dir,
|
||||
CDrv *dv=DrvMakeFreeSlot(DrvNextFreeLet('Q')); //First $LK,"BDT_ISO_FILE_WRITE",A="MN:BDT_ISO_FILE_WRITE"$
|
||||
CBlkDev *bd=BlkDevNextFreeSlot(dv->drv_let,BDT_ISO_FILE_WRITE);
|
||||
|
||||
if (!_iso_filename)
|
||||
_iso_filename=blkdev.dft_iso_filename;
|
||||
iso_filename=ChgExt(_iso_filename,"ISO.C");
|
||||
src_dir=DirNameAbs(_src_dir);
|
||||
if (_stage2_filename) {
|
||||
stage2_filename=FileNameAbs(_stage2_filename);
|
||||
*stage2_filename=dv->drv_let;
|
||||
i=StrLen(src_dir);
|
||||
if (i!=3) //If not head
|
||||
i++; //Skip slash
|
||||
StrCpy(stage2_filename+3,stage2_filename+i);
|
||||
} else
|
||||
stage2_filename=NULL;
|
||||
tmpde=FilesFind(src_dir,FUF_RECURSE);
|
||||
root_cnt=LinkedLstCnt(tmpde)+3;
|
||||
root_dir_blks=CeilU64(root_cnt<<6,BLK_SIZE)>>BLK_SIZE_BITS;
|
||||
if (res=RedSeaISOPass1(tmpde)>>BLK_SIZE_BITS) {
|
||||
bd->drv_offset=19<<2+(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;
|
||||
bitmap_blks=1;
|
||||
do {
|
||||
bitmap_blks1=bitmap_blks;
|
||||
bitmap_blks=(res+bitmap_blks+BLK_SIZE<<3-1)/BLK_SIZE<<3;
|
||||
} while (bitmap_blks!=bitmap_blks1);
|
||||
if (!IsDir(_src_dir))
|
||||
PrintErr("'%s' is not a dir.\n",_src_dir);
|
||||
else {
|
||||
if (!_iso_filename)
|
||||
_iso_filename=blkdev.dft_iso_c_filename;
|
||||
iso_filename=ChgExt(_iso_filename,"ISO.C");
|
||||
src_dir=DirNameAbs(_src_dir);
|
||||
if (_stage2_filename) {
|
||||
stage2_filename=FileNameAbs(_stage2_filename);
|
||||
*stage2_filename=dv->drv_let;
|
||||
i=StrLen(src_dir);
|
||||
if (i!=3) //If not root
|
||||
i++; //Skip slash
|
||||
StrCpy(stage2_filename+3,stage2_filename+i);
|
||||
} else
|
||||
stage2_filename=NULL;
|
||||
tmpde=FilesFind(src_dir,FUF_RECURSE);
|
||||
root_cnt=LinkedLstCnt(tmpde)+3;
|
||||
root_dir_blks=CeilU64(root_cnt<<6,BLK_SIZE)>>BLK_SIZE_BITS;
|
||||
if (res=RedSeaISOPass1(tmpde)>>BLK_SIZE_BITS) {
|
||||
bd->drv_offset=19<<2+(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;
|
||||
bitmap_blks=1;
|
||||
do {
|
||||
bitmap_blks1=bitmap_blks;
|
||||
bitmap_blks=(res+bitmap_blks+BLK_SIZE<<3-1)/BLK_SIZE<<3;
|
||||
} while (bitmap_blks!=bitmap_blks1);
|
||||
|
||||
bd->max_blk=CeilI64(bd->drv_offset+1+bitmap_blks+res,4);
|
||||
bd->max_blk--; //Inclusive.
|
||||
bd->file_dsk_name=AStrNew(iso_filename);
|
||||
bd->init_root_dir_blks=root_dir_blks;
|
||||
BlkDevAdd(bd,,TRUE,TRUE);
|
||||
StrPrint(buf,"%C:/",dv->drv_let);
|
||||
CopyTree(src_dir,buf,TRUE);
|
||||
RedSeaISO9660Stage1(iso_filename,stage2_filename);
|
||||
DrvDel(dv);
|
||||
BlkDevDel(bd);
|
||||
bd->max_blk=CeilI64(bd->drv_offset+1+bitmap_blks+res,4);
|
||||
bd->max_blk--; //Inclusive.
|
||||
bd->file_dsk_name=AStrNew(iso_filename);
|
||||
bd->init_root_dir_blks=root_dir_blks;
|
||||
BlkDevAdd(bd,,TRUE,TRUE);
|
||||
StrPrint(buf,"%C:/",dv->drv_let);
|
||||
CopyTree(src_dir,buf,TRUE);
|
||||
RedSeaISO9660Stage1(iso_filename,stage2_filename);
|
||||
DrvDel(dv);
|
||||
BlkDevDel(bd);
|
||||
}
|
||||
Free(stage2_filename);
|
||||
Free(src_dir);
|
||||
Free(iso_filename);
|
||||
}
|
||||
Free(stage2_filename);
|
||||
Free(src_dir);
|
||||
Free(iso_filename);
|
||||
return res;
|
||||
}
|
||||
+17
-17
@@ -1,6 +1,6 @@
|
||||
#help_index "Graphics/Windows BMP Files"
|
||||
|
||||
#define NUM_BMP_COLORS 16
|
||||
#define BMP_COLORS_NUM 16
|
||||
|
||||
class CFileBMP
|
||||
{
|
||||
@@ -23,13 +23,13 @@ class CFileBMP
|
||||
|
||||
U0 end;
|
||||
|
||||
CBGR24 palette[NUM_BMP_COLORS];
|
||||
CBGR24 palette[BMP_COLORS_NUM];
|
||||
};
|
||||
|
||||
public CFileBMP *BMP4To(CDC *dc)
|
||||
{//To Windows 4-bit BMP.
|
||||
U8 *src,*ptr;
|
||||
CBGR48 palette[NUM_COLORS];
|
||||
CBGR48 palette[COLORS_NUM];
|
||||
I64 i,x,y,w=dc->width>>1,
|
||||
size=sizeof(CFileBMP)+dc->width*dc->height>>1;
|
||||
CFileBMP *bmp =CAlloc(size);
|
||||
@@ -43,8 +43,8 @@ public CFileBMP *BMP4To(CDC *dc)
|
||||
bmp->bit_cnt =4;
|
||||
bmp->image_size =dc->width*dc->height>>1;
|
||||
GrPaletteGet(palette);
|
||||
#assert NUM_COLORS==NUM_BMP_COLORS
|
||||
for (i=0;i<NUM_BMP_COLORS;i++) {
|
||||
#assert COLORS_NUM==BMP_COLORS_NUM
|
||||
for (i=0;i<BMP_COLORS_NUM;i++) {
|
||||
bmp->palette[i].b=palette[i].b>>8;
|
||||
bmp->palette[i].g=palette[i].g>>8;
|
||||
bmp->palette[i].r=palette[i].r>>8;
|
||||
@@ -66,7 +66,7 @@ public CFileBMP *BMPRLE4To(CDC *dc)
|
||||
{//To Windows RLE4 bit BMP.
|
||||
U8 *src,*ptr,*start;
|
||||
I64 i,x,y,w=dc->width,cnt,pattern;
|
||||
CBGR48 palette[NUM_COLORS];
|
||||
CBGR48 palette[COLORS_NUM];
|
||||
CFileBMP *bmp =CAlloc(sizeof(CFileBMP)+2*(dc->width+1)*dc->height);
|
||||
bmp->type ='BM';
|
||||
bmp->planes =1;
|
||||
@@ -77,8 +77,8 @@ public CFileBMP *BMPRLE4To(CDC *dc)
|
||||
bmp->bit_cnt =4;
|
||||
bmp->compression=2; //RLE4
|
||||
GrPaletteGet(palette);
|
||||
#assert NUM_COLORS==NUM_BMP_COLORS
|
||||
for (i=0;i<NUM_BMP_COLORS;i++) {
|
||||
#assert COLORS_NUM==BMP_COLORS_NUM
|
||||
for (i=0;i<BMP_COLORS_NUM;i++) {
|
||||
bmp->palette[i].b=palette[i].b>>8;
|
||||
bmp->palette[i].g=palette[i].g>>8;
|
||||
bmp->palette[i].r=palette[i].r>>8;
|
||||
@@ -94,7 +94,7 @@ public CFileBMP *BMPRLE4To(CDC *dc)
|
||||
src+=2;
|
||||
cnt=2;
|
||||
x+=2;
|
||||
while (x<w && cnt<MAX_U8) {
|
||||
while (x<w && cnt<U8_MAX) {
|
||||
if (*src&15==pattern&15) {
|
||||
src++;
|
||||
cnt++;
|
||||
@@ -184,14 +184,14 @@ public I64 BMPWrite(U8 *filename,CDC *dc,I64 bits=4)
|
||||
U8 *BMPPaletteNew(CFileBMP *bmp)
|
||||
{
|
||||
I64 i,j,best,score,best_score;
|
||||
CBGR48 palette[NUM_COLORS];
|
||||
U8 *res=CAlloc(NUM_BMP_COLORS*sizeof(U8));
|
||||
CBGR48 palette[COLORS_NUM];
|
||||
U8 *res=CAlloc(BMP_COLORS_NUM*sizeof(U8));
|
||||
GrPaletteGet(palette);
|
||||
#assert NUM_COLORS==NUM_BMP_COLORS
|
||||
for (i=0;i<NUM_BMP_COLORS;i++) {
|
||||
#assert COLORS_NUM==BMP_COLORS_NUM
|
||||
for (i=0;i<BMP_COLORS_NUM;i++) {
|
||||
best=i;
|
||||
best_score=MAX_I64;
|
||||
for (j=0;j<NUM_BMP_COLORS;j++) {
|
||||
best_score=I64_MAX;
|
||||
for (j=0;j<BMP_COLORS_NUM;j++) {
|
||||
score=SqrI64(bmp->palette[i].r-palette[j].r>>8)+
|
||||
SqrI64(bmp->palette[i].g-palette[j].g>>8)+
|
||||
SqrI64(bmp->palette[i].b-palette[j].b>>8);
|
||||
@@ -205,7 +205,7 @@ U8 *BMPPaletteNew(CFileBMP *bmp)
|
||||
return res;
|
||||
}
|
||||
|
||||
U8 ms_paint_palette[NUM_BMP_COLORS]={0,4,2,6,1,5,3,8,7,12,10,14,9,13,11,15};
|
||||
U8 ms_paint_palette[BMP_COLORS_NUM]={0,4,2,6,1,5,3,8,7,12,10,14,9,13,11,15};
|
||||
|
||||
I64 BMP24Color(CBGR24 *ptr,Bool dither_probability)
|
||||
{
|
||||
@@ -245,7 +245,7 @@ public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,
|
||||
CDC *res=NULL;
|
||||
if (ptr=FileRead(filename)) {
|
||||
bmp=ptr;
|
||||
if (0<bmp->width<MAX_I32 && 0<bmp->height<MAX_I32) {
|
||||
if (0<bmp->width<I32_MAX && 0<bmp->height<I32_MAX) {
|
||||
res=DCNew(bmp->width,bmp->height);
|
||||
ptr+=bmp->data_offset;
|
||||
if (bmp->compression==2)
|
||||
|
||||
@@ -48,13 +48,32 @@ public I64 LinkChk(U8 *files_find_mask="/*",U8 *fu_flags=NULL)
|
||||
{//Check documents for broken file links.
|
||||
I64 fuf_flags=0,res=0;
|
||||
CDirEntry *tmpde,*tmpde1;
|
||||
U8 *st;
|
||||
progress2_max=1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+$$+f+F+O");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tmpde && !Bt(&fuf_flags,FUf_CANCEL)) {
|
||||
|
||||
st=MStrPrint("Before %s Broke:%d",tmpde->full_name,res);
|
||||
if (StrLen(st)>PROGRESS_DESC_LEN-1)
|
||||
st[PROGRESS_DESC_LEN-1]=0;
|
||||
StrCpy(progress2_desc,st);
|
||||
Free(st);
|
||||
Yield;
|
||||
|
||||
res+=LinkChkFile(tmpde->full_name,&fuf_flags);
|
||||
|
||||
st=MStrPrint("After %s Broke:%d",tmpde->full_name,res);
|
||||
if (StrLen(st)>PROGRESS_DESC_LEN-1)
|
||||
st[PROGRESS_DESC_LEN-1]=0;
|
||||
StrCpy(progress2_desc,st);
|
||||
Free(st);
|
||||
Yield;
|
||||
|
||||
tmpde=tmpde->next;
|
||||
}
|
||||
DirTreeDel(tmpde1);
|
||||
progress2_max=0;
|
||||
return res;
|
||||
}
|
||||
@@ -8,7 +8,7 @@ I64 TSSSize(CTSS *tss)
|
||||
I64 PenBrushesSize()
|
||||
{
|
||||
I64 res=0,i;
|
||||
for (i=0;i<GR_NUM_PEN_BRUSHES;i++)
|
||||
for (i=0;i<GR_PEN_BRUSHES_NUM;i++)
|
||||
res+=DCSize(gr.pen_brushes[i])+DCSize(gr.collision_pen_brushes[i])+
|
||||
DCSize(gr.even_pen_brushes[i])+DCSize(gr.odd_pen_brushes[i]);
|
||||
return res;
|
||||
@@ -17,7 +17,7 @@ I64 PenBrushesSize()
|
||||
I64 ScrnZoomTablesSize()
|
||||
{
|
||||
I64 res=0,i;
|
||||
for (i=1;i<=GR_MAX_SCRN_ZOOM;i++)
|
||||
for (i=1;i<=GR_SCRN_ZOOM_MAX;i++)
|
||||
res+=MSize2(gr.scrn_zoom_tables[i]);
|
||||
return res;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ I64 BlkDevsSize()
|
||||
{
|
||||
I64 i,j,res=MSize2(blkdev.blkdevs);
|
||||
CBlkDev *bd;
|
||||
for (i=0;i<NUM_BLKDEVS;i++) {
|
||||
for (i=0;i<BLKDEVS_NUM;i++) {
|
||||
bd=&blkdev.blkdevs[i];
|
||||
if (bd->bd_signature==BD_SIGNATURE_VAL) {
|
||||
j=(bd->max_blk+1)<<BLK_SIZE_BITS;
|
||||
@@ -81,7 +81,7 @@ I64 BlkDevsSize()
|
||||
I64 DrvsSize()
|
||||
{
|
||||
I64 i,res=MSize2(blkdev.drvs);
|
||||
for (i=0;i<NUM_DRVS;i++)
|
||||
for (i=0;i<DRVS_NUM;i++)
|
||||
res+=MSize2(blkdev.drvs[i].cur_fat_blk)+MSize2(blkdev.drvs[i].fis);
|
||||
return res;
|
||||
}
|
||||
|
||||
+56
-23
@@ -1,6 +1,6 @@
|
||||
#help_index "Misc/TOS"
|
||||
|
||||
public U0 TOSStaffIns()
|
||||
U0 TOSStaffIns()
|
||||
{//Completes TOS install from TempleOSStaff.ISO
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
AutoComplete;
|
||||
@@ -9,16 +9,32 @@ public U0 TOSStaffIns()
|
||||
DocClear;
|
||||
"$$PURPLE$$$$TX+CX,\"Complete TOS install from TempleOSStaff.ISO\"$$$$FG$$\n\n\n\n";
|
||||
InsRereg;
|
||||
if (HostChgDsk("/home/tad/TAD/Site1/Wb/TempleOSSup1.ISO.C"))
|
||||
CopyTree("T:/","~/Sup1");
|
||||
if (HostChgDsk("/home/tad/TAD/Site1Stale/files/TempleOSBooks1.ISO.C"))
|
||||
CopyTree("T:/","~/Books1");
|
||||
if (HostChgDsk("/home/tad/TAD/Site1Stale/files/TempleOSBooks2.ISO.C"))
|
||||
CopyTree("T:/","~/Books2");
|
||||
|
||||
"\nDownload TempleOSSup1.ISO.C\tfrom http://www.templeos.org AppStore.\n"
|
||||
"Download TempleOSBooks1.ISO.C\tfrom http://www.templeos.org AppStore.\n"
|
||||
"Download TempleOSBooks2.ISO.C\tfrom http://www.templeos.org AppStore.\n\n";
|
||||
|
||||
if (PressAKey!=CH_SHIFT_ESC) {
|
||||
if (HostChgDsk("/home/tad/TempleOSSup1.ISO.C"))
|
||||
CopyTree("T:/","~/Sup1");
|
||||
if (HostChgDsk("/home/tad/TempleOSBooks1.ISO.C"))
|
||||
CopyTree("T:/","~/Books1");
|
||||
if (HostChgDsk("/home/tad/TempleOSBooks2.ISO.C"))
|
||||
CopyTree("T:/","~/Books2");
|
||||
|
||||
Once("TOSBootHDIns;");
|
||||
"\nDo you wish to run >$FG,2$TOSRegen;$FG$ to generate\n the "
|
||||
"distro ISO's and the website image, $FG,2$D:/Wb$FG$ ";
|
||||
if (YorN) {
|
||||
Once("TOSRegen;");
|
||||
BootRAM("C:/" KERNEL_BIN_C); //Boot so TOSRegen cmd is available.
|
||||
} else {
|
||||
"\nReboot ";
|
||||
if (YorN)
|
||||
Reboot;
|
||||
}
|
||||
}
|
||||
SettingsPop;
|
||||
Once("TOSBootHDIns;\"\n\nRun TOSRegen;\n\n\n\";");
|
||||
if (PressAKey!=CH_SHIFT_ESC)
|
||||
Reboot;
|
||||
}
|
||||
|
||||
public U0 TOSStdIns()
|
||||
@@ -30,18 +46,35 @@ public U0 TOSStdIns()
|
||||
DocClear;
|
||||
"$$PURPLE$$$$TX+CX,\"Complete TOS install from TempleOSCD.ISO\"$$$$FG$$\n\n\n\n";
|
||||
InsRereg;
|
||||
if (FileFind("/Demo/AcctExample"))
|
||||
Copy("::/Demo/AcctExample/*","~");
|
||||
if (HostChgDsk("/home/tad/Downloads/TempleOSSup1.ISO.C"))
|
||||
CopyTree("T:/","~/Sup1");
|
||||
if (HostChgDsk("/home/tad/Downloads/TempleOSWeb.ISO.C"))
|
||||
CopyTree("T:/","~/Web");
|
||||
if (HostChgDsk("/home/tad/Downloads/TempleOSBooks1.ISO.C"))
|
||||
CopyTree("T:/","~/Books1");
|
||||
if (HostChgDsk("/home/tad/Downloads/TempleOSBooks2.ISO.C"))
|
||||
CopyTree("T:/","~/Books2");
|
||||
|
||||
"\nDownload TempleOSSup1.ISO.C\tfrom http://www.templeos.org AppStore.\n"
|
||||
"Download TempleOSWeb.ISO.C\tfrom http://www.templeos.org AppStore.\n"
|
||||
"Download TempleOSBooks1.ISO.C\tfrom http://www.templeos.org AppStore.\n"
|
||||
"Download TempleOSBooks2.ISO.C\tfrom http://www.templeos.org AppStore.\n\n";
|
||||
|
||||
if (PressAKey!=CH_SHIFT_ESC) {
|
||||
if (FileFind("/Demo/AcctExample"))
|
||||
CopyTree("::/Demo/AcctExample","~");
|
||||
if (HostChgDsk("/home/tad/Downloads/TempleOSSup1.ISO.C"))
|
||||
CopyTree("T:/","~/Sup1");
|
||||
if (HostChgDsk("/home/tad/Downloads/TempleOSWeb.ISO.C"))
|
||||
CopyTree("T:/","~/Web");
|
||||
if (HostChgDsk("/home/tad/Downloads/TempleOSBooks1.ISO.C"))
|
||||
CopyTree("T:/","~/Books1");
|
||||
if (HostChgDsk("/home/tad/Downloads/TempleOSBooks2.ISO.C"))
|
||||
CopyTree("T:/","~/Books2");
|
||||
|
||||
Once("TOSBootHDIns;");
|
||||
"\nDo you wish to run >$FG,2$TOSRegen;$FG$ to generate\n the "
|
||||
"distro ISO's and the website image, $FG,2$D:/Wb$FG$ ";
|
||||
if (YorN) {
|
||||
Once("TOSRegen;");
|
||||
BootRAM("C:/" KERNEL_BIN_C); //Boot so TOSRegen cmd is available.
|
||||
} else {
|
||||
"\nReboot ";
|
||||
if (YorN)
|
||||
Reboot;
|
||||
}
|
||||
}
|
||||
SettingsPop;
|
||||
Once("TOSBootHDIns;\"\n\nRun TOSRegen;\n\n\n\";");
|
||||
if (PressAKey!=CH_SHIFT_ESC)
|
||||
Reboot;
|
||||
}
|
||||
+6
-6
@@ -13,8 +13,8 @@ class CFileSND
|
||||
};
|
||||
|
||||
//Windows media constraint.
|
||||
//#define MAX_SND_FILE_DATA 0x0007FF00
|
||||
#define MAX_SND_FILE_DATA 0x7FFFFF00
|
||||
//#define SND_FILE_DATA_MAX 0x0007FF00
|
||||
#define SND_FILE_DATA_MAX 0x7FFFFF00
|
||||
|
||||
public I64 SndFileCreate(U8 *base_filename,F64 normalized_vol=1.0,
|
||||
F64 averaging=0.0,I64 waveform=WF_SQUARE,
|
||||
@@ -96,7 +96,7 @@ public I64 SndFileCreate(U8 *base_filename,F64 normalized_vol=1.0,
|
||||
level+=s->body[i];
|
||||
level/=cnt-1;
|
||||
for (i=0;i<cnt-1;i++)
|
||||
s->body[i]=ClampI64(s->body[i]-level,MIN_I16,MAX_I16);
|
||||
s->body[i]=ClampI64(s->body[i]-level,I16_MIN,I16_MAX);
|
||||
}
|
||||
|
||||
for (i=0;i<cnt-1;i++)
|
||||
@@ -117,10 +117,10 @@ public I64 SndFileCreate(U8 *base_filename,F64 normalized_vol=1.0,
|
||||
file_num=0;
|
||||
while (cnt2>0) {
|
||||
i=cnt2;
|
||||
if (i>MAX_SND_FILE_DATA)
|
||||
i=MAX_SND_FILE_DATA;
|
||||
if (i>SND_FILE_DATA_MAX)
|
||||
i=SND_FILE_DATA_MAX;
|
||||
s->data_size=EndianU32(i*sizeof(I16));
|
||||
MemCpy(s->body,&s->body[file_num*MAX_SND_FILE_DATA],i*sizeof(I16));
|
||||
MemCpy(s->body,&s->body[file_num*SND_FILE_DATA_MAX],i*sizeof(I16));
|
||||
StrPrint(name2,"%s%03d.SND",name,file_num++);
|
||||
FileWrite(name2,s,offset(CFileSND.body)+i*sizeof(I16));
|
||||
cnt2-=i;
|
||||
|
||||
+4
-4
@@ -138,7 +138,7 @@ public U0 SndWaveCtrlDel(CSndWaveCtrl *swc)
|
||||
#define WF_TRI 3
|
||||
#define WF_SAWTOOTH 4
|
||||
#define WF_NOISE 5
|
||||
#define WF_NUM_WAVEFORMS 6
|
||||
#define WF_WAVEFORMS_NUM 6
|
||||
|
||||
public U0 SndWaveAddBuf(CSndWaveCtrl *swc,U8 *buf,I64 num_samples,
|
||||
F64 _freq,I64 _waveform=WF_SQUARE,F64 _amp=1.0,F64 _left=1.0, F64 _right=1.0)
|
||||
@@ -157,7 +157,7 @@ public U0 SndWaveAddBuf(CSndWaveCtrl *swc,U8 *buf,I64 num_samples,
|
||||
} else {
|
||||
phase=swc->phase;
|
||||
i=0;
|
||||
amp=Min(MAX_I32,MAX_I32*_amp);
|
||||
amp=Min(I32_MAX,I32_MAX*_amp);
|
||||
f=2*ã/swc->sample_rate*_freq;
|
||||
switch (_waveform) {
|
||||
case WF_NOISE:
|
||||
@@ -201,13 +201,13 @@ public U0 SndWaveAddBuf(CSndWaveCtrl *swc,U8 *buf,I64 num_samples,
|
||||
if (phase<ã) {
|
||||
if (phase<f) {
|
||||
swc->last_y=swc->next_y;
|
||||
swc->next_y=a*RandI16/MAX_U16;
|
||||
swc->next_y=a*RandI16/U16_MAX;
|
||||
}
|
||||
j=swc->last_y*(ã-phase)+swc->next_y*phase;
|
||||
} else {
|
||||
if (phase-ã<f) {
|
||||
swc->last_y=swc->next_y;
|
||||
swc->next_y=a*RandI16/MAX_U16;
|
||||
swc->next_y=a*RandI16/U16_MAX;
|
||||
}
|
||||
j=swc->last_y*(2.0*ã-phase)+swc->next_y*(phase-ã);
|
||||
}
|
||||
|
||||
Binary file not shown.
+9
-6
@@ -30,12 +30,12 @@ U0 DrawProgressBars(CDC *dc)
|
||||
{
|
||||
I64 i,j,k,n,m;
|
||||
U8 *st,*st2;
|
||||
for (i=0;i<NUM_PROGRESS_BARS;i++) {
|
||||
for (i=0;i<PROGRESS_BARS_NUM;i++) {
|
||||
if (m=sys_progresses[i].max) {
|
||||
dc->color=BLACK;
|
||||
GrRect(dc,
|
||||
(GR_WIDTH-PROGRESS_BAR_WIDTH)/2,
|
||||
(GR_HEIGHT-(NUM_PROGRESS_BARS*2-1-i*4)*PROGRESS_BAR_HEIGHT)/2,
|
||||
(GR_HEIGHT-(PROGRESS_BARS_NUM*2-1-i*4)*PROGRESS_BAR_HEIGHT)/2,
|
||||
PROGRESS_BAR_WIDTH,PROGRESS_BAR_HEIGHT);
|
||||
|
||||
dc->color=LTGREEN;
|
||||
@@ -44,7 +44,7 @@ U0 DrawProgressBars(CDC *dc)
|
||||
n=m;
|
||||
GrRect(dc,
|
||||
(GR_WIDTH-PROGRESS_BAR_WIDTH)/2+2,
|
||||
(GR_HEIGHT-(NUM_PROGRESS_BARS*2-1-i*4)*PROGRESS_BAR_HEIGHT)/2+2,
|
||||
(GR_HEIGHT-(PROGRESS_BARS_NUM*2-1-i*4)*PROGRESS_BAR_HEIGHT)/2+2,
|
||||
n*(PROGRESS_BAR_WIDTH-4)/m,
|
||||
PROGRESS_BAR_HEIGHT-4);
|
||||
|
||||
@@ -56,11 +56,11 @@ U0 DrawProgressBars(CDC *dc)
|
||||
GrLine(dc,
|
||||
(GR_WIDTH-PROGRESS_BAR_WIDTH)/2+1+j*
|
||||
(PROGRESS_BAR_WIDTH-4)/ToF64(k+1),
|
||||
(GR_HEIGHT-(NUM_PROGRESS_BARS*2-1-i*4)*
|
||||
(GR_HEIGHT-(PROGRESS_BARS_NUM*2-1-i*4)*
|
||||
PROGRESS_BAR_HEIGHT)/2+4,
|
||||
(GR_WIDTH-PROGRESS_BAR_WIDTH)/2+1+j*
|
||||
(PROGRESS_BAR_WIDTH-4)/ToF64(k+1),
|
||||
(GR_HEIGHT-(NUM_PROGRESS_BARS*2-3-i*4)*
|
||||
(GR_HEIGHT-(PROGRESS_BARS_NUM*2-3-i*4)*
|
||||
PROGRESS_BAR_HEIGHT)/2-4);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ U0 DrawProgressBars(CDC *dc)
|
||||
} else
|
||||
st=st2;
|
||||
GrPrint(dc,(GR_WIDTH-FONT_WIDTH*StrLen(st))/2,(GR_HEIGHT-FONT_HEIGHT-
|
||||
(NUM_PROGRESS_BARS*2-2-i*4)*PROGRESS_BAR_HEIGHT)/2,"%s",st);
|
||||
(PROGRESS_BARS_NUM*2-2-i*4)*PROGRESS_BAR_HEIGHT)/2,"%s",st);
|
||||
Free(st);
|
||||
}
|
||||
}
|
||||
@@ -203,6 +203,9 @@ U0 WinFinalUpdate(CDC *dc)
|
||||
{
|
||||
if (ms_grid.show)
|
||||
DrawWinGrid(dc);
|
||||
if (ms_grid.coord)
|
||||
GrPrint(dc,GR_WIDTH-FONT_WIDTH*10,FONT_HEIGHT*3,
|
||||
"(%03d,%03d)",ms.pos.x,ms.pos.y);
|
||||
DrawProgressBars(dc);
|
||||
if (winmgr.show_menu)
|
||||
DrawMenu(dc);
|
||||
|
||||
+1
-1
@@ -193,7 +193,7 @@ I64 WinQueIPMsgs(Bool que)
|
||||
U0 WinCalcIdles()
|
||||
{
|
||||
F64 calc_idle_time;
|
||||
I64 i,k,total_jiffies,total_jiffies_delta,idle_pt_hits[MP_MAX_PROCESSORS];
|
||||
I64 i,k,total_jiffies,total_jiffies_delta,idle_pt_hits[MP_PROCESSORS_NUM];
|
||||
CCPU *c;
|
||||
CWinMgrTimingGlbls *t=winmgr.t;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ U0 BgtIns(CBgtEntry *tmpb)
|
||||
class CBgtEntryForm
|
||||
{
|
||||
U8 date[512] fmtstr "$$DA-P,A=\"Date :%s\"$$\n";
|
||||
F64 amount fmtstr "Amount $$$$$$DA,A=\"%6.2f\"$$\n";
|
||||
F64 amount fmtstr "Amount $$$$$$DA,A=\"%8.2f\"$$\n";
|
||||
U8 credit[512] fmtstr "$$DA-P,A=\"Credit Acct:%s\"$$\n";
|
||||
U8 debit [512] fmtstr "$$DA-P,A=\"Debit Acct:%s\"$$\n";
|
||||
U8 desc [512] fmtstr "$$DA-P,A=\"Desc :%s\"$$\n";
|
||||
|
||||
@@ -46,7 +46,7 @@ class CBgtTemplate
|
||||
U16 flags;
|
||||
U8 start_date[16] fmtstr "$$DA-P,A=\"Start Date:%s\"$$\n";
|
||||
U8 end_date[16] fmtstr "$$DA-P,A=\"End Date :%s\"$$\n";
|
||||
F64 period fmtstr "$$DA,A=\"Period :%6.2f\"$$\n";
|
||||
F64 period fmtstr "$$DA,A=\"Period :%8.2f\"$$\n";
|
||||
U0 end;
|
||||
|
||||
CBgtEntry b;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
//Makes a mesh ball.
|
||||
|
||||
#define MAX_VERTICES 1024
|
||||
#define MAX_TRIS 1024
|
||||
#define VERTICES_NUM 1024
|
||||
#define TRIS_NUM 1024
|
||||
|
||||
class Ball
|
||||
{
|
||||
I32 vertex_cnt;
|
||||
I32 tri_cnt;
|
||||
CD3I32 v[MAX_VERTICES];
|
||||
CMeshTri t[MAX_TRIS];
|
||||
CD3I32 v[VERTICES_NUM];
|
||||
CMeshTri t[TRIS_NUM];
|
||||
} *b;
|
||||
|
||||
class BallDefineStruct
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
//Makes a mesh man.
|
||||
|
||||
#define MAX_VERTICES 1024
|
||||
#define MAX_TRIS 1024
|
||||
#define VERTICES_NUM 1024
|
||||
#define TRIS_NUM 1024
|
||||
|
||||
class Man
|
||||
{
|
||||
I32 vertex_cnt;
|
||||
I32 tri_cnt;
|
||||
CD3I32 v[MAX_VERTICES];
|
||||
CMeshTri t[MAX_TRIS];
|
||||
CD3I32 v[VERTICES_NUM];
|
||||
CMeshTri t[TRIS_NUM];
|
||||
} *m;
|
||||
|
||||
class ManDefineStruct
|
||||
|
||||
+33
-33
@@ -200,36 +200,36 @@ This is just a video game. Relax.
|
||||
|
||||
#define FIRST_STANDING 0
|
||||
|
||||
#define NUM_RUNNING_IMGS 4
|
||||
#define RUNNING_IMGS_NUM 4
|
||||
#define FIRST_RUNNING 0
|
||||
#define LAST_RUNNING (FIRST_RUNNING+NUM_RUNNING_IMGS-1)
|
||||
#define LAST_RUNNING (FIRST_RUNNING+RUNNING_IMGS_NUM-1)
|
||||
|
||||
#define NUM_SHOOTING_IMGS 5
|
||||
#define SHOOTING_IMGS_NUM 5
|
||||
#define FIRST_SHOOTING (LAST_RUNNING+1)
|
||||
#define LAST_SHOOTING (FIRST_SHOOTING+NUM_SHOOTING_IMGS-1)
|
||||
#define LAST_SHOOTING (FIRST_SHOOTING+SHOOTING_IMGS_NUM-1)
|
||||
|
||||
#define NUM_DRIBBLING_IMGS 4
|
||||
#define DRIBBLING_IMGS_NUM 4
|
||||
#define FIRST_DRIBBLING (LAST_SHOOTING+1)
|
||||
#define LAST_DRIBBLING (FIRST_DRIBBLING+NUM_DRIBBLING_IMGS-1)
|
||||
#define LAST_DRIBBLING (FIRST_DRIBBLING+DRIBBLING_IMGS_NUM-1)
|
||||
|
||||
#define NUM_STOPPED_DRIBBLING_IMGS 2
|
||||
#define STOPPED_DRIBBLING_IMGS_NUM 2
|
||||
#define FIRST_STOPPED_DRIBBLING (LAST_DRIBBLING+1)
|
||||
#define LAST_STOPPED_DRIBBLING \
|
||||
(FIRST_STOPPED_DRIBBLING+NUM_STOPPED_DRIBBLING_IMGS-1)
|
||||
(FIRST_STOPPED_DRIBBLING+STOPPED_DRIBBLING_IMGS_NUM-1)
|
||||
|
||||
Frame imgs[LAST_STOPPED_DRIBBLING+1]={
|
||||
{{$IB,"<6>",BI=6$,$IB,"<7>",BI=7$},2*DRIBBLE_T/NUM_RUNNING_IMGS},
|
||||
{{$IB,"<2>",BI=2$,$IB,"<3>",BI=3$},2*DRIBBLE_T/NUM_RUNNING_IMGS},
|
||||
{{$IB,"<6>",BI=6$,$IB,"<7>",BI=7$},2*DRIBBLE_T/NUM_RUNNING_IMGS},
|
||||
{{$IB,"<4>",BI=4$,$IB,"<5>",BI=5$},2*DRIBBLE_T/NUM_RUNNING_IMGS},
|
||||
{{$IB,"<6>",BI=6$,$IB,"<7>",BI=7$},2*DRIBBLE_T/RUNNING_IMGS_NUM},
|
||||
{{$IB,"<2>",BI=2$,$IB,"<3>",BI=3$},2*DRIBBLE_T/RUNNING_IMGS_NUM},
|
||||
{{$IB,"<6>",BI=6$,$IB,"<7>",BI=7$},2*DRIBBLE_T/RUNNING_IMGS_NUM},
|
||||
{{$IB,"<4>",BI=4$,$IB,"<5>",BI=5$},2*DRIBBLE_T/RUNNING_IMGS_NUM},
|
||||
{{$IB,"<8>",BI=8$,$IB,"<9>",BI=9$},0.1},{{$IB,"<10>",BI=10$,$IB,"<11>",BI=11$},0.2},
|
||||
{{$IB,"<12>",BI=12$,$IB,"<13>",BI=13$},0.2},{{$IB,"<12>",BI=12$,$IB,"<13>",BI=13$},0.1},{{$IB,"<14>",BI=14$,$IB,"<15>",BI=15$},0.1},
|
||||
{{$IB,"<20>",BI=20$,$IB,"<21>",BI=21$},2*DRIBBLE_T/NUM_DRIBBLING_IMGS},
|
||||
{{$IB,"<16>",BI=16$,$IB,"<17>",BI=17$},2*DRIBBLE_T/NUM_DRIBBLING_IMGS},
|
||||
{{$IB,"<20>",BI=20$,$IB,"<21>",BI=21$},2*DRIBBLE_T/NUM_DRIBBLING_IMGS},
|
||||
{{$IB,"<18>",BI=18$,$IB,"<19>",BI=19$},2*DRIBBLE_T/NUM_DRIBBLING_IMGS},
|
||||
{{$IB,"<20>",BI=20$,$IB,"<21>",BI=21$},DRIBBLE_T/NUM_STOPPED_DRIBBLING_IMGS},
|
||||
{{$IB,"<22>",BI=22$,$IB,"<23>",BI=23$},DRIBBLE_T/NUM_STOPPED_DRIBBLING_IMGS},
|
||||
{{$IB,"<20>",BI=20$,$IB,"<21>",BI=21$},2*DRIBBLE_T/DRIBBLING_IMGS_NUM},
|
||||
{{$IB,"<16>",BI=16$,$IB,"<17>",BI=17$},2*DRIBBLE_T/DRIBBLING_IMGS_NUM},
|
||||
{{$IB,"<20>",BI=20$,$IB,"<21>",BI=21$},2*DRIBBLE_T/DRIBBLING_IMGS_NUM},
|
||||
{{$IB,"<18>",BI=18$,$IB,"<19>",BI=19$},2*DRIBBLE_T/DRIBBLING_IMGS_NUM},
|
||||
{{$IB,"<20>",BI=20$,$IB,"<21>",BI=21$},DRIBBLE_T/STOPPED_DRIBBLING_IMGS_NUM},
|
||||
{{$IB,"<22>",BI=22$,$IB,"<23>",BI=23$},DRIBBLE_T/STOPPED_DRIBBLING_IMGS_NUM},
|
||||
};
|
||||
|
||||
RegDft("TempleOS/KeepAway","I64 best_score0=0,best_score1=9999;\n");
|
||||
@@ -238,8 +238,8 @@ RegExe("TempleOS/KeepAway");
|
||||
F64 game_t_end,foul_t_end;
|
||||
I64 score0,score1;
|
||||
|
||||
#define NUM_PER_SIDE 3
|
||||
#define NUM_OBJS (NUM_PER_SIDE*2+1)
|
||||
#define PER_SIDE_NUM 3
|
||||
#define OBJS_NUM (PER_SIDE_NUM*2+1)
|
||||
Bool someone_shooting,someone_has_ball;
|
||||
F64 shot_land_t;
|
||||
|
||||
@@ -250,7 +250,7 @@ class Obj
|
||||
F64 get_ball_dt,get_ball_é,nearest_man_dd,last_t0,next_t0,foul_t0;
|
||||
I64 last_img,next_img;
|
||||
Bool stopped,shooting,has_ball,nearest_ball,pad[4];
|
||||
} objs[NUM_OBJS],*ball,*human,*last_owner;
|
||||
} objs[OBJS_NUM],*ball,*human,*last_owner;
|
||||
|
||||
/*Just to be different, I didn't use the built-in
|
||||
DCF_TRANSFORMATION flag in this game.
|
||||
@@ -297,7 +297,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
{
|
||||
F64 tt=tS,d,d_down,d_up;
|
||||
I64 i;
|
||||
Obj *o_sort[NUM_OBJS],*o;
|
||||
Obj *o_sort[OBJS_NUM],*o;
|
||||
|
||||
DCDepthBufAlloc(dc);
|
||||
dc->ls.x=10000;
|
||||
@@ -313,7 +313,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
GrBorder(dc,COURT_BORDER,COURT_BORDER,
|
||||
task->pix_width -1-COURT_BORDER,
|
||||
task->pix_height-1-COURT_BORDER);
|
||||
for (i=0;i<NUM_OBJS;i++) {
|
||||
for (i=0;i<OBJS_NUM;i++) {
|
||||
o=o_sort[i]=&objs[i];
|
||||
if (o!=ball) {
|
||||
if (o->has_ball) {
|
||||
@@ -385,8 +385,8 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
}
|
||||
}
|
||||
|
||||
QSortI64(o_sort,NUM_OBJS,&ObjCompare);
|
||||
for (i=0;i<NUM_OBJS;i++)
|
||||
QSortI64(o_sort,OBJS_NUM,&ObjCompare);
|
||||
for (i=0;i<OBJS_NUM;i++)
|
||||
DrawObj(dc,o_sort[i],tt);
|
||||
tt=(game_t_end-tS)/60;
|
||||
if (tt<=0) {
|
||||
@@ -449,7 +449,7 @@ U0 AnimateTask(CTask *parent_task)
|
||||
|
||||
if (game_t_end) {
|
||||
MemSet(&nearest_ball,0,sizeof(nearest_ball));
|
||||
for (i=0;i<NUM_OBJS;i++) {
|
||||
for (i=0;i<OBJS_NUM;i++) {
|
||||
o=&objs[i];
|
||||
o->nearest_ball=FALSE;
|
||||
if (o!=ball) {
|
||||
@@ -468,7 +468,7 @@ U0 AnimateTask(CTask *parent_task)
|
||||
nearest_ball[0]->nearest_ball=TRUE;
|
||||
nearest_ball[1]->nearest_ball=TRUE;
|
||||
|
||||
for (i=0;i<NUM_OBJS;i++) {
|
||||
for (i=0;i<OBJS_NUM;i++) {
|
||||
o=&objs[i];
|
||||
if (o==ball) {
|
||||
o->x+=dt*o->DxDt;
|
||||
@@ -482,7 +482,7 @@ U0 AnimateTask(CTask *parent_task)
|
||||
dy=ball->y-o->y;
|
||||
if (dx*dx+dy*dy<HAND_SQR_OFFSET && ball->z<o->z+HAND_Z_OFFSET) {
|
||||
gets_ball=TRUE;
|
||||
for (j=0;j<NUM_PER_SIDE*2;j++)
|
||||
for (j=0;j<PER_SIDE_NUM*2;j++)
|
||||
if (j!=i && objs[j].has_ball) {
|
||||
if (Rand<2.0*dt) {
|
||||
objs[j].stolen_t0=t0;
|
||||
@@ -523,8 +523,8 @@ U0 AnimateTask(CTask *parent_task)
|
||||
dx=o->DxDt=MAN_VELOCITY*Cos(o->get_ball_é);
|
||||
dy=o->DyDt=MAN_VELOCITY*Sin(o->get_ball_é);
|
||||
} else {
|
||||
dx=o->DxDt+=RANDOM_MAN_ACCELERATION/sqrt2*RandI16/MAX_I16*dt;
|
||||
dy=o->DyDt+=RANDOM_MAN_ACCELERATION/sqrt2*RandI16/MAX_I16*dt;
|
||||
dx=o->DxDt+=RANDOM_MAN_ACCELERATION/sqrt2*RandI16/I16_MAX*dt;
|
||||
dy=o->DyDt+=RANDOM_MAN_ACCELERATION/sqrt2*RandI16/I16_MAX*dt;
|
||||
}
|
||||
}
|
||||
d=Sqrt(dx*dx+dy*dy);
|
||||
@@ -532,8 +532,8 @@ U0 AnimateTask(CTask *parent_task)
|
||||
o->é=Arg(dx,dy)+ã/2;
|
||||
dx*=MAN_VELOCITY/sqrt2*dt/d;
|
||||
dy*=MAN_VELOCITY/sqrt2*dt/d;
|
||||
o->nearest_man_dd=MAX_F64;
|
||||
for (j=0;j<NUM_PER_SIDE*2;j++)
|
||||
o->nearest_man_dd=F64_MAX;
|
||||
for (j=0;j<PER_SIDE_NUM*2;j++)
|
||||
if (j!=i) {
|
||||
dx2=objs[j].x-o->x;
|
||||
dy2=objs[j].y-o->y;
|
||||
@@ -626,7 +626,7 @@ U0 Init()
|
||||
someone_shooting=FALSE;
|
||||
shot_land_t=0;
|
||||
MemSet(&objs,0,sizeof(objs));
|
||||
for (i=0;i<NUM_PER_SIDE*2;i++) {
|
||||
for (i=0;i<PER_SIDE_NUM*2;i++) {
|
||||
objs[i].team=i&1;
|
||||
objs[i].x=Fs->pix_width/2;
|
||||
objs[i].y=2*Fs->pix_height/2;
|
||||
|
||||
+9
-9
@@ -1,4 +1,4 @@
|
||||
#define MAX_TABLE_SIZE 0x10000
|
||||
#define TABLE_SIZE_MAX 0x10000
|
||||
|
||||
I64 output_found,passes,table_size;
|
||||
|
||||
@@ -65,16 +65,16 @@ U8 *gate_type_lst="NULL\0OUTPUT\0INPUT\0"
|
||||
#define GT_OR3 10
|
||||
#define GT_NAND3 11
|
||||
#define GT_NOR3 12
|
||||
#define GT_NUM_ENTRIES 13
|
||||
#define GT_ENTRIES_NUM 13
|
||||
|
||||
#define MAX_SEL_GATES 128
|
||||
#define SEL_GATES_NUM 128
|
||||
|
||||
U8 *imgs[GT_NUM_ENTRIES]={NULL,NULL,NULL,
|
||||
U8 *imgs[GT_ENTRIES_NUM]={NULL,NULL,NULL,
|
||||
$IB,"<NOT>",BI=1$,$IB,"<AND>",BI=2$,$IB,"<OR>",BI=3$,$IB,"<NAND>",BI=4$,$IB,"<NOR>",BI=5$,$IB,"<XOR>",BI=6$,$IB,"<AND3>",BI=7$,$IB,"<OR3>",BI=8$,$IB,"<NAND3>",BI=9$,$IB,"<NOR3>",BI=10$};
|
||||
|
||||
I64 num_inputs_entered,num_outputs_entered;
|
||||
I64 num_sel_gates,
|
||||
sel_gates[MAX_SEL_GATES];
|
||||
sel_gates[SEL_GATES_NUM];
|
||||
|
||||
U0 GetGates()
|
||||
{
|
||||
@@ -83,12 +83,12 @@ U0 GetGates()
|
||||
|
||||
"\nEnter the available gate types in the order you prefer them to be used.\n"
|
||||
"Your choices are:\n";
|
||||
for (i=GT_FIRST_REAL_GATE;i<GT_NUM_ENTRIES;i++)
|
||||
for (i=GT_FIRST_REAL_GATE;i<GT_ENTRIES_NUM;i++)
|
||||
"%z ",i,gate_type_lst;
|
||||
'\n';
|
||||
|
||||
num_sel_gates=0;
|
||||
while (num_sel_gates<GT_NUM_ENTRIES) {
|
||||
while (num_sel_gates<GT_ENTRIES_NUM) {
|
||||
"%d",num_sel_gates;
|
||||
st=GetStr(" Gate: ");
|
||||
if (!*st) {
|
||||
@@ -110,13 +110,13 @@ U0 Init()
|
||||
|
||||
do {
|
||||
table_size=GetI64("\nTable size in hex (3 input=0x100,4=0x10000): ",0);
|
||||
if (table_size>MAX_TABLE_SIZE)
|
||||
if (table_size>TABLE_SIZE_MAX)
|
||||
"Too large\n";
|
||||
else if (table_size<1) {
|
||||
"No table specified, aborting.\n";
|
||||
throw;
|
||||
}
|
||||
} while (table_size>MAX_TABLE_SIZE);
|
||||
} while (table_size>TABLE_SIZE_MAX);
|
||||
|
||||
gate_type_table =CAlloc(table_size*sizeof(U8));
|
||||
displayed_design=MAlloc((table_size+7)/8);
|
||||
|
||||
@@ -71,7 +71,7 @@ U0 JukeSongPuppet(CTask *juke_task,I64 passes,I64 song_num,U8 *name)
|
||||
}
|
||||
|
||||
public U0 JukeSongsPuppet(U8 *dirname="~/Psalmody",I64 passes=2,
|
||||
I64 start_song=0,I64 end_song=MAX_I64)
|
||||
I64 start_song=0,I64 end_song=I64_MAX)
|
||||
{//Help make music video by puppeting JukeBox task.
|
||||
I64 i;
|
||||
CDirEntry *tmpde,*tmpde1;
|
||||
|
||||
@@ -48,14 +48,14 @@ $SP,"<15>",BI=15$
|
||||
$SP,"<16>",BI=16$
|
||||
$ID,-8$
|
||||
#define PSM_NOTE_SPACING 9
|
||||
#define PSM_NUM_DURATIONS 12
|
||||
#define PSM_DURATIONS_NUM 12
|
||||
|
||||
F64 psm_durations[PSM_NUM_DURATIONS+1]={
|
||||
F64 psm_durations[PSM_DURATIONS_NUM+1]={
|
||||
2*.25/3,.25,2*.5/3,.5,2.0/3.0,0.5*1.5,1.0,1.5,2.0,3.0,4.0,6.0,1000000.0};
|
||||
U8 *psm_duration_lst="st\0s\0et\0e\0qt\0e.\0q\0q.\0h\0h.\0w\0w.\0";
|
||||
U8 *psm_duration_imgs[PSM_NUM_DURATIONS]={
|
||||
U8 *psm_duration_imgs[PSM_DURATIONS_NUM]={
|
||||
$IB,"<1>",BI=1$,$IB,"<1>",BI=1$,$IB,"<2>",BI=2$,$IB,"<2>",BI=2$,$IB,"<3>",BI=3$,$IB,"<2>",BI=2$,$IB,"<3>",BI=3$,$IB,"<3>",BI=3$,$IB,"<4>",BI=4$,$IB,"<4>",BI=4$,$IB,"<5>",BI=5$,$IB,"<5>",BI=5$};
|
||||
Bool psm_triplet_durations[PSM_NUM_DURATIONS]={TRUE,FALSE,TRUE,
|
||||
Bool psm_triplet_durations[PSM_DURATIONS_NUM]={TRUE,FALSE,TRUE,
|
||||
FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE};
|
||||
|
||||
Bool PsmBlink()
|
||||
@@ -127,7 +127,7 @@ U0 PsmSetOctave(I64 octave)
|
||||
|
||||
U0 DrawNote(CDC *dc,I64 x,I64 y,I64 duration)
|
||||
{
|
||||
if (0<=duration<=PSM_NUM_DURATIONS) {
|
||||
if (0<=duration<=PSM_DURATIONS_NUM) {
|
||||
Sprite3(dc,x,y,0,psm_duration_imgs[duration]);
|
||||
if (psm_triplet_durations[duration])
|
||||
Sprite3(dc,x,y,0,$IB,"<16>",BI=16$);
|
||||
@@ -273,7 +273,7 @@ I64 PsmGetPickNoteBoxDuration(I64 xx,I64 yy)
|
||||
{
|
||||
I64 i,x1,x2;
|
||||
if (PSM_NOTE_BOX_Y-14<=yy<PSM_NOTE_BOX_Y+6) {
|
||||
for (i=0;i<PSM_NUM_DURATIONS;i++) {
|
||||
for (i=0;i<PSM_DURATIONS_NUM;i++) {
|
||||
PsmSetPickNoteBoxX(i,&x1);
|
||||
PsmSetPickNoteBoxX(i+1,&x2);
|
||||
if (x1<=xx+PSM_NOTE_SPACING/2<x2)
|
||||
@@ -286,7 +286,7 @@ I64 PsmGetPickNoteBoxDuration(I64 xx,I64 yy)
|
||||
U0 DrawPickNoteBox()
|
||||
{
|
||||
I64 i,x;
|
||||
for (i=0;i<PSM_NUM_DURATIONS;i++) {
|
||||
for (i=0;i<PSM_DURATIONS_NUM;i++) {
|
||||
PsmSetPickNoteBoxX(i,&x);
|
||||
if (PsmIsDotted(i))
|
||||
psm.dc2->color=RED;
|
||||
@@ -330,9 +330,9 @@ Bool PsmGetPickToolBox(I64 xx,I64 yy)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#define PSM_NUM_METERS 7
|
||||
I64 meter_tops[PSM_NUM_METERS] ={2,3,4,5,6,7,9},
|
||||
meter_bottoms[PSM_NUM_METERS]={4,4,4,4,8,8,8};
|
||||
#define PSM_METERS_NUM 7
|
||||
I64 meter_tops[PSM_METERS_NUM] ={2,3,4,5,6,7,9},
|
||||
meter_bottoms[PSM_METERS_NUM]={4,4,4,4,8,8,8};
|
||||
|
||||
#define PSM_METER_X 485
|
||||
#define PSM_METER_Y 13*FONT_HEIGHT
|
||||
@@ -340,7 +340,7 @@ I64 meter_tops[PSM_NUM_METERS] ={2,3,4,5,6,7,9},
|
||||
Bool PsmGetPickMeterBox(I64 xx,I64 yy,I64 *top,I64 *bottom)
|
||||
{
|
||||
I64 i;
|
||||
if (PSM_METER_X<=xx<PSM_METER_X+PSM_METER_W*PSM_NUM_METERS &&
|
||||
if (PSM_METER_X<=xx<PSM_METER_X+PSM_METER_W*PSM_METERS_NUM &&
|
||||
PSM_METER_Y<=yy<PSM_METER_Y+2*FONT_HEIGHT) {
|
||||
i=(xx-PSM_METER_X)/PSM_METER_W;
|
||||
*top=meter_tops[i];
|
||||
@@ -354,7 +354,7 @@ U0 DrawPickMeterBox()
|
||||
{
|
||||
I64 i;
|
||||
psm.dc2->color=BLACK;
|
||||
for (i=0;i<PSM_NUM_METERS;i++)
|
||||
for (i=0;i<PSM_METERS_NUM;i++)
|
||||
DrawTimeSignature(psm.dc2,PSM_METER_X+i*PSM_METER_W,PSM_METER_Y,
|
||||
meter_tops[i],meter_bottoms[i]);
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ U8 *PsmCvtSong()
|
||||
|
||||
i=0;
|
||||
tmpn=psm.head.next;
|
||||
last_octave=MIN_I64;
|
||||
last_octave=I64_MIN;
|
||||
last_duration=-1;
|
||||
while (tmpn!=&psm.head) {
|
||||
dst=&tmpn->ascii;
|
||||
|
||||
@@ -17,7 +17,7 @@ F64 PopUpDuration()
|
||||
"$$MU,\"Make Rest\",LE=PSMR_REST$$\n"
|
||||
"$$MU,\"Insert Note\",LE=PSMR_INS_NOTE$$\n"
|
||||
"$$MU,\"Delete Note\",LE=PSMR_DELETE_NOTE$$\n\n");
|
||||
for (i=0;i<PSM_NUM_DURATIONS;i++)
|
||||
for (i=0;i<PSM_DURATIONS_NUM;i++)
|
||||
DocPrint(doc,"$$MU,\"%7.5f\",LE=%d$$\n",psm_durations[i],i);
|
||||
DocPrint(doc,"\n$$MU,\"CANCEL\",LE=DOCM_CANCEL$$\n");
|
||||
i=PopUpMenu(doc);
|
||||
@@ -35,7 +35,7 @@ U0 PsmRightClick(I64 x,I64 y)
|
||||
if (tmpn!=&psm.head) {
|
||||
Fs->win_inhibit=WIG_USER_TASK_DFT;
|
||||
i=PopUpDuration;
|
||||
if (0<=i<PSM_NUM_DURATIONS) {
|
||||
if (0<=i<PSM_DURATIONS_NUM) {
|
||||
if (tmpn->type==PSMT_NOTE)
|
||||
tmpn->duration=i;
|
||||
} else {
|
||||
@@ -240,7 +240,7 @@ U0 PsmLeftClick(I64 x,I64 y)
|
||||
PsmLeftClickStaffBox(x,y);
|
||||
} else {
|
||||
duration=PsmGetPickNoteBoxDuration(x,y);
|
||||
if (0<=duration<PSM_NUM_DURATIONS)
|
||||
if (0<=duration<PSM_DURATIONS_NUM)
|
||||
PsmLeftClickPickNoteBox(duration);
|
||||
else if (PsmGetPickMeterBox(x,y,&top,&bottom))
|
||||
PsmLeftClickPickMeterBox(top,bottom);
|
||||
@@ -253,7 +253,7 @@ U8 PsmCvtDuration(F64 d)
|
||||
{
|
||||
F64 d1,d2;
|
||||
I64 j;
|
||||
for (j=0;j<PSM_NUM_DURATIONS;j++) {
|
||||
for (j=0;j<PSM_DURATIONS_NUM;j++) {
|
||||
d1=psm_durations[j];
|
||||
d2=psm_durations[j+1];
|
||||
if (d<d1*d2/(d1+d2))
|
||||
@@ -262,7 +262,7 @@ U8 PsmCvtDuration(F64 d)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define PSM_NUM_KEYS 20
|
||||
#define PSM_KEYS_NUM 20
|
||||
class PsmKey
|
||||
{
|
||||
U8 x,w,h,ascii;
|
||||
@@ -273,7 +273,7 @@ class PsmKey
|
||||
#define PSM_B_W 8
|
||||
#define PSM_B_H 20
|
||||
|
||||
PsmKey psm_kbd[PSM_NUM_KEYS]={
|
||||
PsmKey psm_kbd[PSM_KEYS_NUM]={
|
||||
{ 2*PSM_W_W-4,PSM_B_W,PSM_B_H,'e' },
|
||||
{ 3*PSM_W_W-4,PSM_B_W,PSM_B_H,'r' },
|
||||
{ 4*PSM_W_W-4,PSM_B_W,PSM_B_H,'t' },
|
||||
@@ -304,7 +304,7 @@ U0 PsmDownKey(I64 x,I64 y)
|
||||
y-=FONT_HEIGHT*13;
|
||||
if (0<=y<PSM_W_H) {
|
||||
x-=16;
|
||||
for (i=0;i<PSM_NUM_KEYS;i++) {
|
||||
for (i=0;i<PSM_KEYS_NUM;i++) {
|
||||
o=&psm_kbd[i];
|
||||
if (o->x<=x<o->x+o->w && y<o->h) {
|
||||
Msg(MSG_KEY_DOWN,o->ascii,0);
|
||||
@@ -321,7 +321,7 @@ U0 PsmUpKey(I64 x,I64 y)
|
||||
y-=FONT_HEIGHT*13;
|
||||
if (0<=y<PSM_W_H) {
|
||||
x-=16;
|
||||
for (i=0;i<PSM_NUM_KEYS;i++) {
|
||||
for (i=0;i<PSM_KEYS_NUM;i++) {
|
||||
o=&psm_kbd[i];
|
||||
if (o->x<=x<o->x+o->w && y<o->h) {
|
||||
Msg(MSG_KEY_UP,o->ascii,0);
|
||||
|
||||
+2
-2
@@ -34,8 +34,8 @@ CColorROPU32 run_colors[2]={RED,GREEN};
|
||||
#define MD_WIRE 3
|
||||
#define MD_MOVE 4
|
||||
#define MD_DELETE 5
|
||||
#define MD_NUM_MODES 6
|
||||
CColorROPU32 mode_colors[MD_NUM_MODES]=
|
||||
#define MD_MODES_NUM 6
|
||||
CColorROPU32 mode_colors[MD_MODES_NUM]=
|
||||
{BROWN,LTGRAY,DKGRAY,RED,PURPLE,RED};
|
||||
DefineLstLoad("ST_SPAN_MODES","Mass\0Concrete\0Steel\0Wire\0Move\0Delete\0");
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ U0 Span()
|
||||
bt_run =CtrlBttnNew(0,0, 80,,
|
||||
2,"Stopped\0Running\0",run_colors,&run_bttn);
|
||||
bt_mode=CtrlBttnNew(0,3.0*FONT_HEIGHT,80,,
|
||||
MD_NUM_MODES,Define("ST_SPAN_MODES"),mode_colors,&mode_bttn);
|
||||
MD_MODES_NUM,Define("ST_SPAN_MODES"),mode_colors,&mode_bttn);
|
||||
a.saved_ode=NULL;
|
||||
|
||||
Fs->win_inhibit|=WIG_DBL_CLICK;
|
||||
@@ -386,7 +386,7 @@ U0 Span()
|
||||
break;
|
||||
case MSG_MS_R_DOWN:
|
||||
mode_bttn.state++;
|
||||
if (mode_bttn.state>=MD_NUM_MODES)
|
||||
if (mode_bttn.state>=MD_MODES_NUM)
|
||||
mode_bttn.state=0;
|
||||
cursor_mass=tmpm1=tmpm2=NULL;
|
||||
break;
|
||||
|
||||
+13
-13
@@ -7,8 +7,8 @@ $SP,"<2>",BI=2$
|
||||
$SP,"<3>",BI=3$
|
||||
|
||||
$BG$
|
||||
#define NUM_STARS 8192
|
||||
I64 stars_x[NUM_STARS],stars_y[NUM_STARS];
|
||||
#define STARS_NUM 8192
|
||||
I64 stars_x[STARS_NUM],stars_y[STARS_NUM];
|
||||
|
||||
#define RADIUS 7
|
||||
|
||||
@@ -25,8 +25,8 @@ class MySpring:CSpring
|
||||
//Main Modses
|
||||
#define MMD_EDIT 0
|
||||
#define MMD_PLAY 1
|
||||
#define MMD_NUM_MODES 2
|
||||
CColorROPU32 main_mode_colors[MMD_NUM_MODES]={LTRED,LTGREEN};
|
||||
#define MMD_MODES_NUM 2
|
||||
CColorROPU32 main_mode_colors[MMD_MODES_NUM]={LTRED,LTGREEN};
|
||||
DefineLstLoad("ST_MAIN_MODES","Edit\0Play\0");
|
||||
CCtrlBttnState main_mode_bttn;
|
||||
|
||||
@@ -36,8 +36,8 @@ CCtrlBttnState main_mode_bttn;
|
||||
#define EMD_CONNECTOR 2
|
||||
#define EMD_THRUSTER 3
|
||||
#define EMD_MOVE 4
|
||||
#define EMD_NUM_MODES 5
|
||||
CColorROPU32 edit_mode_colors[EMD_NUM_MODES]={LTGRAY,LTCYAN,CYAN,YELLOW,LTBLUE};
|
||||
#define EMD_MODES_NUM 5
|
||||
CColorROPU32 edit_mode_colors[EMD_MODES_NUM]={LTGRAY,LTCYAN,CYAN,YELLOW,LTBLUE};
|
||||
DefineLstLoad("ST_EDIT_MODES","Mass\0Spring\0Connector\0Thruster\0Move\0");
|
||||
CCtrlBttnState edit_mode_bttn;
|
||||
|
||||
@@ -100,7 +100,7 @@ U0 DrawIt(CTask *,CDC *dc)
|
||||
case MMD_PLAY:
|
||||
task->text_attr=BLACK<<4+WHITE;
|
||||
dc->color=WHITE;
|
||||
for (i=0;i<NUM_STARS;i++)
|
||||
for (i=0;i<STARS_NUM;i++)
|
||||
GrPlot3(dc,stars_x[i],stars_y[i],0);
|
||||
break;
|
||||
}
|
||||
@@ -293,7 +293,7 @@ U0 Init()
|
||||
task=Fs;
|
||||
for (i=0;i<=9;i++)
|
||||
action_scan_codes[i]=Char2ScanCode('0'+i);
|
||||
for (i=0;i<NUM_STARS;i++) {
|
||||
for (i=0;i<STARS_NUM;i++) {
|
||||
stars_x[i]=RandU32%8192-4096;
|
||||
stars_y[i]=RandU32%8192-4096;
|
||||
}
|
||||
@@ -378,7 +378,7 @@ U0 PlayShip()
|
||||
ode->drag_v3=0.0001;
|
||||
break;
|
||||
case CH_SPACE:
|
||||
if (++main_mode_bttn.state==MMD_NUM_MODES)
|
||||
if (++main_mode_bttn.state==MMD_MODES_NUM)
|
||||
main_mode_bttn.state=0;
|
||||
GetMsg(,,1<<MSG_KEY_UP);
|
||||
goto ps_done;
|
||||
@@ -415,7 +415,7 @@ U0 EditShip()
|
||||
F64 wx,wy;
|
||||
Bool okay;
|
||||
MyMass *tmpm1=NULL,*tmpm2=NULL;
|
||||
CCtrl *bt_edit_mode=CtrlBttnNew(0,5*FONT_HEIGHT+4,80,,EMD_NUM_MODES,
|
||||
CCtrl *bt_edit_mode=CtrlBttnNew(0,5*FONT_HEIGHT+4,80,,EMD_MODES_NUM,
|
||||
Define("ST_EDIT_MODES"),edit_mode_colors,&edit_mode_bttn);
|
||||
ode->flags|=ODEF_PAUSED;
|
||||
MenuPush(
|
||||
@@ -516,7 +516,7 @@ U0 EditShip()
|
||||
}
|
||||
break;
|
||||
case MSG_MS_R_DOWN:
|
||||
if (++edit_mode_bttn.state==EMD_NUM_MODES)
|
||||
if (++edit_mode_bttn.state==EMD_MODES_NUM)
|
||||
edit_mode_bttn.state=0;
|
||||
break;
|
||||
case MSG_MS_R_UP:
|
||||
@@ -560,7 +560,7 @@ U0 EditShip()
|
||||
Spawn(&Zoom,0.5(I64));
|
||||
break;
|
||||
case CH_SPACE:
|
||||
if (++main_mode_bttn.state==MMD_NUM_MODES)
|
||||
if (++main_mode_bttn.state==MMD_MODES_NUM)
|
||||
main_mode_bttn.state=0;
|
||||
GetMsg(,,1<<MSG_KEY_UP);
|
||||
goto es_done;
|
||||
@@ -615,7 +615,7 @@ U0 Strut()
|
||||
|
||||
PressAKey;
|
||||
bt_main_mode=CtrlBttnNew(
|
||||
(GR_WIDTH-4*FONT_WIDTH-16)>>1,1*FONT_HEIGHT+4,80,,MMD_NUM_MODES,
|
||||
(GR_WIDTH-4*FONT_WIDTH-16)>>1,1*FONT_HEIGHT+4,80,,MMD_MODES_NUM,
|
||||
Define("ST_MAIN_MODES"),main_mode_colors,&main_mode_bttn);
|
||||
DocClear;
|
||||
Init;
|
||||
|
||||
+38
-38
@@ -19,9 +19,9 @@ F64
|
||||
#define PHASES_GROUPS 8
|
||||
#define HACK_DIST 5
|
||||
|
||||
#define U_NUM_ENEMY (PHASES_GROUPS*64)
|
||||
#define U_NUM_FRIENDLY (PHASES_GROUPS*16)
|
||||
#define U_NUM (U_NUM_FRIENDLY+U_NUM_ENEMY)
|
||||
#define U_ENEMY_NUM (PHASES_GROUPS*64)
|
||||
#define U_FRIENDLY_NUM (PHASES_GROUPS*16)
|
||||
#define U_NUM (U_FRIENDLY_NUM+U_ENEMY_NUM)
|
||||
class Unit
|
||||
{
|
||||
I64 x,y,best_dd;
|
||||
@@ -181,8 +181,8 @@ U8 *enemy_hacking_imgs[4]={$IB,"<14>",BI=14$,$IB,"<13>",BI=13$,$IB,"<14>",BI=14$
|
||||
|
||||
|
||||
$BG$
|
||||
#define LS_NUM_APTS 20
|
||||
#define LS_NUM_MOUNTAINS 3
|
||||
#define LS_APTS_NUM 20
|
||||
#define LS_MOUNTAINS_NUM 3
|
||||
#define LS_NUM 128
|
||||
class LandScapeItem
|
||||
{
|
||||
@@ -456,7 +456,7 @@ U0 ExplosionDo(I64 x,I64 y,I64 scroll_y)
|
||||
ManDie(tmpu,TRUE);
|
||||
}
|
||||
}
|
||||
for (i=0;i<LS_NUM_APTS;i++) {
|
||||
for (i=0;i<LS_APTS_NUM;i++) {
|
||||
x2=ls[i].x;
|
||||
y2=(ls[i].y-scroll_y)&(MAP_HEIGHT-1);
|
||||
if (SqrI64(x-x2)+SqrI64(y-y2)<100*100) {
|
||||
@@ -514,7 +514,7 @@ U0 CheckCollisions()
|
||||
}
|
||||
}
|
||||
if (!tmpb->dead)
|
||||
for (i=0;i<LS_NUM_APTS;i++)
|
||||
for (i=0;i<LS_APTS_NUM;i++)
|
||||
if (2*SqrI64(x-ls[i].x)+
|
||||
3*SqrI64(y+35-(ls[i].y-scroll_y)&(MAP_HEIGHT-1))<2*60*60) {
|
||||
tmpb->dead=TRUE;
|
||||
@@ -543,38 +543,38 @@ U0 Init()
|
||||
é=-ã/2;
|
||||
|
||||
for (i=0;i<LS_NUM;i++) {
|
||||
ls[i].x=(Fs->pix_width-100)*RandU32/MAX_U32+50;
|
||||
ls[i].y=(MAP_HEIGHT-100)*RandU32/MAX_U32+50;
|
||||
ls[i].x=(Fs->pix_width-100)*RandU32/U32_MAX+50;
|
||||
ls[i].y=(MAP_HEIGHT-100)*RandU32/U32_MAX+50;
|
||||
ls[i].img=landscape_imgs[RandU16%(LS_TYPES-2)];
|
||||
}
|
||||
|
||||
for (i=0;i<LS_NUM_APTS;i++)
|
||||
for (i=0;i<LS_APTS_NUM;i++)
|
||||
ls[i].img=landscape_imgs[LS_TYPES-1]; //Apartment
|
||||
|
||||
for (;i<LS_NUM_APTS+LS_NUM_MOUNTAINS;i++)
|
||||
for (;i<LS_APTS_NUM+LS_MOUNTAINS_NUM;i++)
|
||||
ls[i].img=landscape_imgs[LS_TYPES-2]; //mountain
|
||||
|
||||
MemSet(u,0,sizeof(u));
|
||||
for (i=0,tmpu=u;i<U_NUM;i++,tmpu++) {
|
||||
if (i<U_NUM_FRIENDLY) {
|
||||
if (i<U_FRIENDLY_NUM) {
|
||||
tmpu->friendly=TRUE;
|
||||
if (!(i&7)) {
|
||||
xx=(Fs->pix_width-200)*RandU32/MAX_U32;
|
||||
yy=(MAP_HEIGHT-200)*RandU32/MAX_U32;
|
||||
xx=(Fs->pix_width-200)*RandU32/U32_MAX;
|
||||
yy=(MAP_HEIGHT-200)*RandU32/U32_MAX;
|
||||
}
|
||||
} else {
|
||||
tmpu->friendly=FALSE;
|
||||
if (!(i&31)) {
|
||||
xx=(Fs->pix_width-200)*RandU32/MAX_U32;
|
||||
yy=(MAP_HEIGHT-200)*RandU32/MAX_U32;
|
||||
xx=(Fs->pix_width-200)*RandU32/U32_MAX;
|
||||
yy=(MAP_HEIGHT-200)*RandU32/U32_MAX;
|
||||
}
|
||||
if (!(i&15))
|
||||
tmpu->tank=TRUE;
|
||||
}
|
||||
tmpu->dead=FALSE;
|
||||
tmpu->x=xx+64*RandI32/MAX_I32+100;
|
||||
tmpu->y=yy+64*RandU32/MAX_I32-64+100;
|
||||
tmpu->best_dd=MAX_I64;
|
||||
tmpu->x=xx+64*RandI32/I32_MAX+100;
|
||||
tmpu->y=yy+64*RandU32/I32_MAX-64+100;
|
||||
tmpu->best_dd=I64_MAX;
|
||||
tmpu->é=ã/2;
|
||||
tmpu->phase=2*ã*Rand;
|
||||
}
|
||||
@@ -584,8 +584,8 @@ U0 Init()
|
||||
e[i].dead=TRUE;
|
||||
e[i].num=i;
|
||||
}
|
||||
friendly_left=U_NUM_FRIENDLY;
|
||||
enemy_left =U_NUM_ENEMY;
|
||||
friendly_left=U_FRIENDLY_NUM;
|
||||
enemy_left =U_ENEMY_NUM;
|
||||
enemy_by_friendly=0;
|
||||
bullets_fired=0;
|
||||
missile_bmp =15;
|
||||
@@ -661,11 +661,11 @@ Bool FireMissile(I64 n)
|
||||
U0 MenMove(I64 phase_group)
|
||||
{
|
||||
I64 i,j,dd,best,best_dd;
|
||||
for (i=phase_group;i<U_NUM_FRIENDLY;i+=PHASES_GROUPS) {
|
||||
for (i=phase_group;i<U_FRIENDLY_NUM;i+=PHASES_GROUPS) {
|
||||
if (!u[i].dead) {
|
||||
best=U_NUM_FRIENDLY;
|
||||
best_dd=MAX_I64;
|
||||
for (j=U_NUM_FRIENDLY;j<U_NUM;j++) {
|
||||
best=U_FRIENDLY_NUM;
|
||||
best_dd=I64_MAX;
|
||||
for (j=U_FRIENDLY_NUM;j<U_NUM;j++) {
|
||||
if (!u[j].dead) {
|
||||
dd=SqrI64(u[i].x-u[j].x)+SqrI64(u[i].y-u[j].y);
|
||||
if (dd<best_dd) {
|
||||
@@ -675,18 +675,18 @@ U0 MenMove(I64 phase_group)
|
||||
}
|
||||
}
|
||||
u[i].best_dd=best_dd;
|
||||
if (best_dd!=MAX_I64) {
|
||||
if (best_dd!=I64_MAX) {
|
||||
u[i].x+=4*SignI64(u[best].x-u[i].x);
|
||||
u[i].y+=4*SignI64(u[best].y-u[i].y);
|
||||
u[i].é=Arg(u[best].x-u[i].x,u[best].y-u[i].y);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i=U_NUM_FRIENDLY+phase_group;i<U_NUM;i+=PHASES_GROUPS) {
|
||||
for (i=U_FRIENDLY_NUM+phase_group;i<U_NUM;i+=PHASES_GROUPS) {
|
||||
if (!u[i].dead) {
|
||||
best=0;
|
||||
best_dd=MAX_I64;
|
||||
for (j=0;j<U_NUM_FRIENDLY;j++) {
|
||||
best_dd=I64_MAX;
|
||||
for (j=0;j<U_FRIENDLY_NUM;j++) {
|
||||
if (!u[j].dead) {
|
||||
dd=SqrI64(u[i].x-u[j].x)+SqrI64(u[i].y-u[j].y);
|
||||
if (dd<best_dd) {
|
||||
@@ -696,7 +696,7 @@ U0 MenMove(I64 phase_group)
|
||||
}
|
||||
}
|
||||
u[i].best_dd=best_dd;
|
||||
if (best_dd!=MAX_I64) {
|
||||
if (best_dd!=I64_MAX) {
|
||||
u[i].x+=4*SignI64(u[best].x-u[i].x);
|
||||
u[i].y+=4*SignI64(u[best].y-u[i].y);
|
||||
u[i].é=Arg(u[best].x-u[i].x,u[best].y-u[i].y);
|
||||
@@ -708,11 +708,11 @@ U0 MenMove(I64 phase_group)
|
||||
U0 MenFight(I64 phase_group)
|
||||
{
|
||||
I64 i,j,dd,best,best_dd;
|
||||
for (i=phase_group;i<U_NUM_FRIENDLY;i+=PHASES_GROUPS) {
|
||||
for (i=phase_group;i<U_FRIENDLY_NUM;i+=PHASES_GROUPS) {
|
||||
if (!u[i].dead) {
|
||||
best=U_NUM_FRIENDLY;
|
||||
best_dd=MAX_I64;
|
||||
for (j=U_NUM_FRIENDLY;j<U_NUM;j++) {
|
||||
best=U_FRIENDLY_NUM;
|
||||
best_dd=I64_MAX;
|
||||
for (j=U_FRIENDLY_NUM;j<U_NUM;j++) {
|
||||
if (!u[j].dead && u[i].y-u[j].y<8) {
|
||||
dd=SqrI64(u[i].x-u[j].x)+SqrI64(u[i].y-u[j].y);
|
||||
if (dd<best_dd) {
|
||||
@@ -726,11 +726,11 @@ U0 MenFight(I64 phase_group)
|
||||
ManDie(&u[best],FALSE);
|
||||
}
|
||||
}
|
||||
for (i=U_NUM_FRIENDLY+phase_group;i<U_NUM;i+=PHASES_GROUPS) {
|
||||
for (i=U_FRIENDLY_NUM+phase_group;i<U_NUM;i+=PHASES_GROUPS) {
|
||||
if (!u[i].dead) {
|
||||
best=0;
|
||||
best_dd=MAX_I64;
|
||||
for (j=0;j<U_NUM_FRIENDLY;j++) {
|
||||
best_dd=I64_MAX;
|
||||
for (j=0;j<U_FRIENDLY_NUM;j++) {
|
||||
if (!u[j].dead&& u[i].y-u[j].y<8) {
|
||||
dd=SqrI64(u[i].x-u[j].x)+SqrI64(u[i].y-u[j].y);
|
||||
if (dd<best_dd) {
|
||||
@@ -898,7 +898,7 @@ U0 Titanium()
|
||||
}
|
||||
SleepUntil(next_update_jiffy);
|
||||
|
||||
total_score=3*(U_NUM_ENEMY-enemy_left)+5*enemy_by_friendly
|
||||
total_score=3*(U_ENEMY_NUM-enemy_left)+5*enemy_by_friendly
|
||||
-100*friendly_fire-10*(tS-t0)-bullets_fired;
|
||||
if (game_over) {
|
||||
tf=tS;
|
||||
|
||||
@@ -4,7 +4,7 @@ U0 PlayerIndirect()
|
||||
I64 i,remaining=0,msg_code,arg1,arg2;
|
||||
F64 target_x,target_y;
|
||||
ViewPlayerSet(cur_player);
|
||||
for (i=0;i<MAX_UNITS;i++) {
|
||||
for (i=0;i<UNITS_NUM;i++) {
|
||||
tmpu=&units[cur_player][i];
|
||||
if (tmpu->life>0 && tmpu->indirect_fire)
|
||||
remaining++;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
Unit *UnitNearestFind(I64 row,I64 col,I64 player,Bool in_LOS,F64 range=-1)
|
||||
{
|
||||
I64 i;
|
||||
F64 dd,best_dd=MAX_F64,x1,y1,x2,y2;
|
||||
F64 dd,best_dd=F64_MAX,x1,y1,x2,y2;
|
||||
Unit *best=NULL;
|
||||
//$LK,"Sqrt",A="MN:Sqrt"$() is slow, so work with squared distances.
|
||||
if (range<0)
|
||||
range=MAX_F64;
|
||||
range=F64_MAX;
|
||||
else
|
||||
range*=range;
|
||||
RowCol2XY(&x1,&y1,row,col);
|
||||
for (i=0;i<MAX_UNITS;i++)
|
||||
for (i=0;i<UNITS_NUM;i++)
|
||||
if (units[player][i].life>0) {
|
||||
if (!in_LOS || LOS(row,col,units[player][i].row,units[player][i].col)) {
|
||||
RowCol2XY(&x2,&y2,units[player][i].row,units[player][i].col);
|
||||
@@ -27,7 +27,7 @@ U0 PlayerIndirect()
|
||||
{
|
||||
Unit *target,*tmpu;
|
||||
I64 i;
|
||||
for (i=0;i<MAX_UNITS;i++) {
|
||||
for (i=0;i<UNITS_NUM;i++) {
|
||||
UserChk;
|
||||
tmpu=&units[cur_player][i];
|
||||
if (tmpu->life>0 && tmpu->indirect_fire &&
|
||||
@@ -43,7 +43,7 @@ U0 PlayerMove()
|
||||
Unit *target,*tmpu;
|
||||
I64 i;
|
||||
F64 x,y;
|
||||
for (i=0;i<MAX_UNITS;i++) {
|
||||
for (i=0;i<UNITS_NUM;i++) {
|
||||
UserChk;
|
||||
tmpu=&units[cur_player][i];
|
||||
if (tmpu->life>0) {
|
||||
@@ -64,7 +64,7 @@ U0 PlayerDirect()
|
||||
{
|
||||
Unit *target,*tmpu;
|
||||
I64 i;
|
||||
for (i=0;i<MAX_UNITS;i++) {
|
||||
for (i=0;i<UNITS_NUM;i++) {
|
||||
UserChk;
|
||||
tmpu=&units[cur_player][i];
|
||||
if (tmpu->life>0 && !tmpu->indirect_fire &&
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
#define MAP_WIDTH 640 //Change this, if you like.
|
||||
#define MAX_UNITS 32 //Change this, if you like.
|
||||
#define UNITS_NUM 32 //Change this, if you like.
|
||||
#define HEX_SIDE 11
|
||||
|
||||
U0 InitDefines()
|
||||
@@ -60,10 +60,10 @@ class Unit
|
||||
Bool vis[2],fired,infantry,indirect_fire,pad[3];
|
||||
};
|
||||
|
||||
Unit units[2][MAX_UNITS];
|
||||
Unit units[2][UNITS_NUM];
|
||||
|
||||
// Bt(vis_unit_bitmap,player1+player0*((MAX_UNITS+7)&~7))
|
||||
U8 vis_unit_bitmap[2][(((MAX_UNITS+7)&~7)*MAX_UNITS)>>3];
|
||||
// Bt(vis_unit_bitmap,player1+player0*((UNITS_NUM+7)&~7))
|
||||
U8 vis_unit_bitmap[2][(((UNITS_NUM+7)&~7)*UNITS_NUM)>>3];
|
||||
|
||||
#define PHASE_START 0
|
||||
#define PHASE_INDIRECT 0
|
||||
|
||||
@@ -234,7 +234,7 @@ U0 InitUnits()
|
||||
I64 i,j,row,col,type;
|
||||
Unit *tmpu;
|
||||
MemSet(units,0,sizeof(units));
|
||||
alive_cnt[0]=alive_cnt[1]=MAX_UNITS;
|
||||
alive_cnt[0]=alive_cnt[1]=UNITS_NUM;
|
||||
for (j=0;j<2;j++)
|
||||
for (i=0;i<alive_cnt[j];i++) {
|
||||
tmpu=&units[j][i];
|
||||
@@ -243,25 +243,25 @@ U0 InitUnits()
|
||||
tmpu->life=100;
|
||||
tmpu->facing=RandU16%6;
|
||||
if (!j) {
|
||||
if (i>=MAX_UNITS/2) {
|
||||
if (i>=15*MAX_UNITS/16)
|
||||
if (i>=UNITS_NUM/2) {
|
||||
if (i>=15*UNITS_NUM/16)
|
||||
type=UT_ARTILLERY;
|
||||
else
|
||||
type=UT_INFANTRY;
|
||||
} else {
|
||||
if (i>=MAX_UNITS/4)
|
||||
if (i>=UNITS_NUM/4)
|
||||
type=UT_MD_TANK;
|
||||
else
|
||||
type=UT_LT_TANK;
|
||||
}
|
||||
} else {
|
||||
if (i>=MAX_UNITS/2) {
|
||||
if (i>=15*MAX_UNITS/16)
|
||||
if (i>=UNITS_NUM/2) {
|
||||
if (i>=15*UNITS_NUM/16)
|
||||
type=UT_ARTILLERY;
|
||||
else
|
||||
type=UT_INFANTRY;
|
||||
} else {
|
||||
if (i>=MAX_UNITS/4)
|
||||
if (i>=UNITS_NUM/4)
|
||||
type=UT_MD_TANK;
|
||||
else
|
||||
type=UT_LT_TANK;
|
||||
|
||||
@@ -61,7 +61,7 @@ Unit *UnitFind(I64 row,I64 col)
|
||||
{//Finds unit in a hexagon.
|
||||
I64 i,j;
|
||||
for (j=0;j<2;j++)
|
||||
for (i=0;i<MAX_UNITS;i++)
|
||||
for (i=0;i<UNITS_NUM;i++)
|
||||
if (units[j][i].life>0 &&
|
||||
units[j][i].row==row &&
|
||||
units[j][i].col==col)
|
||||
|
||||
+20
-20
@@ -22,7 +22,7 @@ U0 VRSetUp(I64 player)
|
||||
Unit *ut0,*ut1;
|
||||
ut0=&units[player][0];
|
||||
ut1=&units[player^1][0];
|
||||
for (i=0;i<MAX_UNITS;i++,ut0++,ut1++) {
|
||||
for (i=0;i<UNITS_NUM;i++,ut0++,ut1++) {
|
||||
LBtr(&ut1->vis[player],0);
|
||||
LBEqu(&ut0->vis[player],0,ut0->life>0);
|
||||
}
|
||||
@@ -32,15 +32,15 @@ U0 VRMerge(I64 player)
|
||||
{
|
||||
I64 i,j;
|
||||
Unit *ut1;
|
||||
U8 *dst,*src,*mask=CAlloc((MAX_UNITS+7)>>3);
|
||||
for (j=0;j<MAX_UNITS;j++) {//p0
|
||||
src=&vis_unit_bitmap[player][(((MAX_UNITS+7)&~7)*j)>>3];
|
||||
U8 *dst,*src,*mask=CAlloc((UNITS_NUM+7)>>3);
|
||||
for (j=0;j<UNITS_NUM;j++) {//p0
|
||||
src=&vis_unit_bitmap[player][(((UNITS_NUM+7)&~7)*j)>>3];
|
||||
dst=mask;
|
||||
for (i=0;i<(MAX_UNITS+7)>>3;i++) //player1
|
||||
for (i=0;i<(UNITS_NUM+7)>>3;i++) //player1
|
||||
*dst++|=*src++;
|
||||
}
|
||||
ut1=&units[player^1][0];
|
||||
for (j=0;j<MAX_UNITS;j++,ut1++)
|
||||
for (j=0;j<UNITS_NUM;j++,ut1++)
|
||||
LBEqu(&ut1->vis[player],0,Bt(mask,j) && ut1->life>0);
|
||||
Free(mask);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ Bool MPVisRecalc(MPCtrl1 *job)
|
||||
case VR_UPDATE_FRIENDLY_UNIT:
|
||||
case VR_ONE_FRIENDLY_UNIT:
|
||||
if (job->mode==VR_UPDATE_FRIENDLY_UNIT)
|
||||
range=MAX_F64;
|
||||
range=F64_MAX;
|
||||
RowCol2XY(&x1,&y1,row,col);
|
||||
for (i=job->lo;i<job->hi;i++,ut1++) {
|
||||
seen=FALSE;
|
||||
@@ -78,7 +78,7 @@ Bool MPVisRecalc(MPCtrl1 *job)
|
||||
}
|
||||
if (job->mode==VR_UPDATE_FRIENDLY_UNIT)
|
||||
LBEqu(&vis_unit_bitmap[cur_player],
|
||||
i+job->tmpu->num*((MAX_UNITS+7)&~7),seen);
|
||||
i+job->tmpu->num*((UNITS_NUM+7)&~7),seen);
|
||||
}
|
||||
break;
|
||||
case VR_ONE_ENEMY_UNIT:
|
||||
@@ -87,15 +87,15 @@ Bool MPVisRecalc(MPCtrl1 *job)
|
||||
if (ut1->life>0 &&
|
||||
LOS(row,col,ut1->row,ut1->col)) {
|
||||
LBts(&vis_unit_bitmap[enemy_player],
|
||||
job->tmpu->num+i*((MAX_UNITS+7)&~7));
|
||||
job->tmpu->num+i*((UNITS_NUM+7)&~7));
|
||||
res=TRUE;
|
||||
} else
|
||||
LBtr(&vis_unit_bitmap[enemy_player],
|
||||
job->tmpu->num+i*((MAX_UNITS+7)&~7));
|
||||
job->tmpu->num+i*((UNITS_NUM+7)&~7));
|
||||
break;
|
||||
case VR_ALL_UNITS:
|
||||
ut0=&units[cur_player][0];
|
||||
for (i=0;i<MAX_UNITS;i++,ut0++)
|
||||
for (i=0;i<UNITS_NUM;i++,ut0++)
|
||||
if (ut0->life>0) {
|
||||
RowCol2XY(&x1,&y1,ut0->row,ut0->col);
|
||||
ut1=&units[enemy_player][job->lo];
|
||||
@@ -103,15 +103,15 @@ Bool MPVisRecalc(MPCtrl1 *job)
|
||||
if (ut1->life>0 &&
|
||||
LOS(ut0->row,ut0->col,ut1->row,ut1->col)) {
|
||||
LBts(&ut1->vis[cur_player],0);
|
||||
LBts(&vis_unit_bitmap[cur_player],j+i*((MAX_UNITS+7)&~7));
|
||||
LBts(&vis_unit_bitmap[cur_player],j+i*((UNITS_NUM+7)&~7));
|
||||
} else
|
||||
LBtr(&vis_unit_bitmap[cur_player],j+i*((MAX_UNITS+7)&~7));
|
||||
LBtr(&vis_unit_bitmap[cur_player],j+i*((UNITS_NUM+7)&~7));
|
||||
}
|
||||
} else
|
||||
for (j=job->lo;j<job->hi;j++)
|
||||
LBtr(&vis_unit_bitmap[cur_player],j+i*((MAX_UNITS+7)&~7));
|
||||
LBtr(&vis_unit_bitmap[cur_player],j+i*((UNITS_NUM+7)&~7));
|
||||
ut0=&units[enemy_player][0];
|
||||
for (i=0;i<MAX_UNITS;i++,ut0++)
|
||||
for (i=0;i<UNITS_NUM;i++,ut0++)
|
||||
if (ut0->life>0) {
|
||||
RowCol2XY(&x1,&y1,ut0->row,ut0->col);
|
||||
ut1=&units[cur_player][job->lo];
|
||||
@@ -119,13 +119,13 @@ Bool MPVisRecalc(MPCtrl1 *job)
|
||||
if (ut1->life>0 &&
|
||||
LOS(ut0->row,ut0->col,ut1->row,ut1->col)) {
|
||||
LBts(&ut1->vis[enemy_player],0);
|
||||
LBts(&vis_unit_bitmap[enemy_player],j+i*((MAX_UNITS+7)&~7));
|
||||
LBts(&vis_unit_bitmap[enemy_player],j+i*((UNITS_NUM+7)&~7));
|
||||
} else
|
||||
LBtr(&vis_unit_bitmap[enemy_player],j+i*((MAX_UNITS+7)&~7));
|
||||
LBtr(&vis_unit_bitmap[enemy_player],j+i*((UNITS_NUM+7)&~7));
|
||||
}
|
||||
} else
|
||||
for (j=job->lo;j<job->hi;j++)
|
||||
LBtr(&vis_unit_bitmap[enemy_player],j+i*((MAX_UNITS+7)&~7));
|
||||
LBtr(&vis_unit_bitmap[enemy_player],j+i*((UNITS_NUM+7)&~7));
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
@@ -148,13 +148,13 @@ $LK,"MAlloc",A="MN:MAlloc"$() would probably be the better choice.
|
||||
|
||||
if (mode==VR_FRIENDLY_UNIT_DIED) {
|
||||
MemSet((&vis_unit_bitmap[enemy_player])(U8 *)+
|
||||
(tmpu->num*((MAX_UNITS+7)&~7))>>3,0,(MAX_UNITS+7)>>3);
|
||||
(tmpu->num*((UNITS_NUM+7)&~7))>>3,0,(UNITS_NUM+7)>>3);
|
||||
VRMerge(enemy_player);
|
||||
return 0; //Return any value--don't care
|
||||
}
|
||||
|
||||
cnt=mp_cnt; //Cores
|
||||
hi=MAX_UNITS;
|
||||
hi=UNITS_NUM;
|
||||
if (mode==VR_ONE_ENEMY_UNIT) {
|
||||
for (hi--;hi>=0;hi--)
|
||||
if (units[enemy_player][hi].life>0)
|
||||
|
||||
@@ -7,7 +7,7 @@ U0 TurnNew()
|
||||
{
|
||||
I64 i,j;
|
||||
for (j=0;j<2;j++)
|
||||
for (i=0;i<MAX_UNITS;i++) {
|
||||
for (i=0;i<UNITS_NUM;i++) {
|
||||
units[j][i].remaining_movement=units[j][i].movement;
|
||||
units[j][i].fired=FALSE;
|
||||
}
|
||||
|
||||
+35
-35
@@ -28,9 +28,9 @@ class MySpring:CSpring
|
||||
};
|
||||
|
||||
#define SPIN_GAIN 0.25
|
||||
#define MAX_MASSES 8
|
||||
#define MAX_SPRINGS 16
|
||||
#define MAX_MISSILES 2
|
||||
#define MASSES_NUM 8
|
||||
#define SPRINGS_NUM 16
|
||||
#define MISSILES_NUM 2
|
||||
#define ST_HUMAN1 0
|
||||
#define ST_ENEMY1 1
|
||||
#define ST_ENEMY2 2
|
||||
@@ -53,14 +53,14 @@ class Ship
|
||||
{
|
||||
Ship *next,*last;
|
||||
I64 type,masses,springs;
|
||||
MyMass p[MAX_MASSES];
|
||||
MySpring s[MAX_SPRINGS];
|
||||
MyMass p[MASSES_NUM];
|
||||
MySpring s[SPRINGS_NUM];
|
||||
F64 fire_rate;
|
||||
F64 reload_timeout,spacewalk_timeout;
|
||||
F64 die_time,die_timeout;
|
||||
I64 spacewalk_side;
|
||||
F64 laser_temperature;
|
||||
Missile missiles[MAX_MISSILES];
|
||||
Missile missiles[MISSILES_NUM];
|
||||
Bool lasering,exploding,laser_overheat;
|
||||
} ship_head,*human;
|
||||
|
||||
@@ -77,8 +77,8 @@ class Shot
|
||||
F64 t_solar_storm;
|
||||
Bool alarm;
|
||||
|
||||
#define MAX_THRUST 200.0
|
||||
#define MAX_ANTISPIN 25.0
|
||||
#define THRUST_MAX 200.0
|
||||
#define ANTISPIN_MAX 25.0
|
||||
#define SPACEWALK_TIME 7.5
|
||||
|
||||
#define CMD_NULL 0
|
||||
@@ -89,8 +89,8 @@ Bool alarm;
|
||||
#define CMD_EXIT 5
|
||||
Bool game_over,show_level_msg;
|
||||
|
||||
#define NUM_STARS 100
|
||||
I64 stars_x[NUM_STARS],stars_y[NUM_STARS];
|
||||
#define STARS_NUM 100
|
||||
I64 stars_x[STARS_NUM],stars_y[STARS_NUM];
|
||||
|
||||
CMathODE *ode=NULL;
|
||||
I64 level,score,remaining;
|
||||
@@ -471,7 +471,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
(task->pix_height-FONT_HEIGHT)/2+50,"Level %d",level);
|
||||
}
|
||||
|
||||
for (i=0;i<NUM_STARS;i++)
|
||||
for (i=0;i<STARS_NUM;i++)
|
||||
GrPlot(dc,stars_x[i],stars_y[i]);
|
||||
|
||||
tmpm=ode->next_mass;
|
||||
@@ -534,7 +534,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
} else
|
||||
spin=0;
|
||||
t_left =Clamp(human_t_left+SPIN_GAIN*spin*human_antispin,
|
||||
0,MAX_THRUST);
|
||||
0,THRUST_MAX);
|
||||
|
||||
if (d=D3Norm(D3Sub(&p1,&tmpsp->p[0].x,&tmpsp->p[2].x))) {
|
||||
D3Sub(&p2,&tmpsp->p[0].DxDt,&tmpsp->p[2].DxDt);
|
||||
@@ -543,7 +543,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
} else
|
||||
spin=0;
|
||||
t_right=Clamp(human_t_right-SPIN_GAIN*spin*human_antispin,
|
||||
0,MAX_THRUST);
|
||||
0,THRUST_MAX);
|
||||
}
|
||||
|
||||
D3Sub(&p1,&tmpsp->p[1].x,&tmpsp->p[0].x);
|
||||
@@ -737,7 +737,7 @@ U0 Explosion(MyMass *tmpm1,MyMass *tmpm2,F64 tons)
|
||||
Ship TargetGet(Missile *tmpmi)
|
||||
{
|
||||
Ship *tmpsp,*res=NULL;
|
||||
F64 dd,best_dd=MAX_F64;
|
||||
F64 dd,best_dd=F64_MAX;
|
||||
I64 i;
|
||||
CD3 p,p1,p2;
|
||||
D3Unit(D3Sub(&p,&tmpmi->p_front.state->x,&tmpmi->p_back.state->x));
|
||||
@@ -831,15 +831,15 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||
if (0.485<d<0.515) {
|
||||
D3Unit(D3Sub(&p,&tmpsp->p[2].state->x,&tmpsp->p[1].state->x));
|
||||
if (tmpsp->spacewalk_side==3) {
|
||||
tmpsp->p[3].DstateDt->DxDt-=10*MAX_THRUST*p.x;
|
||||
tmpsp->p[3].DstateDt->DyDt-=10*MAX_THRUST*p.y;
|
||||
tmpsp->p[1].DstateDt->DxDt+=10*MAX_THRUST*p.x;
|
||||
tmpsp->p[1].DstateDt->DyDt+=10*MAX_THRUST*p.y;
|
||||
tmpsp->p[3].DstateDt->DxDt-=10*THRUST_MAX*p.x;
|
||||
tmpsp->p[3].DstateDt->DyDt-=10*THRUST_MAX*p.y;
|
||||
tmpsp->p[1].DstateDt->DxDt+=10*THRUST_MAX*p.x;
|
||||
tmpsp->p[1].DstateDt->DyDt+=10*THRUST_MAX*p.y;
|
||||
} else {
|
||||
tmpsp->p[4].DstateDt->DxDt+=10*MAX_THRUST*p.x;
|
||||
tmpsp->p[4].DstateDt->DyDt+=10*MAX_THRUST*p.y;
|
||||
tmpsp->p[2].DstateDt->DxDt-=10*MAX_THRUST*p.x;
|
||||
tmpsp->p[2].DstateDt->DyDt-=10*MAX_THRUST*p.y;
|
||||
tmpsp->p[4].DstateDt->DxDt+=10*THRUST_MAX*p.x;
|
||||
tmpsp->p[4].DstateDt->DyDt+=10*THRUST_MAX*p.y;
|
||||
tmpsp->p[2].DstateDt->DxDt-=10*THRUST_MAX*p.x;
|
||||
tmpsp->p[2].DstateDt->DyDt-=10*THRUST_MAX*p.y;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -851,7 +851,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||
} else
|
||||
spin=0;
|
||||
t_left =Clamp(human_t_left+SPIN_GAIN*spin*human_antispin,
|
||||
0,MAX_THRUST);
|
||||
0,THRUST_MAX);
|
||||
|
||||
if (d=D3Norm(D3Sub(&p1,&tmpsp->p[0].state->x,
|
||||
&tmpsp->p[2].state->x))) {
|
||||
@@ -861,7 +861,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||
} else
|
||||
spin=0;
|
||||
t_right=Clamp(human_t_right-SPIN_GAIN*spin*human_antispin,
|
||||
0,MAX_THRUST);
|
||||
0,THRUST_MAX);
|
||||
|
||||
D3Sub(&p1,&tmpsp->p[0].state->x,&tmpsp->p[1].state->x);
|
||||
D3Sub(&p2,&tmpsp->p[0].state->x,&tmpsp->p[2].state->x);
|
||||
@@ -905,7 +905,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||
p2.x=p.x*Cos(é_thrust)-p.y*Sin(é_thrust);
|
||||
p2.y=p.y*Cos(é_thrust)+p.x*Sin(é_thrust);
|
||||
p2.z=0;
|
||||
D3AddEqu(&tmpmi->p_back.DstateDt->DxDt,D3MulEqu(&p2,MAX_THRUST));
|
||||
D3AddEqu(&tmpmi->p_back.DstateDt->DxDt,D3MulEqu(&p2,THRUST_MAX));
|
||||
}
|
||||
}
|
||||
} else
|
||||
@@ -970,7 +970,7 @@ U0 CheckDamage()
|
||||
human->laser_overheat=FALSE;
|
||||
}
|
||||
if (!human->laser_overheat && human->lasering) {
|
||||
if (human->laser_temperature>=LASER_MAX_TEMP) {
|
||||
if (human->laser_temperature>=LASER_TEMP_MAX) {
|
||||
human->laser_overheat=TRUE;
|
||||
Snd;
|
||||
} else {
|
||||
@@ -982,7 +982,7 @@ U0 CheckDamage()
|
||||
p2.y=-p.x;
|
||||
p2.z=0;
|
||||
best_mass=NULL;
|
||||
best_distance=MAX_F64;
|
||||
best_distance=F64_MAX;
|
||||
tmpm=ode->next_mass;
|
||||
while (tmpm!=&ode->next_mass) {
|
||||
D3Sub(&p1,&human->p[0].x,&tmpm->x);
|
||||
@@ -1050,7 +1050,7 @@ U0 CheckDamage()
|
||||
}
|
||||
if (!tmpsp->exploding) {
|
||||
for (i=0;i<tmpsp->masses;i++)
|
||||
if (tmpsp->p[i].temperature>MAX_MASS_TEMP)
|
||||
if (tmpsp->p[i].temperature>MASS_TEMP_MAX)
|
||||
death_score++;
|
||||
if (death_score) {
|
||||
tmpsp->exploding=TRUE;
|
||||
@@ -1249,7 +1249,7 @@ U0 ExpireMissiles()
|
||||
while (tmpmi!=&missile_head) {
|
||||
tmpm1=tmpmi->next;
|
||||
if (tmpmi->launched) {
|
||||
best_dd=MAX_F64;
|
||||
best_dd=F64_MAX;
|
||||
if (tmpmi->target)
|
||||
for (i=0;i<tmpmi->target->masses;i++) {
|
||||
dd=D3DistSqr(&tmpmi->p_front.x,&tmpmi->target->p[i].x);
|
||||
@@ -1331,7 +1331,7 @@ U0 Init()
|
||||
QueInit(&shot_head);
|
||||
QueInit(&missile_head);
|
||||
|
||||
for (i=0;i<NUM_STARS;i++) {
|
||||
for (i=0;i<STARS_NUM;i++) {
|
||||
stars_x[i]=RandU16%GR_WIDTH;
|
||||
stars_y[i]=RandU16%GR_HEIGHT;
|
||||
}
|
||||
@@ -1407,7 +1407,7 @@ U0 XCaliber()
|
||||
else if (sc&SCF_SHIFT)
|
||||
ctrl_panel.fuse_time+=2;
|
||||
else
|
||||
human_t_right=MAX_THRUST;
|
||||
human_t_right=THRUST_MAX;
|
||||
break;
|
||||
case SC_CURSOR_LEFT:
|
||||
if (sc&SCF_CTRL)
|
||||
@@ -1415,21 +1415,21 @@ U0 XCaliber()
|
||||
else if (sc&SCF_SHIFT)
|
||||
ctrl_panel.fuse_time-=2;
|
||||
else
|
||||
human_t_left =MAX_THRUST;
|
||||
human_t_left =THRUST_MAX;
|
||||
break;
|
||||
case SC_CURSOR_UP:
|
||||
if (sc&SCF_SHIFT)
|
||||
ctrl_panel.shot_radius+=2;
|
||||
else {
|
||||
human_t_right=MAX_THRUST;
|
||||
human_t_left =MAX_THRUST;
|
||||
human_t_right=THRUST_MAX;
|
||||
human_t_left =THRUST_MAX;
|
||||
}
|
||||
break;
|
||||
case SC_CURSOR_DOWN:
|
||||
if (sc&SCF_SHIFT)
|
||||
ctrl_panel.shot_radius-=2;
|
||||
else
|
||||
human_antispin=MAX_ANTISPIN;
|
||||
human_antispin=ANTISPIN_MAX;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define LASER_MAX_TEMP 30.0
|
||||
#define LASER_TEMP_MAX 30.0
|
||||
#define LASER_THRESHOLD_TEMP 10.0
|
||||
#define MAX_MASS_TEMP 5.0
|
||||
#define MASS_TEMP_MAX 5.0
|
||||
|
||||
class CtrlPanelState
|
||||
{
|
||||
@@ -82,7 +82,7 @@ U0 DrawCtrlPanelCtrl(CDC *dc,CCtrl *c)
|
||||
CTRL_PANEL_RANGE-1-s->fuse_time-1,5,3);
|
||||
|
||||
d_range=c->right-c->left-5-5;
|
||||
d=s->laser_temperature*d_range/LASER_MAX_TEMP;
|
||||
d=s->laser_temperature*d_range/LASER_TEMP_MAX;
|
||||
dc->color=BLACK;
|
||||
GrRect(dc,c->left+5-1,c->bottom+TMP_Y-2,d_range+2,2+1+1);
|
||||
if (d>1.0) {
|
||||
|
||||
+14
-14
@@ -226,26 +226,26 @@ I64 AsmMakeArgMask(CCmpCtrl *cc,CAsmArg *arg)
|
||||
if (arg->indirect)
|
||||
res&=0x00FFFF0000;
|
||||
else if (arg->num.i<0) {
|
||||
if (arg->num.i>=MIN_I8)
|
||||
if (arg->num.i>=I8_MIN)
|
||||
res&=0x8FE;
|
||||
else if (arg->num.i>=MIN_I16)
|
||||
else if (arg->num.i>=I16_MIN)
|
||||
res&=0x8EE;
|
||||
else if (arg->num.i>=MIN_I32)
|
||||
else if (arg->num.i>=I32_MIN)
|
||||
res&=0x8CE;
|
||||
else
|
||||
res&=0x88E;
|
||||
} else {
|
||||
if (arg->num.i<=MAX_I8)
|
||||
if (arg->num.i<=I8_MAX)
|
||||
res&=0xFFE;
|
||||
else if (arg->num.i<=MAX_U8)
|
||||
else if (arg->num.i<=U8_MAX)
|
||||
res&=0xFEE;
|
||||
else if (arg->num.i<=MAX_I16)
|
||||
else if (arg->num.i<=I16_MAX)
|
||||
res&=0xEEE;
|
||||
else if (arg->num.i<=MAX_U16)
|
||||
else if (arg->num.i<=U16_MAX)
|
||||
res&=0xECE;
|
||||
else if (arg->num.i<=MAX_I32)
|
||||
else if (arg->num.i<=I32_MAX)
|
||||
res&=0xCCE;
|
||||
else if (arg->num.i<=MAX_U32)
|
||||
else if (arg->num.i<=U32_MAX)
|
||||
res&=0xC8E;
|
||||
else
|
||||
res&=0x88E;
|
||||
@@ -280,7 +280,7 @@ Bool AsmStoreNum(CCmpCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
|
||||
aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
|
||||
num2->num.glbl_asm_undef_hash,cc->lex_include_stk->line_num,
|
||||
U8_avail);
|
||||
else if (!num2->imm_flag && !(MIN_I8<=num2->num.i<=MAX_I8))
|
||||
else if (!num2->imm_flag && !(I8_MIN<=num2->num.i<=I8_MAX))
|
||||
LexExcept(cc,"Branch out of range at ");
|
||||
if (num2->imm_flag) {
|
||||
if (num2->num.abs_cnts.abs_addres&1) {
|
||||
@@ -307,7 +307,7 @@ Bool AsmStoreNum(CCmpCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
|
||||
aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
|
||||
num2->num.glbl_asm_undef_hash,cc->lex_include_stk->line_num,
|
||||
U8_avail);
|
||||
else if (!num2->imm_flag && !(MIN_I16<=num2->num.i<=MAX_I16))
|
||||
else if (!num2->imm_flag && !(I16_MIN<=num2->num.i<=I16_MAX))
|
||||
LexExcept(cc,"Branch out of range at ");
|
||||
if (num2->imm_flag) {
|
||||
if (num2->num.abs_cnts.abs_addres&1) {
|
||||
@@ -334,7 +334,7 @@ Bool AsmStoreNum(CCmpCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
|
||||
aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
|
||||
num2->num.glbl_asm_undef_hash,cc->lex_include_stk->line_num,
|
||||
U8_avail);
|
||||
else if (!num2->imm_flag && !(MIN_I32<=num2->num.i<=MAX_I32))
|
||||
else if (!num2->imm_flag && !(I32_MIN<=num2->num.i<=I32_MAX))
|
||||
LexExcept(cc,"Branch out of range at ");
|
||||
if (num2->imm_flag) {
|
||||
if (num2->num.abs_cnts.abs_addres&1) {
|
||||
@@ -542,7 +542,7 @@ Bool PrsAsmInst(CCmpCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
|
||||
if (tmpa1->imm_or_off_present) {
|
||||
MemCpy(&cur.disp.num,&tmpa1->num,sizeof(CAsmNum));
|
||||
if (!cur.disp.num.machine_code &&
|
||||
MIN_I8<=cur.disp.num.i<=MAX_I8) {
|
||||
I8_MIN<=cur.disp.num.i<=I8_MAX) {
|
||||
cur.ModrM|=0x40;
|
||||
cur.disp.U8_cnt=1;
|
||||
} else if (aotc->seg_size==16) {
|
||||
@@ -689,7 +689,7 @@ Bool PrsAsmInst(CCmpCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
|
||||
if (tmpa1->imm_or_off_present) {
|
||||
MemCpy(&cur.disp.num,&tmpa1->num,sizeof(CAsmNum));
|
||||
if (!cur.disp.num.machine_code &&
|
||||
MIN_I8<=cur.disp.num.i<=MAX_I8) {
|
||||
I8_MIN<=cur.disp.num.i<=I8_MAX) {
|
||||
cur.ModrM|=0x40;
|
||||
cur.disp.U8_cnt=1;
|
||||
} else if (aotc->seg_size==16) {
|
||||
|
||||
+1
-1
@@ -194,7 +194,7 @@ U0 AsmHashLoad()
|
||||
}
|
||||
Free(tmpo_max);
|
||||
CmpCtrlDel(cc);
|
||||
for (i=0;i<NUM_INTERNAL_TYPES;i++) {
|
||||
for (i=0;i<INTERNAL_TYPES_NUM;i++) {
|
||||
tmpit=&internal_types_table[i];
|
||||
tmpc=PrsClassNew;
|
||||
tmpc->type=HTT_INTERNAL_TYPE;
|
||||
|
||||
@@ -18,8 +18,8 @@ U0 AsmResolve(CCmpCtrl *cc,CAsmUnresolvedRef *tmpu,U8 *label,Bool undefined)
|
||||
}
|
||||
} else if (!(tmpu->type&IEF_IMM_NOT_REL)) {
|
||||
res-=tmpu->rel_rip;
|
||||
if (tmpu->type==IET_REL_I8 && !(MIN_I8<=res<=MAX_I8) ||
|
||||
tmpu->type==IET_REL_I16 && !(MIN_I16<=res<=MAX_I16)) {
|
||||
if (tmpu->type==IET_REL_I8 && !(I8_MIN<=res<=I8_MAX) ||
|
||||
tmpu->type==IET_REL_I16 && !(I16_MIN<=res<=I16_MAX)) {
|
||||
PrintErr("Branch out of range at line:%04d %s\n",
|
||||
tmpu->line_num,label);
|
||||
LexExcept(cc);
|
||||
|
||||
+11
-11
@@ -82,17 +82,17 @@ U0 ICAddSubEctImm(CIntermediateCode *tmpi,CICType t1,I64 r1,I64 d1,
|
||||
} else if (d==-1 && op.u8[0]==0x03) {
|
||||
ICU24(tmpi,0xC8FF00+i+(r1&7)<<16);
|
||||
return;
|
||||
} else if (MIN_I8<=d<=MAX_I8) {
|
||||
} else if (I8_MIN<=d<=I8_MAX) {
|
||||
ICU24(tmpi,0xC08300+op.u8[1]<<19+i+(r1&7)<<16);
|
||||
ICU8(tmpi,d);
|
||||
return;
|
||||
} else if (MIN_I32<=d<=MAX_I32) {
|
||||
} else if (I32_MIN<=d<=I32_MAX) {
|
||||
ICU24(tmpi,0xC08100+op.u8[1]<<19+i+(r1&7)<<16);
|
||||
ICU32(tmpi,d);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (op.u8[0]==0x03 && MIN_I32<=d<=MAX_I32 &&
|
||||
if (op.u8[0]==0x03 && I32_MIN<=d<=I32_MAX &&
|
||||
!Bt(&cmp.non_ptr_vars_mask,r2)) {
|
||||
i=ICModr1(r1,MDF_DISP+RT_I64,r2,d);
|
||||
i.u8[1]|=0x48;
|
||||
@@ -141,12 +141,12 @@ U0 ICAddSubEctImm(CIntermediateCode *tmpi,CICType t1,I64 r1,I64 d1,
|
||||
ICModr2(tmpi,i,,d1,rip);
|
||||
return;
|
||||
}
|
||||
if (MIN_I8<=d<=MAX_I8 || t1&(RTG_MASK-RTF_UNSIGNED)==RT_I8) {
|
||||
if (I8_MIN<=d<=I8_MAX || t1&(RTG_MASK-RTF_UNSIGNED)==RT_I8) {
|
||||
ICSlashOp(tmpi,t1,r1,d1,SLASH_OP_IMM_U8+op.u8[1],rip+1);
|
||||
ICU8(tmpi,d);
|
||||
return;
|
||||
}
|
||||
if (MIN_I32<=d<=MAX_I32 || t1.raw_type<RT_I64) {
|
||||
if (I32_MIN<=d<=I32_MAX || t1.raw_type<RT_I64) {
|
||||
ICSlashOp(tmpi,t1,r1,d1,SLASH_OP_IMM_U32+op.u8[1],rip);
|
||||
if (t1&(RTG_MASK-RTF_UNSIGNED)==RT_I16)
|
||||
ICU16(tmpi,d);
|
||||
@@ -237,7 +237,7 @@ U0 ICMul(CIntermediateCode *tmpi,I64 rip)
|
||||
}
|
||||
i=arg2->disp;
|
||||
if (!(tmpi->ic_class->raw_type&RTF_UNSIGNED) &&
|
||||
arg2->type&MDF_IMM && MIN_I32<=i<=MAX_I32) {
|
||||
arg2->type&MDF_IMM && I32_MIN<=i<=I32_MAX) {
|
||||
if (tmpi->res.type==MDF_REG+RT_I64) {
|
||||
ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
|
||||
arg1->type,arg1->reg,arg1->disp,rip);
|
||||
@@ -248,7 +248,7 @@ U0 ICMul(CIntermediateCode *tmpi,I64 rip)
|
||||
j=0xC0004D;
|
||||
else
|
||||
j=0xC00048;
|
||||
if (MIN_I8<=i<=MAX_I8)
|
||||
if (I8_MIN<=i<=I8_MAX)
|
||||
ICU32(tmpi,i<<24+0x6B00+j+(r&7)<<16+(r&7)<<19);
|
||||
else {
|
||||
ICU24(tmpi,0x6900+j+(r&7)<<16+(r&7)<<19);
|
||||
@@ -286,7 +286,7 @@ U0 ICMulEqu(CIntermediateCode *tmpi,I64 rip)
|
||||
{
|
||||
I64 i=tmpi->arg2.disp,r=REG_RAX,j;
|
||||
if (!(tmpi->ic_class->raw_type&RTF_UNSIGNED) &&
|
||||
tmpi->arg2.type&MDF_IMM && MIN_I32<=i<=MAX_I32) {
|
||||
tmpi->arg2.type&MDF_IMM && I32_MIN<=i<=I32_MAX) {
|
||||
if (tmpi->ic_flags & ICF_BY_VAL) {
|
||||
if (tmpi->arg1.type==MDF_REG+RT_I64)
|
||||
r=tmpi->arg1.reg;
|
||||
@@ -298,7 +298,7 @@ U0 ICMulEqu(CIntermediateCode *tmpi,I64 rip)
|
||||
j=0xC0004D;
|
||||
else
|
||||
j=0xC00048;
|
||||
if (MIN_I8<=i<=MAX_I8)
|
||||
if (I8_MIN<=i<=I8_MAX)
|
||||
ICU32(tmpi,i<<24+0x6B00+j+(r&7)<<16+(r&7)<<19);
|
||||
else {
|
||||
ICU24(tmpi,0x6900+j+(r&7)<<16+(r&7)<<19);
|
||||
@@ -312,7 +312,7 @@ U0 ICMulEqu(CIntermediateCode *tmpi,I64 rip)
|
||||
ICMov(tmpi,MDF_REG+RT_I64,REG_RBX,0,
|
||||
MDF_DISP+tmpi->arg1_type_pointed_to,REG_RCX,0,rip);
|
||||
r=REG_RBX;
|
||||
if (MIN_I8<=i<=MAX_I8)
|
||||
if (I8_MIN<=i<=I8_MAX)
|
||||
ICU32(tmpi,i<<24+0xDB6B48);
|
||||
else {
|
||||
ICU24(tmpi,0xDB6948);
|
||||
@@ -513,7 +513,7 @@ U0 ICAddSubEctEqu(CIntermediateCode *tmpi,U8 type_pointed_to,
|
||||
if (t3&MDF_IMM && op.u8[2]) {
|
||||
if (!d3.u32[1]) {
|
||||
if (tmpi->ic_flags&ICF_RES_NOT_USED &&
|
||||
t2&MDF_REG && d3(U64)<=MAX_I8) {
|
||||
t2&MDF_REG && d3(U64)<=I8_MAX) {
|
||||
ICSlashOp(tmpi,MDF_DISP+type_pointed_to,r2,0,0x838000+op.u8[4],rip);
|
||||
ICU8(tmpi,d3);
|
||||
done=TRUE;
|
||||
|
||||
+11
-11
@@ -102,7 +102,7 @@ U0 ICXorXor(CIntermediateCode *tmpi,I64 rip)
|
||||
U0 ICCmp(CIntermediateCode *tmpi,I64 us,I64 is,I64 rip)
|
||||
{
|
||||
I64 r1,d1,r2,i=0x48,j=tmpi->arg2.disp;
|
||||
if (tmpi->arg2.type&MDF_IMM && MIN_I32<=j<=MAX_I32) {
|
||||
if (tmpi->arg2.type&MDF_IMM && I32_MIN<=j<=I32_MAX) {
|
||||
if (!(tmpi->ic_flags&(ICF_POP_CMP|ICF_PUSH_CMP)) &&
|
||||
tmpi->arg1.type&MDF_DISP && //TODO
|
||||
tmpi->arg1.type.raw_type>=RT_I64 && tmpi->arg1.reg!=REG_RAX) {
|
||||
@@ -111,20 +111,20 @@ U0 ICCmp(CIntermediateCode *tmpi,I64 us,I64 is,I64 rip)
|
||||
ICZero(tmpi,REG_RAX);
|
||||
if (r1>7)
|
||||
i++;
|
||||
if (MIN_I8<=j<=MAX_I8)
|
||||
if (I8_MIN<=j<=I8_MAX)
|
||||
i+=0x388300;
|
||||
else
|
||||
i+=0x388100;
|
||||
if (!d1) {
|
||||
ICU24(tmpi,0x000000+i+(r1&7)<<16);
|
||||
} else if (MIN_I8<=d1<=MAX_I8) {
|
||||
} else if (I8_MIN<=d1<=I8_MAX) {
|
||||
ICU24(tmpi,0x400000+i+(r1&7)<<16);
|
||||
ICU8(tmpi,d1);
|
||||
} else {
|
||||
ICU24(tmpi,0x800000+i+(r1&7)<<16);
|
||||
ICU32(tmpi,d1);
|
||||
}
|
||||
if (MIN_I8<=j<=MAX_I8)
|
||||
if (I8_MIN<=j<=I8_MAX)
|
||||
ICU8(tmpi,j);
|
||||
else
|
||||
ICU32(tmpi,j);
|
||||
@@ -144,7 +144,7 @@ U0 ICCmp(CIntermediateCode *tmpi,I64 us,I64 is,I64 rip)
|
||||
ICZero(tmpi,REG_RAX);
|
||||
if (r1>7)
|
||||
i++;
|
||||
if (MIN_I8<=j<=MAX_I8) {
|
||||
if (I8_MIN<=j<=I8_MAX) {
|
||||
ICU24(tmpi,0xF88300+i+(r1&7)<<16);
|
||||
ICU8(tmpi,j);
|
||||
} else {
|
||||
@@ -475,7 +475,7 @@ U0 ICCmpAndBranch(CIntermediateCode *tmpi,Bool has_res,I64 rip,
|
||||
CICArg *arg1=&tmpi->arg1,*arg2=&tmpi->arg2;
|
||||
|
||||
j=arg1->disp;
|
||||
if (arg1->type&MDF_IMM && MIN_I32<=j<=MAX_I32) {
|
||||
if (arg1->type&MDF_IMM && I32_MIN<=j<=I32_MAX) {
|
||||
SwapI64(&arg1,&arg2);
|
||||
swap=TRUE;
|
||||
us=not_us;
|
||||
@@ -487,7 +487,7 @@ U0 ICCmpAndBranch(CIntermediateCode *tmpi,Bool has_res,I64 rip,
|
||||
is=us;
|
||||
|
||||
j=arg2->disp;
|
||||
if (arg2->type&MDF_IMM && MIN_I32<=j<=MAX_I32) {
|
||||
if (arg2->type&MDF_IMM && I32_MIN<=j<=I32_MAX) {
|
||||
if (!has_res && arg1->type&MDG_REG_DISP_SIB_RIP)
|
||||
ICAddSubEctImm(tmpi,arg1->type,arg1->reg,arg1->disp,
|
||||
arg1->type,arg1->reg,arg1->disp,j,0x073B,rip2);
|
||||
@@ -517,7 +517,7 @@ U0 ICCmpAndBranch(CIntermediateCode *tmpi,Bool has_res,I64 rip,
|
||||
} else {
|
||||
if (r1>7)
|
||||
i++;
|
||||
if (MIN_I8<=j<=MAX_I8) {
|
||||
if (I8_MIN<=j<=I8_MAX) {
|
||||
ICU24(tmpi,0xF88300+i+(r1&7)<<16);
|
||||
ICU8(tmpi,j);
|
||||
} else {
|
||||
@@ -606,7 +606,7 @@ U0 ICCmpAndBranch(CIntermediateCode *tmpi,Bool has_res,I64 rip,
|
||||
else
|
||||
i+=8;
|
||||
}
|
||||
if (MIN_I8<=i<=MAX_I8)
|
||||
if (I8_MIN<=i<=I8_MAX)
|
||||
short_jmp=TRUE;
|
||||
}
|
||||
|
||||
@@ -665,7 +665,7 @@ U0 ICTestAndBranch(CIntermediateCode *tmpi,I64 rip,I64 is,U8 *buf,I64 rip2)
|
||||
i=lb->addr-(rip+2);
|
||||
if (lb->flags&CMF_POP_CMP)
|
||||
i+=8;
|
||||
if (MIN_I8<=i<=MAX_I8)
|
||||
if (I8_MIN<=i<=I8_MAX)
|
||||
short_jmp=TRUE;
|
||||
}
|
||||
|
||||
@@ -698,7 +698,7 @@ U0 ICFlagBranch(CIntermediateCode *tmpi,I64 rip,I64 is,U8 *buf)
|
||||
i=lb->addr-(rip+2);
|
||||
if (lb->flags&CMF_POP_CMP)
|
||||
i+=8;
|
||||
if (MIN_I8<=i<=MAX_I8)
|
||||
if (I8_MIN<=i<=I8_MAX)
|
||||
short_jmp=TRUE;
|
||||
}
|
||||
|
||||
|
||||
+18
-18
@@ -16,7 +16,7 @@ U0 ICAndBranch(CIntermediateCode *tmpi,I64 rip,I64 is,U8 *buf,I64 rip2)
|
||||
arg2=&tmpi->arg2;
|
||||
}
|
||||
|
||||
if (arg2->type&MDF_IMM && arg2->disp>MAX_U32)
|
||||
if (arg2->type&MDF_IMM && arg2->disp>U32_MAX)
|
||||
override=TRUE;
|
||||
else
|
||||
override=FALSE;
|
||||
@@ -27,11 +27,11 @@ U0 ICAndBranch(CIntermediateCode *tmpi,I64 rip,I64 is,U8 *buf,I64 rip2)
|
||||
it=arg2->type.raw_type;
|
||||
|
||||
i=arg2->disp;
|
||||
if (arg2->type&MDF_IMM && i<=MAX_U32) {
|
||||
if (arg2->type&MDF_IMM && i<=U32_MAX) {
|
||||
ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,arg1->type,arg1->reg,arg1->disp,rip2);
|
||||
if (i<=MAX_U8)
|
||||
if (i<=U8_MAX)
|
||||
ICU16(tmpi,i<<8+0xA8);
|
||||
else if (i<=MAX_U16)
|
||||
else if (i<=U16_MAX)
|
||||
ICU32(tmpi,i<<16+0xA900+OC_OP_SIZE_PREFIX);
|
||||
else {
|
||||
ICU8(tmpi,0xA9);
|
||||
@@ -136,7 +136,7 @@ U0 ICAndBranch(CIntermediateCode *tmpi,I64 rip,I64 is,U8 *buf,I64 rip2)
|
||||
i=lb->addr-(rip+2);
|
||||
if (lb->flags&CMF_POP_CMP)
|
||||
i+=8;
|
||||
if (MIN_I8<=i<=MAX_I8)
|
||||
if (I8_MIN<=i<=I8_MAX)
|
||||
short_jmp=TRUE;
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ U0 ICBrBitOps(CIntermediateCode *tmpi,I64 rip,
|
||||
i=lb->addr-(rip+2);
|
||||
if (lb->flags&CMF_POP_CMP)
|
||||
i+=8;
|
||||
if (MIN_I8<=i<=MAX_I8)
|
||||
if (I8_MIN<=i<=I8_MAX)
|
||||
short_jmp=TRUE;
|
||||
}
|
||||
|
||||
@@ -564,7 +564,7 @@ U0 ICOrEqu(CIntermediateCode *tmpi,I64 rip2)
|
||||
tmpi->ic_flags&ICF_RES_NOT_USED) {
|
||||
i=tmpi->arg2.disp;
|
||||
bit=Bsf(i);
|
||||
if (0<=bit==Bsr(i) && i>MAX_I8) {
|
||||
if (0<=bit==Bsr(i) && i>I8_MAX) {
|
||||
tmpi->arg2.disp=bit;
|
||||
tmpi->arg2.reg=0;
|
||||
tmpi->arg1.type=tmpi->arg1.type&MDG_MASK+RT_I64;
|
||||
@@ -618,12 +618,12 @@ U0 ICSwitch(CIntermediateCode *tmpi,I64 rip,
|
||||
j=tmpi->arg2.disp;
|
||||
ICMov(tmpi,MDF_REG+RT_I64,r,0,
|
||||
tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
|
||||
if (MIN_I8<=j<=MAX_I8) {
|
||||
if (I8_MIN<=j<=I8_MAX) {
|
||||
i=0xF88348+(r&7)<<16;
|
||||
if (r>7) i++;
|
||||
ICU24(tmpi,i);
|
||||
ICU8(tmpi,j);
|
||||
} else if (MIN_I32<=j<=MAX_I32) {
|
||||
} else if (I32_MIN<=j<=I32_MAX) {
|
||||
i=0xF88148+(r&7)<<16;
|
||||
if (r>7) i++;
|
||||
ICU24(tmpi,i);
|
||||
@@ -650,7 +650,7 @@ U0 ICSwitch(CIntermediateCode *tmpi,I64 rip,
|
||||
short_jmp=ToBool(tmpi->ic_flags&ICF_SHORT_JMP);
|
||||
if (!buf && lb->addr!=INVALID_PTR) {
|
||||
i=lb->addr-(rip+2);
|
||||
if (MIN_I8<=i<=MAX_I8)
|
||||
if (I8_MIN<=i<=I8_MAX)
|
||||
short_jmp=TRUE;
|
||||
}
|
||||
if (short_jmp) {
|
||||
@@ -666,12 +666,12 @@ U0 ICSwitch(CIntermediateCode *tmpi,I64 rip,
|
||||
lb=tmpi->ic_data;
|
||||
begin=lb->begin->addr;
|
||||
if (!buf && begin!=INVALID_PTR) {
|
||||
min=MAX_I64;
|
||||
max=MIN_I64;
|
||||
min=I64_MAX;
|
||||
max=I64_MIN;
|
||||
for (i=0;i<lb->range;i++) {
|
||||
if (lb->jmp_table[i]->addr==INVALID_PTR) {
|
||||
min=MIN_I64;
|
||||
max=MAX_I64;
|
||||
min=I64_MIN;
|
||||
max=I64_MAX;
|
||||
break;
|
||||
} else {
|
||||
j=lb->jmp_table[i]->addr-begin;
|
||||
@@ -679,13 +679,13 @@ U0 ICSwitch(CIntermediateCode *tmpi,I64 rip,
|
||||
max=MaxI64(max,j);
|
||||
}
|
||||
}
|
||||
if (MIN_I8<=min<=max<=MAX_I8)
|
||||
if (I8_MIN<=min<=max<=I8_MAX)
|
||||
lb->flags|=CMF_I8_JMP_TABLE;
|
||||
else if (MIN_U8<=min<=max<=MAX_U8)
|
||||
else if (U8_MIN<=min<=max<=U8_MAX)
|
||||
lb->flags|=CMF_U8_JMP_TABLE;
|
||||
else if (MIN_I16<=min<=max<=MAX_I16)
|
||||
else if (I16_MIN<=min<=max<=I16_MAX)
|
||||
lb->flags|=CMF_I16_JMP_TABLE;
|
||||
else if (MIN_U16<=min<=max<=MAX_U16)
|
||||
else if (U16_MIN<=min<=max<=U16_MAX)
|
||||
lb->flags|=CMF_U16_JMP_TABLE;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -309,7 +309,7 @@ U0 ICFPow(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
|
||||
throw('Compiler');
|
||||
else {
|
||||
i=tmpex->val-(rip+tmpi->ic_cnt+5);
|
||||
if (!(MIN_I32<=i<=MAX_I32)) {
|
||||
if (!(I32_MIN<=i<=I32_MAX)) {
|
||||
throw('Compiler');
|
||||
// ICU16(tmpi,0xBB48);
|
||||
// ICU64(tmpi,tmpex->val);
|
||||
@@ -322,7 +322,7 @@ U0 ICFPow(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
|
||||
}
|
||||
} else {
|
||||
i=tmpex->val-(rip+tmpi->ic_cnt+5);
|
||||
if (!(MIN_I32<=i<=MAX_I32)) {
|
||||
if (!(I32_MIN<=i<=I32_MAX)) {
|
||||
ICU16(tmpi,0xBB48);
|
||||
ICU64(tmpi,tmpex->val);
|
||||
ICU16(tmpi,0xD3FF);
|
||||
|
||||
+1
-1
@@ -457,7 +457,7 @@ U0 ICFCmpAndBranch(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 rip,
|
||||
else
|
||||
i+=8;
|
||||
}
|
||||
if (MIN_I8<=i<=MAX_I8)
|
||||
if (I8_MIN<=i<=I8_MAX)
|
||||
short_jmp=TRUE;
|
||||
}
|
||||
|
||||
|
||||
+15
-15
@@ -99,18 +99,18 @@ U0 ICAddRSP(CIntermediateCode *tmpi,I64 i,Bool optimize=TRUE)
|
||||
}
|
||||
last_start=tmpi->ic_cnt;
|
||||
if (i>0) {
|
||||
if (i<=MAX_I8)
|
||||
if (i<=I8_MAX)
|
||||
ICU32(tmpi,0xC48348+i<<24);
|
||||
else if (i<=MAX_I32) {
|
||||
else if (i<=I32_MAX) {
|
||||
ICU24(tmpi,0xC48148);
|
||||
ICU32(tmpi,i);
|
||||
} else
|
||||
throw('Compiler');
|
||||
} else if (i<0) {
|
||||
i=-i;
|
||||
if (i<=MAX_I8)
|
||||
if (i<=I8_MAX)
|
||||
ICU32(tmpi,0xEC8348+i<<24);
|
||||
else if (i<=MAX_I32) {
|
||||
else if (i<=I32_MAX) {
|
||||
ICU24(tmpi,0xEC8148);
|
||||
ICU32(tmpi,i);
|
||||
} else
|
||||
@@ -166,7 +166,7 @@ I64 ICModr1(I64 r,CICType t2,I64 r2,I64 d2)
|
||||
if (!d2 && r2!=REG_RBP) {
|
||||
res.u8[2]=r<<3+r2;
|
||||
res.u8[0]=MODR_INDIRECT_REG;
|
||||
} else if (MIN_I8<=d2<=MAX_I8) {
|
||||
} else if (I8_MIN<=d2<=I8_MAX) {
|
||||
res.u8[2]=0x40+r<<3+r2;
|
||||
res.u8[0]=MODR_D8_INDIRECT_REG;
|
||||
} else {
|
||||
@@ -190,7 +190,7 @@ I64 ICModr1(I64 r,CICType t2,I64 r2,I64 d2)
|
||||
if (!d2 && r2.u8[0]&7!=REG_RBP) {
|
||||
res.u8[2]=4+r<<3;
|
||||
res.u8[0]=MODR_SIB_INDIRECT_REG;
|
||||
} else if (MIN_I8<=d2<=MAX_I8) {
|
||||
} else if (I8_MIN<=d2<=I8_MAX) {
|
||||
res.u8[2]=0x44+r<<3;
|
||||
res.u8[0]=MODR_SIB_D8_INDIRECT_REG;
|
||||
} else {
|
||||
@@ -319,9 +319,9 @@ U0 ICPush(CIntermediateCode *tmpi,CICType t1,I64 r1,I64 d1,I64 rip)
|
||||
ICU8(tmpi,0x50+r1);
|
||||
return;
|
||||
case MDf_IMM:
|
||||
if (MIN_I8<=d1<=MAX_I8)
|
||||
if (I8_MIN<=d1<=I8_MAX)
|
||||
ICU16(tmpi,0x6A+d1<<8);
|
||||
else if (MIN_I32<=d1<=MAX_I32) {
|
||||
else if (I32_MIN<=d1<=I32_MAX) {
|
||||
ICU8(tmpi,0x68);
|
||||
ICU32(tmpi,d1);
|
||||
} else {
|
||||
@@ -350,7 +350,7 @@ U0 ICPush(CIntermediateCode *tmpi,CICType t1,I64 r1,I64 d1,I64 rip)
|
||||
U0 ICPushRegs(CIntermediateCode *tmpi,I64 mask)
|
||||
{
|
||||
I64 i;
|
||||
for (i=0;i<NUM_REGS;i++) {
|
||||
for (i=0;i<REG_REGS_NUM;i++) {
|
||||
if (Bt(&mask,i)) {
|
||||
if (i>7)
|
||||
ICU16(tmpi,0x5049+(i&7)<<8);
|
||||
@@ -391,7 +391,7 @@ U0 ICPop(CIntermediateCode *tmpi,CICType t1,I64 r1,I64 d1,I64 rip)
|
||||
U0 ICPopRegs(CIntermediateCode *tmpi,I64 mask)
|
||||
{
|
||||
I64 i;
|
||||
for (i=NUM_REGS-1;i>=0;i--) {
|
||||
for (i=REG_REGS_NUM-1;i>=0;i--) {
|
||||
if (Bt(&mask,i)) {
|
||||
if (i>7)
|
||||
ICU16(tmpi,0x5849+(i&7)<<8);
|
||||
@@ -454,7 +454,7 @@ U0 ICMov(CIntermediateCode *tmpi,
|
||||
if (t2&MDF_IMM) {
|
||||
if (!d2)
|
||||
ICZero(tmpi,r1);
|
||||
else if (0<=d2<=MAX_U8) {
|
||||
else if (0<=d2<=U8_MAX) {
|
||||
ICZero(tmpi,r1);
|
||||
if (r1>7)
|
||||
ICU24(tmpi,d2<<16+(0xB0+r1&7)<<8+0x41);
|
||||
@@ -462,7 +462,7 @@ U0 ICMov(CIntermediateCode *tmpi,
|
||||
ICU24(tmpi,d2<<16+(0xB0+r1)<<8+0x40);
|
||||
else
|
||||
ICU16(tmpi,d2<<8+0xB0+r1);
|
||||
} else if (MIN_I8<=d2<0) {
|
||||
} else if (I8_MIN<=d2<0) {
|
||||
if (r1>7) {
|
||||
r1&=7;
|
||||
ICU24(tmpi,d2<<16+(0xB0+r1)<<8+0x41);
|
||||
@@ -474,7 +474,7 @@ U0 ICMov(CIntermediateCode *tmpi,
|
||||
ICU16(tmpi,d2<<8+0xB0+r1);
|
||||
ICU32(tmpi,0xC0BE0F48+r1<<24+r1<<27);
|
||||
}
|
||||
} else if (0<=d2<=MAX_U32) {
|
||||
} else if (0<=d2<=U32_MAX) {
|
||||
if (r1>7) {
|
||||
r1&=7;
|
||||
ICU16(tmpi,(0xB8+r1)<<8+0x41);
|
||||
@@ -483,7 +483,7 @@ U0 ICMov(CIntermediateCode *tmpi,
|
||||
ICU8(tmpi,0xB8+r1);
|
||||
ICU32(tmpi,d2);
|
||||
}
|
||||
} else if (MIN_I32<=d2<0) {
|
||||
} else if (I32_MIN<=d2<0) {
|
||||
if (r1>7) {
|
||||
r1&=7;
|
||||
ICU16(tmpi,(0xB8+r1)<<8+0x41);
|
||||
@@ -550,7 +550,7 @@ U0 ICMov(CIntermediateCode *tmpi,
|
||||
case MDf_DISP:
|
||||
case MDf_RIP_DISP32:
|
||||
case MDf_SIB:
|
||||
if (t2&MDF_IMM && (t1.raw_type<RT_I64 || (MIN_I32<=d2<=MAX_I32))) {
|
||||
if (t2&MDF_IMM && (t1.raw_type<RT_I64 || (I32_MIN<=d2<=I32_MAX))) {
|
||||
ICSlashOp(tmpi,t1,r1,d1,SLASH_OP_MOV_IMM,rip);
|
||||
switch (t1.raw_type) {
|
||||
case RT_I8:
|
||||
|
||||
+15
-15
@@ -1,9 +1,9 @@
|
||||
#define NUM_INTERNAL_TYPES 17
|
||||
#define INTERNAL_TYPES_NUM 17
|
||||
|
||||
class CInternalType
|
||||
{
|
||||
U8 type,size,name[8];
|
||||
} internal_types_table[NUM_INTERNAL_TYPES]={
|
||||
} internal_types_table[INTERNAL_TYPES_NUM]={
|
||||
{RT_I0,0,"I0i"},{RT_I0,0,"I0"},{RT_U0,0,"U0i"},{RT_U0,0,"U0"},
|
||||
{RT_I8,1,"I8i"},{RT_I8,1,"I8"},{RT_I8,1,"Bool"},
|
||||
{RT_U8,1,"U8i"},{RT_U8,1,"U8"},
|
||||
@@ -13,7 +13,7 @@ class CInternalType
|
||||
{RT_F64,8,"F64i"},{RT_F64,8,"F64"},
|
||||
};
|
||||
|
||||
CIntermediateStruct intermediate_code_table[IC_NUM_ENTRIES]={
|
||||
CIntermediateStruct intermediate_code_table[IC_ICS_NUM]={
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"END"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"NOP1"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"END_EXP"},
|
||||
@@ -185,10 +185,10 @@ CIntermediateStruct intermediate_code_table[IC_NUM_ENTRIES]={
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SWAP_U64"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"ABS_I64"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SIGN_I64"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"MIN_I64"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"MIN_U64"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"MAX_I64"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"MAX_U64"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"I64_MIN"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"U64_MIN"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"I64_MAX"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"U64_MAX"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"MOD_U64"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SQRI64"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SQRU64"},
|
||||
@@ -241,21 +241,21 @@ U0 CmpFillTables()
|
||||
I64 i;
|
||||
U32 *d;
|
||||
|
||||
cmp.to_reg_vars_map=CAlloc(NUM_REGS*sizeof(U8));
|
||||
cmp.to_reg_vars_map=CAlloc(REG_REGS_NUM*sizeof(U8));
|
||||
cmp.num_reg_vars=0;
|
||||
cmp.reg_vars_mask=REGG_LOCAL_VARS;
|
||||
for (i=0;i<NUM_REGS;i++)
|
||||
for (i=0;i<REG_REGS_NUM;i++)
|
||||
if (Bt(&cmp.reg_vars_mask,i))
|
||||
cmp.to_reg_vars_map[cmp.num_reg_vars++]=i;
|
||||
|
||||
cmp.non_ptr_vars_map=CAlloc(NUM_REGS*sizeof(U8));
|
||||
cmp.non_ptr_vars_map=CAlloc(REG_REGS_NUM*sizeof(U8));
|
||||
cmp.num_non_ptr_vars=0;
|
||||
cmp.non_ptr_vars_mask=REGG_LOCAL_NON_PTR_VARS;
|
||||
for (i=0;i<NUM_REGS;i++)
|
||||
for (i=0;i<REG_REGS_NUM;i++)
|
||||
if (Bt(&cmp.non_ptr_vars_mask,i))
|
||||
cmp.non_ptr_vars_map[cmp.num_non_ptr_vars++]=i;
|
||||
|
||||
cmp.dual_U16_tokens1=d=CAlloc(sizeof(U32)*TK_NUM_TK);
|
||||
cmp.dual_U16_tokens1=d=CAlloc(sizeof(U32)*TK_TKS_NUM);
|
||||
d['!']=TK_NOT_EQU<<16+'=';
|
||||
d['&']=TK_AND_AND<<16+'&';
|
||||
d['*']=TK_MUL_EQU<<16+'=';
|
||||
@@ -270,7 +270,7 @@ U0 CmpFillTables()
|
||||
d['|']=TK_OR_OR<<16+'|';
|
||||
d['%']=TK_MOD_EQU<<16+'=';
|
||||
|
||||
cmp.dual_U16_tokens2=d=CAlloc(sizeof(U32)*TK_NUM_TK);
|
||||
cmp.dual_U16_tokens2=d=CAlloc(sizeof(U32)*TK_TKS_NUM);
|
||||
d['&']=TK_AND_EQU<<16+'=';
|
||||
d['+']=TK_ADD_EQU<<16+'=';
|
||||
d['-']=TK_MINUS_MINUS<<16+'-';
|
||||
@@ -280,11 +280,11 @@ U0 CmpFillTables()
|
||||
d['^']=TK_XOR_XOR<<16+'^';
|
||||
d['|']=TK_OR_EQU<<16+'=';
|
||||
|
||||
cmp.dual_U16_tokens3=d=CAlloc(sizeof(U32)*TK_NUM_TK);
|
||||
cmp.dual_U16_tokens3=d=CAlloc(sizeof(U32)*TK_TKS_NUM);
|
||||
d['-']=TK_SUB_EQU<<16+'=';
|
||||
d['/']=TK_DIV_EQU<<16+'=';
|
||||
|
||||
cmp.binary_ops=d=CAlloc(sizeof(U32)*TK_NUM_TK);
|
||||
cmp.binary_ops=d=CAlloc(sizeof(U32)*TK_TKS_NUM);
|
||||
d['`'] =(PREC_EXP+ASSOCF_RIGHT)<<16+IC_POWER;
|
||||
d[TK_SHL]=(PREC_EXP+ASSOCF_LEFT)<<16+IC_SHL;
|
||||
d[TK_SHR]=(PREC_EXP+ASSOCF_LEFT)<<16+IC_SHR;
|
||||
|
||||
+7
-7
@@ -255,7 +255,7 @@ U0 CmpFixUpJITAsm(CCmpCtrl *cc,CAOT *tmpaot)
|
||||
case IET_IMM_U0:
|
||||
break;
|
||||
case IET_REL_I8:
|
||||
if (!(MIN_I8<=i-ptr-1<=MAX_I8))
|
||||
if (!(I8_MIN<=i-ptr-1<=I8_MAX))
|
||||
LexExcept(cc,"Branch out of range at ");
|
||||
*ptr(U8 *) =i-ptr-1;
|
||||
break;
|
||||
@@ -263,7 +263,7 @@ U0 CmpFixUpJITAsm(CCmpCtrl *cc,CAOT *tmpaot)
|
||||
*ptr(U8 *) =i;
|
||||
break;
|
||||
case IET_REL_I16:
|
||||
if (!(MIN_I16<=i-ptr-2<=MAX_I16))
|
||||
if (!(I16_MIN<=i-ptr-2<=I16_MAX))
|
||||
LexExcept(cc,"Branch out of range at ");
|
||||
*ptr(U16 *)=i-ptr-2;
|
||||
break;
|
||||
@@ -271,7 +271,7 @@ U0 CmpFixUpJITAsm(CCmpCtrl *cc,CAOT *tmpaot)
|
||||
*ptr(U16 *)=i;
|
||||
break;
|
||||
case IET_REL_I32:
|
||||
if (!(MIN_I32<=i-ptr-4<=MAX_I32))
|
||||
if (!(I32_MIN<=i-ptr-4<=I32_MAX))
|
||||
LexExcept(cc,"Branch out of range at ");
|
||||
*ptr(U32 *)=i-ptr-4;
|
||||
break;
|
||||
@@ -355,7 +355,7 @@ U0 CmpFixUpAOTAsm(CCmpCtrl *cc,CAOT *tmpaot)
|
||||
case IET_IMM_U0:
|
||||
break;
|
||||
case IET_REL_I8:
|
||||
if (!(MIN_I8<=i-ptr-1<=MAX_I8))
|
||||
if (!(I8_MIN<=i-ptr-1<=I8_MAX))
|
||||
LexExcept(cc,"Branch out of range at ");
|
||||
*ptr(U8 *) =i-ptr-1;
|
||||
break;
|
||||
@@ -363,7 +363,7 @@ U0 CmpFixUpAOTAsm(CCmpCtrl *cc,CAOT *tmpaot)
|
||||
*ptr(U8 *) =i;
|
||||
break;
|
||||
case IET_REL_I16:
|
||||
if (!(MIN_I16<=i-ptr-2<=MAX_I16))
|
||||
if (!(I16_MIN<=i-ptr-2<=I16_MAX))
|
||||
LexExcept(cc,"Branch out of range at ");
|
||||
*ptr(U16 *)=i-ptr-2;
|
||||
break;
|
||||
@@ -371,7 +371,7 @@ U0 CmpFixUpAOTAsm(CCmpCtrl *cc,CAOT *tmpaot)
|
||||
*ptr(U16 *)=i;
|
||||
break;
|
||||
case IET_REL_I32:
|
||||
if (!(MIN_I32<=i-ptr-4<=MAX_I32))
|
||||
if (!(I32_MIN<=i-ptr-4<=I32_MAX))
|
||||
LexExcept(cc,"Branch out of range at ");
|
||||
*ptr(U32 *)=i-ptr-4;
|
||||
break;
|
||||
@@ -538,7 +538,7 @@ I64 Cmp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
|
||||
size=(sizeof(CBinFile)+aot_U8s+i+15)&-16;
|
||||
bfh=MAlloc(size);
|
||||
bfh->jmp=0xEB+256*(sizeof(CBinFile)-2);
|
||||
#assert sizeof(CBinFile)-2<=MAX_I8
|
||||
#assert sizeof(CBinFile)-2<=I8_MAX
|
||||
bfh->reserved=0;
|
||||
bfh->bin_signature=BIN_SIGNATURE_VAL;
|
||||
bfh->module_org=tmpaot->module_org;
|
||||
|
||||
Binary file not shown.
+79
-84
@@ -7,7 +7,7 @@ $LK,"CmpRawTypePointed",A="FL:::/Compiler/OptLib.HC.Z,517",BI=6$
|
||||
$LK,"OptFixupBinaryOp1",A="FL:::/Compiler/OptLib.HC.Z,96",BI=7$
|
||||
$LK,"OptFixupBinaryOp2",A="FL:::/Compiler/OptLib.HC.Z,182",BI=8$
|
||||
$LK,"COCInit",A="FL:::/Compiler/PrsLib.HC.Z,99",BI=9$
|
||||
$LK,"IsLexExpression2Bin",A="FL:::/Compiler/PrsExp.HC.Z,1129",BI=10$
|
||||
$LK,"IsLexExpression2Bin",A="FL:::/Compiler/PrsExp.HC.Z,1135",BI=10$
|
||||
$LK,"CSubSwitch",A="FL:::/Compiler/PrsStmt.HC.Z,566"$
|
||||
$LK,"LexFilePop",A="FL:::/Compiler/Lex.HC.Z,11",BI=11$
|
||||
$LK,"ExePutS",A="FL:::/Compiler/CMain.HC.Z,571",BI=12$
|
||||
@@ -57,25 +57,24 @@ $LK,"PE_POP_ALL1",A="FL:::/Compiler/PrsExp.HC.Z,12"$
|
||||
$LK,"PE_POP_ALL2",A="FL:::/Compiler/PrsExp.HC.Z,13"$
|
||||
$LK,"COCAppend",A="FL:::/Compiler/PrsLib.HC.Z,126",BI=46$
|
||||
$LK,"LexFilePush",A="FL:::/Compiler/Lex.HC.Z,1",BI=47$
|
||||
$LK,"PrsUnaryModifier",A="FL:::/Compiler/PrsExp.HC.Z,955",BI=48$
|
||||
$LK,"PrsUnaryModifier",A="FL:::/Compiler/PrsExp.HC.Z,960",BI=48$
|
||||
$LK,"OptFixupUnaryOp",A="FL:::/Compiler/OptLib.HC.Z,196",BI=49$
|
||||
$LK,"LexPush",A="FL:::/Compiler/LexLib.HC.Z,12",BI=50$
|
||||
$LK,"SLASH_OP_MOV",A="FL:::/Compiler/BackLib.HC.Z,267"$
|
||||
$LK,"ICPopRegs",A="FL:::/Compiler/BackLib.HC.Z,391",BI=51$
|
||||
$LK,"SLASH_OP_MUL",A="FL:::/Compiler/BackLib.HC.Z,264"$
|
||||
$LK,"SLASH_OP_NOT",A="FL:::/Compiler/BackLib.HC.Z,260"$
|
||||
$LK,"NUM_INTERNAL_TYPES",A="FL:::/Compiler/CInit.HC.Z,1"$
|
||||
$LK,"SLASH_OP_POP",A="FL:::/Compiler/BackLib.HC.Z,270"$
|
||||
$LK,"ICFOp",A="FL:::/Compiler/BackFA.HC.Z,339",BI=52$
|
||||
$LK,"CN_A1",A="FL:::/Compiler/BackFA.HC.Z,2"$
|
||||
$LK,"CN_A2",A="FL:::/Compiler/BackFA.HC.Z,1"$
|
||||
$LK,"LexExpressionF64",A="FL:::/Compiler/PrsExp.HC.Z,1148",BI=53$
|
||||
$LK,"LexExpressionF64",A="FL:::/Compiler/PrsExp.HC.Z,1154",BI=53$
|
||||
$LK,"ICAdd",A="FL:::/Compiler/PrsLib.HC.Z,79",BI=54$
|
||||
$LK,"CmpRawType",A="FL:::/Compiler/OptLib.HC.Z,508",BI=55$
|
||||
$LK,"ICFOpEqu",A="FL:::/Compiler/BackFB.HC.Z,1",BI=56$
|
||||
$LK,"LexExpressionI64",A="FL:::/Compiler/PrsExp.HC.Z,1134",BI=57$
|
||||
$LK,"LexExpressionI64",A="FL:::/Compiler/PrsExp.HC.Z,1140",BI=57$
|
||||
$LK,"ICQueInsRev",A="FL:::/Compiler/BackC.HC.Z,378",BI=58$
|
||||
$LK,"LexExpression",A="FL:::/Compiler/PrsExp.HC.Z,1162",BI=59$
|
||||
$LK,"LexExpression",A="FL:::/Compiler/PrsExp.HC.Z,1168",BI=59$
|
||||
$LK,"PrsExpression",A="FL:::/Compiler/PrsExp.HC.Z,264",BI=60$
|
||||
$LK,"PrsClassNew",A="FL:::/Compiler/PrsLib.HC.Z,40",BI=61$
|
||||
$LK,"LexInStr",A="FL:::/Compiler/Lex.HC.Z,367",BI=62$
|
||||
@@ -105,7 +104,7 @@ $LK,"Ui",A="FL:::/Compiler/UAsm.HC.Z,245",BI=81$
|
||||
$LK,"ICSlashOp",A="FL:::/Compiler/BackLib.HC.Z,282",BI=82$
|
||||
$LK,"OptBrZero",A="FL:::/Compiler/OptLib.HC.Z,230",BI=83$
|
||||
$LK,"Un",A="FL:::/Compiler/UAsm.HC.Z,668",BI=84$
|
||||
$LK,"PrsSizeOf",A="FL:::/Compiler/PrsExp.HC.Z,298",BI=85$
|
||||
$LK,"PrsSizeOf",A="FL:::/Compiler/PrsExp.HC.Z,303",BI=85$
|
||||
$LK,"ICToI64",A="FL:::/Compiler/BackB.HC.Z,277",BI=86$
|
||||
$LK,"ICMod",A="FL:::/Compiler/BackA.HC.Z,425",BI=87$
|
||||
$LK,"OptSetNOP1",A="FL:::/Compiler/OptLib.HC.Z,17",BI=88$
|
||||
@@ -154,7 +153,7 @@ $LK,"ICModr1",A="FL:::/Compiler/BackLib.HC.Z,136",BI=120$
|
||||
$LK,"ICModr2",A="FL:::/Compiler/BackLib.HC.Z,214",BI=121$
|
||||
$LK,"SLASH_OP_FMUL",A="FL:::/Compiler/BackLib.HC.Z,274"$
|
||||
$LK,"ICPreIncDec",A="FL:::/Compiler/BackB.HC.Z,304",BI=122$
|
||||
$LK,"PrsUnaryTerm",A="FL:::/Compiler/PrsExp.HC.Z,588",BI=123$
|
||||
$LK,"PrsUnaryTerm",A="FL:::/Compiler/PrsExp.HC.Z,593",BI=123$
|
||||
$LK,"MemberLstDel",A="FL:::/Compiler/LexLib.HC.Z,183",BI=124$
|
||||
$LK,"SLASH_OP_FSUB",A="FL:::/Compiler/BackLib.HC.Z,272"$
|
||||
$LK,"ICAndAnd",A="FL:::/Compiler/BackB.HC.Z,30",BI=125$
|
||||
@@ -187,7 +186,7 @@ $LK,"StreamPrint",A="FL:::/Compiler/CMisc.HC.Z,68",BI=146$
|
||||
$LK,"_LAST_FUN",A="FL:::/Compiler/CMisc.HC.Z,12"$
|
||||
$LK,"ICFCvt",A="FL:::/Compiler/BackFA.HC.Z,123",BI=147$
|
||||
$LK,"StreamDir",A="FL:::/Compiler/CMisc.HC.Z,82",BI=148$
|
||||
$LK,"PrsOffsetOf",A="FL:::/Compiler/PrsExp.HC.Z,348",BI=149$
|
||||
$LK,"PrsOffsetOf",A="FL:::/Compiler/PrsExp.HC.Z,353",BI=149$
|
||||
$LK,"GetOption",A="FL:::/Compiler/CMisc.HC.Z,6",BI=150$
|
||||
$LK,"PrsDoWhile",A="FL:::/Compiler/PrsStmt.HC.Z,506",BI=151$
|
||||
$LK,"ICShift",A="FL:::/Compiler/BackA.HC.Z,573",BI=152$
|
||||
@@ -200,7 +199,7 @@ $LK,"LexPopRestore",A="FL:::/Compiler/LexLib.HC.Z,23",BI=156$
|
||||
$LK,"ICUnaries",A="FL:::/Compiler/BackB.HC.Z,1",BI=157$
|
||||
$LK,"ICFMul",A="FL:::/Compiler/BackFB.HC.Z,488",BI=158$
|
||||
$LK,"ICShiftEqu",A="FL:::/Compiler/BackA.HC.Z,603",BI=159$
|
||||
$LK,"LexExpression2Bin",A="FL:::/Compiler/PrsExp.HC.Z,1111",BI=160$
|
||||
$LK,"LexExpression2Bin",A="FL:::/Compiler/PrsExp.HC.Z,1117",BI=160$
|
||||
$LK,"ICFPow",A="FL:::/Compiler/BackFA.HC.Z,266",BI=161$
|
||||
$LK,"MapFileWrite",A="FL:::/Compiler/CHash.HC.Z,90",BI=162$
|
||||
$LK,"ICFSub",A="FL:::/Compiler/BackFB.HC.Z,551",BI=163$
|
||||
@@ -245,6 +244,7 @@ $LK,"ICOrOr",A="FL:::/Compiler/BackB.HC.Z,51",BI=191$
|
||||
$LK,"LexExcept",A="FL:::/Compiler/CExcept.HC.Z,81",BI=192$
|
||||
$LK,"cmp_templates",A="FL:::/Compiler/CExts.HC.Z,42"$
|
||||
$LK,"CmpF2PushPop",A="FL:::/Compiler/OptLib.HC.Z,542",BI=193$
|
||||
$LK,"INTERNAL_TYPES_NUM",A="FL:::/Compiler/CInit.HC.Z,1"$
|
||||
$LK,"CmpJoin",A="FL:::/Compiler/CMain.HC.Z,35",BI=194$
|
||||
$LK,"PrsPop2",A="FL:::/Compiler/PrsLib.HC.Z,16",BI=195$
|
||||
$LK,"CMP_TEMPLATES",A="FL:::/Compiler/Templates.HC.Z,4"$
|
||||
@@ -303,7 +303,7 @@ $LK,"LexDocRead",A="FL:::/Compiler/Lex.HC.Z,305",BI=238$
|
||||
$LK,"CmpFixUpJITAsm",A="FL:::/Compiler/CMain.HC.Z,174",BI=239$
|
||||
$LK,"COCPopNoFree",A="FL:::/Compiler/PrsLib.HC.Z,114",BI=240$
|
||||
$LK,"ParenWarning",A="FL:::/Compiler/CExcept.HC.Z,110",BI=241$
|
||||
$LK,"PrsFunCall",A="FL:::/Compiler/PrsExp.HC.Z,378",BI=242$
|
||||
$LK,"PrsFunCall",A="FL:::/Compiler/PrsExp.HC.Z,383",BI=242$
|
||||
$LK,"SLASH_OP_IMM_U32",A="FL:::/Compiler/BackLib.HC.Z,263"$
|
||||
$LK,"ICDerefPostIncDec",A="FL:::/Compiler/BackB.HC.Z,384",BI=243$
|
||||
$LK,"Option",A="FL:::/Compiler/CMisc.HC.Z,1",BI=244$
|
||||
@@ -344,85 +344,80 @@ $LK,"PrsDotDotDot",A="FL:::/Compiler/PrsVar.HC.Z,381",BI=266$
|
||||
$LK,"ICMulEqu",A="FL:::/Compiler/BackA.HC.Z,285",BI=267$
|
||||
$LK,"AsmPrsInsFlags",A="FL:::/Compiler/AsmInit.HC.Z,1",BI=268$
|
||||
$LK,"PrsNoWarn",A="FL:::/Compiler/PrsStmt.HC.Z,791",BI=269$
|
||||
| ||||