TempleOSCD_140715.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:46:09 +02:00
1 parent 7ef616a20e
commit 64f679eeb9
1095 files changed
+24814 -221011

No files matched your search

+89 -18
View File
@@ -1,23 +1,23 @@
CHashDefineStr *DefineLoad(U8 *name,U8 *st)
{
{//Create DEFINE hash entry with string.
CHashDefineStr *temph=CAlloc(sizeof(CHashDefineStr));
temph->type=HTT_DEFINE_STR;
temph->str=StrNew(name);
temph->data=StrNew(st);
temph->cnt=-1;
temph->src_link=MPrint("AD:0x%X",Caller);
temph->src_link=MStrPrint("AD:0x%X",Caller);
HashAdd(temph,Fs->hash_table);
return temph;
}
CHashDefineStr *DefineLstLoad(U8 *name,U8 *st)
{ //Not especially efficient but handy.
{//Create DEFINE list. Not efficient, but handy.
I64 cnt=0;
U8 *ptr,**lst;
CHashDefineStr *temph=CAlloc(sizeof(CHashDefineStr));
temph->type=HTT_DEFINE_STR;
temph->str=StrNew(name);
temph->src_link=MPrint("AD:0x%X",Caller);
temph->src_link=MStrPrint("AD:0x%X",Caller);
ptr=st;
while (*ptr) {
if (*ptr!='@')
@@ -47,7 +47,7 @@ U0 UndefinedDefine(U8 *name)
}
U8 *Define(U8 *name)
{
{//Look for DEFINE named in hash table, return ptr string.
CHashDefineStr *temph;
if (temph=HashFind(name,Fs->hash_table,HTT_DEFINE_STR))
return temph->data;
@@ -58,7 +58,7 @@ U8 *Define(U8 *name)
}
U8 *DefineSub(I64 sub,U8 *name)
{
{//Return DEFINE list entry indexed by number.
CHashDefineStr *temph;
if (temph=HashFind(name,Fs->hash_table,HTT_DEFINE_STR)) {
if (0<=sub<temph->cnt)
@@ -72,7 +72,7 @@ U8 *DefineSub(I64 sub,U8 *name)
}
I64 DefineCnt(U8 *name)
{
{//Return cnt of entries in define list.
CHashDefineStr *temph;
if (temph=HashFind(name,Fs->hash_table,HTT_DEFINE_STR))
return temph->cnt;
@@ -83,13 +83,13 @@ I64 DefineCnt(U8 *name)
}
I64 DefineMatch(U8 *needle,U8 *haystack_lst_name,I64 flags=0)
{
{//Find match for string in define list.
return LstMatch(needle,Define(haystack_lst_name),flags);
}
U0 DefinePrint(U8 *name,U8 *src,...)
{
U8 *buf=SPrintJoin(NULL,src,argc,argv);
{//Create DEFINE entry with $LK,"Print",A="FI:::/Doc/Print.TXT"$()ed string.
U8 *buf=StrPrintJoin(NULL,src,argc,argv);
DefineLoad(name,buf);
Free(buf);
}
@@ -106,7 +106,7 @@ U0 SysDefinesLoad()
"Thursday\0Friday\0Saturday\0");
DefineLstLoad("ST_MONTHS","January\0February\0March\0April\0May\0"
"June\0July\0August\0September\0October\0November\0December\0");
DefineLstLoad("ST_FILE_ATTRS","R\0H\0S\0V\0D\0A\0 \0 \0X\0Y\0T\0Z\0C\0F\0");
DefineLstLoad("ST_FILE_ATTRS","R\0H\0S\0V\0D\0A\0 \0 \0X\0T\0Z\0C\0F\0");
DefineLstLoad("ST_FILE_UTIL_FLAGS","r\0d\0i\0a\0c\0R\0p\0m\0x\0s\0"
"D\0F\0T\0S\0A\0J\0G\0Z\0O\0P\0f\0l\0lb\0la\0");
DefineLstLoad("ST_BLKDEV_TYPES","NULL\0RAM\0ATA\0ATAPI\0");
@@ -124,22 +124,93 @@ U0 SysDefinesLoad()
"MP Crash\0Wake\0Dbg\0");
}
U8 *Color2Text(U8 *buf,CColorROPU32 c)
{
U8 *Color2Str(U8 *buf,CColorROPU32 c)
{//$LK,"CColorROPU32",A="MN:CColorROPU32"$ with flags to $LK,"GrLighting",A="MN:GrLighting"$ str.
*buf=0;
if (c.c0.rop&ROPBF_TWO_SIDED)
CatPrint(buf,"TWO|");
if (c.c0.rop&ROPBF_HALF_RANGE_COLOR)
CatPrint(buf,"HALF|");
if (0<=c.c0.color<16)
StrCpy(buf,DefineSub(c.c0.color,"ST_COLORS"));
else if (c.c0.color==COLOR_TRANSPARENT)
StrCpy(buf,"TRANSPARENT");
CatPrint(buf,DefineSub(c.c0.color,"ST_COLORS"));
else if (c.c0.color==TRANSPARENT)
CatPrint(buf,"TRANSPARENT");
else
StrCpy(buf,"INVALID");
CatPrint(buf,"INVALID");
if (c&ROPF_DITHER) {
CatPrint(buf,"/");
if (c.c1.rop&ROPBF_TWO_SIDED)
CatPrint(buf,"TWO|");
if (c.c1.rop&ROPBF_HALF_RANGE_COLOR)
CatPrint(buf,"HALF|");
if (0<=c.c1.color<16)
CatPrint(buf,DefineSub(c.c1.color,"ST_COLORS"));
else if (c.c1.color==COLOR_TRANSPARENT)
else if (c.c1.color==TRANSPARENT)
CatPrint(buf,"TRANSPARENT");
else
CatPrint(buf,"INVALID");
}
return buf;
}
CColorROPU16 Str2ColorU16(U8 *st)
{//$LK,"GrLighting",A="MN:GrLighting"$ color str with flags to $LK,"CColorROPU16",A="MN:CColorROPU16"$.
CColorROPU16 result=COLOR_INVALID;
I64 i;
U8 *ptr,*ptr2,*st2;
if (!st) return COLOR_INVALID;
while (TRUE) {
if (!*st||StrOcc("/,)}>",*st))
return result;
if (Bt(chars_bitmap_alpha,*st)) {
ptr=st;
while (Bt(chars_bitmap_alpha_numeric,*ptr))
ptr++;
st2=ptr2=MAlloc(ptr-st+1);
while (st<ptr)
*ptr2++=*st++;
*ptr2++=0;
if (!StrICmp(st2,"TWO"))
result.rop|=ROPBF_TWO_SIDED;
else if (!StrICmp(st2,"HALF"))
result.rop|=ROPBF_HALF_RANGE_COLOR;
else if ((i=DefineMatch(st2,"ST_COLORS",LMF_IGNORE_CASE))>=0)
result.color=i;
else if (!StrICmp(st2,"TRANSPARENT"))
result.color=TRANSPARENT;
else {
Free(st2);
return COLOR_INVALID;
}
Free(st2);
} else if (*st=='+'||*st=='|'||Bt(chars_bitmap_white_space,*st))
st++;
else if ('0'<=*st<='9') {
i=Str2I64(st,10,&ptr);
if (0<=i<=0xFF) {
result.color=i;
st=ptr;
} else
return COLOR_INVALID;
} else
return COLOR_INVALID;
}
}
CColorROPU32 Str2ColorU32(U8 *st)
{//$LK,"GrLighting",A="MN:GrLighting"$ color str with flags to $LK,"CColorROPU32",A="MN:CColorROPU32"$.
U8 *st2;
CColorROPU32 result=0;
if (!st) return COLOR_INVALID;
st2=MAlloc(StrLen(st)+1);
StrFirstRem(st,"/,)}>",st2);
result.c0=Str2ColorU16(st2);
if (*st) {
result.c1=Str2ColorU16(st);
result|=ROPF_DITHER;
}
if (result.c0.color==COLOR_INVALID||result.c1.color==COLOR_INVALID)
return COLOR_INVALID;
else
return result;
}