text
stringlengths 130
8.09k
| formatted
dict |
|---|---|
// Source: D:\TempleOS-Projects\html\Host-Adam.html
// Date: unknown-date
// Language: HolyC
#help_index "Misc/Host"
public Bool HostChgDsk(U8 *iso_filename)
{//Help user change CD/DVD or ISO_file.
Bool res=FALSE;
SettingsPush; //See SettingsPush
try {
AutoComplete;
WinBorder;
WinMax;
DocClear;
"$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))
"
Click CDROM Icon in bottom-right border of VMware window.
Click \"Settings\".
Set ISO image to \"%s\".
When browsing, change the file mask from \"*.iso\" to \"All Files\".
",iso_filename;
else
"
Click CDROM Icon in bottom-right border of VMware window.
Click \"Settings\".
Set ISO image to \"%s\".
",iso_filename;
break;
case VM_QEMU:
"
Change to QEMU monitor using <CTRL-ALT-2>
Get the CDROM designation.
>info block
Use the designation.
>eject ide1-cd0
Use the designation.
>change ide1-cd0 %s
Change back to QEMU using <CTRL-ALT-1>
",iso_filename;
break;
default:
"
Place the CDDVD %s in the drive.
",iso_filename;
}
if (PressAKey!=CH_SHIFT_ESC) {
">DskChg('T');\n\n";
DskChg('T');
res=TRUE;
}
} catch
PutExcept;
SettingsPop;
return res;
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Host-Adam.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"Misc/Host\"\n\npublic Bool HostChgDsk(U8 *iso_filename)\n{//Help user change CD/DVD or ISO_file.\n Bool res=FALSE;\n SettingsPush; //See SettingsPush\n try {\n AutoComplete;\n WinBorder;\n WinMax;\n DocClear;\n \"$PURPLE$$TX+CX,\\\"Set to %s\\\"$$FG$\\n\\n\\n\\n\",iso_filename;\n switch (ins_reg.host_vm) {\n case VM_VMWARE:\n if (IsDotC(iso_filename))\n\"\nClick CDROM Icon in bottom-right border of VMware window.\n\nClick \\\"Settings\\\".\n\nSet ISO image to \\\"%s\\\".\nWhen browsing, change the file mask from \\\"*.iso\\\" to \\\"All Files\\\".\n\n\",iso_filename;\n else\n\"\nClick CDROM Icon in bottom-right border of VMware window.\n\nClick \\\"Settings\\\".\n\nSet ISO image to \\\"%s\\\".\n\n\",iso_filename;\n break;\n case VM_QEMU:\n\"\nChange to QEMU monitor using <CTRL-ALT-2>\n\nGet the CDROM designation.\n\n >info block\n\nUse the designation.\n\n >eject ide1-cd0\n\nUse the designation.\n\n >change ide1-cd0 %s\n\nChange back to QEMU using <CTRL-ALT-1>\n\n\",iso_filename;\n break;\n default:\n\"\nPlace the CDDVD %s in the drive.\n\n\",iso_filename;\n }\n if (PressAKey!=CH_SHIFT_ESC) {\n \">DskChg('T');\\n\\n\";\n DskChg('T');\n res=TRUE;\n }\n } catch\n PutExcept;\n SettingsPop;\n return res;\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\AsmLib-Compiler.html
// Date: unknown-date
// Language: HolyC
U0 AOTStoreCodeU8(CCmpCtrl *cc,U8 b)
{
CAOTCtrl *aotc=cc->aotc;
I64 i=aotc->rip>>AOT_BIN_BLK_BITS;
CAOTBinBlk *tmpbin=aotc->bin;
while (i--)
if (!(tmpbin=tmpbin->next)) {
i=aotc->rip>>AOT_BIN_BLK_BITS+1;
tmpbin=&aotc->bin;
while (i--) {
if (!tmpbin->next)
tmpbin->next=CAlloc(sizeof(CAOTBinBlk));
tmpbin=tmpbin->next;
}
break;
}
tmpbin->body[aotc->rip++ & (AOT_BIN_BLK_SIZE-1)]=b;
if (aotc->lst) {
if (aotc->lst_col>=24) {
'\n';
aotc->lst_col=0;
}
"%02X ",b;
aotc->lst_col+=3;
}
if (aotc->rip>aotc->num_bin_U8s)
aotc->num_bin_U8s=aotc->rip;
}
U0 AOTStoreCodeU32(CCmpCtrl *cc,U32 d)
{
CAOTCtrl *aotc=cc->aotc;
I64 i=aotc->rip>>AOT_BIN_BLK_BITS,j=(aotc->rip+sizeof(U32))>>AOT_BIN_BLK_BITS;
U32 *_d;
CAOTBinBlk *tmpbin;
if (i!=j)
for (i=0;i<sizeof(U32);i++)
AOTStoreCodeU8(cc,d.u8[i]);
else {
tmpbin=aotc->bin;
while (i--)
if (!(tmpbin=tmpbin->next)) {
i=aotc->rip>>AOT_BIN_BLK_BITS+1;
tmpbin=&aotc->bin;
while (i--) {
if (!tmpbin->next)
tmpbin->next=CAlloc(sizeof(CAOTBinBlk));
tmpbin=tmpbin->next;
}
break;
}
_d=tmpbin->body+ aotc->rip&(AOT_BIN_BLK_SIZE-1);
*_d=d;
aotc->rip+=sizeof(U32);
if (aotc->lst) {
if (aotc->lst_col>=24) {
'\n';
aotc->lst_col=0;
}
"%08X ",d;
aotc->lst_col+=9;
}
if (aotc->rip>aotc->num_bin_U8s)
aotc->num_bin_U8s=aotc->rip;
}
}
U0 AOTStoreCodeU64(CCmpCtrl *cc,U64 q)
{
CAOTCtrl *aotc=cc->aotc;
I64 i=aotc->rip>>AOT_BIN_BLK_BITS,
j=(aotc->rip+sizeof(I64))>>AOT_BIN_BLK_BITS, *_q;
CAOTBinBlk *tmpbin;
if (i!=j)
for (i=0;i<sizeof(I64);i++)
AOTStoreCodeU8(cc,q.u8[i]);
else {
tmpbin=aotc->bin;
while (i--)
if (!(tmpbin=tmpbin->next)) {
i=aotc->rip>>AOT_BIN_BLK_BITS+1;
tmpbin=&aotc->bin;
while (i--) {
if (!tmpbin->next)
tmpbin->next=CAlloc(sizeof(CAOTBinBlk));
tmpbin=tmpbin->next;
}
break;
}
_q=tmpbin->body+ aotc->rip&(AOT_BIN_BLK_SIZE-1);
*_q=q;
aotc->rip+=sizeof(I64);
if (aotc->lst) {
if (aotc->lst_col>=24) {
'\n';
aotc->lst_col=0;
}
"%016X ",q;
aotc->lst_col+=17;
}
if (aotc->rip>aotc->num_bin_U8s)
aotc->num_bin_U8s=aotc->rip;
}
}
U0 AOTStoreCodeU8At(CCmpCtrl *cc,I64 rip,...)
{
CAOTCtrl *aotc=cc->aotc;
CAOTBinBlk *tmpbin;
I64 i,j;
for (j=0;j<argc;j++) {
i=rip>>AOT_BIN_BLK_BITS+1;
tmpbin=&aotc->bin;
while (i--) {
if (!tmpbin->next) {
tmpbin->next=CAlloc(sizeof(CAOTBinBlk));
tmpbin->next->next=NULL;
}
tmpbin=tmpbin->next;
}
tmpbin->body[rip++ & (AOT_BIN_BLK_SIZE-1)]=argv[j];
}
if (rip>aotc->num_bin_U8s)
aotc->num_bin_U8s=rip;
}
I64 AsmLexExpression(CCmpCtrl *cc)
{
U8 *machine_code;
I64 res=0;
cc->asm_undef_hash=NULL;
cc->flags&=~(CCF_UNRESOLVED+CCF_LOCAL);
cc->abs_cnts=0;
if (!IsLexExpression2Bin(cc,&machine_code))
LexSkipEol(cc);
else {
if (cc->abs_cnts.externs)
LexExcept(cc,"Extern Not Allowed at ");
if (cc->flags & CCF_UNRESOLVED)
LexExcept(cc,"Undefined sym at ");
res=Call(machine_code);
Free(machine_code);
}
return res;
}
U0 AsmLineLst(CCmpCtrl *cc)
{
CAOTCtrl *aotc=cc->aotc;
CLexFile *tmpf=cc->lex_include_stk;
CDocEntry *doc_e=tmpf->line_start,*doc_e2;
if (aotc->lst && aotc->lst_last_lfn==tmpf && doc_e) {
if (doc_e2=aotc->lst_last_line) {
if (tmpf->flags& LFSF_DOC) {
while (doc_e2->y<doc_e->y) {
"%h*c%08X ",24-aotc->lst_col,CH_SPACE,aotc->lst_last_rip;
aotc->lst_col=0;
doc_e2=LexPutLine(cc,doc_e2);
}
} else {
while (*doc_e2(U8 *) && doc_e2!=doc_e) {
"%h*c%08X ",24-aotc->lst_col,CH_SPACE,aotc->lst_last_rip;
aotc->lst_col=0;
doc_e2=LexPutLine(cc,doc_e2);
}
}
aotc->lst_last_line=doc_e2;
} else
aotc->lst_last_line=doc_e;
} else {
aotc->lst_last_line=NULL;
aotc->lst_last_lfn=tmpf;
}
aotc->lst_last_rip=aotc->rip;
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\AsmLib-Compiler.html\n// Date: unknown-date\n// Language: HolyC\n\nU0 AOTStoreCodeU8(CCmpCtrl *cc,U8 b)\n{\n CAOTCtrl *aotc=cc->aotc;\n I64 i=aotc->rip>>AOT_BIN_BLK_BITS;\n CAOTBinBlk *tmpbin=aotc->bin;\n while (i--)\n if (!(tmpbin=tmpbin->next)) {\n i=aotc->rip>>AOT_BIN_BLK_BITS+1;\n tmpbin=&aotc->bin;\n while (i--) {\n if (!tmpbin->next)\n tmpbin->next=CAlloc(sizeof(CAOTBinBlk));\n tmpbin=tmpbin->next;\n }\n break;\n }\n tmpbin->body[aotc->rip++ & (AOT_BIN_BLK_SIZE-1)]=b;\n if (aotc->lst) {\n if (aotc->lst_col>=24) {\n '\\n';\n aotc->lst_col=0;\n }\n \"%02X \",b;\n aotc->lst_col+=3;\n }\n if (aotc->rip>aotc->num_bin_U8s)\n aotc->num_bin_U8s=aotc->rip;\n}\n\nU0 AOTStoreCodeU32(CCmpCtrl *cc,U32 d)\n{\n CAOTCtrl *aotc=cc->aotc;\n I64 i=aotc->rip>>AOT_BIN_BLK_BITS,j=(aotc->rip+sizeof(U32))>>AOT_BIN_BLK_BITS;\n U32 *_d;\n CAOTBinBlk *tmpbin;\n if (i!=j)\n for (i=0;i<sizeof(U32);i++)\n AOTStoreCodeU8(cc,d.u8[i]);\n else {\n tmpbin=aotc->bin;\n while (i--)\n if (!(tmpbin=tmpbin->next)) {\n i=aotc->rip>>AOT_BIN_BLK_BITS+1;\n tmpbin=&aotc->bin;\n while (i--) {\n if (!tmpbin->next)\n tmpbin->next=CAlloc(sizeof(CAOTBinBlk));\n tmpbin=tmpbin->next;\n }\n break;\n }\n _d=tmpbin->body+ aotc->rip&(AOT_BIN_BLK_SIZE-1);\n *_d=d;\n aotc->rip+=sizeof(U32);\n if (aotc->lst) {\n if (aotc->lst_col>=24) {\n '\\n';\n aotc->lst_col=0;\n }\n \"%08X \",d;\n aotc->lst_col+=9;\n }\n if (aotc->rip>aotc->num_bin_U8s)\n aotc->num_bin_U8s=aotc->rip;\n }\n}\n\nU0 AOTStoreCodeU64(CCmpCtrl *cc,U64 q)\n{\n CAOTCtrl *aotc=cc->aotc;\n I64 i=aotc->rip>>AOT_BIN_BLK_BITS,\n j=(aotc->rip+sizeof(I64))>>AOT_BIN_BLK_BITS, *_q;\n CAOTBinBlk *tmpbin;\n if (i!=j)\n for (i=0;i<sizeof(I64);i++)\n AOTStoreCodeU8(cc,q.u8[i]);\n else {\n tmpbin=aotc->bin;\n while (i--)\n if (!(tmpbin=tmpbin->next)) {\n i=aotc->rip>>AOT_BIN_BLK_BITS+1;\n tmpbin=&aotc->bin;\n while (i--) {\n if (!tmpbin->next)\n tmpbin->next=CAlloc(sizeof(CAOTBinBlk));\n tmpbin=tmpbin->next;\n }\n break;\n }\n _q=tmpbin->body+ aotc->rip&(AOT_BIN_BLK_SIZE-1);\n *_q=q;\n aotc->rip+=sizeof(I64);\n if (aotc->lst) {\n if (aotc->lst_col>=24) {\n '\\n';\n aotc->lst_col=0;\n }\n \"%016X \",q;\n aotc->lst_col+=17;\n }\n if (aotc->rip>aotc->num_bin_U8s)\n aotc->num_bin_U8s=aotc->rip;\n }\n}\n\nU0 AOTStoreCodeU8At(CCmpCtrl *cc,I64 rip,...)\n{\n CAOTCtrl *aotc=cc->aotc;\n CAOTBinBlk *tmpbin;\n I64 i,j;\n for (j=0;j<argc;j++) {\n i=rip>>AOT_BIN_BLK_BITS+1;\n tmpbin=&aotc->bin;\n while (i--) {\n if (!tmpbin->next) {\n tmpbin->next=CAlloc(sizeof(CAOTBinBlk));\n tmpbin->next->next=NULL;\n }\n tmpbin=tmpbin->next;\n }\n tmpbin->body[rip++ & (AOT_BIN_BLK_SIZE-1)]=argv[j];\n }\n if (rip>aotc->num_bin_U8s)\n aotc->num_bin_U8s=rip;\n}\n\nI64 AsmLexExpression(CCmpCtrl *cc)\n{\n U8 *machine_code;\n I64 res=0;\n cc->asm_undef_hash=NULL;\n cc->flags&=~(CCF_UNRESOLVED+CCF_LOCAL);\n cc->abs_cnts=0;\n if (!IsLexExpression2Bin(cc,&machine_code))\n LexSkipEol(cc);\n else {\n if (cc->abs_cnts.externs)\n LexExcept(cc,\"Extern Not Allowed at \");\n if (cc->flags & CCF_UNRESOLVED)\n LexExcept(cc,\"Undefined sym at \");\n res=Call(machine_code);\n Free(machine_code);\n }\n return res;\n}\n\nU0 AsmLineLst(CCmpCtrl *cc)\n{\n CAOTCtrl *aotc=cc->aotc;\n CLexFile *tmpf=cc->lex_include_stk;\n CDocEntry *doc_e=tmpf->line_start,*doc_e2;\n if (aotc->lst && aotc->lst_last_lfn==tmpf && doc_e) {\n if (doc_e2=aotc->lst_last_line) {\n if (tmpf->flags& LFSF_DOC) {\n while (doc_e2->y<doc_e->y) {\n \"%h*c%08X \",24-aotc->lst_col,CH_SPACE,aotc->lst_last_rip;\n aotc->lst_col=0;\n doc_e2=LexPutLine(cc,doc_e2);\n }\n } else {\n while (*doc_e2(U8 *) && doc_e2!=doc_e) {\n \"%h*c%08X \",24-aotc->lst_col,CH_SPACE,aotc->lst_last_rip;\n aotc->lst_col=0;\n doc_e2=LexPutLine(cc,doc_e2);\n }\n }\n aotc->lst_last_line=doc_e2;\n } else\n aotc->lst_last_line=doc_e;\n } else {\n aotc->lst_last_line=NULL;\n aotc->lst_last_lfn=tmpf;\n }\n aotc->lst_last_rip=aotc->rip;\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\AMath-Adam.html
// Date: unknown-date
// Language: HolyC
#help_index "Math"
public U0 R2P(F64 *_mag=NULL,F64 *_arg=NULL,F64 x,F64 y)
{//Rect to polar
//Returns angle in range (-pi,pi]
if (_arg)
*_arg=Arg(x,y);
if (_mag)
*_mag=Sqrt(x*x+y*y);
}
public U0 P2R(F64 *_x=NULL,F64 *_y=NULL,F64 mag,F64 arg)
{//Polar to Rect
if (_x)
*_x=mag*Cos(arg);
if (_y)
*_y=mag*Sin(arg);
}
public F64 Wrap(F64 theta,F64 base=-pi)
{//Returns angle in range [base,base+2*pi)
F64 res=theta%(2*pi);
if (res>=base+2*pi)
res-=2*pi;
else if (res<base)
res+=2*pi;
return res;
}
public I64 DistSqrI64(I64 x1,I64 y1,I64 x2,I64 y2)
{//Distance-squared between 2 points.
I64 dx=x1-x2,dy=y1-y2;
return dx*dx+dy*dy;
}
public F64 ASin(F64 s)
{//Arc Sin (Inverse Sin).
F64 c;
c=s*s;
if (c>=1.0)
return pi/2.0;
c=Sqrt(1.0-c);
return ATan(s/c);
}
public F64 ACos(F64 c)
{//Arc Cos (Inverse Cos).
F64 s;
if (!c)
return pi/2.0;
s=c*c;
if (s>=1.0)
return 0.0;
s=Sqrt(1.0-s);
return ATan(s/c);
}
public F64 Sinh(F64 x)
{//Hyperbolic Sine.
return 0.5*(Exp(x)-Exp(-x));
}
public F64 Cosh(F64 x)
{//Hyperbolic Cosine.
return 0.5*(Exp(x)+Exp(-x));
}
#help_index "Math/Complex;Data Types/Complex"
public Complex *CAdd(Complex *sum,Complex *n1,Complex *n2)
{//sum=n1+n2
sum->x=n1->x+n2->x;
sum->y=n1->y+n2->y;
return sum;
}
public Complex *CSub(Complex *diff,Complex *n1,Complex *n2)
{//diff=n1-n2
diff->x=n1->x-n2->x;
diff->y=n1->y-n2->y;
return diff;
}
public Complex *CMul(Complex *prod,Complex *n1,Complex *n2)
{//prod=n1*n2
prod->x=n1->x*n2->x-n1->y*n2->y;
prod->y=n1->x*n2->y+n1->y*n2->x;
return prod;
}
public Complex *CDiv(Complex *quot,Complex *n1,Complex *n2)
{//quot=n1/n2
F64 m1,arg1,m2,arg2;
R2P(&m1,&arg1,n1->x,n1->y);
R2P(&m2,&arg2,n2->x,n2->y);
m1/=m2;
arg1-=arg2;
quot->x=m1*Cos(arg1);
quot->y=m1*Sin(arg1);
return quot;
}
public Complex *CScale(Complex *dst,F64 s)
{//dst*=s
dst->x*=s;
dst->y*=s;
return dst;
}
public Complex *CCopy(Complex *dst,Complex *src)
{//dst=src
dst->x=src->x;
dst->y=src->y;
return dst;
}
public Complex *CEqu(Complex *dst,F64 x,F64 y)
{//dst=(x,y)
dst->x=x;
dst->y=y;
return dst;
}
public Complex *CPoly(Complex *dst,I64 n,Complex *zeros,Complex *x)
{//Eval complex polynomial
I64 i;
Complex n1,n2;
if (n>0) {
CSub(dst,x,&zeros[0]);
for (i=1;i<n;i++) {
CCopy(&n1,dst);
CMul(dst,&n1,CSub(&n2,x,&zeros[i]));
}
} else
CEqu(dst,1.0,0.0);
return dst;
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\AMath-Adam.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"Math\"\npublic U0 R2P(F64 *_mag=NULL,F64 *_arg=NULL,F64 x,F64 y)\n{//Rect to polar\n//Returns angle in range (-pi,pi]\n if (_arg)\n *_arg=Arg(x,y);\n if (_mag)\n *_mag=Sqrt(x*x+y*y);\n}\n\npublic U0 P2R(F64 *_x=NULL,F64 *_y=NULL,F64 mag,F64 arg)\n{//Polar to Rect\n if (_x)\n *_x=mag*Cos(arg);\n if (_y)\n *_y=mag*Sin(arg);\n}\n\npublic F64 Wrap(F64 theta,F64 base=-pi)\n{//Returns angle in range [base,base+2*pi)\n F64 res=theta%(2*pi);\n if (res>=base+2*pi)\n res-=2*pi;\n else if (res<base)\n res+=2*pi;\n return res;\n}\n\npublic I64 DistSqrI64(I64 x1,I64 y1,I64 x2,I64 y2)\n{//Distance-squared between 2 points.\n I64 dx=x1-x2,dy=y1-y2;\n return dx*dx+dy*dy;\n}\n\npublic F64 ASin(F64 s)\n{//Arc Sin (Inverse Sin).\n F64 c;\n c=s*s;\n if (c>=1.0)\n return pi/2.0;\n c=Sqrt(1.0-c);\n return ATan(s/c);\n}\n\npublic F64 ACos(F64 c)\n{//Arc Cos (Inverse Cos).\n F64 s;\n if (!c)\n return pi/2.0;\n s=c*c;\n if (s>=1.0)\n return 0.0;\n s=Sqrt(1.0-s);\n return ATan(s/c);\n}\n\npublic F64 Sinh(F64 x)\n{//Hyperbolic Sine.\n return 0.5*(Exp(x)-Exp(-x));\n}\n\npublic F64 Cosh(F64 x)\n{//Hyperbolic Cosine.\n return 0.5*(Exp(x)+Exp(-x));\n}\n\n#help_index \"Math/Complex;Data Types/Complex\"\npublic Complex *CAdd(Complex *sum,Complex *n1,Complex *n2)\n{//sum=n1+n2\n sum->x=n1->x+n2->x;\n sum->y=n1->y+n2->y;\n return sum;\n}\n\npublic Complex *CSub(Complex *diff,Complex *n1,Complex *n2)\n{//diff=n1-n2\n diff->x=n1->x-n2->x;\n diff->y=n1->y-n2->y;\n return diff;\n}\n\npublic Complex *CMul(Complex *prod,Complex *n1,Complex *n2)\n{//prod=n1*n2\n prod->x=n1->x*n2->x-n1->y*n2->y;\n prod->y=n1->x*n2->y+n1->y*n2->x;\n return prod;\n}\n\npublic Complex *CDiv(Complex *quot,Complex *n1,Complex *n2)\n{//quot=n1/n2\n F64 m1,arg1,m2,arg2;\n R2P(&m1,&arg1,n1->x,n1->y);\n R2P(&m2,&arg2,n2->x,n2->y);\n m1/=m2;\n arg1-=arg2;\n quot->x=m1*Cos(arg1);\n quot->y=m1*Sin(arg1);\n return quot;\n}\n\npublic Complex *CScale(Complex *dst,F64 s)\n{//dst*=s\n dst->x*=s;\n dst->y*=s;\n return dst;\n}\n\npublic Complex *CCopy(Complex *dst,Complex *src)\n{//dst=src\n dst->x=src->x;\n dst->y=src->y;\n return dst;\n}\n\npublic Complex *CEqu(Complex *dst,F64 x,F64 y)\n{//dst=(x,y)\n dst->x=x;\n dst->y=y;\n return dst;\n}\n\npublic Complex *CPoly(Complex *dst,I64 n,Complex *zeros,Complex *x)\n{//Eval complex polynomial\n I64 i;\n Complex n1,n2;\n if (n>0) {\n CSub(dst,x,&zeros[0]);\n for (i=1;i<n;i++) {\n CCopy(&n1,dst);\n CMul(dst,&n1,CSub(&n2,x,&zeros[i]));\n }\n } else\n CEqu(dst,1.0,0.0);\n return dst;\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\elijah-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has graphics
<1>/* Graphics Not Rendered in HTML */
<2>/* Graphics Not Rendered in HTML */
<3>/* Graphics Not Rendered in HTML */
F64 t0=Beat;
#define WOOD_X 220
#define WOOD_Y 45
U0 DrawIt(CTask *,CDC *dc)
{
U8 *img;
F64 dt=Beat-t0;
I64 r;
if (dt<8)
r=3;
else if (dt<18)
r=dt-5;
else
r=18-5;
dc->color=BLUE;
GrEllipse (dc,WOOD_X,WOOD_Y,r,1.5*r,pi/8);
GrFloodFill(dc,WOOD_X,WOOD_Y);
if (dt<20)
img=<1>;
else if (dt%0.4>.2)
img=<2>;
else
img=<3>;
Sprite3(dc,WOOD_X,WOOD_Y,0,img);
}
U0 Song()
{
CTask *task;
SettingsPush; //See SettingsPush
MusicSettingsRst;
Fs->task_end_cb=&SndTaskEndCB;
Fs->draw_it=&DrawIt;
music.tempo= 2.480;
music.stacatto_factor= 0.902;
try {
task=PopUpViewPrint("1 Kings,18:35\n");
TaskWait(task);
WinHorz(Fs->win_left,TEXT_COLS-10,task);
WinVert(Fs->win_bottom+3,Fs->win_bottom+15,task);
while (!ScanKey) {
t0=Beat;
DocClear;
Play("4qGeGB5sD4G5D4GqB5eFCqD4eA5F4qA",
"Soak, \0 \0 \0soak \0 \0that \0 \0wood.\n\0 \0 \0 \0 \0 \0 \0");
Play("4GeGB5sD4G5D4GqB5eFCqD4eA5F4qA",
"Once, \0 \0 \0once \0 \0for \0 \0good...\n\0 \0 \0 \0 \0 \0 \0");
DocClear;
Play("4etB5DEeDFqE4B5sCFCFeCFqDsFDFD",
"See \0 \0 \0the \0em\0bers? \0 \0 \0"
"Where \0 \0is \0 \0your \0God?\n\0 \0 \0 \0 \0");
Play("4etB5DEeDFqE4B5sCFCFeCFqDsFDFD",
"Tell, \0 \0 \0tell \0me, \0sirs, \0 \0 \0"
"where \0 \0is \0 \0your \0God?\n\0 \0 \0 \0 \0");
}
} catch
PutExcept;
SettingsPop;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\elijah-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has graphics\n\n\n\n <1>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n\n\n <2>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n\n \n\n <3>/* Graphics Not Rendered in HTML */\n\n \n\nF64 t0=Beat;\n\n#define WOOD_X 220\n#define WOOD_Y 45\n\nU0 DrawIt(CTask *,CDC *dc)\n{\n U8 *img;\n F64 dt=Beat-t0;\n I64 r;\n\n if (dt<8)\n r=3;\n else if (dt<18)\n r=dt-5;\n else\n r=18-5;\n dc->color=BLUE;\n GrEllipse (dc,WOOD_X,WOOD_Y,r,1.5*r,pi/8);\n GrFloodFill(dc,WOOD_X,WOOD_Y);\n\n if (dt<20)\n img=<1>;\n else if (dt%0.4>.2)\n img=<2>;\n else\n img=<3>;\n Sprite3(dc,WOOD_X,WOOD_Y,0,img);\n}\n\nU0 Song()\n{\n CTask *task;\n SettingsPush; //See SettingsPush\n MusicSettingsRst;\n Fs->task_end_cb=&SndTaskEndCB;\n Fs->draw_it=&DrawIt;\n music.tempo= 2.480;\n music.stacatto_factor= 0.902;\n try {\n task=PopUpViewPrint(\"1 Kings,18:35\\n\");\n TaskWait(task);\n WinHorz(Fs->win_left,TEXT_COLS-10,task);\n WinVert(Fs->win_bottom+3,Fs->win_bottom+15,task);\n while (!ScanKey) {\n t0=Beat;\n DocClear;\n Play(\"4qGeGB5sD4G5D4GqB5eFCqD4eA5F4qA\",\n \"Soak, \\0 \\0 \\0soak \\0 \\0that \\0 \\0wood.\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"4GeGB5sD4G5D4GqB5eFCqD4eA5F4qA\",\n \"Once, \\0 \\0 \\0once \\0 \\0for \\0 \\0good...\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n DocClear;\n Play(\"4etB5DEeDFqE4B5sCFCFeCFqDsFDFD\",\n \"See \\0 \\0 \\0the \\0em\\0bers? \\0 \\0 \\0\"\n \"Where \\0 \\0is \\0 \\0your \\0God?\\n\\0 \\0 \\0 \\0 \\0\");\n Play(\"4etB5DEeDFqE4B5sCFCFeCFqDsFDFD\",\n \"Tell, \\0 \\0 \\0tell \\0me, \\0sirs, \\0 \\0 \\0\"\n \"where \\0 \\0is \\0 \\0your \\0God?\\n\\0 \\0 \\0 \\0 \\0\");\n }\n } catch\n PutExcept;\n SettingsPop;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\Comm-Doc.html
// Date: unknown-date
// Language: HolyC
/* RS232 serial ports no longer exist.
Be sure to Adam Include this by placing
it in your start-up scripts.
*/
#help_index "Comm"
#define UART_THR 0
#define UART_RDR 0
#define UART_BRDL 0
#define UART_IER 1
#define UART_BRDH 1
#define UART_IIR 2
#define UART_LCR 3
#define UART_MCR 4
#define UART_LSR 5
#define UART_MSR 6
#define COMf_ENABLED 0
class CComm
{
I64 base,
flags;
CFifoU8 *RX_fifo;
CFifoU8 *TX_fifo;
} comm_ports[5];
U0 CommHndlr(I64 port)
{
CComm *c=&comm_ports[port];
I64 b=0,stat;
if (Bt(&c->flags,COMf_ENABLED)) {
stat=InU8(c->base+UART_IIR);
if (stat & 4) //RX
FifoU8Ins(c->RX_fifo,InU8(c->base+UART_RDR));
if (stat & 2) { //TX
if (FifoU8Rem(c->TX_fifo,&b))
OutU8(c->base+UART_THR,b);
else
OutU8(c->base+UART_IER,1); //RX but no THR empty
}
}
}
interrupt U0 IRQComm3()
{
CommHndlr(2);
CommHndlr(4);
OutU8(0x20,0x20);
}
interrupt U0 IRQComm4()
{
CommHndlr(1);
CommHndlr(3);
OutU8(0x20,0x20);
}
U0 CommInit()
{
MemSet(&comm_ports,0,sizeof(comm_ports));
comm_ports[1].base=0x3F8;
comm_ports[2].base=0x2F8;
comm_ports[3].base=0x3E8;
comm_ports[4].base=0x2E8;
IntEntrySet(0x23,&IRQComm3);
IntEntrySet(0x24,&IRQComm4);
}
CommInit;
public CComm *CommInit8n1(I64 port,I64 baud)
{
CComm *c=&comm_ports[port];
PUSHFD
CLI
if (LBts(&c->flags,COMf_ENABLED)) {
FifoU8Del(c->RX_fifo);
FifoU8Del(c->TX_fifo);
}
c->RX_fifo=FifoU8New(256);
c->TX_fifo=FifoU8New(256);
OutU8(c->base+UART_LCR,0); //Set for IER
OutU8(c->base+UART_IER,0); //Disable all IRQ
OutU8(c->base+UART_LCR,0x80); //Enable baud rate control
OutU8(c->base+UART_BRDL,(0x180/(baud/300)) & 0xFF); //LSB
OutU8(c->base+UART_BRDH,(0x180/(baud/300)) / 256); //MSB
OutU8(c->base+UART_LCR,3); //8-none-1
InU8(c->base+UART_RDR); //read garbage
InU8(c->base+UART_LSR);
OutU8(c->base+UART_MCR,4);
OutU8(c->base+UART_IER,0); //Disable all IRQ
OutU8(c->base+UART_MCR,0xA); //out2 and rts
OutU8(0x21,InU8(0x21) & (0xFF-0x18)); //Enable 8259 IRQ 3 & 4
OutU8(c->base+UART_IER,1); //RX but no THR empty
POPFD
return c;
}
public U0 CommPutChar(I64 port,U8 b)
{
CComm *c=&comm_ports[port];
PUSHFD
CLI
FifoU8Ins(c->TX_fifo,b);
OutU8(c->base+UART_IER,3); //RX and THR empty
POPFD
Sleep(10); //!!! Remove this line!!! Linux echo_socket is too slow.
}
U0 CommPutS(I64 port,U8 *st)
{
I64 b;
while (b=*st++)
CommPutChar(port,b);
}
public U0 CommPutBlk(I64 port,U8 *buf,I64 cnt)
{
while (cnt--)
CommPutChar(port,*buf++);
}
public U0 CommPrint(I64 port,U8 *fmt,...)
{
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
CommPutS(port,buf);
Free(buf);
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Comm-Doc.html\n// Date: unknown-date\n// Language: HolyC\n\n/* RS232 serial ports no longer exist.\nBe sure to Adam Include this by placing\nit in your start-up scripts.\n*/\n\n#help_index \"Comm\"\n\n#define UART_THR 0\n#define UART_RDR 0\n#define UART_BRDL 0\n#define UART_IER 1\n#define UART_BRDH 1\n#define UART_IIR 2\n#define UART_LCR 3\n#define UART_MCR 4\n#define UART_LSR 5\n#define UART_MSR 6\n\n#define COMf_ENABLED 0\nclass CComm\n{\n I64 base,\n flags;\n CFifoU8 *RX_fifo;\n CFifoU8 *TX_fifo;\n} comm_ports[5];\n\nU0 CommHndlr(I64 port)\n{\n CComm *c=&comm_ports[port];\n I64 b=0,stat;\n if (Bt(&c->flags,COMf_ENABLED)) {\n stat=InU8(c->base+UART_IIR);\n if (stat & 4) //RX\n FifoU8Ins(c->RX_fifo,InU8(c->base+UART_RDR));\n if (stat & 2) { //TX\n if (FifoU8Rem(c->TX_fifo,&b))\n OutU8(c->base+UART_THR,b);\n else\n OutU8(c->base+UART_IER,1); //RX but no THR empty\n }\n }\n}\n\ninterrupt U0 IRQComm3()\n{\n CommHndlr(2);\n CommHndlr(4);\n OutU8(0x20,0x20);\n}\n\ninterrupt U0 IRQComm4()\n{\n CommHndlr(1);\n CommHndlr(3);\n OutU8(0x20,0x20);\n}\n\nU0 CommInit()\n{\n MemSet(&comm_ports,0,sizeof(comm_ports));\n comm_ports[1].base=0x3F8;\n comm_ports[2].base=0x2F8;\n comm_ports[3].base=0x3E8;\n comm_ports[4].base=0x2E8;\n IntEntrySet(0x23,&IRQComm3);\n IntEntrySet(0x24,&IRQComm4);\n}\nCommInit;\n\npublic CComm *CommInit8n1(I64 port,I64 baud)\n{\n CComm *c=&comm_ports[port];\n\n PUSHFD\n CLI\n if (LBts(&c->flags,COMf_ENABLED)) {\n FifoU8Del(c->RX_fifo);\n FifoU8Del(c->TX_fifo);\n }\n c->RX_fifo=FifoU8New(256);\n c->TX_fifo=FifoU8New(256);\n OutU8(c->base+UART_LCR,0); //Set for IER\n OutU8(c->base+UART_IER,0); //Disable all IRQ\n OutU8(c->base+UART_LCR,0x80); //Enable baud rate control\n OutU8(c->base+UART_BRDL,(0x180/(baud/300)) & 0xFF); //LSB\n OutU8(c->base+UART_BRDH,(0x180/(baud/300)) / 256); //MSB\n OutU8(c->base+UART_LCR,3); //8-none-1\n\n InU8(c->base+UART_RDR); //read garbage\n InU8(c->base+UART_LSR);\n\n OutU8(c->base+UART_MCR,4);\n OutU8(c->base+UART_IER,0); //Disable all IRQ\n OutU8(c->base+UART_MCR,0xA); //out2 and rts\n OutU8(0x21,InU8(0x21) & (0xFF-0x18)); //Enable 8259 IRQ 3 & 4\n OutU8(c->base+UART_IER,1); //RX but no THR empty\n POPFD\n\n return c;\n}\n\npublic U0 CommPutChar(I64 port,U8 b)\n{\n CComm *c=&comm_ports[port];\n PUSHFD\n CLI\n FifoU8Ins(c->TX_fifo,b);\n OutU8(c->base+UART_IER,3); //RX and THR empty\n POPFD\n Sleep(10); //!!! Remove this line!!! Linux echo_socket is too slow.\n}\n\nU0 CommPutS(I64 port,U8 *st)\n{\n I64 b;\n while (b=*st++)\n CommPutChar(port,b);\n}\n\npublic U0 CommPutBlk(I64 port,U8 *buf,I64 cnt)\n{\n while (cnt--)\n CommPutChar(port,*buf++);\n}\n\npublic U0 CommPrint(I64 port,U8 *fmt,...)\n{\n U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);\n CommPutS(port,buf);\n Free(buf);\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\rush-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//0 no nothing
U0 Song()
{
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.480;
music.stacatto_factor= 0.902;
try {
while (!ScanKey) {
Play("4eG5DFG4BGsG5C4G5C4BBBB5qCDhC");
Play("4eG5DFG4BGsG5C4G5C4BBBB5qCDhC");
Play("qFFetECEqF4BetAB5G4qAetBB5D");
Play("qFFetECEqF4BetAB5G4qAetBB5D");
}
} catch
PutExcept;
Snd;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\rush-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//0 no nothing\nU0 Song()\n{\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 2.480;\n music.stacatto_factor= 0.902;\n try {\n while (!ScanKey) {\n Play(\"4eG5DFG4BGsG5C4G5C4BBBB5qCDhC\");\n Play(\"4eG5DFG4BGsG5C4G5C4BBBB5qCDhC\");\n Play(\"qFFetECEqF4BetAB5G4qAetBB5D\");\n Play(\"qFFetECEqF4BetAB5G4qAetBB5D\");\n }\n } catch\n PutExcept;\n Snd;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\dream-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has graphics
#define NUM 10
#define RAD_PROP 60
#define RAD_PRISM 8
I32 rainbow_10[NUM]={
RED,LTRED,BROWN,YELLOW,GREEN,LTGREEN,BLUE,LTBLUE,PURPLE,LTPURPLE};
#define X 320
#define Y 35
F64 t0=Beat;
U0 DrawIt(CTask *,CDC *dc)
{
I64 i;
F64 dt=16*Sin(pi*(Beat-t0)/8),theta;
dc->color=WHITE;
theta=pi*dt+0.5;
GrLine(dc,X+RAD_PRISM*Cos(theta) ,Y+RAD_PRISM*Sin(theta),
X+RAD_PRISM*Cos(theta+2*pi/3),Y+RAD_PRISM*Sin(theta+2*pi/3));
GrLine(dc,X+RAD_PRISM*Cos(theta+2*pi/3),Y+RAD_PRISM*Sin(theta+2*pi/3),
X+RAD_PRISM*Cos(theta+4*pi/3),Y+RAD_PRISM*Sin(theta+4*pi/3));
GrLine(dc,X+RAD_PRISM*Cos(theta+4*pi/3),Y+RAD_PRISM*Sin(theta+4*pi/3),
X+RAD_PRISM*Cos(theta),Y+RAD_PRISM*Sin(theta));
for (i=0;i<NUM;i++) {
theta=pi/8*ToF64(i)/NUM*(3+2*Sin(pi*dt/8))/3+pi*dt;
dc->color=WHITE;
GrLine(dc,X,Y,X-RAD_PROP*Cos(theta),Y-RAD_PROP*Sin(theta));
dc->color=rainbow_10[i];
GrLine(dc,X,Y,X+RAD_PROP*Cos(theta),Y+RAD_PROP*Sin(theta));
}
}
U0 Song()
{
SettingsPush; //See SettingsPush
Fs->text_attr=BLACK<<4+WHITE;
Fs->draw_it=&DrawIt;
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.480;
music.stacatto_factor= 0.902;
try {
"$BG+H,BLACK$$FD+H,WHITE$";
while (!ScanKey) {
t0=Beat;
Play("4qA5sDGDG4qA5sC4A5C4A5eC4B5sFDFDetCG4AsA5D4A5D",
" \0I\0mag\0 \0ine.\n\0 \0 \0 \0 \0 \0 \0 \0"
" \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0");
Play("4qA5sDGDG4qA5sC4A5C4A5eC4B5sFDFDetCG4AsA5D4A5D",
" \0 \0Fa\0 \0thom.\n\0 \0 \0 \0 \0 \0 \0 \0"
" \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0");
Play("5GFGFE4B5E4B5eC4BqG5sF4A5F4A5qCE4A",
"Hi-\0 \0i-\0gh \0as \0 \0your \0 \0thoughts \0"
"will \0go.\n\0 \0 \0 \0 \0 \0 \0 \0");
Play("5sGFGFE4B5E4B5eC4BqG5sF4A5F4A5qCE4A",
"Deep \0 \0 \0as \0 \0 \0we \0 \0ought \0to \0"
"know.\n\0 \0 \0 \0 \0 \0 \0 \0");
}
} catch
PutExcept;
SettingsPop;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\dream-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has graphics\n\n#define NUM 10\n#define RAD_PROP 60\n#define RAD_PRISM 8\nI32 rainbow_10[NUM]={\nRED,LTRED,BROWN,YELLOW,GREEN,LTGREEN,BLUE,LTBLUE,PURPLE,LTPURPLE};\n\n#define X 320\n#define Y 35\n\nF64 t0=Beat;\nU0 DrawIt(CTask *,CDC *dc)\n{\n I64 i;\n F64 dt=16*Sin(pi*(Beat-t0)/8),theta;\n dc->color=WHITE;\n theta=pi*dt+0.5;\n GrLine(dc,X+RAD_PRISM*Cos(theta) ,Y+RAD_PRISM*Sin(theta),\n X+RAD_PRISM*Cos(theta+2*pi/3),Y+RAD_PRISM*Sin(theta+2*pi/3));\n GrLine(dc,X+RAD_PRISM*Cos(theta+2*pi/3),Y+RAD_PRISM*Sin(theta+2*pi/3),\n X+RAD_PRISM*Cos(theta+4*pi/3),Y+RAD_PRISM*Sin(theta+4*pi/3));\n GrLine(dc,X+RAD_PRISM*Cos(theta+4*pi/3),Y+RAD_PRISM*Sin(theta+4*pi/3),\n X+RAD_PRISM*Cos(theta),Y+RAD_PRISM*Sin(theta));\n for (i=0;i<NUM;i++) {\n theta=pi/8*ToF64(i)/NUM*(3+2*Sin(pi*dt/8))/3+pi*dt;\n dc->color=WHITE;\n GrLine(dc,X,Y,X-RAD_PROP*Cos(theta),Y-RAD_PROP*Sin(theta));\n dc->color=rainbow_10[i];\n GrLine(dc,X,Y,X+RAD_PROP*Cos(theta),Y+RAD_PROP*Sin(theta));\n }\n}\n\nU0 Song()\n{\n SettingsPush; //See SettingsPush\n Fs->text_attr=BLACK<<4+WHITE;\n Fs->draw_it=&DrawIt;\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 2.480;\n music.stacatto_factor= 0.902;\n try {\n \"$BG+H,BLACK$$FD+H,WHITE$\";\n while (!ScanKey) {\n t0=Beat;\n Play(\"4qA5sDGDG4qA5sC4A5C4A5eC4B5sFDFDetCG4AsA5D4A5D\",\n \" \\0I\\0mag\\0 \\0ine.\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"4qA5sDGDG4qA5sC4A5C4A5eC4B5sFDFDetCG4AsA5D4A5D\",\n \" \\0 \\0Fa\\0 \\0thom.\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5GFGFE4B5E4B5eC4BqG5sF4A5F4A5qCE4A\",\n \"Hi-\\0 \\0i-\\0gh \\0as \\0 \\0your \\0 \\0thoughts \\0\"\n \"will \\0go.\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5sGFGFE4B5E4B5eC4BqG5sF4A5F4A5qCE4A\",\n \"Deep \\0 \\0 \\0as \\0 \\0 \\0we \\0 \\0ought \\0to \\0\"\n \"know.\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n }\n } catch\n PutExcept;\n SettingsPop;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\Start-Doc.html
// Date: unknown-date
// Language: HolyC
TempleOS V5.03
Public Domain Operating System
Help & Index, Quick Start: Cmd line
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Start-Doc.html\n// Date: unknown-date\n// Language: HolyC\n\nTempleOS V5.03\n\n Public Domain Operating System\n\nHelp & Index, Quick Start: Cmd line"
}
]
}
|
// Source: D:\TempleOS-Projects\html\TOSVideos-Web-Home.html
// Date: unknown-date
// Language: HolyC
TempleOS Instructional Videos
The keys that I press are shown in the upper right corner during the videos.
Tour Not Really StdIn/StdOut
VMware Install and Making Distro Benchmark: VMware,VirtualBox,QEMU
Holy C Highlight of Features
Using the Debugger Kernel Algorithms
Neil deGrasse Tyson --------------> Naughty Fun with Internals
Compiler/Assembler/Unassembler Establishing My Geek Credentials
Filter Search Divine Intellect Operating System
Demands on the Industry ClassRep() ClassRepD() & lastclass
Take-Down of Linus Torvalds Why TempleOS Better than Linux
#1: Beginner Orientation Hello World
#2: Beginner Orientation Demo Index
Graphics: Triangle Fill What God Wants in Music
Intro to Graphics <CTRL-r> Graphic Editing
FileFind() Usage Random Numbers and Seed()
StdIn StdOut Command-Line Tricks
Programming Guide Adam, Command-Line and Linkage
FAQ PrintF/ScanF
Using the Assembler Asm Prog Example
Memory Start-Up Code
Tasks, Threads and Processes MultiCore
CS Lectures in TempleOS Spin-Locks
ATA/ATAPI HardDisk CD/DVD-ROM Code FAT32 Code
Binary Files Not ELF Graphics Code
#1: Making Asteroids Game #1: Making Hymns
#2: Making Asteroids Game #2: Making Hymns
#3: Making Asteroids Game #3: Making Hymns
#1: Making an O.S. from Scratch #2: Making an O.S. from Scratch
TempleOS Games
#01: Titanium, FlapBat, BomberGolf and Strut.
#02: TreeCheckers. (Net-Wars)
#03: KeepAway and FlatTop.
#04: BattleLines.
#05: FlightSim, First Person Shooter.
#06: X-Caliber, RawHide, Wenceslas.
#07: Span bridge design.
#08: ToTheFront.
#09: BlackDiamond.
#10: Pilgrim.
#11: Stadium. Beginner demo game.
#12: RocketScience. Advanced demo game.
#13: SimStructure (Windows Control System Simulator Application)
5-Minute Random Code Walk-Thru
#001: Compiler back-end. Floating-point.
#002: Document node to plain text.
#003: Debugger. Caller().
#004: Sound effects.
#005: Document entry copy.
#006: Graphic bitmap blot.
#007: Compiler optimizer pass 0,1,2.
#008: HD audio task.
#009: LZW compression, expansion routine.
#010: FindFiles DirTreeDel().
#011: Compiler back-end library ICMov().
#012: Graphic sprite editor main menu. Width.
#013: Compiler lexical analyser. #ifndef.
#014: Compiler lexical analyser. LexDollar().
#015: Compiler back-end. Assign.
#016: Song. Struggles.
#017: Psalmody. Graphic layers.
#018: Web log report.
#019: CD/DVD ISO.
#020: Song. Keeping.
#021: AfterEgypt. The mountain.
#022: BattleLines. Init().
#023: X-Caliber. Draw explosion.
#024: Coach tee-ball game.
#025: EdLite.
#026: Compiler stmt parser. ClassNew().
#027: ModelGen. Draw man.
#028: Shading ball demo.
#029: Graphics init globals.
#030: Budget. String file.
#031: Archived code. IDE that was removed.
#032: Demo. Conway's game of life.
#033: Kernel disk code. Read clus blocks.
#034: Debugger. Set breakpoint.
#035: Compiler optimizer pass 0,1,2. IC_XOR_XOR.
#036: DunGen game. Init().
#037: Document main. Right click menu.
#038: Web log report. Block IP numbers.
#039: Song. Furnishing.
#040: Document link check.
#041: Kernel header. KernelA.
#042: Song. Awake.
#043: Graphics sprite bitmap editor.
#044: Graphics bitmap. GrRect().
#045: Compiler back-end. Floating-point conversion.
#046: String utilities. Assembly StrIMatch().
#047: Song. Keeping.
#048: Spell check. Suggested spelling demo.
#049: Lectures. Time instruction. Cached vs Uncached.
#050: Document Recalc-b.
#051: Psalmody. PopUpDuration().
#052: Graphics sprite mesh editor.
#053: Game. RawHide.
#054: Multicore demo. LoadTest.
#055: Util DC2Doc. Screen captured BMP to text.
#056: Graphics sprite editor. Sprite edit menu.
#057: Kernel disk code. Disk cache invalidate.
#058: Demo. Pick3D.
#059: CtrlBttnNew().
#060: Demo. Tower of Hanoi.
#061: Demo. Fish tank wallpaper.
#062: Compiler optimization library. BrNotZero/BrZero.
#063: Graphic sprite editor. Convert to bitmap.
#064: Kernel header KernelA. Compiler member list.
#065: Slider managed code.
#066: Game AfterEgypt. Horeb. Walking around on mountain top.
#067: Demo. Pick3D.
#068: TS distribution code. Make TempleOS website.
#069: Compiler optimizer library. BrZero BrNotZero.
#070: Kernel FAT32 driver.
#071: Kernel header file KernelC.
#072: Demo game. Talons.
#073: TestSuite for GrModels.
#074: Kernel disk CFile. FSetClus(). FOpen().
#075: Demo. Pick.
#076: Graphics math. Circle().
#077: Compiler back-end. Floating point += -= /= %=.
#078: Compiler lexical analyzer. Near LexGetChar().
#079: Kernel servant command. In() Xtalk().
#080: Code tools. Reindent.
#081: Document. <Ctrl-l>
#082: Game app. Strut.
#083: Document optimizer. FilesFind().
#084: Song. Dialog.
#085: Kernel disk code. RedSea file system. DrvValidate().
#086: Graphics math. BSpline3().
#087: Kernel header KernelA. Whole thing.
#088: Song. Exiled.
#089: Kernel datatypes. Queue. Fifo. LinkedList. QueVector.
#090: MemRep. Disk structures.
#091: Compiler back-end. Exponent operator.
#092: Demo. Pick3D
#093: Song. Signifies.
#094: Kernel ScanKey().
#095: Editor. EdCursorRight().
#096: Compiler parse global var initializing.
#097: Game. TreeCheckers.
#098: Game. Rocket.
#099: Graphics math. GrFillTri0().
#100: Kernel disk identify HD/DVD port numbers. ATAProbe().
#101: Song. Bedewed.
#102: Graphics SpriteTypeMask().
#103: Document DocPutS().
#104: Game app. ToTheFront.
Old TempleOS Instructional Videos
* "VMware" is a trademark owned by VMware, Inc.
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\TOSVideos-Web-Home.html\n// Date: unknown-date\n// Language: HolyC\n\nTempleOS Instructional Videos\nThe keys that I press are shown in the upper right corner during the videos.\n\n Tour Not Really StdIn/StdOut\n VMware Install and Making Distro Benchmark: VMware,VirtualBox,QEMU\n Holy C Highlight of Features\n Using the Debugger Kernel Algorithms\n Neil deGrasse Tyson --------------> Naughty Fun with Internals\n Compiler/Assembler/Unassembler Establishing My Geek Credentials\n Filter Search Divine Intellect Operating System\n Demands on the Industry ClassRep() ClassRepD() & lastclass\n Take-Down of Linus Torvalds Why TempleOS Better than Linux\n#1: Beginner Orientation Hello World\n#2: Beginner Orientation Demo Index\n Graphics: Triangle Fill What God Wants in Music\n Intro to Graphics <CTRL-r> Graphic Editing\n FileFind() Usage Random Numbers and Seed()\n StdIn StdOut Command-Line Tricks\n Programming Guide Adam, Command-Line and Linkage\n FAQ PrintF/ScanF\n Using the Assembler Asm Prog Example\n Memory Start-Up Code\n Tasks, Threads and Processes MultiCore\n CS Lectures in TempleOS Spin-Locks\n ATA/ATAPI HardDisk CD/DVD-ROM Code FAT32 Code\n Binary Files Not ELF Graphics Code\n#1: Making Asteroids Game #1: Making Hymns\n#2: Making Asteroids Game #2: Making Hymns\n#3: Making Asteroids Game #3: Making Hymns\n#1: Making an O.S. from Scratch #2: Making an O.S. from Scratch\n\n TempleOS Games\n#01: Titanium, FlapBat, BomberGolf and Strut.\n#02: TreeCheckers. (Net-Wars)\n#03: KeepAway and FlatTop.\n#04: BattleLines.\n#05: FlightSim, First Person Shooter.\n#06: X-Caliber, RawHide, Wenceslas.\n#07: Span bridge design.\n#08: ToTheFront.\n#09: BlackDiamond.\n#10: Pilgrim.\n#11: Stadium. Beginner demo game.\n#12: RocketScience. Advanced demo game.\n#13: SimStructure (Windows Control System Simulator Application)\n\n\n 5-Minute Random Code Walk-Thru\n#001: Compiler back-end. Floating-point.\n#002: Document node to plain text.\n#003: Debugger. Caller().\n#004: Sound effects.\n#005: Document entry copy.\n#006: Graphic bitmap blot.\n#007: Compiler optimizer pass 0,1,2.\n#008: HD audio task.\n#009: LZW compression, expansion routine.\n#010: FindFiles DirTreeDel().\n#011: Compiler back-end library ICMov().\n#012: Graphic sprite editor main menu. Width.\n#013: Compiler lexical analyser. #ifndef.\n#014: Compiler lexical analyser. LexDollar().\n#015: Compiler back-end. Assign.\n#016: Song. Struggles.\n#017: Psalmody. Graphic layers.\n#018: Web log report.\n#019: CD/DVD ISO.\n#020: Song. Keeping.\n#021: AfterEgypt. The mountain.\n#022: BattleLines. Init().\n#023: X-Caliber. Draw explosion.\n#024: Coach tee-ball game.\n#025: EdLite.\n#026: Compiler stmt parser. ClassNew().\n#027: ModelGen. Draw man.\n#028: Shading ball demo.\n#029: Graphics init globals.\n#030: Budget. String file.\n#031: Archived code. IDE that was removed.\n#032: Demo. Conway's game of life.\n#033: Kernel disk code. Read clus blocks.\n#034: Debugger. Set breakpoint.\n#035: Compiler optimizer pass 0,1,2. IC_XOR_XOR.\n#036: DunGen game. Init().\n#037: Document main. Right click menu.\n#038: Web log report. Block IP numbers.\n#039: Song. Furnishing.\n#040: Document link check.\n#041: Kernel header. KernelA.\n#042: Song. Awake.\n#043: Graphics sprite bitmap editor.\n#044: Graphics bitmap. GrRect().\n#045: Compiler back-end. Floating-point conversion.\n#046: String utilities. Assembly StrIMatch().\n#047: Song. Keeping.\n#048: Spell check. Suggested spelling demo.\n#049: Lectures. Time instruction. Cached vs Uncached.\n#050: Document Recalc-b.\n#051: Psalmody. PopUpDuration().\n#052: Graphics sprite mesh editor.\n#053: Game. RawHide.\n#054: Multicore demo. LoadTest.\n#055: Util DC2Doc. Screen captured BMP to text.\n#056: Graphics sprite editor. Sprite edit menu.\n#057: Kernel disk code. Disk cache invalidate.\n#058: Demo. Pick3D.\n#059: CtrlBttnNew().\n#060: Demo. Tower of Hanoi.\n#061: Demo. Fish tank wallpaper.\n#062: Compiler optimization library. BrNotZero/BrZero.\n#063: Graphic sprite editor. Convert to bitmap.\n#064: Kernel header KernelA. Compiler member list.\n#065: Slider managed code.\n#066: Game AfterEgypt. Horeb. Walking around on mountain top.\n#067: Demo. Pick3D.\n#068: TS distribution code. Make TempleOS website.\n#069: Compiler optimizer library. BrZero BrNotZero.\n#070: Kernel FAT32 driver.\n#071: Kernel header file KernelC.\n#072: Demo game. Talons.\n#073: TestSuite for GrModels.\n#074: Kernel disk CFile. FSetClus(). FOpen().\n#075: Demo. Pick.\n#076: Graphics math. Circle().\n#077: Compiler back-end. Floating point += -= /= %=.\n#078: Compiler lexical analyzer. Near LexGetChar().\n#079: Kernel servant command. In() Xtalk().\n#080: Code tools. Reindent.\n#081: Document. <Ctrl-l>\n#082: Game app. Strut.\n#083: Document optimizer. FilesFind().\n#084: Song. Dialog.\n#085: Kernel disk code. RedSea file system. DrvValidate().\n#086: Graphics math. BSpline3().\n#087: Kernel header KernelA. Whole thing.\n#088: Song. Exiled.\n#089: Kernel datatypes. Queue. Fifo. LinkedList. QueVector.\n#090: MemRep. Disk structures.\n#091: Compiler back-end. Exponent operator.\n#092: Demo. Pick3D\n#093: Song. Signifies.\n#094: Kernel ScanKey().\n#095: Editor. EdCursorRight().\n#096: Compiler parse global var initializing.\n#097: Game. TreeCheckers.\n#098: Game. Rocket.\n#099: Graphics math. GrFillTri0().\n#100: Kernel disk identify HD/DVD port numbers. ATAProbe().\n#101: Song. Bedewed.\n#102: Graphics SpriteTypeMask().\n#103: Document DocPutS().\n#104: Game app. ToTheFront.\n\nOld TempleOS Instructional Videos\n\n\n* \"VMware\" is a trademark owned by VMware, Inc."
}
]
}
|
// Source: D:\TempleOS-Projects\html\Slider-Graphics-Demo.html
// Date: unknown-date
// Language: HolyC
/*This was done with <CTRL-SHIFT-L> template code.
It's conceptually easy to do a ctrl,
but tedious. You have complete freedom.
See CCtrl.
*/
//Start of autocreated Code
#define SLIDER_RANGE 30
#define SLIDER_SPACING 20
#define SLIDER_BORDER 2
class CSliderState
{
I64 left_pos;
I64 right_pos;
} sld;
U0 DrawCtrlSlider(CDC *dc,CCtrl *c)
{
CSliderState *s=c->state;
dc->color=LTRED;
GrRect(dc, c->left,c->top,SLIDER_SPACING*3+2,SLIDER_SPACING*2+SLIDER_RANGE);
dc->color=BLUE;
GrRect(dc, c->left+SLIDER_BORDER,c->top+SLIDER_BORDER,
SLIDER_SPACING*3+2-2*SLIDER_BORDER,
SLIDER_SPACING*2+SLIDER_RANGE-2*SLIDER_BORDER);
dc->color=BLACK;
GrLine(dc,c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING,
c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
GrLine(dc,c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING,
c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
dc->color=LTRED;
GrPrint(dc,c->left+1*SLIDER_SPACING+0-FONT_WIDTH/2,
c->top+SLIDER_SPACING+SLIDER_RANGE+3,
"%d",s->left_pos*10/SLIDER_RANGE);
GrPrint(dc,c->left+2*SLIDER_SPACING+1-FONT_WIDTH/2,
c->top+SLIDER_SPACING+SLIDER_RANGE+3,
"%d",s->right_pos*10/SLIDER_RANGE);
GrRect(dc,c->left+1*SLIDER_SPACING+0-3,
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-2,7,5);
GrRect(dc,c->left+2*SLIDER_SPACING+1-3,
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-2,7,5);
dc->color=YELLOW;
GrRect(dc,c->left+1*SLIDER_SPACING+0-2,
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-1,5,3);
GrRect(dc,c->left+2*SLIDER_SPACING+1-2,
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-1,5,3);
}
U0 UpdateDerivedCtrlSlider(CCtrl *c)
{
CSliderState *s=c->state;
c->left=c->win_task->pix_width/2-(SLIDER_SPACING*3+2)/2;
c->right=c->left+3*SLIDER_SPACING+2;
c->top=c->win_task->pix_height/2-(SLIDER_SPACING*2+SLIDER_RANGE)/2;
c->bottom=c->top+SLIDER_SPACING*2+SLIDER_RANGE;
s->left_pos=ClampI64(s->left_pos,0,SLIDER_RANGE-1);
s->right_pos=ClampI64(s->right_pos,0,SLIDER_RANGE-1);
}
U0 LeftClickSlider(CCtrl *c,I64 x,I64 y,Bool)
{
CSliderState *s=c->state;
if (x<c->left+1*SLIDER_SPACING+0+SLIDER_SPACING/2)
s->left_pos=SLIDER_RANGE-1-(y-(c->top+SLIDER_SPACING));
else
s->right_pos=SLIDER_RANGE-1-(y-(c->top+SLIDER_SPACING));
if (c->update_derived_vals)
(*c->update_derived_vals)(c);
}
CCtrl *SliderNew()
{
CCtrl *c=CAlloc(sizeof(CCtrl));
c->win_task=Fs;
c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_MS;
c->type=CTRLT_GENERIC;
c->state=&sld;
MemSet(&sld,0,sizeof(CSliderState));
c->draw_it=&DrawCtrlSlider;
c->left_click=&LeftClickSlider;
c->update_derived_vals=&UpdateDerivedCtrlSlider;
QueIns(c,Fs->last_ctrl);
TaskDerivedValsUpdate;
return c;
}
U0 SliderDel(CCtrl *c)
{
QueRem(c);
Free(c);
}
//End of autocreated Code
U0 Main()
{
"This is to demo ctrls.\n";
CCtrl *c=SliderNew;
PressAKey;
"Left: %d Right: %d\n",
sld.left_pos*10/SLIDER_RANGE,
sld.right_pos*10/SLIDER_RANGE;
SliderDel(c);
DocBottom;
}
Main;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Slider-Graphics-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\n/*This was done with <CTRL-SHIFT-L> template code.\nIt's conceptually easy to do a ctrl,\nbut tedious. You have complete freedom.\n\nSee CCtrl.\n*/\n\n//Start of autocreated Code\n#define SLIDER_RANGE 30\n#define SLIDER_SPACING 20\n#define SLIDER_BORDER 2\n\nclass CSliderState\n{\n I64 left_pos;\n I64 right_pos;\n} sld;\n\nU0 DrawCtrlSlider(CDC *dc,CCtrl *c)\n{\n CSliderState *s=c->state;\n\n dc->color=LTRED;\n GrRect(dc, c->left,c->top,SLIDER_SPACING*3+2,SLIDER_SPACING*2+SLIDER_RANGE);\n dc->color=BLUE;\n GrRect(dc, c->left+SLIDER_BORDER,c->top+SLIDER_BORDER,\n SLIDER_SPACING*3+2-2*SLIDER_BORDER,\n SLIDER_SPACING*2+SLIDER_RANGE-2*SLIDER_BORDER);\n dc->color=BLACK;\n GrLine(dc,c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING,\n c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING+SLIDER_RANGE-1);\n GrLine(dc,c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING,\n c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING+SLIDER_RANGE-1);\n dc->color=LTRED;\n GrPrint(dc,c->left+1*SLIDER_SPACING+0-FONT_WIDTH/2,\n c->top+SLIDER_SPACING+SLIDER_RANGE+3,\n \"%d\",s->left_pos*10/SLIDER_RANGE);\n GrPrint(dc,c->left+2*SLIDER_SPACING+1-FONT_WIDTH/2,\n c->top+SLIDER_SPACING+SLIDER_RANGE+3,\n \"%d\",s->right_pos*10/SLIDER_RANGE);\n GrRect(dc,c->left+1*SLIDER_SPACING+0-3,\n c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-2,7,5);\n GrRect(dc,c->left+2*SLIDER_SPACING+1-3,\n c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-2,7,5);\n dc->color=YELLOW;\n GrRect(dc,c->left+1*SLIDER_SPACING+0-2,\n c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-1,5,3);\n GrRect(dc,c->left+2*SLIDER_SPACING+1-2,\n c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-1,5,3);\n}\n\nU0 UpdateDerivedCtrlSlider(CCtrl *c)\n{\n CSliderState *s=c->state;\n c->left=c->win_task->pix_width/2-(SLIDER_SPACING*3+2)/2;\n c->right=c->left+3*SLIDER_SPACING+2;\n c->top=c->win_task->pix_height/2-(SLIDER_SPACING*2+SLIDER_RANGE)/2;\n c->bottom=c->top+SLIDER_SPACING*2+SLIDER_RANGE;\n s->left_pos=ClampI64(s->left_pos,0,SLIDER_RANGE-1);\n s->right_pos=ClampI64(s->right_pos,0,SLIDER_RANGE-1);\n}\n\nU0 LeftClickSlider(CCtrl *c,I64 x,I64 y,Bool)\n{\n CSliderState *s=c->state;\n if (x<c->left+1*SLIDER_SPACING+0+SLIDER_SPACING/2)\n s->left_pos=SLIDER_RANGE-1-(y-(c->top+SLIDER_SPACING));\n else\n s->right_pos=SLIDER_RANGE-1-(y-(c->top+SLIDER_SPACING));\n if (c->update_derived_vals)\n (*c->update_derived_vals)(c);\n}\n\nCCtrl *SliderNew()\n{\n CCtrl *c=CAlloc(sizeof(CCtrl));\n c->win_task=Fs;\n c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_MS;\n c->type=CTRLT_GENERIC;\n c->state=&sld;\n MemSet(&sld,0,sizeof(CSliderState));\n c->draw_it=&DrawCtrlSlider;\n c->left_click=&LeftClickSlider;\n c->update_derived_vals=&UpdateDerivedCtrlSlider;\n QueIns(c,Fs->last_ctrl);\n TaskDerivedValsUpdate;\n return c;\n}\n\nU0 SliderDel(CCtrl *c)\n{\n QueRem(c);\n Free(c);\n}\n\n//End of autocreated Code\n\nU0 Main()\n{\n \"This is to demo ctrls.\\n\";\n CCtrl *c=SliderNew;\n PressAKey;\n \"Left: %d Right: %d\\n\",\n sld.left_pos*10/SLIDER_RANGE,\n sld.right_pos*10/SLIDER_RANGE;\n SliderDel(c);\n DocBottom;\n}\n\nMain;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\BMPView-Sup1-Sup1Graphics-VanGogh-Home.html
// Date: unknown-date
// Language: HolyC
#define DC_NUM 4
CDC *cafe_dc[DC_NUM];
F64 glbl_scale;
U0 DrawIt(CTask *,CDC *dc)
{
dc->flags|=DCF_TRANSFORMATION;
Mat4x4Scale(dc->r,glbl_scale);
GrBlot3(dc,0,0,0,cafe_dc[winmgr.updates%DC_NUM]);
}
U0 Init(U8 *filename,F64 scale)
{
I64 i;
glbl_scale=scale;
for (i=0;i<DC_NUM;i++)
cafe_dc[i]=BMPRead(filename,TRUE);
}
U0 CleanUp()
{
I64 i;
for (i=0;i<DC_NUM;i++)
DCDel(cafe_dc[i]);
}
U0 BMP24View(U8 *filename,F64 scale=1.0)
{
Cd(__DIR__);
if (!FileFind(filename))
throw('NotFound');
Init(filename,scale);
SettingsPush; //See SettingsPush
AutoComplete;
WinBorder;
WinMax;
DocClear;
Fs->draw_it=&DrawIt;
GetChar;
SettingsPop;
CleanUp;
}
BMP24View("Cafe.BMP.Z",0.785);
BMP24View("Elephants.BMP.Z",2.135);
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\BMPView-Sup1-Sup1Graphics-VanGogh-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n#define DC_NUM 4\n\nCDC *cafe_dc[DC_NUM];\nF64 glbl_scale;\n\nU0 DrawIt(CTask *,CDC *dc)\n{\n dc->flags|=DCF_TRANSFORMATION;\n Mat4x4Scale(dc->r,glbl_scale);\n GrBlot3(dc,0,0,0,cafe_dc[winmgr.updates%DC_NUM]);\n}\n\nU0 Init(U8 *filename,F64 scale)\n{\n I64 i;\n glbl_scale=scale;\n for (i=0;i<DC_NUM;i++)\n cafe_dc[i]=BMPRead(filename,TRUE);\n}\n\nU0 CleanUp()\n{\n I64 i;\n for (i=0;i<DC_NUM;i++)\n DCDel(cafe_dc[i]);\n}\n\nU0 BMP24View(U8 *filename,F64 scale=1.0)\n{\n Cd(__DIR__);\n if (!FileFind(filename))\n throw('NotFound');\n Init(filename,scale);\n SettingsPush; //See SettingsPush\n AutoComplete;\n WinBorder;\n WinMax;\n DocClear;\n Fs->draw_it=&DrawIt;\n GetChar;\n SettingsPop;\n CleanUp;\n}\n\nBMP24View(\"Cafe.BMP.Z\",0.785);\nBMP24View(\"Elephants.BMP.Z\",2.135);"
}
]
}
|
// Source: D:\TempleOS-Projects\html\GrTextBase-Gr-Adam.html
// Date: unknown-date
// Language: HolyC
#help_index "TextBase Layer;Char/TextBase Layer"
#help_file "::/Doc/TextBase"
asm {
//************************************
_TEXT_CHAR::
//Bool TextChar(CTask *task,Bool allow_border=FALSE,I64 x,I64 y,I64 d);
//Must be called 30fps in Fs->draw_it() callback.
PUSH RBP
MOV RBP,RSP
MOV RCX,U64 SF_ARG1[RBP]
MOV RBX,U64 CTask.scroll_x[RCX]
SAR RBX,3
ADD RBX,U64 SF_ARG3[RBP]
MOV RAX,U64 CTask.scroll_y[RCX]
SAR RAX,3
ADD RAX,U64 SF_ARG4[RBP]
TEST U8 SF_ARG2[RBP],0xFF
JNZ @@10
//Border not allowed
TEST RBX,RBX //Check X
JS @@05
ADD RBX,U64 CTask.win_left[RCX]
CMP RBX,U64 CTask.win_right[RCX]
JG @@05
TEST RBX,RBX
JS @@05
CMP RBX,TEXT_COLS
JGE @@05
TEST RAX,RAX //Check Y
JS @@05
ADD RAX,U64 CTask.win_top[RCX]
CMP RAX,U64 CTask.win_bottom[RCX]
JG @@05
TEST RAX,RAX
JS @@05
CMP RAX,TEXT_ROWS
JGE @@05
JMP @@15
@@05: XOR RAX,RAX //return FALSE
POP RBP
RET1 40
//Border allowed
@@10: MOV RDX,-1 //Check X
CMP RBX,RDX
JL @@05
ADD RBX,U64 CTask.win_left[RCX]
MOV RDX,U64 CTask.win_right[RCX]
INC RDX
CMP RBX,RDX
JG @@05
TEST RBX,RBX
JS @@05
CMP RBX,TEXT_COLS
JGE @@05
MOV RDX,-1 //Check Y
CMP RAX,RDX
JL @@05
ADD RAX,U64 CTask.win_top[RCX]
MOV RDX,U64 CTask.win_bottom[RCX]
INC RDX
CMP RAX,RDX
JG @@05
TEST RAX,RAX
JS @@05
CMP RAX,TEXT_ROWS
JGE @@05
@@15: IMUL2 RAX,TEXT_COLS
ADD RBX,RAX
SHL RBX,2
ADD RBX,U64 [&gr.text_base]
MOV RAX,U64 SF_ARG5[RBP]
MOV U32 [RBX],EAX
MOV RAX,TRUE
POP RBP
RET1 40
//************************************
_TEXT_LEN_STR::
//Bool TextLenStr(CTask *task,I64 x,I64 y,I64 len,I64 attr,U8 *s)
//Must be called 30fps in Fs->draw_it() callback.
PUSH RBP
MOV RBP,RSP
PUSH RSI
PUSH RDI
MOV RBX,U64 SF_ARG1[RBP]
MOV RSI,U64 SF_ARG6[RBP]
MOV RDI,U64 CTask.scroll_x[RBX]
SAR RDI,3
ADD RDI,U64 SF_ARG2[RBP]
MOV RCX,U64 SF_ARG4[RBP]
TEST RDI,RDI
JNS @@05
ADD RCX,RDI
SUB RSI,RDI
XOR RDI,RDI
@@05: ADD RDI,U64 CTask.win_left[RBX]
MOV RDX,RCX
ADD RDX,RDI
DEC RDX
CMP RDX,U64 CTask.win_right[RBX]
JLE @@10
MOV RAX,RDX
SUB RAX,U64 CTask.win_right[RBX]
SUB RDX,RAX
SUB RCX,RAX
@@10: TEST RDI,RDI
JNS @@15
ADD RCX,RDI
SUB RSI,RDI
XOR RDI,RDI
@@15: INC RDX
SUB RDX,TEXT_COLS
JLE @@20
SUB RCX,RDX
@@20: CMP RCX,1
JL @@30
MOV RAX,U64 CTask.scroll_y[RBX]
SAR RAX,3
ADD RAX,U64 SF_ARG3[RBP]
TEST RAX,RAX
JS @@30
ADD RAX,U64 CTask.win_top[RBX]
CMP RAX,U64 CTask.win_bottom[RBX]
JG @@30
TEST RAX,RAX
JS @@30
CMP RAX,TEXT_ROWS
JGE @@30
IMUL2 RAX,TEXT_COLS
ADD RDI,RAX
SHL RDI,2
ADD RDI,U64 [&gr.text_base]
MOV RAX,U64 SF_ARG5[RBP]
@@25: LODSB
STOSD
DEC RCX
JNZ @@25
POP RDI
POP RSI
MOV RAX,TRUE
POP RBP
RET1 48
@@30: POP RDI
POP RSI
XOR RAX,RAX
POP RBP
RET1 48
//************************************
_TEXT_LEN_ATTR_STR::
//Bool TextLenAttrStr(CTask *task,I64 x,I64 y,I64 len,U32 *_attr)
//Must be called 30fps in Fs->draw_it() callback.
PUSH RBP
MOV RBP,RSP
PUSH RSI
PUSH RDI
MOV RBX,U64 SF_ARG1[RBP]
MOV RSI,U64 SF_ARG5[RBP]
MOV RDI,U64 CTask.scroll_x[RBX]
SAR RDI,3
ADD RDI,U64 SF_ARG2[RBP]
MOV RCX,U64 SF_ARG4[RBP]
TEST RDI,RDI
JNS @@05
ADD RCX,RDI
SHL RDI,2
SUB RSI,RDI
XOR RDI,RDI
@@05: ADD RDI,U64 CTask.win_left[RBX]
MOV RDX,RCX
ADD RDX,RDI
DEC RDX
CMP RDX,U64 CTask.win_right[RBX]
JLE @@10
MOV RAX,RDX
SUB RAX,U64 CTask.win_right[RBX]
SUB RDX,RAX
SUB RCX,RAX
@@10: TEST RDI,RDI
JNS @@15
ADD RCX,RDI
SHL RDI,2
SUB RSI,RDI
XOR RDI,RDI
@@15: INC RDX
SUB RDX,TEXT_COLS
JLE @@20
SUB RCX,RDX
@@20: CMP RCX,1
JL @@30
MOV RAX,U64 CTask.scroll_y[RBX]
SAR RAX,3
ADD RAX,U64 SF_ARG3[RBP]
TEST RAX,RAX
JS @@30
ADD RAX,U64 CTask.win_top[RBX]
CMP RAX,U64 CTask.win_bottom[RBX]
JG @@30
TEST RAX,RAX
JS @@30
CMP RAX,TEXT_ROWS
JGE @@30
IMUL2 RAX,TEXT_COLS
ADD RDI,RAX
SHL RDI,2
ADD RDI,U64 [&gr.text_base]
@@25: MOVSD
DEC RCX
JNZ @@25
POP RDI
POP RSI
MOV RAX,TRUE
POP RBP
RET1 40
@@30: POP RDI
POP RSI
XOR RAX,RAX
POP RBP
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\GrTextBase-Gr-Adam.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"TextBase Layer;Char/TextBase Layer\"\n#help_file \"::/Doc/TextBase\"\n\nasm {\n//************************************\n_TEXT_CHAR::\n//Bool TextChar(CTask *task,Bool allow_border=FALSE,I64 x,I64 y,I64 d);\n//Must be called 30fps in Fs->draw_it() callback.\n PUSH RBP\n MOV RBP,RSP\n MOV RCX,U64 SF_ARG1[RBP]\n MOV RBX,U64 CTask.scroll_x[RCX]\n SAR RBX,3\n ADD RBX,U64 SF_ARG3[RBP]\n MOV RAX,U64 CTask.scroll_y[RCX]\n SAR RAX,3\n ADD RAX,U64 SF_ARG4[RBP]\n\n TEST U8 SF_ARG2[RBP],0xFF\n JNZ @@10\n\n//Border not allowed\n TEST RBX,RBX //Check X\n JS @@05\n ADD RBX,U64 CTask.win_left[RCX]\n CMP RBX,U64 CTask.win_right[RCX]\n JG @@05\n TEST RBX,RBX\n JS @@05\n CMP RBX,TEXT_COLS\n JGE @@05\n TEST RAX,RAX //Check Y\n JS @@05\n ADD RAX,U64 CTask.win_top[RCX]\n CMP RAX,U64 CTask.win_bottom[RCX]\n JG @@05\n TEST RAX,RAX\n JS @@05\n CMP RAX,TEXT_ROWS\n JGE @@05\n JMP @@15\n\n@@05: XOR RAX,RAX //return FALSE\n POP RBP\n RET1 40\n\n//Border allowed\n@@10: MOV RDX,-1 //Check X\n CMP RBX,RDX\n JL @@05\n ADD RBX,U64 CTask.win_left[RCX]\n MOV RDX,U64 CTask.win_right[RCX]\n INC RDX\n CMP RBX,RDX\n JG @@05\n TEST RBX,RBX\n JS @@05\n CMP RBX,TEXT_COLS\n JGE @@05\n MOV RDX,-1 //Check Y\n CMP RAX,RDX\n JL @@05\n ADD RAX,U64 CTask.win_top[RCX]\n MOV RDX,U64 CTask.win_bottom[RCX]\n INC RDX\n CMP RAX,RDX\n JG @@05\n TEST RAX,RAX\n JS @@05\n CMP RAX,TEXT_ROWS\n JGE @@05\n\n@@15: IMUL2 RAX,TEXT_COLS\n ADD RBX,RAX\n SHL RBX,2\n ADD RBX,U64 [&gr.text_base]\n MOV RAX,U64 SF_ARG5[RBP]\n MOV U32 [RBX],EAX\n\n MOV RAX,TRUE\n POP RBP\n RET1 40\n//************************************\n_TEXT_LEN_STR::\n//Bool TextLenStr(CTask *task,I64 x,I64 y,I64 len,I64 attr,U8 *s)\n//Must be called 30fps in Fs->draw_it() callback.\n PUSH RBP\n MOV RBP,RSP\n PUSH RSI\n PUSH RDI\n MOV RBX,U64 SF_ARG1[RBP]\n MOV RSI,U64 SF_ARG6[RBP]\n MOV RDI,U64 CTask.scroll_x[RBX]\n SAR RDI,3\n ADD RDI,U64 SF_ARG2[RBP]\n MOV RCX,U64 SF_ARG4[RBP]\n\n TEST RDI,RDI\n JNS @@05\n ADD RCX,RDI\n SUB RSI,RDI\n XOR RDI,RDI\n@@05: ADD RDI,U64 CTask.win_left[RBX]\n MOV RDX,RCX\n ADD RDX,RDI\n DEC RDX\n CMP RDX,U64 CTask.win_right[RBX]\n JLE @@10\n MOV RAX,RDX\n SUB RAX,U64 CTask.win_right[RBX]\n SUB RDX,RAX\n SUB RCX,RAX\n@@10: TEST RDI,RDI\n JNS @@15\n ADD RCX,RDI\n SUB RSI,RDI\n XOR RDI,RDI\n@@15: INC RDX\n SUB RDX,TEXT_COLS\n JLE @@20\n SUB RCX,RDX\n@@20: CMP RCX,1\n JL @@30\n\n MOV RAX,U64 CTask.scroll_y[RBX]\n SAR RAX,3\n ADD RAX,U64 SF_ARG3[RBP]\n TEST RAX,RAX\n JS @@30\n ADD RAX,U64 CTask.win_top[RBX]\n CMP RAX,U64 CTask.win_bottom[RBX]\n JG @@30\n TEST RAX,RAX\n JS @@30\n CMP RAX,TEXT_ROWS\n JGE @@30\n\n IMUL2 RAX,TEXT_COLS\n ADD RDI,RAX\n SHL RDI,2\n ADD RDI,U64 [&gr.text_base]\n MOV RAX,U64 SF_ARG5[RBP]\n@@25: LODSB\n STOSD\n DEC RCX\n JNZ @@25\n\n POP RDI\n POP RSI\n MOV RAX,TRUE\n POP RBP\n RET1 48\n\n@@30: POP RDI\n POP RSI\n XOR RAX,RAX\n POP RBP\n RET1 48\n//************************************\n_TEXT_LEN_ATTR_STR::\n//Bool TextLenAttrStr(CTask *task,I64 x,I64 y,I64 len,U32 *_attr)\n//Must be called 30fps in Fs->draw_it() callback.\n PUSH RBP\n MOV RBP,RSP\n PUSH RSI\n PUSH RDI\n MOV RBX,U64 SF_ARG1[RBP]\n MOV RSI,U64 SF_ARG5[RBP]\n MOV RDI,U64 CTask.scroll_x[RBX]\n SAR RDI,3\n ADD RDI,U64 SF_ARG2[RBP]\n MOV RCX,U64 SF_ARG4[RBP]\n\n TEST RDI,RDI\n JNS @@05\n ADD RCX,RDI\n SHL RDI,2\n SUB RSI,RDI\n XOR RDI,RDI\n@@05: ADD RDI,U64 CTask.win_left[RBX]\n MOV RDX,RCX\n ADD RDX,RDI\n DEC RDX\n CMP RDX,U64 CTask.win_right[RBX]\n JLE @@10\n MOV RAX,RDX\n SUB RAX,U64 CTask.win_right[RBX]\n SUB RDX,RAX\n SUB RCX,RAX\n@@10: TEST RDI,RDI\n JNS @@15\n ADD RCX,RDI\n SHL RDI,2\n SUB RSI,RDI\n XOR RDI,RDI\n@@15: INC RDX\n SUB RDX,TEXT_COLS\n JLE @@20\n SUB RCX,RDX\n@@20: CMP RCX,1\n JL @@30\n\n MOV RAX,U64 CTask.scroll_y[RBX]\n SAR RAX,3\n ADD RAX,U64 SF_ARG3[RBP]\n TEST RAX,RAX\n JS @@30\n ADD RAX,U64 CTask.win_top[RBX]\n CMP RAX,U64 CTask.win_bottom[RBX]\n JG @@30\n TEST RAX,RAX\n JS @@30\n CMP RAX,TEXT_ROWS\n JGE @@30\n\n IMUL2 RAX,TEXT_COLS\n ADD RDI,RAX\n SHL RDI,2\n ADD RDI,U64 [&gr.text_base]\n@@25: MOVSD\n DEC RCX\n JNZ @@25\n\n POP RDI\n POP RSI\n MOV RAX,TRUE\n POP RBP\n RET1 40\n\n@@30: POP RDI\n POP RSI\n XOR RAX,RAX\n POP RBP\n"
}
]
}
|
// Source: D:\TempleOS-Projects\html\o-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 no nothing
U0 Song()
{
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.480;
music.stacatto_factor= 0.902;
try {
while (!ScanKey) {
Play("5sCGCG4etA5DD4sG5G4G5GF4A5F4A5DDDDqG4sBGBG5qG");
Play("5sCGCG4etA5DD4sG5G4G5GF4A5F4A5DDDDqG4sBGBG5qG");
Play("5eG4G5qE4eAsAGqA5sE4A5E4A5DEDEqF4eAG");
Play("5G4G5qE4eAsAGqA5sE4A5E4A5DEDEqF4eAG");
}
} catch
PutExcept;
Snd;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\o-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 no nothing\nU0 Song()\n{\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 2.480;\n music.stacatto_factor= 0.902;\n try {\n while (!ScanKey) {\n Play(\"5sCGCG4etA5DD4sG5G4G5GF4A5F4A5DDDDqG4sBGBG5qG\");\n Play(\"5sCGCG4etA5DD4sG5G4G5GF4A5F4A5DDDDqG4sBGBG5qG\");\n Play(\"5eG4G5qE4eAsAGqA5sE4A5E4A5DEDEqF4eAG\");\n Play(\"5G4G5qE4eAsAGqA5sE4A5E4A5DEDEqF4eAG\");\n }\n } catch\n PutExcept;\n Snd;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\640x480-Web-Home.html
// Date: unknown-date
// Language: HolyC
Why TempleOS is 640x480 16 Color
God said 640x480 16 color was a covenant like circumcision. The resolution will
remain 640x480 16 color for centuries to come.
Mom taught preschool. She said the kids would color with crayons. Then, put
black crayon all over the top of the drawing. She speculated that the black
crayon felt powerful to them and was fun to use.
She did not like sending home ugly black-colored scribbles, so she started
collecting all the black crayons before having them do coloring.
You can see how Wolfenstein and Battlezone got turned into awful games with
story-lines no one enjoys. Game designers feel they must tell a story, once
they get high color and memory.
If you made a WWI game realistic, God said you should put the agonistic moans of
the wounded. <sarcasm> Boy wouldn't that be fun! </sarcasm> God said to have
just one audio voice and only a 7-bit signed value, I guess like an 88 key piano
note, for TempleOS. I named such values an "ona". One voice means one
frequency you set, perhaps, with waveform and reverb.
God does not want gore and sex in His temple.
"What about adults?" Adults should not be playing video games.
God's favorite game is Donkey Kong. God said Shakespeare had a vile heart.
Watch your heart. God likes Beverly Hillbillies and Gomer Pyle. God's favorite
thing on TV is soap operas. God liked King David and said children should be
taught about military things. God is not a prude when it comes to violence --
it's just that there is a good-hearted and a bad-hearted way to do it.
God likes BC's Quest for Tires.
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\640x480-Web-Home.html\n// Date: unknown-date\n// Language: HolyC\n\nWhy TempleOS is 640x480 16 Color\n\nGod said 640x480 16 color was a covenant like circumcision. The resolution will \nremain 640x480 16 color for centuries to come.\n\n\n\n\n\n\n\n\n\nMom taught preschool. She said the kids would color with crayons. Then, put \nblack crayon all over the top of the drawing. She speculated that the black \ncrayon felt powerful to them and was fun to use.\n\nShe did not like sending home ugly black-colored scribbles, so she started \ncollecting all the black crayons before having them do coloring.\n\nYou can see how Wolfenstein and Battlezone got turned into awful games with \nstory-lines no one enjoys. Game designers feel they must tell a story, once \nthey get high color and memory.\n\nIf you made a WWI game realistic, God said you should put the agonistic moans of \nthe wounded. <sarcasm> Boy wouldn't that be fun! </sarcasm> God said to have \njust one audio voice and only a 7-bit signed value, I guess like an 88 key piano \nnote, for TempleOS. I named such values an \"ona\". One voice means one \nfrequency you set, perhaps, with waveform and reverb.\n\nGod does not want gore and sex in His temple.\n\n\"What about adults?\" Adults should not be playing video games.\n\nGod's favorite game is Donkey Kong. God said Shakespeare had a vile heart. \nWatch your heart. God likes Beverly Hillbillies and Gomer Pyle. God's favorite \nthing on TV is soap operas. God liked King David and said children should be \ntaught about military things. God is not a prude when it comes to violence -- \nit's just that there is a good-hearted and a bad-hearted way to do it.\n\nGod likes BC's Quest for Tires."
}
]
}
|
// Source: D:\TempleOS-Projects\html\garfield-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has words
U0 Song()
{
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.480;
music.stacatto_factor= 0.902;
try {
while (!ScanKey) {
Play("5eGsD4B5eFCFF4GGB5sEEeDsDCqE4etA5ED",
"I \0don't \0 \0get \0that \0joke.\n\0"
" \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0");
Play("5eGsD4B5eFCFF4GGB5sEEeDsDCqE4etA5ED",
"To \0much \0 \0pot \0I \0smoke.\n\0"
" \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0");
Play("5C4GB5sDEDEeF4B5etE4G5C4qGeAGqG5sGFGF",
" \0$RED$You \0 \0can \0 \0re\0 \0cover!$FG$\n\0"
" \0 \0 \0 \0I'm \0not \0sure.\n\0 \0 \0 \0 \0 \0");
Play("5etC4GB5sDEDEeF4B5etE4G5C4qGeAGqG5sGFGF",
" \0My \0 \0cell \0 \0smoth\0 \0er.\n\0"
" \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0");
}
} catch
PutExcept;
Snd;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\garfield-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has words\nU0 Song()\n{\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 2.480;\n music.stacatto_factor= 0.902;\n try {\n while (!ScanKey) {\n Play(\"5eGsD4B5eFCFF4GGB5sEEeDsDCqE4etA5ED\",\n \"I \\0don't \\0 \\0get \\0that \\0joke.\\n\\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5eGsD4B5eFCFF4GGB5sEEeDsDCqE4etA5ED\",\n \"To \\0much \\0 \\0pot \\0I \\0smoke.\\n\\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5C4GB5sDEDEeF4B5etE4G5C4qGeAGqG5sGFGF\",\n \" \\0$RED$You \\0 \\0can \\0 \\0re\\0 \\0cover!$FG$\\n\\0\"\n \" \\0 \\0 \\0 \\0I'm \\0not \\0sure.\\n\\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5etC4GB5sDEDEeF4B5etE4G5C4qGeAGqG5sGFGF\",\n \" \\0My \\0 \\0cell \\0 \\0smoth\\0 \\0er.\\n\\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n }\n } catch\n PutExcept;\n Snd;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\WallPaperCtrl-Graphics-Demo.html
// Date: unknown-date
// Language: HolyC
/*Done with <CTRL-SHIFT-L> template code
that was modified.
This is an advanced demo that shows
that you can place ctrls on the
wall paper.
See ::/Demo/Graphics/Slider.HC
and ::/Demo/Graphics/WallPaperFish.HC
before messing with this program.
It must be "Adam Included".
*/
#define SLIDER_RANGE 30
#define SLIDER_SPACING 20
#define SLIDER_BORDER 2
class CSliderState
{
I64 left_pos;
I64 right_pos;
};
U0 DrawCtrlSlider(CDC *dc,CCtrl *c)
{
CSliderState *s=c->state;
dc->color=LTRED;
GrRect(dc, c->left,c->top,SLIDER_SPACING*3+2,SLIDER_SPACING*2+SLIDER_RANGE);
dc->color=BLUE;
GrRect(dc, c->left+SLIDER_BORDER,c->top+SLIDER_BORDER,
SLIDER_SPACING*3+2-2*SLIDER_BORDER,
SLIDER_SPACING*2+SLIDER_RANGE-2*SLIDER_BORDER);
dc->color=BLACK;
GrLine(dc,c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING,
c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
GrLine(dc,c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING,
c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
dc->color=LTRED;
GrPrint(dc,c->left+1*SLIDER_SPACING+0-FONT_WIDTH/2,
c->top+SLIDER_SPACING+SLIDER_RANGE+3,
"%d",s->left_pos*10/SLIDER_RANGE);
GrPrint(dc,c->left+2*SLIDER_SPACING+1-FONT_WIDTH/2,
c->top+SLIDER_SPACING+SLIDER_RANGE+3,
"%d",s->right_pos*10/SLIDER_RANGE);
GrRect(dc,c->left+1*SLIDER_SPACING+0-3,
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-2,7,5);
GrRect(dc,c->left+2*SLIDER_SPACING+1-3,
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-2,7,5);
dc->color=YELLOW;
GrRect(dc,c->left+1*SLIDER_SPACING+0-2,
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-1,5,3);
GrRect(dc,c->left+2*SLIDER_SPACING+1-2,
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-1,5,3);
}
U0 UpdateDerivedCtrlSlider(CCtrl *c)
{
CSliderState *s=c->state;
c->left=c->win_task->pix_width/2-(SLIDER_SPACING*3+2)/2;
c->right=c->left+3*SLIDER_SPACING+2;
c->top=c->win_task->pix_height/2-(SLIDER_SPACING*2+SLIDER_RANGE)/2;
c->bottom=c->top+SLIDER_SPACING*2+SLIDER_RANGE;
s->left_pos=ClampI64(s->left_pos,0,SLIDER_RANGE-1);
s->right_pos=ClampI64(s->right_pos,0,SLIDER_RANGE-1);
}
U0 LeftClickSlider(CCtrl *c,I64 x,I64 y,Bool)
{
CSliderState *s=c->state;
if (x<c->left+1*SLIDER_SPACING+0+SLIDER_SPACING/2)
s->left_pos=SLIDER_RANGE-1-(y-(c->top+SLIDER_SPACING));
else
s->right_pos=SLIDER_RANGE-1-(y-(c->top+SLIDER_SPACING));
if (c->update_derived_vals)
(*c->update_derived_vals)(c);
}
CCtrl *SliderNew()
{
CCtrl *c;
if (Fs!=adam_task) {
"Must be Adam Included with SHIFT-F5.\n"
"(Would crash when code mem was freed.)\n";
return NULL;
}
c=ACAlloc(sizeof(CCtrl));
c->win_task=sys_winmgr_task;
c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_MS;
c->type=CTRLT_GENERIC;
c->state=ACAlloc(sizeof(CSliderState));
c->draw_it=&DrawCtrlSlider;
c->left_click=&LeftClickSlider;
c->update_derived_vals=&UpdateDerivedCtrlSlider;
QueIns(c,sys_winmgr_task->last_ctrl);
TaskDerivedValsUpdate;
return c;
}
U0 SliderDel(CCtrl *c)
{
QueRem(c);
Free(c->state);
Free(c);
}
SliderNew;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\WallPaperCtrl-Graphics-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\n/*Done with <CTRL-SHIFT-L> template code\nthat was modified.\n\nThis is an advanced demo that shows\nthat you can place ctrls on the\nwall paper.\n\nSee ::/Demo/Graphics/Slider.HC\nand ::/Demo/Graphics/WallPaperFish.HC\nbefore messing with this program.\n\nIt must be \"Adam Included\".\n*/\n\n#define SLIDER_RANGE 30\n#define SLIDER_SPACING 20\n#define SLIDER_BORDER 2\n\nclass CSliderState\n{\n I64 left_pos;\n I64 right_pos;\n};\n\nU0 DrawCtrlSlider(CDC *dc,CCtrl *c)\n{\n CSliderState *s=c->state;\n\n dc->color=LTRED;\n GrRect(dc, c->left,c->top,SLIDER_SPACING*3+2,SLIDER_SPACING*2+SLIDER_RANGE);\n dc->color=BLUE;\n GrRect(dc, c->left+SLIDER_BORDER,c->top+SLIDER_BORDER,\n SLIDER_SPACING*3+2-2*SLIDER_BORDER,\n SLIDER_SPACING*2+SLIDER_RANGE-2*SLIDER_BORDER);\n dc->color=BLACK;\n GrLine(dc,c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING,\n c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING+SLIDER_RANGE-1);\n GrLine(dc,c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING,\n c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING+SLIDER_RANGE-1);\n dc->color=LTRED;\n GrPrint(dc,c->left+1*SLIDER_SPACING+0-FONT_WIDTH/2,\n c->top+SLIDER_SPACING+SLIDER_RANGE+3,\n \"%d\",s->left_pos*10/SLIDER_RANGE);\n GrPrint(dc,c->left+2*SLIDER_SPACING+1-FONT_WIDTH/2,\n c->top+SLIDER_SPACING+SLIDER_RANGE+3,\n \"%d\",s->right_pos*10/SLIDER_RANGE);\n GrRect(dc,c->left+1*SLIDER_SPACING+0-3,\n c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-2,7,5);\n GrRect(dc,c->left+2*SLIDER_SPACING+1-3,\n c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-2,7,5);\n dc->color=YELLOW;\n GrRect(dc,c->left+1*SLIDER_SPACING+0-2,\n c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-1,5,3);\n GrRect(dc,c->left+2*SLIDER_SPACING+1-2,\n c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-1,5,3);\n}\n\nU0 UpdateDerivedCtrlSlider(CCtrl *c)\n{\n CSliderState *s=c->state;\n c->left=c->win_task->pix_width/2-(SLIDER_SPACING*3+2)/2;\n c->right=c->left+3*SLIDER_SPACING+2;\n c->top=c->win_task->pix_height/2-(SLIDER_SPACING*2+SLIDER_RANGE)/2;\n c->bottom=c->top+SLIDER_SPACING*2+SLIDER_RANGE;\n s->left_pos=ClampI64(s->left_pos,0,SLIDER_RANGE-1);\n s->right_pos=ClampI64(s->right_pos,0,SLIDER_RANGE-1);\n}\n\nU0 LeftClickSlider(CCtrl *c,I64 x,I64 y,Bool)\n{\n CSliderState *s=c->state;\n if (x<c->left+1*SLIDER_SPACING+0+SLIDER_SPACING/2)\n s->left_pos=SLIDER_RANGE-1-(y-(c->top+SLIDER_SPACING));\n else\n s->right_pos=SLIDER_RANGE-1-(y-(c->top+SLIDER_SPACING));\n if (c->update_derived_vals)\n (*c->update_derived_vals)(c);\n}\n\nCCtrl *SliderNew()\n{\n CCtrl *c;\n if (Fs!=adam_task) {\n \"Must be Adam Included with SHIFT-F5.\\n\"\n \"(Would crash when code mem was freed.)\\n\";\n return NULL;\n }\n c=ACAlloc(sizeof(CCtrl));\n c->win_task=sys_winmgr_task;\n c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_MS;\n c->type=CTRLT_GENERIC;\n c->state=ACAlloc(sizeof(CSliderState));\n c->draw_it=&DrawCtrlSlider;\n c->left_click=&LeftClickSlider;\n c->update_derived_vals=&UpdateDerivedCtrlSlider;\n QueIns(c,sys_winmgr_task->last_ctrl);\n TaskDerivedValsUpdate;\n return c;\n}\n\nU0 SliderDel(CCtrl *c)\n{\n QueRem(c);\n Free(c->state);\n Free(c);\n}\n\nSliderNew;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\RainDrops-Games-Demo.html
// Date: unknown-date
// Language: HolyC
I64 sc_1,sc_2;
#define DROPS_NUM 0x2000
class Drop
{
I32 x,y;
} drops[DROPS_NUM];
CDC *cur_dc;
U0 DrawFrame(CTask *task,CDC *dc)
{
I64 w=task->pix_width,h=task->pix_height,
cx=w>>1,cy=h>>1;
dc->color=LTRED;
GrLine(dc,cx-20,cy-50,cx,cy-150);
GrLine(dc,cx+20,cy-50,cx,cy-150);
dc->color=LTRED;
GrLine(dc,cx-100,cy-100,cx,cy);
GrLine(dc,cx+100,cy-100,cx,cy);
if (Bt(kbd.down_bitmap,sc_1)) {
dc->color=WHITE;
GrRect(dc,cx-2,cy-2,5,5);
}
dc->color=BLACK;
GrPrint(dc,cx+10,cy,"Press '1'");
dc->color=LTRED;
GrRect(dc,cx-20,cy+60,41,21);
dc->color=LTRED;
GrLine(dc,cx-200,cy,cx,cy+100);
GrLine(dc,cx+200,cy,cx,cy+100);
if (Bt(kbd.down_bitmap,sc_2)) {
dc->color=WHITE;
GrRect(dc,cx-2,cy+100-2,5,5);
}
dc->color=BLACK;
GrPrint(dc,cx+10,cy+100,"Press '2'");
dc->color=LTRED;
GrLine(dc,cx+400,cy+100,cx-250,cy+200);
}
U0 DrawDrops(CTask *,CDC *dc)
{
I64 i;
dc->color=BLUE;
for (i=0;i<DROPS_NUM;i++)
if (drops[i].y>=0 && GrPeek(dc,drops[i].x,drops[i].y)==WHITE)
GrPlot(dc,drops[i].x,drops[i].y);
}
U0 UpdateCurBase(CTask *task,CDC *dc)
{
cur_dc->color=ROP_EQU;
dc->flags|=DCF_NO_TRANSPARENTS;
GrBlot(cur_dc,-task->pix_left-task->scroll_x,
-task->pix_top-task->scroll_y,dc);
dc->flags&=~DCF_NO_TRANSPARENTS;
}
U0 DrawIt(CTask *task,CDC *dc)
{
DrawFrame(task,dc);
DrawDrops(task,dc);
UpdateCurBase(task,dc);
}
U0 AnimateTask(I64)
{
I64 i,j,cur_drop=0,c1,c2,x0,y0,x1,y1,w,h;
while (TRUE) {
w=Fs->parent_task->pix_width;
h=Fs->parent_task->pix_height;
for (i=0;i<2;i++) {
j=0;
do {
if (++cur_drop>=DROPS_NUM)
cur_drop=0;
if (drops[cur_drop].y<0)
break;
j++;
} while (j<=DROPS_NUM);
drops[cur_drop].x=RandU32%w;
drops[cur_drop].y=0;
}
for (i=0;i<DROPS_NUM;i++) {
if (drops[i].y>=0) {
if (drops[i].y>=h-1)
drops[i].y=-I32_MAX;
else {
x0=x1=drops[i].x;
y0=y1=drops[i].y;
if (GrPeek(cur_dc,x0,y0+1)==WHITE)
y1++;
else {
c1=GrPeek(cur_dc,x0+1,y0);
c2=GrPeek(cur_dc,x0-1,y0);
if (c1==WHITE && c2!=WHITE)
x1++;
else if (c2==WHITE && c1!=WHITE)
x1--;
else if (c1==WHITE && c2==WHITE) {
c1=GrPeek(cur_dc,x0+1,y0+1);
c2=GrPeek(cur_dc,x0-1,y0+1);
if (c1==WHITE && c2!=WHITE)
x1++;
else if (c2==WHITE && c1!=WHITE)
x1--;
else if (RandI16>=0)
x1++;
else
x1--;
}
if (GrPeek(cur_dc,x1,y1+1)==WHITE)
y1++;
}
if (GrPeek(cur_dc,x0,y0)==BLUE) {
cur_dc->color=WHITE;
GrPlot(cur_dc,x0,y0);
}
cur_dc->color=BLUE;
GrPlot(cur_dc,x1,y1);
drops[i].x=x1;
drops[i].y=y1;
}
}
}
Sleep(10);
}
}
U0 Init()
{
I64 i;
MemSet(drops,0,sizeof(drops));
for (i=0;i<DROPS_NUM;i++)
drops[i].y=-I32_MAX;
}
U0 RainDrops()
{
I64 ch,sc;
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
" Exit(,CH_ESC);"
"}"
"Play {"
" Restart(,'\n');"
" OpenUpper(,'1');"
" OpenLower(,'2');"
"}"
);
SettingsPush; //See SettingsPush
AutoComplete;
WinBorder;
WinMax;
DocCursor;
DocClear;
cur_dc=DCNew(GR_WIDTH,GR_HEIGHT);
sc_1=Char2ScanCode('1');
sc_2=Char2ScanCode('2');
Init;
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
Fs->draw_it=&DrawIt;
try {
do
switch (ch=GetKey(&sc)) {
case '\n':
Init;
break;
}
while (ch!=CH_ESC && ch!=CH_SHIFT_ESC);
} catch
PutExcept;
SettingsPop;
MenuPop;
DCDel(cur_dc);
}
RainDrops;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\RainDrops-Games-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\nI64 sc_1,sc_2;\n\n#define DROPS_NUM 0x2000\n\nclass Drop\n{\n I32 x,y;\n} drops[DROPS_NUM];\n\nCDC *cur_dc;\n\nU0 DrawFrame(CTask *task,CDC *dc)\n{\n I64 w=task->pix_width,h=task->pix_height,\n cx=w>>1,cy=h>>1;\n\n dc->color=LTRED;\n GrLine(dc,cx-20,cy-50,cx,cy-150);\n GrLine(dc,cx+20,cy-50,cx,cy-150);\n\n dc->color=LTRED;\n GrLine(dc,cx-100,cy-100,cx,cy);\n GrLine(dc,cx+100,cy-100,cx,cy);\n if (Bt(kbd.down_bitmap,sc_1)) {\n dc->color=WHITE;\n GrRect(dc,cx-2,cy-2,5,5);\n }\n dc->color=BLACK;\n GrPrint(dc,cx+10,cy,\"Press '1'\");\n\n dc->color=LTRED;\n GrRect(dc,cx-20,cy+60,41,21);\n\n dc->color=LTRED;\n GrLine(dc,cx-200,cy,cx,cy+100);\n GrLine(dc,cx+200,cy,cx,cy+100);\n if (Bt(kbd.down_bitmap,sc_2)) {\n dc->color=WHITE;\n GrRect(dc,cx-2,cy+100-2,5,5);\n }\n dc->color=BLACK;\n GrPrint(dc,cx+10,cy+100,\"Press '2'\");\n\n dc->color=LTRED;\n GrLine(dc,cx+400,cy+100,cx-250,cy+200);\n}\n\nU0 DrawDrops(CTask *,CDC *dc)\n{\n I64 i;\n dc->color=BLUE;\n for (i=0;i<DROPS_NUM;i++)\n if (drops[i].y>=0 && GrPeek(dc,drops[i].x,drops[i].y)==WHITE)\n GrPlot(dc,drops[i].x,drops[i].y);\n}\n\nU0 UpdateCurBase(CTask *task,CDC *dc)\n{\n cur_dc->color=ROP_EQU;\n dc->flags|=DCF_NO_TRANSPARENTS;\n GrBlot(cur_dc,-task->pix_left-task->scroll_x,\n -task->pix_top-task->scroll_y,dc);\n dc->flags&=~DCF_NO_TRANSPARENTS;\n}\n\nU0 DrawIt(CTask *task,CDC *dc)\n{\n DrawFrame(task,dc);\n DrawDrops(task,dc);\n UpdateCurBase(task,dc);\n}\n\nU0 AnimateTask(I64)\n{\n I64 i,j,cur_drop=0,c1,c2,x0,y0,x1,y1,w,h;\n while (TRUE) {\n w=Fs->parent_task->pix_width;\n h=Fs->parent_task->pix_height;\n\n for (i=0;i<2;i++) {\n j=0;\n do {\n if (++cur_drop>=DROPS_NUM)\n cur_drop=0;\n if (drops[cur_drop].y<0)\n break;\n j++;\n } while (j<=DROPS_NUM);\n\n drops[cur_drop].x=RandU32%w;\n drops[cur_drop].y=0;\n }\n\n for (i=0;i<DROPS_NUM;i++) {\n if (drops[i].y>=0) {\n if (drops[i].y>=h-1)\n drops[i].y=-I32_MAX;\n else {\n x0=x1=drops[i].x;\n y0=y1=drops[i].y;\n if (GrPeek(cur_dc,x0,y0+1)==WHITE)\n y1++;\n else {\n c1=GrPeek(cur_dc,x0+1,y0);\n c2=GrPeek(cur_dc,x0-1,y0);\n if (c1==WHITE && c2!=WHITE)\n x1++;\n else if (c2==WHITE && c1!=WHITE)\n x1--;\n else if (c1==WHITE && c2==WHITE) {\n c1=GrPeek(cur_dc,x0+1,y0+1);\n c2=GrPeek(cur_dc,x0-1,y0+1);\n if (c1==WHITE && c2!=WHITE)\n x1++;\n else if (c2==WHITE && c1!=WHITE)\n x1--;\n else if (RandI16>=0)\n x1++;\n else\n x1--;\n }\n if (GrPeek(cur_dc,x1,y1+1)==WHITE)\n y1++;\n }\n if (GrPeek(cur_dc,x0,y0)==BLUE) {\n cur_dc->color=WHITE;\n GrPlot(cur_dc,x0,y0);\n }\n cur_dc->color=BLUE;\n GrPlot(cur_dc,x1,y1);\n drops[i].x=x1;\n drops[i].y=y1;\n }\n }\n }\n Sleep(10);\n }\n}\n\nU0 Init()\n{\n I64 i;\n MemSet(drops,0,sizeof(drops));\n for (i=0;i<DROPS_NUM;i++)\n drops[i].y=-I32_MAX;\n}\n\nU0 RainDrops()\n{\n I64 ch,sc;\n MenuPush(\n \"File {\"\n \" Abort(,CH_SHIFT_ESC);\"\n \" Exit(,CH_ESC);\"\n \"}\"\n \"Play {\"\n \" Restart(,'\\n');\"\n \" OpenUpper(,'1');\"\n \" OpenLower(,'2');\"\n \"}\"\n );\n SettingsPush; //See SettingsPush\n AutoComplete;\n WinBorder;\n WinMax;\n DocCursor;\n DocClear;\n cur_dc=DCNew(GR_WIDTH,GR_HEIGHT);\n sc_1=Char2ScanCode('1');\n sc_2=Char2ScanCode('2');\n Init;\n Fs->animate_task=Spawn(&AnimateTask,NULL,\"Animate\",,Fs);\n Fs->draw_it=&DrawIt;\n try {\n do\n switch (ch=GetKey(&sc)) {\n case '\\n':\n Init;\n break;\n }\n while (ch!=CH_ESC && ch!=CH_SHIFT_ESC);\n } catch\n PutExcept;\n SettingsPop;\n MenuPop;\n DCDel(cur_dc);\n}\n\nRainDrops;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\killed-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has graphics
#define RAD 20
#define WIDTH 16
F64 t0=Beat;
U0 DrawIt(CTask *,CDC *dc)
{
F64 dt=Beat-t0,x1,y1,x2,y2,z,dtheta;
I64 i;
DCDepthBufAlloc(dc);
dc->x=200;
dc->y=70;
dc->z=GR_Z_ALL;
dc->flags|=DCF_TRANSFORMATION;
Mat4x4RotX(dc->r,pi/4);
Mat4x4RotY(dc->r,Sin(pi*dt/23)/5);
if (dt<28)
dtheta=-2*pi/8+(dt+16)*Sin(-pi*dt)/3000;
else if (dt<32)
dtheta=-2*pi/8-2*pi/8*(dt-28)/4;
else
dtheta=-2*pi/4;
z=WIDTH*3;
x1=-12; y1=0;
x2=x1-RAD/2*Cos(dtheta);
y2=y1+RAD*Sin(dtheta);
dc->color=BLACK;
dc->thick=14;
GrLine3(dc,x1,y1,z,x2,y2,z);
dc->color=YELLOW;
dc->thick=12;
GrLine3(dc,x1,y1,z,x2,y2,z);
for (z=0;z<WIDTH*4;z+=WIDTH) {
x1=-RAD; y1=0;
for (i=0;i<4;i++) {
x2=x1-RAD*Cos(dtheta*i);
y2=y1+RAD*Sin(dtheta*i);
dc->color=BLACK;
dc->thick=10;
GrLine3(dc,x1,y1,z,x2,y2,z);
dc->color=YELLOW;
dc->thick=8;
GrLine3(dc,x1,y1,z,x2,y2,z);
x1=x2; y1=y2;
}
}
}
U0 Song()
{
SettingsPush; //See SettingsPush
Fs->draw_it=&DrawIt;
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.480;
music.stacatto_factor= 0.902;
try {
while (!ScanKey) {
t0=Beat;
Play("M4/4");
Play("4qB5sEG4eB5D4e.A5sC4eAqFsBBeA5C4BBsBB",
"I \0could \0 \0 \0die.\n\0 \0 \0"
" \0 \0 \0 \0 \0Could \0I \0kill?\n\0 \0 \0");
Play("4qB5sEG4eB5D4e.A5sC4eAqFsBBeA5C4BBsBB",
"I'm \0not \0 \0 \0spry.\n\0 \0 \0 \0 \0 \0"
" \0 \0I \0best \0chill.\n\0 \0 \0");
Play("5eDDsGFGFeE4B5qGM5/4",
"If \0 \0God \0 \0 \0 \0 \0 \0asked,\n\0");
Play("4eB5GFAe.FsE4qAAM4/4",
" \0\"$RED$Can \0 \0 \0you \0 \0Kill?$FG$\"\n\0 \0");
Play("5eDDsGFGFeE4Bq5GM5/4",
"I \0 \0think, \0 \0 \0 \0 \0 \0\"Yeah.\"\n\0");
Play("4eB5GFAe.FsE4qAA",
" \0\"Right \0 \0 \0my \0 \0will.\"\n\0 \0");
}
} catch
PutExcept;
SettingsPop;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\killed-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has graphics\n\n#define RAD 20\n#define WIDTH 16\n\nF64 t0=Beat;\nU0 DrawIt(CTask *,CDC *dc)\n{\n F64 dt=Beat-t0,x1,y1,x2,y2,z,dtheta;\n I64 i;\n\n DCDepthBufAlloc(dc);\n dc->x=200;\n dc->y=70;\n dc->z=GR_Z_ALL;\n dc->flags|=DCF_TRANSFORMATION;\n Mat4x4RotX(dc->r,pi/4);\n Mat4x4RotY(dc->r,Sin(pi*dt/23)/5);\n\n if (dt<28)\n dtheta=-2*pi/8+(dt+16)*Sin(-pi*dt)/3000;\n else if (dt<32)\n dtheta=-2*pi/8-2*pi/8*(dt-28)/4;\n else\n dtheta=-2*pi/4;\n\n z=WIDTH*3;\n x1=-12; y1=0;\n x2=x1-RAD/2*Cos(dtheta);\n y2=y1+RAD*Sin(dtheta);\n dc->color=BLACK;\n dc->thick=14;\n GrLine3(dc,x1,y1,z,x2,y2,z);\n dc->color=YELLOW;\n dc->thick=12;\n GrLine3(dc,x1,y1,z,x2,y2,z);\n\n\n for (z=0;z<WIDTH*4;z+=WIDTH) {\n x1=-RAD; y1=0;\n for (i=0;i<4;i++) {\n x2=x1-RAD*Cos(dtheta*i);\n y2=y1+RAD*Sin(dtheta*i);\n dc->color=BLACK;\n dc->thick=10;\n GrLine3(dc,x1,y1,z,x2,y2,z);\n dc->color=YELLOW;\n dc->thick=8;\n GrLine3(dc,x1,y1,z,x2,y2,z);\n x1=x2; y1=y2;\n }\n }\n}\n\nU0 Song()\n{\n SettingsPush; //See SettingsPush\n Fs->draw_it=&DrawIt;\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 2.480;\n music.stacatto_factor= 0.902;\n try {\n while (!ScanKey) {\n t0=Beat;\n Play(\"M4/4\");\n Play(\"4qB5sEG4eB5D4e.A5sC4eAqFsBBeA5C4BBsBB\",\n \"I \\0could \\0 \\0 \\0die.\\n\\0 \\0 \\0\"\n \" \\0 \\0 \\0 \\0 \\0Could \\0I \\0kill?\\n\\0 \\0 \\0\");\n Play(\"4qB5sEG4eB5D4e.A5sC4eAqFsBBeA5C4BBsBB\",\n \"I'm \\0not \\0 \\0 \\0spry.\\n\\0 \\0 \\0 \\0 \\0 \\0\"\n \" \\0 \\0I \\0best \\0chill.\\n\\0 \\0 \\0\");\n Play(\"5eDDsGFGFeE4B5qGM5/4\",\n \"If \\0 \\0God \\0 \\0 \\0 \\0 \\0 \\0asked,\\n\\0\");\n Play(\"4eB5GFAe.FsE4qAAM4/4\",\n \" \\0\\\"$RED$Can \\0 \\0 \\0you \\0 \\0Kill?$FG$\\\"\\n\\0 \\0\");\n Play(\"5eDDsGFGFeE4Bq5GM5/4\",\n \"I \\0 \\0think, \\0 \\0 \\0 \\0 \\0 \\0\\\"Yeah.\\\"\\n\\0\");\n Play(\"4eB5GFAe.FsE4qAA\",\n \" \\0\\\"Right \\0 \\0 \\0my \\0 \\0will.\\\"\\n\\0 \\0\");\n }\n } catch\n PutExcept;\n SettingsPop;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\NumWords1000-Sup1-Sup1Blog-Home.html
// Date: unknown-date
// Language: HolyC
000 the
001 of
002 to
003 and
004 a
005 in
006 is
007 it
008 you
009 that
010 he
011 was
012 for
013 on
014 are
015 with
016 as
017 I
018 his
019 they
020 be
021 at
022 one
023 have
024 this
025 from
026 or
027 had
028 by
029 hot
030 word
031 but
032 what
033 some
034 we
035 can
036 out
037 other
038 were
039 all
040 there
041 when
042 up
043 use
044 your
045 how
046 said
047 an
048 each
049 she
050 which
051 do
052 their
053 time
054 if
055 will
056 way
057 about
058 many
059 then
060 them
061 write
062 would
063 like
064 so
065 these
066 her
067 long
068 make
069 thing
070 see
071 him
072 two
073 has
074 look
075 more
076 day
077 could
078 go
079 come
080 did
081 number
082 sound
083 no
084 most
085 people
086 my
087 over
088 know
089 water
090 than
091 call
092 first
093 who
094 may
095 down
096 side
097 been
098 now
099 find
100 any
101 new
102 work
103 part
104 take
105 get
106 place
107 made
108 live
109 where
110 after
111 back
112 little
113 only
114 round
115 man
116 year
117 came
118 show
119 every
120 good
121 me
122 give
123 our
124 under
125 name
126 very
127 through
128 just
129 form
130 sentence
131 great
132 think
133 say
134 help
135 low
136 line
137 differ
138 turn
139 cause
140 much
141 mean
142 before
143 move
144 right
145 boy
146 old
147 too
148 same
149 tell
150 does
151 set
152 three
153 want
154 air
155 well
156 also
157 play
158 small
159 end
160 put
161 home
162 read
163 hand
164 port
165 large
166 spell
167 add
168 even
169 land
170 here
171 must
172 big
173 high
174 such
175 follow
176 act
177 why
178 ask
179 men
180 change
181 went
182 light
183 kind
184 off
185 need
186 house
187 picture
188 try
189 us
190 again
191 animal
192 point
193 mother
194 world
195 near
196 build
197 self
198 earth
199 father
200 head
201 stand
202 own
203 page
204 should
205 country
206 found
207 answer
208 school
209 grow
210 study
211 still
212 learn
213 plant
214 cover
215 food
216 sun
217 four
218 between
219 state
220 keep
221 eye
222 never
223 last
224 let
225 thought
226 city
227 tree
228 cross
229 farm
230 hard
231 start
232 might
233 story
234 saw
235 far
236 sea
237 draw
238 left
239 late
240 run
241 don't
242 while
243 press
244 close
245 night
246 real
247 life
248 few
249 north
250 open
251 seem
252 together
253 next
254 white
255 children
256 begin
257 got
258 walk
259 example
260 ease
261 paper
262 group
263 always
264 music
265 those
266 both
267 mark
268 often
269 letter
270 until
271 mile
272 river
273 car
274 feet
275 care
276 second
277 book
278 carry
279 took
280 science
281 eat
282 room
283 friend
284 began
285 idea
286 fish
287 mountain
288 stop
289 once
290 base
291 hear
292 horse
293 cut
294 sure
295 watch
296 color
297 face
298 wood
299 main
300 enough
301 plain
302 girl
303 usual
304 young
305 ready
306 above
307 ever
308 red
309 list
310 though
311 feel
312 talk
313 bird
314 soon
315 body
316 dog
317 family
318 direct
319 pose
320 leave
321 song
322 measure
323 door
324 product
325 black
326 short
327 numeral
328 class
329 wind
330 question
331 happen
332 complete
333 ship
334 area
335 half
336 rock
337 order
338 fire
339 south
340 problem
341 piece
342 told
343 knew
344 pass
345 since
346 top
347 whole
348 king
349 space
350 heard
351 best
352 hour
353 better
354 true
355 during
356 hundred
357 five
358 remember
359 step
360 early
361 hold
362 west
363 ground
364 interest
365 reach
366 fast
367 verb
368 sing
369 listen
370 six
371 table
372 travel
373 less
374 morning
375 ten
376 simple
377 several
378 vowel
379 toward
380 war
381 lay
382 against
383 pattern
384 slow
385 center
386 love
387 person
388 money
389 serve
390 appear
391 road
392 map
393 rain
394 rule
395 govern
396 pull
397 cold
398 notice
399 voice
400 unit
401 power
402 town
403 fine
404 certain
405 fly
406 fall
407 lead
408 cry
409 dark
410 machine
411 note
412 wait
413 plan
414 figure
415 star
416 box
417 noun
418 field
419 rest
420 correct
421 able
422 pound
423 done
424 beauty
425 drive
426 stood
427 contain
428 front
429 teach
430 week
431 final
432 gave
433 green
434 oh
435 quick
436 develop
437 ocean
438 warm
439 free
440 minute
441 strong
442 special
443 mind
444 behind
445 clear
446 tail
447 produce
448 fact
449 street
450 inch
451 multiply
452 nothing
453 course
454 stay
455 wheel
456 full
457 force
458 blue
459 object
460 decide
461 surface
462 deep
463 moon
464 island
465 foot
466 system
467 busy
468 test
469 record
470 boat
471 common
472 gold
473 possible
474 plane
475 stead
476 dry
477 wonder
478 laugh
479 thousand
480 ago
481 ran
482 check
483 game
484 shape
485 equate
486 hot
487 miss
488 brought
489 heat
490 snow
491 tire
492 bring
493 yes
494 distant
495 fill
496 east
497 paint
498 language
499 among
500 grand
501 ball
502 yet
503 wave
504 drop
505 heart
506 am
507 present
508 heavy
509 dance
510 engine
511 position
512 arm
513 wide
514 sail
515 material
516 size
517 vary
518 settle
519 speak
520 weight
521 general
522 ice
523 matter
524 circle
525 pair
526 include
527 divide
528 syllable
529 felt
530 perhaps
531 pick
532 sudden
533 count
534 square
535 reason
536 length
537 represent
538 art
539 subject
540 region
541 energy
542 hunt
543 probable
544 bed
545 brother
546 egg
547 ride
548 cell
549 believe
550 fraction
551 forest
552 sit
553 race
554 window
555 store
556 summer
557 train
558 sleep
559 prove
560 lone
561 leg
562 exercise
563 wall
564 catch
565 mount
566 wish
567 sky
568 board
569 joy
570 winter
571 sat
572 written
573 wild
574 instrument
575 kept
576 glass
577 grass
578 cow
579 job
580 edge
581 sign
582 visit
583 past
584 soft
585 fun
586 bright
587 gas
588 weather
589 month
590 million
591 bear
592 finish
593 happy
594 hope
595 flower
596 clothe
597 strange
598 gone
599 jump
600 baby
601 eight
602 village
603 meet
604 root
605 buy
606 raise
607 solve
608 metal
609 whether
610 push
611 seven
612 paragraph
613 third
614 shall
615 held
616 hair
617 describe
618 cook
619 floor
620 either
621 result
622 burn
623 hill
624 safe
625 cat
626 century
627 consider
628 type
629 law
630 bit
631
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\NumWords1000-Sup1-Sup1Blog-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n000 the\n001 of\n002 to\n003 and\n004 a\n005 in\n006 is\n007 it\n008 you\n009 that\n010 he\n011 was\n012 for\n013 on\n014 are\n015 with\n016 as\n017 I\n018 his\n019 they\n020 be\n021 at\n022 one\n023 have\n024 this\n025 from\n026 or\n027 had\n028 by\n029 hot\n030 word\n031 but\n032 what\n033 some\n034 we\n035 can\n036 out\n037 other\n038 were\n039 all\n040 there\n041 when\n042 up\n043 use\n044 your\n045 how\n046 said\n047 an\n048 each\n049 she\n050 which\n051 do\n052 their\n053 time\n054 if\n055 will\n056 way\n057 about\n058 many\n059 then\n060 them\n061 write\n062 would\n063 like\n064 so\n065 these\n066 her\n067 long\n068 make\n069 thing\n070 see\n071 him\n072 two\n073 has\n074 look\n075 more\n076 day\n077 could\n078 go\n079 come\n080 did\n081 number\n082 sound\n083 no\n084 most\n085 people\n086 my\n087 over\n088 know\n089 water\n090 than\n091 call\n092 first\n093 who\n094 may\n095 down\n096 side\n097 been\n098 now\n099 find\n100 any\n101 new\n102 work\n103 part\n104 take\n105 get\n106 place\n107 made\n108 live\n109 where\n110 after\n111 back\n112 little\n113 only\n114 round\n115 man\n116 year\n117 came\n118 show\n119 every\n120 good\n121 me\n122 give\n123 our\n124 under\n125 name\n126 very\n127 through\n128 just\n129 form\n130 sentence\n131 great\n132 think\n133 say\n134 help\n135 low\n136 line\n137 differ\n138 turn\n139 cause\n140 much\n141 mean\n142 before\n143 move\n144 right\n145 boy\n146 old\n147 too\n148 same\n149 tell\n150 does\n151 set\n152 three\n153 want\n154 air\n155 well\n156 also\n157 play\n158 small\n159 end\n160 put\n161 home\n162 read\n163 hand\n164 port\n165 large\n166 spell\n167 add\n168 even\n169 land\n170 here\n171 must\n172 big\n173 high\n174 such\n175 follow\n176 act\n177 why\n178 ask\n179 men\n180 change\n181 went\n182 light\n183 kind\n184 off\n185 need\n186 house\n187 picture\n188 try\n189 us\n190 again\n191 animal\n192 point\n193 mother\n194 world\n195 near\n196 build\n197 self\n198 earth\n199 father\n200 head\n201 stand\n202 own\n203 page\n204 should\n205 country\n206 found\n207 answer\n208 school\n209 grow\n210 study\n211 still\n212 learn\n213 plant\n214 cover\n215 food\n216 sun\n217 four\n218 between\n219 state\n220 keep\n221 eye\n222 never\n223 last\n224 let\n225 thought\n226 city\n227 tree\n228 cross\n229 farm\n230 hard\n231 start\n232 might\n233 story\n234 saw\n235 far\n236 sea\n237 draw\n238 left\n239 late\n240 run\n241 don't\n242 while\n243 press\n244 close\n245 night\n246 real\n247 life\n248 few\n249 north\n250 open\n251 seem\n252 together\n253 next\n254 white\n255 children\n256 begin\n257 got\n258 walk\n259 example\n260 ease\n261 paper\n262 group\n263 always\n264 music\n265 those\n266 both\n267 mark\n268 often\n269 letter\n270 until\n271 mile\n272 river\n273 car\n274 feet\n275 care\n276 second\n277 book\n278 carry\n279 took\n280 science\n281 eat\n282 room\n283 friend\n284 began\n285 idea\n286 fish\n287 mountain\n288 stop\n289 once\n290 base\n291 hear\n292 horse\n293 cut\n294 sure\n295 watch\n296 color\n297 face\n298 wood\n299 main\n300 enough\n301 plain\n302 girl\n303 usual\n304 young\n305 ready\n306 above\n307 ever\n308 red\n309 list\n310 though\n311 feel\n312 talk\n313 bird\n314 soon\n315 body\n316 dog\n317 family\n318 direct\n319 pose\n320 leave\n321 song\n322 measure\n323 door\n324 product\n325 black\n326 short\n327 numeral\n328 class\n329 wind\n330 question\n331 happen\n332 complete\n333 ship\n334 area\n335 half\n336 rock\n337 order\n338 fire\n339 south\n340 problem\n341 piece\n342 told\n343 knew\n344 pass\n345 since\n346 top\n347 whole\n348 king\n349 space\n350 heard\n351 best\n352 hour\n353 better\n354 true\n355 during\n356 hundred\n357 five\n358 remember\n359 step\n360 early\n361 hold\n362 west\n363 ground\n364 interest\n365 reach\n366 fast\n367 verb\n368 sing\n369 listen\n370 six\n371 table\n372 travel\n373 less\n374 morning\n375 ten\n376 simple\n377 several\n378 vowel\n379 toward\n380 war\n381 lay\n382 against\n383 pattern\n384 slow\n385 center\n386 love\n387 person\n388 money\n389 serve\n390 appear\n391 road\n392 map\n393 rain\n394 rule\n395 govern\n396 pull\n397 cold\n398 notice\n399 voice\n400 unit\n401 power\n402 town\n403 fine\n404 certain\n405 fly\n406 fall\n407 lead\n408 cry\n409 dark\n410 machine\n411 note\n412 wait\n413 plan\n414 figure\n415 star\n416 box\n417 noun\n418 field\n419 rest\n420 correct\n421 able\n422 pound\n423 done\n424 beauty\n425 drive\n426 stood\n427 contain\n428 front\n429 teach\n430 week\n431 final\n432 gave\n433 green\n434 oh\n435 quick\n436 develop\n437 ocean\n438 warm\n439 free\n440 minute\n441 strong\n442 special\n443 mind\n444 behind\n445 clear\n446 tail\n447 produce\n448 fact\n449 street\n450 inch\n451 multiply\n452 nothing\n453 course\n454 stay\n455 wheel\n456 full\n457 force\n458 blue\n459 object\n460 decide\n461 surface\n462 deep\n463 moon\n464 island\n465 foot\n466 system\n467 busy\n468 test\n469 record\n470 boat\n471 common\n472 gold\n473 possible\n474 plane\n475 stead\n476 dry\n477 wonder\n478 laugh\n479 thousand\n480 ago\n481 ran\n482 check\n483 game\n484 shape\n485 equate\n486 hot\n487 miss\n488 brought\n489 heat\n490 snow\n491 tire\n492 bring\n493 yes\n494 distant\n495 fill\n496 east\n497 paint\n498 language\n499 among\n500 grand\n501 ball\n502 yet\n503 wave\n504 drop\n505 heart\n506 am\n507 present\n508 heavy\n509 dance\n510 engine\n511 position\n512 arm\n513 wide\n514 sail\n515 material\n516 size\n517 vary\n518 settle\n519 speak\n520 weight\n521 general\n522 ice\n523 matter\n524 circle\n525 pair\n526 include\n527 divide\n528 syllable\n529 felt\n530 perhaps\n531 pick\n532 sudden\n533 count\n534 square\n535 reason\n536 length\n537 represent\n538 art\n539 subject\n540 region\n541 energy\n542 hunt\n543 probable\n544 bed\n545 brother\n546 egg\n547 ride\n548 cell\n549 believe\n550 fraction\n551 forest\n552 sit\n553 race\n554 window\n555 store\n556 summer\n557 train\n558 sleep\n559 prove\n560 lone\n561 leg\n562 exercise\n563 wall\n564 catch\n565 mount\n566 wish\n567 sky\n568 board\n569 joy\n570 winter\n571 sat\n572 written\n573 wild\n574 instrument\n575 kept\n576 glass\n577 grass\n578 cow\n579 job\n580 edge\n581 sign\n582 visit\n583 past\n584 soft\n585 fun\n586 bright\n587 gas\n588 weather\n589 month\n590 million\n591 bear\n592 finish\n593 happy\n594 hope\n595 flower\n596 clothe\n597 strange\n598 gone\n599 jump\n600 baby\n601 eight\n602 village\n603 meet\n604 root\n605 buy\n606 raise\n607 solve\n608 metal\n609 whether\n610 push\n611 seven\n612 paragraph\n613 third\n614 shall\n615 held\n616 hair\n617 describe\n618 cook\n619 floor\n620 either\n621 result\n622 burn\n623 hill\n624 safe\n625 cat\n626 century\n627 consider\n628 type\n629 law\n630 bit\n631 "
}
]
}
|
// Source: D:\TempleOS-Projects\html\FixedPointAdvanced-Lectures-Demo.html
// Date: unknown-date
// Language: HolyC
/*"Fixed point" means you use ints
that are scaled by a value. A common
example would be using number of pennies
instead of dollars with a float.
Fixed-point used to be much faster,
but modern processors do well with
floats. It also depends on the compiler
and my compiler is poor with floats.
I often use 64-bit ints with upper 32-bits
as int and lower 32-bits as fraction.
See ::/Demo/SubIntAccess.HC for how
to access upper or lower 32-bits.
*/
#define SAMPLE_SIZE 10000000
I32 coordinates[65536];
asm {
_ASM_FIXED_POINT::
PUSH RBP
MOV RBP,RSP
PUSH RSI
PUSH RDI
MOV RSI,coordinates
MOV RDI,ToI64(Sin(1.0)*0x100000000)
XOR RBX,RBX //SUM
MOV RCX,SAMPLE_SIZE-1
@@05: XOR RDX,RDX
MOV DX,CX
MOVSXD RAX,U32 [RSI+RDX*4]
IMUL RDI
SAR RAX,32
ADD RBX,RAX
DEC RCX
JGE @@05
MOV RAX,RBX
POP RDI
POP RSI
POP RBP
RET
SINE_VAL: DU64 Sin(1.0);
RET_VAL: DU64 0;
_ASM_FLOAT::
PUSH RBP
MOV RBP,RSP
PUSH RSI
MOV RSI,coordinates
FLD U64 [SINE_VAL]
FLDZ
MOV RCX,SAMPLE_SIZE-1
@@05: XOR RDX,RDX
MOV DX,CX
FILD U32 [RSI+RDX*4]
FMUL ST0,ST2
FADDP ST1,ST0
DEC RCX
JGE @@05
FISTP U64 [RET_VAL]
MOV RAX,U64 [RET_VAL]
FFREE ST0
FINCSTP
POP RSI
POP RBP
RET
}
_extern _ASM_FIXED_POINT I64 AsmFixedPt();
_extern _ASM_FLOAT I64 AsmFloat();
U0 Main()
{
I64 start,end,overhead_time,test_time;
F64 d1,fsum;
I64 reg i,tmp,reg d2,reg sum;
CPURep;
//Set-up some sample coordinates
for (i=0;i<65536;i++)
coordinates[i]=RandU32;
//Measure Loop Overhead
start=GetTSC;
for (i=SAMPLE_SIZE-1;i>=0;i--) {
}
end=GetTSC;
overhead_time=end-start;
"$RED$Overhead Cycles :%10.5f$FG$\n",
ToF64(overhead_time)/SAMPLE_SIZE;
//Measure F64 arithmetic
// (Some of this is due to crappy
// compiler code.)
d1=Sin(1.0);
fsum=0;
start=GetTSC;
for (i=SAMPLE_SIZE-1;i>=0;i--)
fsum+=d1*coordinates[i&65535];
end=GetTSC;
test_time=end-start;
"Float Sum :%X\n",ToI64(fsum);
"$RED$Float Cycles :%10.5f$FG$\n",
ToF64(test_time)/SAMPLE_SIZE;
//Measure fixed point arithmetic
d2=Sin(1.0)*0x100000000;
sum=0;
start=GetTSC;
for (i=SAMPLE_SIZE-1;i>=0;i--) {
tmp=d2*coordinates[i&65535];
sum+=tmp.i32[1];
}
end=GetTSC;
test_time=end-start;
"Fixed-Point Sum :%X\n",sum;
"$RED$Fixed-Point Cycles :%10.5f$FG$\n",
ToF64(test_time)/SAMPLE_SIZE;
//Measure fixed point arithmetic
start=GetTSC;
sum=AsmFixedPt;
end=GetTSC;
test_time=end-start;
"Asm Fixed-Point Sum :%X\n",sum;
"$RED$Asm Fixed-Point Cycles:%10.5f$FG$\n",
ToF64(test_time)/SAMPLE_SIZE;
//Measure float arithmetic
start=GetTSC;
sum=AsmFloat;
end=GetTSC;
test_time=end-start;
"Asm Float Sum :%X\n",sum;
"$RED$Asm Float Cycles :%10.5f$FG$\n",
ToF64(test_time)/SAMPLE_SIZE;
}
Main;
/* Program Output
Machine 1:
8 Cores 2.660GHz
Overhead Cycles : 2.00814
Float Sum :FFFFE1D361BEED68
Float Cycles : 10.16076
Fixed-Point Sum :FFFFE1D361729914
Fixed-Point Cycles : 5.29392
Asm Fixed-Point Sum :FFFFE1D361729914
Asm Fixed-Point Cycles: 4.20464
Asm Float Sum :FFFFE1D361BEED56
Asm Float Cycles : 3.04635
Machine 2:
8 Cores 3.395GHz
Overhead Cycles : 4.87040
Float Sum :D20A01DB177
Float Cycles : 10.11558
Fixed-Point Sum :D209FD18CC7
Fixed-Point Cycles : 4.50618
Asm Fixed-Point Sum :D209FD18CC7
Asm Fixed-Point Cycles: 3.02426
Asm Float Sum :D20A01DB17B
Asm Float Cycles : 3.21070
*/
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\FixedPointAdvanced-Lectures-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\n/*\"Fixed point\" means you use ints\nthat are scaled by a value. A common\nexample would be using number of pennies\ninstead of dollars with a float.\n\nFixed-point used to be much faster,\nbut modern processors do well with\nfloats. It also depends on the compiler\nand my compiler is poor with floats.\n\nI often use 64-bit ints with upper 32-bits\nas int and lower 32-bits as fraction.\n\nSee ::/Demo/SubIntAccess.HC for how\nto access upper or lower 32-bits.\n*/\n\n#define SAMPLE_SIZE 10000000\n\nI32 coordinates[65536];\n\nasm {\n_ASM_FIXED_POINT::\n PUSH RBP\n MOV RBP,RSP\n PUSH RSI\n PUSH RDI\n MOV RSI,coordinates\n MOV RDI,ToI64(Sin(1.0)*0x100000000)\n XOR RBX,RBX //SUM\n MOV RCX,SAMPLE_SIZE-1\n@@05: XOR RDX,RDX\n MOV DX,CX\n MOVSXD RAX,U32 [RSI+RDX*4]\n IMUL RDI\n SAR RAX,32\n ADD RBX,RAX\n DEC RCX\n JGE @@05\n MOV RAX,RBX\n POP RDI\n POP RSI\n POP RBP\n RET\n\nSINE_VAL: DU64 Sin(1.0);\nRET_VAL: DU64 0;\n\n_ASM_FLOAT::\n PUSH RBP\n MOV RBP,RSP\n PUSH RSI\n MOV RSI,coordinates\n FLD U64 [SINE_VAL]\n FLDZ\n MOV RCX,SAMPLE_SIZE-1\n@@05: XOR RDX,RDX\n MOV DX,CX\n FILD U32 [RSI+RDX*4]\n FMUL ST0,ST2\n FADDP ST1,ST0\n DEC RCX\n JGE @@05\n FISTP U64 [RET_VAL]\n MOV RAX,U64 [RET_VAL]\n FFREE ST0\n FINCSTP\n POP RSI\n POP RBP\n RET\n}\n\n_extern _ASM_FIXED_POINT I64 AsmFixedPt();\n_extern _ASM_FLOAT I64 AsmFloat();\n\nU0 Main()\n{\n I64 start,end,overhead_time,test_time;\n F64 d1,fsum;\n I64 reg i,tmp,reg d2,reg sum;\n\n CPURep;\n\n //Set-up some sample coordinates\n for (i=0;i<65536;i++)\n coordinates[i]=RandU32;\n\n //Measure Loop Overhead\n start=GetTSC;\n for (i=SAMPLE_SIZE-1;i>=0;i--) {\n }\n end=GetTSC;\n overhead_time=end-start;\n \"$RED$Overhead Cycles :%10.5f$FG$\\n\",\n ToF64(overhead_time)/SAMPLE_SIZE;\n\n //Measure F64 arithmetic\n // (Some of this is due to crappy\n // compiler code.)\n d1=Sin(1.0);\n fsum=0;\n start=GetTSC;\n for (i=SAMPLE_SIZE-1;i>=0;i--)\n fsum+=d1*coordinates[i&65535];\n end=GetTSC;\n test_time=end-start;\n \"Float Sum :%X\\n\",ToI64(fsum);\n \"$RED$Float Cycles :%10.5f$FG$\\n\",\n ToF64(test_time)/SAMPLE_SIZE;\n\n //Measure fixed point arithmetic\n d2=Sin(1.0)*0x100000000;\n sum=0;\n start=GetTSC;\n for (i=SAMPLE_SIZE-1;i>=0;i--) {\n tmp=d2*coordinates[i&65535];\n sum+=tmp.i32[1];\n }\n end=GetTSC;\n test_time=end-start;\n \"Fixed-Point Sum :%X\\n\",sum;\n \"$RED$Fixed-Point Cycles :%10.5f$FG$\\n\",\n ToF64(test_time)/SAMPLE_SIZE;\n\n //Measure fixed point arithmetic\n start=GetTSC;\n sum=AsmFixedPt;\n end=GetTSC;\n test_time=end-start;\n \"Asm Fixed-Point Sum :%X\\n\",sum;\n \"$RED$Asm Fixed-Point Cycles:%10.5f$FG$\\n\",\n ToF64(test_time)/SAMPLE_SIZE;\n\n //Measure float arithmetic\n start=GetTSC;\n sum=AsmFloat;\n end=GetTSC;\n test_time=end-start;\n \"Asm Float Sum :%X\\n\",sum;\n \"$RED$Asm Float Cycles :%10.5f$FG$\\n\",\n ToF64(test_time)/SAMPLE_SIZE;\n\n}\n\nMain;\n\n/* Program Output\n\nMachine 1:\n8 Cores 2.660GHz\nOverhead Cycles : 2.00814\nFloat Sum :FFFFE1D361BEED68\nFloat Cycles : 10.16076\nFixed-Point Sum :FFFFE1D361729914\nFixed-Point Cycles : 5.29392\nAsm Fixed-Point Sum :FFFFE1D361729914\nAsm Fixed-Point Cycles: 4.20464\nAsm Float Sum :FFFFE1D361BEED56\nAsm Float Cycles : 3.04635\n\nMachine 2:\n8 Cores 3.395GHz\nOverhead Cycles : 4.87040\nFloat Sum :D20A01DB177\nFloat Cycles : 10.11558\nFixed-Point Sum :D209FD18CC7\nFixed-Point Cycles : 4.50618\nAsm Fixed-Point Sum :D209FD18CC7\nAsm Fixed-Point Cycles: 3.02426\nAsm Float Sum :D20A01DB17B\nAsm Float Cycles : 3.21070\n\n*/"
}
]
}
|
// Source: D:\TempleOS-Projects\html\SndFile-Snd-Adam.html
// Date: unknown-date
// Language: HolyC
#help_index "Snd/Snd Files"
#define SNDFILE_SAMPLE_RATE 8000
//Header for a ".SND" file
class CFileSND
{//big endian
U32 signature; //0x646e732e
U32 offset; //24
U32 data_size;
U32 coding; //3=16bit uncompressed
U32 sample_rate; //Hz
U32 channels; //1=mono
I16 body[1];
};
//Windows media constraint.
//#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,
F64 reverb_delay=0,F64 reverb_intensity=0,F64 time_shift=0)
{//Use "snd.record" flag to start or stop recording, then call this routine.
//Averaging should be a num from 0.0 to 0.999.
//Vol should be from 0.0 to 1.0.
//Set reverb_delay to like 0.3 sec and reverb_intensity to like 0.4.
I64 i,k,cnt,cnt2,level,file_num;
F64 avg,dt;
CFileSND *s;
CSndWaveCtrl *swc=SndWaveCtrlNew(SNDFILE_SAMPLE_RATE,16,1);
CSndData *d,*d1;
U8 *name,*name2;
snd.record=FALSE;
dt=snd.record_head.last->time-snd.record_head.next->time;
if (!dt) return 0;
cnt=dt*SNDFILE_SAMPLE_RATE;
cnt++; //Terminator
name=StrNew(base_filename);
FileExtRem(name);
s=CAlloc(offset(CFileSND.body)+cnt*sizeof(I16));
s->signature=0x646e732e;
s->offset=EndianU32(offset(CFileSND.body));
s->coding=EndianU32(3);
s->sample_rate=EndianU32(SNDFILE_SAMPLE_RATE);
s->channels=EndianU32(1);
if (time_shift) {
d=snd.record_head.next;
d->time-=time_shift;
while (d->next!=&snd.record_head) {
d1=d->next;
dt=d1->time-d->time;
if (dt<0) {
QueRem(d1);
Free(d1);
} else
break;
}
}
d=snd.record_head.next;
k=0;
while (d->next!=&snd.record_head) {
d1=d->next;
dt=d1->time-d->time;
cnt2=dt*SNDFILE_SAMPLE_RATE;
SndWaveAddBuf(swc,&s->body[k],cnt2,
Ona2Freq(d->ona),waveform,normalized_vol);
k+=cnt2;
QueRem(d);
Free(d);
d=d1;
}
//Average
if (averaging) {
avg=0;
for (i=0;i<cnt-1;i++)
s->body[i]=avg=LowPass1(averaging,avg,s->body[i],1.0);
}
//Reverb
if (reverb_intensity) {
if (dt=reverb_delay*SNDFILE_SAMPLE_RATE)
for (i=dt;i<cnt;i++)
s->body[i]+=reverb_intensity*s->body[i-dt];
}
//Get rid of D.C. component
for (k=0;k<3;k++) {
level=0;
for (i=0;i<cnt-1;i++)
level+=s->body[i];
level/=cnt-1;
for (i=0;i<cnt-1;i++)
s->body[i]=ClampI64(s->body[i]-level,I16_MIN,I16_MAX);
}
for (i=0;i<cnt-1;i++)
s->body[i]=EndianU16(s->body[i]);
s->body[cnt-1]=0;
d=snd.record_head.next;
while (d!=&snd.record_head) {
d1=d->next;
QueRem(d);
Free(d);
d=d1;
}
name2=MAlloc(StrLen(name)+3+1+3+1);
cnt2=cnt;
file_num=0;
while (cnt2>0) {
i=cnt2;
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*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;
}
Free(s);
Free(name);
Free(name2);
SndWaveCtrlDel(swc);
return cnt;
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\SndFile-Snd-Adam.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"Snd/Snd Files\"\n#define SNDFILE_SAMPLE_RATE 8000\n//Header for a \".SND\" file\nclass CFileSND\n{//big endian\n U32 signature; //0x646e732e\n U32 offset; //24\n U32 data_size;\n U32 coding; //3=16bit uncompressed\n U32 sample_rate; //Hz\n U32 channels; //1=mono\n I16 body[1];\n};\n\n//Windows media constraint.\n//#define SND_FILE_DATA_MAX 0x0007FF00\n#define SND_FILE_DATA_MAX 0x7FFFFF00\n\npublic I64 SndFileCreate(U8 *base_filename,F64 normalized_vol=1.0,\n F64 averaging=0.0,I64 waveform=WF_SQUARE,\n F64 reverb_delay=0,F64 reverb_intensity=0,F64 time_shift=0)\n{//Use \"snd.record\" flag to start or stop recording, then call this routine.\n//Averaging should be a num from 0.0 to 0.999.\n //Vol should be from 0.0 to 1.0.\n //Set reverb_delay to like 0.3 sec and reverb_intensity to like 0.4.\n I64 i,k,cnt,cnt2,level,file_num;\n F64 avg,dt;\n CFileSND *s;\n CSndWaveCtrl *swc=SndWaveCtrlNew(SNDFILE_SAMPLE_RATE,16,1);\n CSndData *d,*d1;\n U8 *name,*name2;\n\n snd.record=FALSE;\n\n dt=snd.record_head.last->time-snd.record_head.next->time;\n if (!dt) return 0;\n cnt=dt*SNDFILE_SAMPLE_RATE;\n cnt++; //Terminator\n\n name=StrNew(base_filename);\n FileExtRem(name);\n\n s=CAlloc(offset(CFileSND.body)+cnt*sizeof(I16));\n s->signature=0x646e732e;\n s->offset=EndianU32(offset(CFileSND.body));\n s->coding=EndianU32(3);\n s->sample_rate=EndianU32(SNDFILE_SAMPLE_RATE);\n s->channels=EndianU32(1);\n\n if (time_shift) {\n d=snd.record_head.next;\n d->time-=time_shift;\n while (d->next!=&snd.record_head) {\n d1=d->next;\n dt=d1->time-d->time;\n if (dt<0) {\n QueRem(d1);\n Free(d1);\n } else\n break;\n }\n }\n\n d=snd.record_head.next;\n k=0;\n while (d->next!=&snd.record_head) {\n d1=d->next;\n dt=d1->time-d->time;\n cnt2=dt*SNDFILE_SAMPLE_RATE;\n SndWaveAddBuf(swc,&s->body[k],cnt2,\n Ona2Freq(d->ona),waveform,normalized_vol);\n k+=cnt2;\n QueRem(d);\n Free(d);\n d=d1;\n }\n\n //Average\n if (averaging) {\n avg=0;\n for (i=0;i<cnt-1;i++)\n s->body[i]=avg=LowPass1(averaging,avg,s->body[i],1.0);\n }\n\n //Reverb\n if (reverb_intensity) {\n if (dt=reverb_delay*SNDFILE_SAMPLE_RATE)\n for (i=dt;i<cnt;i++)\n s->body[i]+=reverb_intensity*s->body[i-dt];\n }\n\n //Get rid of D.C. component\n for (k=0;k<3;k++) {\n level=0;\n for (i=0;i<cnt-1;i++)\n level+=s->body[i];\n level/=cnt-1;\n for (i=0;i<cnt-1;i++)\n s->body[i]=ClampI64(s->body[i]-level,I16_MIN,I16_MAX);\n }\n\n for (i=0;i<cnt-1;i++)\n s->body[i]=EndianU16(s->body[i]);\n\n s->body[cnt-1]=0;\n\n d=snd.record_head.next;\n while (d!=&snd.record_head) {\n d1=d->next;\n QueRem(d);\n Free(d);\n d=d1;\n }\n\n name2=MAlloc(StrLen(name)+3+1+3+1);\n cnt2=cnt;\n file_num=0;\n while (cnt2>0) {\n i=cnt2;\n if (i>SND_FILE_DATA_MAX)\n i=SND_FILE_DATA_MAX;\n s->data_size=EndianU32(i*sizeof(I16));\n MemCpy(s->body,&s->body[file_num*SND_FILE_DATA_MAX],i*sizeof(I16));\n StrPrint(name2,\"%s%03d.SND\",name,file_num++);\n FileWrite(name2,s,offset(CFileSND.body)+i*sizeof(I16));\n cnt2-=i;\n }\n Free(s);\n Free(name);\n Free(name2);\n\n SndWaveCtrlDel(swc);\n return cnt;\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\DolDoc.1-Adam.html
// Date: unknown-date
// Language: HolyC
../
DocBin.html 14766
DocChar.html 72458
DocClipBoard.html 16140
DocCodeTools.html 77629
DocDblBuf.html 14613
DocEd.html 30902
DocExt.html 5810
DocFile.html 46034
DocFind.html 60156
DocForm.html 43500
DocGet.html 28145
DocGr.html 22325
DocHighlight.html 18290
DocInit.html 16456
DocLink.html 44690
DocMacro.html 24530
DocNew.html 40980
DocPlain.html 75222
DocPopUp.html 43283
DocPutKey.html 96950
DocPutS.html 35854
DocRecalc.html 142913
DocRecalcLib.html 26112
DocRun.html 14293
DocTerm.html 28390
DocTree.html 29069
DocWidgetWiz.html 137381
MakeDoc.html 10282
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\DolDoc.1-Adam.html\n// Date: unknown-date\n// Language: HolyC\n\n../\nDocBin.html 14766\nDocChar.html 72458\nDocClipBoard.html 16140\nDocCodeTools.html 77629\nDocDblBuf.html 14613\nDocEd.html 30902\nDocExt.html 5810\nDocFile.html 46034\nDocFind.html 60156\nDocForm.html 43500\nDocGet.html 28145\nDocGr.html 22325\nDocHighlight.html 18290\nDocInit.html 16456\nDocLink.html 44690\nDocMacro.html 24530\nDocNew.html 40980\nDocPlain.html 75222\nDocPopUp.html 43283\nDocPutKey.html 96950\nDocPutS.html 35854\nDocRecalc.html 142913\nDocRecalcLib.html 26112\nDocRun.html 14293\nDocTerm.html 28390\nDocTree.html 29069\nDocWidgetWiz.html 137381\nMakeDoc.html 10282"
}
]
}
|
// Source: D:\TempleOS-Projects\html\first-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has graphics
<1>/* Graphics Not Rendered in HTML */
U0 Song()
{
CTask *task;
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo=2.5;
try {
task=PopUpViewPrint(
"$WW+H,1$BF:Matthew,22:35\n\n"
"How many people hear \"Love God with all heart "
"mind and soul; and neighbor as self,\" but walk "
"away thinking \"Love neighbor with all heart "
"mind and soul?\"\n"
);
TaskWait(task);
WinHorz(Fs->win_left,TEXT_COLS-10,task);
WinVert(Fs->win_bottom+3,Fs->win_bottom+15,task);
DocRecalc(DocPut(task)); //Reformat word-wrap with new window size.
while (!ScanKey) {
Play("5qF4eAGqB5eG4B5qEetDC4B5qEeFF",
"First, \0lo\0ve \0God \0with \0 \0ALL \0$RED$heart$FG$, \0"
"mind \0and \0soul.\n\0 \0 \0");
Sprite(<heart>);
"$CM,0,6$";
Play("5qF4eAGqB5eG4B5qEetDC4B5qEeFF",
"First, \0lo\0ve \0God \0with \0 \0ALL \0$RED$heart$FG$, \0"
"mind \0and \0soul.\n\0 \0 \0");
Sprite(<heart>);
"$CM,0,6$";
Play("5G4BsA5D4A5DqE4G5eCDqG4sGBGBetB5D4B",
"What's \0 \0 \0 \0 \0 \0left? \0 \0I \0don't \0know.\n\0"
" \0 \0 \0 \0 \0 \0 \0");
Play("5eG4BsA5D4A5DqE4G5eCDqG4sGBGBetB5D4B",
"What's \0 \0 \0 \0 \0 \0left? \0 \0I \0don't \0know.\n\0"
" \0 \0 \0 \0 \0 \0 \0");
}
} catch
PutExcept;
Snd;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\first-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has graphics\n<1>/* Graphics Not Rendered in HTML */\n\n\n\n\n\nU0 Song()\n{\n CTask *task;\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo=2.5;\n try {\n task=PopUpViewPrint(\n \"$WW+H,1$BF:Matthew,22:35\\n\\n\"\n \"How many people hear \\\"Love God with all heart \"\n \"mind and soul; and neighbor as self,\\\" but walk \"\n \"away thinking \\\"Love neighbor with all heart \"\n \"mind and soul?\\\"\\n\"\n );\n TaskWait(task);\n WinHorz(Fs->win_left,TEXT_COLS-10,task);\n WinVert(Fs->win_bottom+3,Fs->win_bottom+15,task);\n DocRecalc(DocPut(task)); //Reformat word-wrap with new window size.\n while (!ScanKey) {\n Play(\"5qF4eAGqB5eG4B5qEetDC4B5qEeFF\",\n \"First, \\0lo\\0ve \\0God \\0with \\0 \\0ALL \\0$RED$heart$FG$, \\0\"\n \"mind \\0and \\0soul.\\n\\0 \\0 \\0\");\n Sprite(<heart>);\n \"$CM,0,6$\";\n Play(\"5qF4eAGqB5eG4B5qEetDC4B5qEeFF\",\n \"First, \\0lo\\0ve \\0God \\0with \\0 \\0ALL \\0$RED$heart$FG$, \\0\"\n \"mind \\0and \\0soul.\\n\\0 \\0 \\0\");\n Sprite(<heart>);\n \"$CM,0,6$\";\n Play(\"5G4BsA5D4A5DqE4G5eCDqG4sGBGBetB5D4B\",\n \"What's \\0 \\0 \\0 \\0 \\0 \\0left? \\0 \\0I \\0don't \\0know.\\n\\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5eG4BsA5D4A5DqE4G5eCDqG4sGBGBetB5D4B\",\n \"What's \\0 \\0 \\0 \\0 \\0 \\0left? \\0 \\0I \\0don't \\0know.\\n\\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n }\n } catch\n PutExcept;\n Snd;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\veils-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has words
-] Reward1
CallExtStr("JukeReward",""
-] Reward2
"gels prominence Colombia Italy "
"bikini's Cheviot autograph's end "
"mailer psyche compliment's mukluk "
"fears animates unexplored esthetics "
"Cabernet catchphrase conglomerated almanac's "
);
U0 Song()
{
CTask *task;
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.480;
music.stacatto_factor= 0.902;
try {
task=PopUpViewPrint(
"Exodus,34:29-36\n");
TaskWait(task);
WinHorz(Fs->win_left,TEXT_COLS-10,task);
WinVert(Fs->win_bottom+3,Fs->win_bottom+15,task);
while (!ScanKey) {
Play("5qCeEEqFDE4B5DC",
"Shade \0my \0 \0eyes \0the \0noon \0ap\0proach\0es.\n\0");
Play("5eAAAGAGFGEFEDhC");
Play("4qB5GF4BG5eGDqGeFG",
"Look \0a\0way.\n\0 \0 \0Oy!\n\0 \0 \0 \0 \0");
Play("4qB5GF4BG5eGDqGeFG",
"Hot \0to\0day!\n\0 \0 \0Oy!\n\0 \0 \0 \0 \0");
}
} catch
PutExcept;
Snd;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\veils-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has words\n\n-] Reward1\n CallExtStr(\"JukeReward\",\"\"\n -] Reward2\n \n \"gels prominence Colombia Italy \"\n \"bikini's Cheviot autograph's end \"\n \"mailer psyche compliment's mukluk \"\n \"fears animates unexplored esthetics \"\n \"Cabernet catchphrase conglomerated almanac's \"\n \n );\n\nU0 Song()\n{\n CTask *task;\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 2.480;\n music.stacatto_factor= 0.902;\n try {\n task=PopUpViewPrint(\n \"Exodus,34:29-36\\n\");\n TaskWait(task);\n WinHorz(Fs->win_left,TEXT_COLS-10,task);\n WinVert(Fs->win_bottom+3,Fs->win_bottom+15,task);\n while (!ScanKey) {\n Play(\"5qCeEEqFDE4B5DC\",\n \"Shade \\0my \\0 \\0eyes \\0the \\0noon \\0ap\\0proach\\0es.\\n\\0\");\n Play(\"5eAAAGAGFGEFEDhC\");\n Play(\"4qB5GF4BG5eGDqGeFG\",\n \"Look \\0a\\0way.\\n\\0 \\0 \\0Oy!\\n\\0 \\0 \\0 \\0 \\0\");\n Play(\"4qB5GF4BG5eGDqGeFG\",\n \"Hot \\0to\\0day!\\n\\0 \\0 \\0Oy!\\n\\0 \\0 \\0 \\0 \\0\");\n }\n } catch\n PutExcept;\n Snd;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\CPURep-Adam.html
// Date: unknown-date
// Language: HolyC
#help_index "Info;Time/CPU Cycles;Processor"
class CCPURep
{
Bool mp_start,mp_end;
I64 mp_not_done_flags,
**swaps,
**cycles;
};
U0 MPCPURep(CCPURep *cr)
{
I64 swaps=0,cycles_0,cycles_f;
while (!cr->mp_start)
Yield;
cycles_0=GetTSC;
while (!cr->mp_end) {
swaps++;
Yield;
}
cycles_f=GetTSC;
cr->swaps[Gs->num]=swaps;
cr->cycles[Gs->num]=cycles_f-cycles_0;
LBtr(&cr->mp_not_done_flags,Gs->num);
}
public U0 CPURep(Bool full=FALSE)
{//Report number of cores and clock freq.
I64 i,total_swaps,total_cycles;
F64 t0,tf;
CCPURep cr;
if (!full)
"%03X Cores %6h?nHz\n",mp_cnt,ToF64(cnts.time_stamp_freq);
else {
cr.swaps=CAlloc(sizeof(I64)*mp_cnt);
cr.cycles=CAlloc(sizeof(I64)*mp_cnt);
cr.mp_start=cr.mp_end=FALSE;
cr.mp_not_done_flags=1<<mp_cnt-1;
for (i=0;i<mp_cnt;i++)
Spawn(&MPCPURep,&cr,NULL,i);
t0=tS;
cr.mp_start=TRUE;
Sleep(2000);
cr.mp_end=TRUE;
while (cr.mp_not_done_flags)
Yield;
tf=tS;
"\n%03X Cores %6h?nHz\n",mp_cnt,ToF64(cnts.time_stamp_freq);
"\n Context\n"
"CPU Swaps/s Cycles\n"
"--- ------------- -----------------\n";
total_swaps=0;
total_cycles=0;
for (i=0;i<mp_cnt;i++) {
" %02X %13,d %17,d\n",i,
ToI64(cr.swaps[i]/(tf-t0)),ToI64(cr.cycles[i]/(tf-t0));
total_swaps+=cr.swaps[i];
total_cycles+=cr.cycles[i];
}
"--- ------------- -----------------\n";
"%03X %13,d %17,d\n",i,
ToI64(total_swaps/(tf-t0)),ToI64(total_cycles/(tf-t0));
"Avg %13,d %17,d\n\n",
ToI64(total_swaps/(tf-t0)/i),ToI64(total_cycles/(tf-t0)/i);
"Avg Cycles/Swap: %12.6f\n",ToF64(total_cycles)/total_swaps;
"Avg Time/Swap : %12.6fns\n\n",(tf-t0)*1000000000.0*i/total_swaps;
Free(cr.swaps);
Free(cr.cycles);
}
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\CPURep-Adam.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"Info;Time/CPU Cycles;Processor\"\nclass CCPURep\n{\n Bool mp_start,mp_end;\n I64 mp_not_done_flags,\n **swaps,\n **cycles;\n};\n\nU0 MPCPURep(CCPURep *cr)\n{\n I64 swaps=0,cycles_0,cycles_f;\n while (!cr->mp_start)\n Yield;\n cycles_0=GetTSC;\n while (!cr->mp_end) {\n swaps++;\n Yield;\n }\n cycles_f=GetTSC;\n cr->swaps[Gs->num]=swaps;\n cr->cycles[Gs->num]=cycles_f-cycles_0;\n LBtr(&cr->mp_not_done_flags,Gs->num);\n}\n\npublic U0 CPURep(Bool full=FALSE)\n{//Report number of cores and clock freq.\n I64 i,total_swaps,total_cycles;\n F64 t0,tf;\n CCPURep cr;\n\n if (!full)\n \"%03X Cores %6h?nHz\\n\",mp_cnt,ToF64(cnts.time_stamp_freq);\n else {\n cr.swaps=CAlloc(sizeof(I64)*mp_cnt);\n cr.cycles=CAlloc(sizeof(I64)*mp_cnt);\n cr.mp_start=cr.mp_end=FALSE;\n cr.mp_not_done_flags=1<<mp_cnt-1;\n for (i=0;i<mp_cnt;i++)\n Spawn(&MPCPURep,&cr,NULL,i);\n\n t0=tS;\n cr.mp_start=TRUE;\n Sleep(2000);\n cr.mp_end=TRUE;\n while (cr.mp_not_done_flags)\n Yield;\n tf=tS;\n\n \"\\n%03X Cores %6h?nHz\\n\",mp_cnt,ToF64(cnts.time_stamp_freq);\n \"\\n Context\\n\"\n \"CPU Swaps/s Cycles\\n\"\n \"--- ------------- -----------------\\n\";\n total_swaps=0;\n total_cycles=0;\n for (i=0;i<mp_cnt;i++) {\n \" %02X %13,d %17,d\\n\",i,\n ToI64(cr.swaps[i]/(tf-t0)),ToI64(cr.cycles[i]/(tf-t0));\n total_swaps+=cr.swaps[i];\n total_cycles+=cr.cycles[i];\n }\n \"--- ------------- -----------------\\n\";\n \"%03X %13,d %17,d\\n\",i,\n ToI64(total_swaps/(tf-t0)),ToI64(total_cycles/(tf-t0));\n \"Avg %13,d %17,d\\n\\n\",\n ToI64(total_swaps/(tf-t0)/i),ToI64(total_cycles/(tf-t0)/i);\n \"Avg Cycles/Swap: %12.6f\\n\",ToF64(total_cycles)/total_swaps;\n \"Avg Time/Swap : %12.6fns\\n\\n\",(tf-t0)*1000000000.0*i/total_swaps;\n Free(cr.swaps);\n Free(cr.cycles);\n }\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\HomeWrappers-AcctExample-Demo.html
// Date: unknown-date
// Language: HolyC
#help_index "Cmd Line (Typically)"
#define FILEMASK_OFF_LIMITS "!*/Misc/PCIDevices.DD*;!*/Misc/Bible.TXT*;"\
"!*/Books?/*;!*/Sup1/Sup1Words/*;!*/Sup1/Sup1Bin/*;"\
"!*/Sup1/Sup1Blog/NumBible.TXT*;!*/God/Vocab.DD*"
public I64 F(U8 *needle_str,U8 *fu_flags=NULL)
{//Find text in all text files.
return Find(needle_str,"/*",fu_flags);
}
public I64 F2(U8 *needle_str,U8 *fu_flags=NULL)
{//Find text in most text files.
return Find(needle_str,"/*;" FILEMASK_OFF_LIMITS,fu_flags);
}
public I64 R(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags="+l-i")
{//Find text and replace in most text files.
return Find(needle_str,"/*;" FILEMASK_OFF_LIMITS,fu_flags,replace_text);
}
public I64 FD(U8 *needle_str,U8 *fu_flags=NULL)
{//Find text in cur dir text files.
return Find(needle_str,"*",fu_flags);
}
public I64 FD2(U8 *needle_str,U8 *fu_flags=NULL)
{//Find text in most cur dir text files.
return Find(needle_str,"*;" FILEMASK_OFF_LIMITS,fu_flags);
}
public I64 RD(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags="+l-i")
{//Find text and replace in most cur dir text files.
return Find(needle_str,"*;" FILEMASK_OFF_LIMITS,fu_flags,replace_text);
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\HomeWrappers-AcctExample-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"Cmd Line (Typically)\"\n\n#define FILEMASK_OFF_LIMITS \"!*/Misc/PCIDevices.DD*;!*/Misc/Bible.TXT*;\"\\\n \"!*/Books?/*;!*/Sup1/Sup1Words/*;!*/Sup1/Sup1Bin/*;\"\\\n \"!*/Sup1/Sup1Blog/NumBible.TXT*;!*/God/Vocab.DD*\"\n\npublic I64 F(U8 *needle_str,U8 *fu_flags=NULL)\n{//Find text in all text files.\n return Find(needle_str,\"/*\",fu_flags);\n}\n\npublic I64 F2(U8 *needle_str,U8 *fu_flags=NULL)\n{//Find text in most text files.\n return Find(needle_str,\"/*;\" FILEMASK_OFF_LIMITS,fu_flags);\n}\n\npublic I64 R(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags=\"+l-i\")\n{//Find text and replace in most text files.\n return Find(needle_str,\"/*;\" FILEMASK_OFF_LIMITS,fu_flags,replace_text);\n}\n\npublic I64 FD(U8 *needle_str,U8 *fu_flags=NULL)\n{//Find text in cur dir text files.\n return Find(needle_str,\"*\",fu_flags);\n}\n\npublic I64 FD2(U8 *needle_str,U8 *fu_flags=NULL)\n{//Find text in most cur dir text files.\n return Find(needle_str,\"*;\" FILEMASK_OFF_LIMITS,fu_flags);\n}\n\npublic I64 RD(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags=\"+l-i\")\n{//Find text and replace in most cur dir text files.\n return Find(needle_str,\"*;\" FILEMASK_OFF_LIMITS,fu_flags,replace_text);\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\NumBible-Sup1-Sup1Blog-Home.html
// Date: December 31, 2001
// Language: HolyC
00001 **Welcome To The World of Free Plain Vanilla Electronic Texts**
00002
00003 **Etexts Readable By Both Humans and By Computers, Since 1971**
00004
00005 *These Etexts Prepared By Hundreds of Volunteers and Donations*
00006
00007
00008 August, 1989 [Etext #10]
00009
00010
00011 ******The Project Gutenberg Etext of The King James Bible******
00012 ******This file should be named kjv10.txt or kjv10.zip*****
00013
00014
00015 Copyright laws are changing all over the world, be sure to check
00016 the copyright laws for your country before posting these files!!
00017
00018 Please take a look at the important information in this header.
00019 We encourage you to keep this file on your own disk, keeping an
00020 electronic path open for the next readers. Do not remove this.
00021
00022
00023 **Welcome To The World of Free Plain Vanilla Electronic Texts**
00024
00025 **Etexts Readable By Both Humans and By Computers, Since 1971**
00026
00027 *These Etexts Prepared By Hundreds of Volunteers and Donations*
00028
00029 Information on contacting Project Gutenberg to get Etexts, and
00030 further information is included below. We need your donations.
00031
00032
00033 The King James Bible
00034
00035 August, 1989 [Etext #10]
00036
00037
00038 ******The Project Gutenberg Etext of The King James Bible******
00039 ******This file should be named kjv10.txt or kjv10.zip*****
00040
00041 Corrected EDITIONS of our etexts get a new NUMBER, kjv11.txt
00042 VERSIONS based on separate sources get new LETTER, kjv10aa.txt
00043
00044 Warning: also look for our Bible Etext under biblexxx.xxx: as
00045 well as under kjvxxxxx.xxx.
00046
00047
00048 Project Gutenberg Etexts are usually created from multiple editions,
00049 all of which are in the Public Domain in the United States, unless a
00050 copyright notice is included. Therefore, we do usually do NOT! keep
00051 these books in compliance with any particular paper edition.
00052
00053
00054 We are now trying to release all our books one month in advance
00055 of the official release dates, leaving time for better editing.
00056
00057 Please note: neither this list nor its contents are final till
00058 midnight of the last day of the month of any such announcement.
00059 The official release date of all Project Gutenberg Etexts is at
00060 Midnight, Central Time, of the last day of the stated month. A
00061 preliminary version may often be posted for suggestion, comment
00062 and editing by those who wish to do so. To be sure you have an
00063 up to date first edition [xxxxx10x.xxx] please check file sizes
00064 in the first week of the next month. Since our ftp program has
00065 a bug in it that scrambles the date [tried to fix and failed] a
00066 look at the file size will have to do, but we will try to see a
00067 new copy has at least one byte more or less.
00068
00069
00070 Information about Project Gutenberg (one page)
00071
00072 We produce about two million dollars for each hour we work. The
00073 time it takes us, a rather conservative estimate, is fifty hours
00074 to get any etext selected, entered, proofread, edited, copyright
00075 searched and analyzed, the copyright letters written, etc. This
00076 projected audience is one hundred million readers. If our value
00077 per text is nominally estimated at one dollar then we produce &2
00078 million dollars per hour this year as we release thirty-six text
00079 files per month, or 432 more Etexts in 1999 for a total of 2000+
00080 If these reach just 10% of the computerized population, then the
00081 total should reach over 200 billion Etexts given away this year.
00082
00083 The Goal of Project Gutenberg is to Give Away One Trillion Etext
00084 Files by December 31, 2001. [10,000 x 100,000,000 = 1 Trillion]
00085 This is ten thousand titles each to one hundred million readers,
00086 which is only ~5% of the present number of computer users.
00087
00088 At our revised rates of production, we will reach only one-third
00089 of that goal by the end of 2001, or about 3,333 Etexts unless we
00090 manage to get some real funding; currently our funding is mostly
00091 from Michael Hart's salary at Carnegie-Mellon University, and an
00092 assortment of sporadic gifts; this salary is only good for a few
00093 more years, so we are looking for something to replace it, as we
00094 don't want Project Gutenberg to be so dependent on one person.
00095
00096 We need your donations more than ever!
00097
00098
00099 All donations should be made to "Project Gutenberg/CMU": and are
00100 tax deductible to the extent allowable by law. (CMU = Carnegie-
00101 Mellon University).
00102
00103 For these and other matters, please mail to:
00104
00105 Project Gutenberg
00106 P. O. Box 2782
00107 Champaign, IL 61825
00108
00109 When all other email fails. . .try our Executive Director:
00110 Michael S. Hart <[email protected]>
00111 [email protected] forwards to [email protected] and archive.org
00112 if your mail bounces from archive.org, I will still see it, if
00113 it bounces from prairienet.org, better resend later on. . . .
00114
00115 We would prefer to send you this information by email.
00116
00117 ******
00118
00119 To access Project Gutenberg etexts, use any Web browser
00120 to view http://promo.net/pg. This site lists Etexts by
00121 author and by title, and includes information about how
00122 to get involved with Project Gutenberg. You could also
00123 download our past Newsletters, or subscribe here. This
00124 is one of our major sites, please email [email protected],
00125 for a more complete list of our various sites.
00126
00127 To go directly to the etext collections, use FTP or any
00128 Web browser to visit a Project Gutenberg mirror (mirror
00129 sites are available on 7 continents; mirrors are listed
00130 at http://promo.net/pg).
00131
00132 Mac users, do NOT point and click, typing works better.
00133
00134 Example FTP session:
00135
00136 ftp sunsite.unc.edu
00137 login: anonymous
00138 password: [email
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\NumBible-Sup1-Sup1Blog-Home.html\n// Date: December 31, 2001\n// Language: HolyC\n\n00001 **Welcome To The World of Free Plain Vanilla Electronic Texts**\n00002\n00003 **Etexts Readable By Both Humans and By Computers, Since 1971**\n00004\n00005 *These Etexts Prepared By Hundreds of Volunteers and Donations*\n00006\n00007\n00008 August, 1989 [Etext #10]\n00009\n00010\n00011 ******The Project Gutenberg Etext of The King James Bible******\n00012 ******This file should be named kjv10.txt or kjv10.zip*****\n00013\n00014\n00015 Copyright laws are changing all over the world, be sure to check\n00016 the copyright laws for your country before posting these files!!\n00017\n00018 Please take a look at the important information in this header.\n00019 We encourage you to keep this file on your own disk, keeping an\n00020 electronic path open for the next readers. Do not remove this.\n00021\n00022\n00023 **Welcome To The World of Free Plain Vanilla Electronic Texts**\n00024\n00025 **Etexts Readable By Both Humans and By Computers, Since 1971**\n00026\n00027 *These Etexts Prepared By Hundreds of Volunteers and Donations*\n00028\n00029 Information on contacting Project Gutenberg to get Etexts, and\n00030 further information is included below. We need your donations.\n00031\n00032\n00033 The King James Bible\n00034\n00035 August, 1989 [Etext #10]\n00036\n00037\n00038 ******The Project Gutenberg Etext of The King James Bible******\n00039 ******This file should be named kjv10.txt or kjv10.zip*****\n00040\n00041 Corrected EDITIONS of our etexts get a new NUMBER, kjv11.txt\n00042 VERSIONS based on separate sources get new LETTER, kjv10aa.txt\n00043\n00044 Warning: also look for our Bible Etext under biblexxx.xxx: as\n00045 well as under kjvxxxxx.xxx.\n00046\n00047\n00048 Project Gutenberg Etexts are usually created from multiple editions,\n00049 all of which are in the Public Domain in the United States, unless a\n00050 copyright notice is included. Therefore, we do usually do NOT! keep\n00051 these books in compliance with any particular paper edition.\n00052\n00053\n00054 We are now trying to release all our books one month in advance\n00055 of the official release dates, leaving time for better editing.\n00056\n00057 Please note: neither this list nor its contents are final till\n00058 midnight of the last day of the month of any such announcement.\n00059 The official release date of all Project Gutenberg Etexts is at\n00060 Midnight, Central Time, of the last day of the stated month. A\n00061 preliminary version may often be posted for suggestion, comment\n00062 and editing by those who wish to do so. To be sure you have an\n00063 up to date first edition [xxxxx10x.xxx] please check file sizes\n00064 in the first week of the next month. Since our ftp program has\n00065 a bug in it that scrambles the date [tried to fix and failed] a\n00066 look at the file size will have to do, but we will try to see a\n00067 new copy has at least one byte more or less.\n00068\n00069\n00070 Information about Project Gutenberg (one page)\n00071\n00072 We produce about two million dollars for each hour we work. The\n00073 time it takes us, a rather conservative estimate, is fifty hours\n00074 to get any etext selected, entered, proofread, edited, copyright\n00075 searched and analyzed, the copyright letters written, etc. This\n00076 projected audience is one hundred million readers. If our value\n00077 per text is nominally estimated at one dollar then we produce &2\n00078 million dollars per hour this year as we release thirty-six text\n00079 files per month, or 432 more Etexts in 1999 for a total of 2000+\n00080 If these reach just 10% of the computerized population, then the\n00081 total should reach over 200 billion Etexts given away this year.\n00082\n00083 The Goal of Project Gutenberg is to Give Away One Trillion Etext\n00084 Files by December 31, 2001. [10,000 x 100,000,000 = 1 Trillion]\n00085 This is ten thousand titles each to one hundred million readers,\n00086 which is only ~5% of the present number of computer users.\n00087\n00088 At our revised rates of production, we will reach only one-third\n00089 of that goal by the end of 2001, or about 3,333 Etexts unless we\n00090 manage to get some real funding; currently our funding is mostly\n00091 from Michael Hart's salary at Carnegie-Mellon University, and an\n00092 assortment of sporadic gifts; this salary is only good for a few\n00093 more years, so we are looking for something to replace it, as we\n00094 don't want Project Gutenberg to be so dependent on one person.\n00095\n00096 We need your donations more than ever!\n00097\n00098\n00099 All donations should be made to \"Project Gutenberg/CMU\": and are\n00100 tax deductible to the extent allowable by law. (CMU = Carnegie-\n00101 Mellon University).\n00102\n00103 For these and other matters, please mail to:\n00104\n00105 Project Gutenberg\n00106 P. O. Box 2782\n00107 Champaign, IL 61825\n00108\n00109 When all other email fails. . .try our Executive Director:\n00110 Michael S. Hart <[email protected]>\n00111 [email protected] forwards to [email protected] and archive.org\n00112 if your mail bounces from archive.org, I will still see it, if\n00113 it bounces from prairienet.org, better resend later on. . . .\n00114\n00115 We would prefer to send you this information by email.\n00116\n00117 ******\n00118\n00119 To access Project Gutenberg etexts, use any Web browser\n00120 to view http://promo.net/pg. This site lists Etexts by\n00121 author and by title, and includes information about how\n00122 to get involved with Project Gutenberg. You could also\n00123 download our past Newsletters, or subscribe here. This\n00124 is one of our major sites, please email [email protected],\n00125 for a more complete list of our various sites.\n00126\n00127 To go directly to the etext collections, use FTP or any\n00128 Web browser to visit a Project Gutenberg mirror (mirror\n00129 sites are available on 7 continents; mirrors are listed\n00130 at http://promo.net/pg).\n00131\n00132 Mac users, do NOT point and click, typing works better.\n00133\n00134 Example FTP session:\n00135\n00136 ftp sunsite.unc.edu\n00137 login: anonymous\n00138 password: [email "
}
]
}
|
// Source: D:\TempleOS-Projects\html\limit-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has graphics
F64 t0=Beat;
<1>/* Graphics Not Rendered in HTML */
U0 DrawIt(CTask *,CDC *dc)
{
F64 dt=Beat-t0;
dc->color=BLACK;
if (dt<21.5)
GrPrint(dc,235,30,"- -");
else {
Sprite3(dc,235,30,0,<1>);
GrPrint(dc,235,30,"o o");
}
}
U0 Song()
{
SettingsPush; //See SettingsPush
Fs->draw_it=&DrawIt;
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.500;
music.stacatto_factor= 0.900;
try {
while (!ScanKey) {
t0=Beat;
Play("4qB5D4A5GFF4eBA5sD4G5D4G",
"Do \0not \0push \0your \0luck.\n\0 \0 \0 \0 \0 \0 \0 \0");
Play("4qB5D4A5GFF4eBA5sD4G5D4G",
"Do \0not \0push \0your \0luck.\n\0 \0 \0 \0 \0 \0 \0 \0");
Play("5qGFCeCGqF4etAA5FqEF",
"God \0is \0not \0 \0a \0schmuck.\n\0 \0 \0 \0 \0 \0");
Play("5GFCeCGqF4etAA5FqEF",
"God \0is \0not \0 \0a \0schmuck. \0 \0 \0 \0No!\n\0 \0");
t0=Beat;
Play("4B5D4A5GFF4eBA5sD4G5D4G",
"\nDo \0not \0tell \0the \0Lord\n\0 \0 \0 \0 \0 \0 \0 \0");
Play("4qB5D4A5GFF4eBA5sD4G5D4G",
"that \0you're \0feel\0ing \0bored.\n\0 \0 \0 \0 \0 \0 \0 \0");
Play("5qGFCeCGqF4etAA5FqEF",
"He \0will \0send \0 \0the \0sword.\n\0 \0 \0 \0 \0 \0");
Play("5GFCeCGqF4etAA5FqEF",
"He \0will \0send \0 \0the \0sword. \0 \0 \0 \0Yep!\n\n\0 \0");
"$GREEN$(Boredom is an insult to the Creator.\n"
"We are like guest at a banquet.)\n$FG$";
}
} catch
PutExcept;
SettingsPop;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\limit-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has graphics\nF64 t0=Beat;\n\n<1>/* Graphics Not Rendered in HTML */\n\nU0 DrawIt(CTask *,CDC *dc)\n{\n F64 dt=Beat-t0;\n\n dc->color=BLACK;\n if (dt<21.5)\n GrPrint(dc,235,30,\"- -\");\n else {\n Sprite3(dc,235,30,0,<1>);\n GrPrint(dc,235,30,\"o o\");\n }\n}\n\nU0 Song()\n{\n SettingsPush; //See SettingsPush\n Fs->draw_it=&DrawIt;\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 2.500;\n music.stacatto_factor= 0.900;\n try {\n while (!ScanKey) {\n t0=Beat;\n Play(\"4qB5D4A5GFF4eBA5sD4G5D4G\",\n \"Do \\0not \\0push \\0your \\0luck.\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"4qB5D4A5GFF4eBA5sD4G5D4G\",\n \"Do \\0not \\0push \\0your \\0luck.\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5qGFCeCGqF4etAA5FqEF\",\n \"God \\0is \\0not \\0 \\0a \\0schmuck.\\n\\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5GFCeCGqF4etAA5FqEF\",\n \"God \\0is \\0not \\0 \\0a \\0schmuck. \\0 \\0 \\0 \\0No!\\n\\0 \\0\");\n t0=Beat;\n Play(\"4B5D4A5GFF4eBA5sD4G5D4G\",\n \"\\nDo \\0not \\0tell \\0the \\0Lord\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"4qB5D4A5GFF4eBA5sD4G5D4G\",\n \"that \\0you're \\0feel\\0ing \\0bored.\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5qGFCeCGqF4etAA5FqEF\",\n \"He \\0will \\0send \\0 \\0the \\0sword.\\n\\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5GFCeCGqF4etAA5FqEF\",\n \"He \\0will \\0send \\0 \\0the \\0sword. \\0 \\0 \\0 \\0Yep!\\n\\n\\0 \\0\");\n \"$GREEN$(Boredom is an insult to the Creator.\\n\"\n \"We are like guest at a banquet.)\\n$FG$\";\n }\n } catch\n PutExcept;\n SettingsPop;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\SndScope-Sup1-Sup1HDAudio-Examples-Home.html
// Date: unknown-date
// Language: HolyC
U0 DrawIt(CTask *task,CDC *dc)
{
SND_OUT_CONTAINER *buf=hda.ostr0_buf[0];
I64 i,x1,y1,x2,y2,
cy=task->pix_height>>1;
dc->color=BLUE;
x2=0;y2=cy;
for (i=0;i<SND_BUF_LEN;i+=2) {
x1=i*task->pix_width/SND_BUF_LEN;
y1=cy-buf[i]*cy/snd_vol/I32_MAX;
GrLine(dc,x2,y2,x1,y1);
x2=x1;y2=y1;
}
dc->color=GREEN;
x2=0;y2=cy;
for (i=1;i<SND_BUF_LEN;i+=2) {
x1=i*task->pix_width/SND_BUF_LEN;
y1=cy-buf[i]*cy/snd_vol/I32_MAX;
GrLine(dc,x2,y2,x1,y1);
x2=x1; y2=y1;
}
}
U0 SndScope()
{
if (snd_dev!=SD_HD_AUDIO) {
"Only works for HD Audio.\n";
return;
}
SettingsPush; //See SettingsPush
WinHorz(1,18);
WinVert(15,TEXT_ROWS-2);
DocCursor;
DocClear;
Fs->draw_it=&DrawIt;
GetChar;
SettingsPop;
}
#if __CMD_LINE__
SndScope;
#endif
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\SndScope-Sup1-Sup1HDAudio-Examples-Home.html\n// Date: unknown-date\n// Language: HolyC\n\nU0 DrawIt(CTask *task,CDC *dc)\n{\n SND_OUT_CONTAINER *buf=hda.ostr0_buf[0];\n I64 i,x1,y1,x2,y2,\n cy=task->pix_height>>1;\n\n dc->color=BLUE;\n x2=0;y2=cy;\n for (i=0;i<SND_BUF_LEN;i+=2) {\n x1=i*task->pix_width/SND_BUF_LEN;\n y1=cy-buf[i]*cy/snd_vol/I32_MAX;\n GrLine(dc,x2,y2,x1,y1);\n x2=x1;y2=y1;\n }\n\n dc->color=GREEN;\n x2=0;y2=cy;\n for (i=1;i<SND_BUF_LEN;i+=2) {\n x1=i*task->pix_width/SND_BUF_LEN;\n y1=cy-buf[i]*cy/snd_vol/I32_MAX;\n GrLine(dc,x2,y2,x1,y1);\n x2=x1; y2=y1;\n }\n}\n\nU0 SndScope()\n{\n if (snd_dev!=SD_HD_AUDIO) {\n \"Only works for HD Audio.\\n\";\n return;\n }\n SettingsPush; //See SettingsPush\n WinHorz(1,18);\n WinVert(15,TEXT_ROWS-2);\n DocCursor;\n DocClear;\n Fs->draw_it=&DrawIt;\n GetChar;\n SettingsPop;\n}\n\n#if __CMD_LINE__\nSndScope;\n#endif"
}
]
}
|
// Source: D:\TempleOS-Projects\html\awake-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has graphics
#define R1 13
#define R2 21
U0 DrawIt(CTask *,CDC *dc)
{
static F64 theta=0;
I64 x1=200,y1=20,x2=x1,y2=y1+R2;
F64 tt=Beat%16.0,phi;
theta+=1/(tt*tt+1);
dc->color=BLACK;
dc->thick=4;
GrCircle3(dc,x2,y2,0,R2+10);
for (phi=theta;phi<theta+2*pi;phi+=pi/3) {
dc->color=BLACK;
dc->thick=2;
GrCircle3(dc,x2+R2*Cos(phi),y2-R2*Sin(phi),0,8);
dc->color=WHITE;
dc->thick=2;
GrCircle3(dc,x2+(R2+15)*Cos(phi+pi/6),y2-(R2+15)*Sin(phi+pi/6),0,3);
}
dc->color=BROWN;
GrFloodFill(dc,x2+R2*Cos(phi),y2-R2*Sin(phi));
dc->color=DKGRAY;
GrFloodFill(dc,x2,y2);
dc->thick=6;
dc->color=RED;
GrCircle3(dc,x1,y1,0,R1-6);
dc->color=DKGRAY;
GrCircle3(dc,x1,y1,0,R1-2);
dc->color=LTGRAY;
GrRect(dc,x1-2,y1-R2-1,4,10);
GrCircle3(dc,x1,y1,0,R1);
dc->color=RED;
GrFloodFill(dc,x1,y1,TRUE);
dc->color=BLACK;
GrFloodFill(dc,x1,y1);
}
U0 Song()
{
CTask *task;
SettingsPush; //See SettingsPush
Fs->draw_it=&DrawIt;
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.480;
music.stacatto_factor= 0.902;
try {
task=PopUpViewPrint("Mark,14:37\n");
TaskWait(task);
WinHorz(Fs->win_left,TEXT_COLS-10,task);
WinVert(Fs->win_bottom+3,Fs->win_bottom+15,task);
while (!ScanKey) {
"$GREEN$Jesus talking...$FG$\n";
Play("4eB5C4qBsG5D4G5DetCGFsC4B5C4B5etCG4BeB5G4sB5C4B5C",
"Stay \0a\0wake.\n\0 \0 \0 \0 \0 \0 \0 \0"
" \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0");
Play("4eB5C4qBsG5D4G5DetCGFsC4B5C4B5etCG4BeB5G4sB5C4B5C",
"Stay \0a\0wake.\n\0 \0 \0 \0 \0 \0 \0 \0"
" \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0");
Play("5qDsD4B5D4BetAG5G4qBGsA5D4A5DqDetGFD",
" \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0"
"I \0 \0am \0a \0dead \0 \0man.\n\0");
Play("5qDsD4B5D4BetAG5G4qBGsA5D4A5DqDetGFD",
" \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0"
"I \0 \0am \0a \0dead \0 \0man.\n\0");
}
} catch
PutExcept;
SettingsPop;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\awake-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has graphics\n#define R1 13\n#define R2 21\n\nU0 DrawIt(CTask *,CDC *dc)\n{\n static F64 theta=0;\n I64 x1=200,y1=20,x2=x1,y2=y1+R2;\n F64 tt=Beat%16.0,phi;\n theta+=1/(tt*tt+1);\n dc->color=BLACK;\n dc->thick=4;\n GrCircle3(dc,x2,y2,0,R2+10);\n for (phi=theta;phi<theta+2*pi;phi+=pi/3) {\n dc->color=BLACK;\n dc->thick=2;\n GrCircle3(dc,x2+R2*Cos(phi),y2-R2*Sin(phi),0,8);\n dc->color=WHITE;\n dc->thick=2;\n GrCircle3(dc,x2+(R2+15)*Cos(phi+pi/6),y2-(R2+15)*Sin(phi+pi/6),0,3);\n }\n dc->color=BROWN;\n GrFloodFill(dc,x2+R2*Cos(phi),y2-R2*Sin(phi));\n dc->color=DKGRAY;\n GrFloodFill(dc,x2,y2);\n dc->thick=6;\n dc->color=RED;\n GrCircle3(dc,x1,y1,0,R1-6);\n dc->color=DKGRAY;\n GrCircle3(dc,x1,y1,0,R1-2);\n dc->color=LTGRAY;\n GrRect(dc,x1-2,y1-R2-1,4,10);\n GrCircle3(dc,x1,y1,0,R1);\n dc->color=RED;\n GrFloodFill(dc,x1,y1,TRUE);\n dc->color=BLACK;\n GrFloodFill(dc,x1,y1);\n}\n\nU0 Song()\n{\n CTask *task;\n SettingsPush; //See SettingsPush\n Fs->draw_it=&DrawIt;\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 2.480;\n music.stacatto_factor= 0.902;\n try {\n task=PopUpViewPrint(\"Mark,14:37\\n\");\n TaskWait(task);\n WinHorz(Fs->win_left,TEXT_COLS-10,task);\n WinVert(Fs->win_bottom+3,Fs->win_bottom+15,task);\n while (!ScanKey) {\n \"$GREEN$Jesus talking...$FG$\\n\";\n Play(\"4eB5C4qBsG5D4G5DetCGFsC4B5C4B5etCG4BeB5G4sB5C4B5C\",\n \"Stay \\0a\\0wake.\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"4eB5C4qBsG5D4G5DetCGFsC4B5C4B5etCG4BeB5G4sB5C4B5C\",\n \"Stay \\0a\\0wake.\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5qDsD4B5D4BetAG5G4qBGsA5D4A5DqDetGFD\",\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\"\n \"I \\0 \\0am \\0a \\0dead \\0 \\0man.\\n\\0\");\n Play(\"5qDsD4B5D4BetAG5G4qBGsA5D4A5DqDetGFD\",\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\"\n \"I \\0 \\0am \\0a \\0dead \\0 \\0man.\\n\\0\");\n }\n } catch\n PutExcept;\n SettingsPop;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\BigGuns-Games-Demo.html
// Date: unknown-date
// Language: HolyC
//Uses fixed-point.
class MyMass:CMass
{
Bool collision;
};
#define MAP_WIDTH 2048
#define MAP_HEIGHT (GR_HEIGHT-3*FONT_HEIGHT)
I64 gun_x,gun_y,active_map=0,gun_recoil;
F64 gun_theta;
CDC *map_dcs[2]={NULL,NULL};
I16 elevs[MAP_WIDTH];
F64 wind_x;
#define DUST_NUM 512
I64 dust_x[DUST_NUM],dust_y[DUST_NUM];
CMathODE *ode=NULL;
<1>/* Graphics Not Rendered in HTML */
<2>/* Graphics Not Rendered in HTML */
U0 DrawIt(CTask *task,CDC *dc)
{
CDC *map=map_dcs[active_map&1];
MyMass *tmpm;
F64 theta=gun_theta;
I64 i,x,y,w,
h=-task->horz_scroll.pos,
v=-task->vert_scroll.pos;
task->horz_scroll.min=0;
task->horz_scroll.max=MAP_WIDTH-task->pix_width;
task->vert_scroll.min=0;
task->vert_scroll.max=MAP_HEIGHT-task->pix_height;
map->flags|=DCF_NO_TRANSPARENTS;
GrBlot(dc,h,v,map);
Sprite3(dc,gun_x+h,gun_y+v,0,<2>);
if (theta<-pi/2) {
dc->flags|=DCF_SYMMETRY|DCF_JUST_MIRROR;
DCSymmetrySet(dc,gun_x+h,0,gun_x+h,1);
theta=-pi-theta;
}
Sprite3ZB(dc,
gun_x+h-gun_recoil*Cos(theta),
gun_y+v-gun_recoil*Sin(theta)-10,0,<1>,theta);
dc->flags&=~(DCF_SYMMETRY|DCF_JUST_MIRROR);
tmpm=ode->next_mass;
dc->color=BLACK;
map->color=ROP_COLLISION;
map->bkcolor=LTCYAN;
while (tmpm!=&ode->next_mass) {
map->collision_cnt=0;
GrCircle(map,tmpm->x,tmpm->y,2);
if (map->collision_cnt)
tmpm->collision=TRUE;
GrCircle(dc,tmpm->x+h,tmpm->y+v,2);
tmpm=tmpm->next;
}
dc->color=LTGRAY;
w=tS*wind_x;
for (i=0;i<DUST_NUM;i++) {
x=(dust_x[i]+w)%MAP_WIDTH;
y=dust_y[i];
if (y<elevs[x])
GrPlot(dc,x+h,y+v);
}
}
U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
{
MyMass *tmpm=ode->next_mass;
while (tmpm!=&ode->next_mass) {
tmpm->DstateDt->DyDt+=1000.0*tmpm->mass;
tmpm->DstateDt->DxDt+=25.0*wind_x;
tmpm=tmpm->next;
}
}
U0 DrawMap()
{
CDC *map=map_dcs[(active_map+1)&1];
I64 x;
map->color=LTCYAN;
GrRect(map,0,0,MAP_WIDTH,MAP_HEIGHT);
map->color=BLACK;
for (x=1;x<MAP_WIDTH;x++)
GrLine(map,x-1,elevs[x-1],x,elevs[x]);
map->color=BROWN;
GrFloodFill(map,0,MAP_HEIGHT-1,FALSE);
active_map++;
}
U0 FireTask(I64)
{
MyMass *tmpm;
I64 i;
if (gun_recoil) return;
tmpm=CAlloc(sizeof(MyMass),Fs->parent_task);
tmpm->mass=10.0;
tmpm->drag_profile_factor=0.1;
tmpm->x=gun_x+27*Cos(gun_theta);
tmpm->y=gun_y-15+27*Sin(gun_theta);
tmpm->DxDt=600.0*Cos(gun_theta);
tmpm->DyDt=600.0*Sin(gun_theta);
tmpm->collision=FALSE;
while (sys_task_being_scrn_updated==Fs->parent_task)
Yield;
QueIns(tmpm,ode->last_mass);
Fs->task_end_cb=&SndTaskEndCB;
for (i=0;i<60;i++) {
Snd(50*Rand+10);
Sleep(2);
gun_recoil=i/12;
}
for (i=0;i<=60;i++) {
Sleep(1);
gun_recoil=5-i/12;
}
}
U0 ManageShots()
{
I64 i;
MyMass *tmpm,*tmpm1;
Bool chged=FALSE;
tmpm=ode->next_mass;
while (tmpm!=&ode->next_mass) {
tmpm1=tmpm->next;
if (!(0<=tmpm->x<MAP_WIDTH) ||
tmpm->collision) {
QueRem(tmpm);
for (i=tmpm->x-4;i<=tmpm->x+4;i++)
if (0<=i<MAP_WIDTH)
elevs[i]=ClampI64(elevs[i]+10-2*AbsI64(i-tmpm->x),0,MAP_HEIGHT-2);
Free(tmpm);
chged=TRUE;
}
tmpm=tmpm1;
}
if (chged)
DrawMap;
}
U0 MoveTask(I64)
{
static F64 quit_time=0;
if (quit_time)
quit_time=tS+0.1;
else {
Snd(34);
Fs->task_end_cb=&SndTaskEndCB;
quit_time=tS+0.1;
while (quit_time>tS)
Yield;
quit_time=0;
}
}
U0 Init()
{
CDC *map;
I64 i,x,y,dy;
if (!map_dcs[0])
map_dcs[0]=DCNew(MAP_WIDTH,MAP_HEIGHT);
if (!map_dcs[1])
map_dcs[1]=DCNew(MAP_WIDTH,MAP_HEIGHT);
map=map_dcs[active_map&1];
Fs->horz_scroll.pos=0;
Fs->vert_scroll.pos=0;
y=ToI64(0.7*MAP_HEIGHT)<<32;
dy=0;
for (x=0;x<MAP_WIDTH;x++) {
dy=ClampI64(SignI64(RandI16)<<30+dy,-3<<32,3<<32);
y=ClampI64(y+dy,ToI64(0.3*MAP_HEIGHT)<<32,(MAP_HEIGHT-2)<<32);
elevs[x]=y.i32[1];
}
gun_x=RandU32%(MAP_WIDTH-100)+50;
gun_y=elevs[gun_x];
gun_theta=0;
gun_recoil=0;
for (x=gun_x-20;x<=gun_x+20;x++)
elevs[x]=gun_y;
wind_x=RandI16/250.0;
for (i=0;i<DUST_NUM;i++) {
dust_x[i]=RandU16%MAP_WIDTH;
dust_y[i]=RandU16%MAP_HEIGHT;
}
ode=ODENew(0,1e-4,ODEF_HAS_MASSES);
ode->derive=&MyDerivative;
ode->drag_v2=0.002;
ode->drag_v3=0.0001;
ode->acceleration_limit=5e5;
QueIns(ode,Fs->last_ode);
Fs->horz_scroll.min=0;
Fs->horz_scroll.max=MAP_WIDTH-Fs->pix_width;
Fs->horz_scroll.pos=gun_x-Fs->pix_width/2;
Fs->vert_scroll.min=0;
Fs->vert_scroll.max=MAP_HEIGHT-Fs->pix_height;
Fs->vert_scroll.pos=0;
TaskDerivedValsUpdate;
DrawMap;
}
U0 CleanUp(CMathODE *ode)
{
if (ode) {
QueRem(ode);
QueDel(&ode->next_mass,TRUE);
ODEDel(ode);
}
}
U0 BigGuns()
{
I64 ch,sc;
PopUpOk(
"I refuse to rip-off the original\n"
"so this is intentionally crappy\n"
"and included for demonstration\n"
"purposes.\n\n"
"Write games, don't play them.\n");
PopUpOk("The map scrolls.\n");
SettingsPush; //See SettingsPush
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
" Exit(,CH_ESC);"
"}"
"Play {"
" Restart(,'\n');"
" Fire(,CH_SPACE);"
" Left(,,SC_CURSOR_LEFT);"
" Right(,,SC_CURSOR_RIGHT);"
"}"
);
AutoComplete;
WinBorder(ON);
WinMax;
DocCursor;
DocClear;
DocScroll;
Init;
Fs->draw_it=&DrawIt;
try {
while (TRUE) {
while (ScanKey(&ch,&sc))
switch (ch) {
case 0:
switch (sc.u8[0]) {
case SC_CURSOR_RIGHT:
gun_theta+=2.0*pi/180;
if (gun_theta>0)
gun_theta=0;
else
Spawn(&MoveTask,NULL,"Move",,Fs);
break;
case SC_CURSOR_LEFT:
gun_theta-=2.0*pi/180;
if (gun_theta<-pi)
gun_theta=-pi;
else
Spawn(&MoveTask,NULL,"Move",,Fs);
break;
}
break;
case '\n':
CleanUp(ode);
Init;
break;
case CH_SPACE:
Spawn(&FireTask,NULL,"Fire",,Fs);
break;
case CH_SHIFT_ESC:
case CH_ESC:
goto bg_done;
}
ManageShots;
Refresh;
}
bg_done:
} catch
PutExcept;
SettingsPop;
DCDel(map_dcs[0]); map_dcs[0]=NULL;
DCDel(map_dcs[1]); map_dcs[1]=NULL;
CleanUp(ode);
MenuPop;
}
BigGuns;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\BigGuns-Games-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\n//Uses fixed-point.\n\nclass MyMass:CMass\n{\n Bool collision;\n};\n\n#define MAP_WIDTH 2048\n#define MAP_HEIGHT (GR_HEIGHT-3*FONT_HEIGHT)\n\nI64 gun_x,gun_y,active_map=0,gun_recoil;\nF64 gun_theta;\nCDC *map_dcs[2]={NULL,NULL};\nI16 elevs[MAP_WIDTH];\n\nF64 wind_x;\n#define DUST_NUM 512\nI64 dust_x[DUST_NUM],dust_y[DUST_NUM];\n\nCMathODE *ode=NULL;\n\n <1>/* Graphics Not Rendered in HTML */\n\n\n <2>/* Graphics Not Rendered in HTML */\n\nU0 DrawIt(CTask *task,CDC *dc)\n{\n CDC *map=map_dcs[active_map&1];\n MyMass *tmpm;\n F64 theta=gun_theta;\n I64 i,x,y,w,\n h=-task->horz_scroll.pos,\n v=-task->vert_scroll.pos;\n task->horz_scroll.min=0;\n task->horz_scroll.max=MAP_WIDTH-task->pix_width;\n task->vert_scroll.min=0;\n task->vert_scroll.max=MAP_HEIGHT-task->pix_height;\n map->flags|=DCF_NO_TRANSPARENTS;\n GrBlot(dc,h,v,map);\n\n Sprite3(dc,gun_x+h,gun_y+v,0,<2>);\n\n if (theta<-pi/2) {\n dc->flags|=DCF_SYMMETRY|DCF_JUST_MIRROR;\n DCSymmetrySet(dc,gun_x+h,0,gun_x+h,1);\n theta=-pi-theta;\n }\n Sprite3ZB(dc,\n gun_x+h-gun_recoil*Cos(theta),\n gun_y+v-gun_recoil*Sin(theta)-10,0,<1>,theta);\n dc->flags&=~(DCF_SYMMETRY|DCF_JUST_MIRROR);\n\n tmpm=ode->next_mass;\n dc->color=BLACK;\n map->color=ROP_COLLISION;\n map->bkcolor=LTCYAN;\n while (tmpm!=&ode->next_mass) {\n map->collision_cnt=0;\n GrCircle(map,tmpm->x,tmpm->y,2);\n if (map->collision_cnt)\n tmpm->collision=TRUE;\n\n GrCircle(dc,tmpm->x+h,tmpm->y+v,2);\n\n tmpm=tmpm->next;\n }\n\n dc->color=LTGRAY;\n w=tS*wind_x;\n for (i=0;i<DUST_NUM;i++) {\n x=(dust_x[i]+w)%MAP_WIDTH;\n y=dust_y[i];\n if (y<elevs[x])\n GrPlot(dc,x+h,y+v);\n }\n}\n\nU0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)\n{\n MyMass *tmpm=ode->next_mass;\n while (tmpm!=&ode->next_mass) {\n tmpm->DstateDt->DyDt+=1000.0*tmpm->mass;\n tmpm->DstateDt->DxDt+=25.0*wind_x;\n tmpm=tmpm->next;\n }\n}\n\nU0 DrawMap()\n{\n CDC *map=map_dcs[(active_map+1)&1];\n I64 x;\n\n map->color=LTCYAN;\n GrRect(map,0,0,MAP_WIDTH,MAP_HEIGHT);\n\n map->color=BLACK;\n for (x=1;x<MAP_WIDTH;x++)\n GrLine(map,x-1,elevs[x-1],x,elevs[x]);\n\n map->color=BROWN;\n GrFloodFill(map,0,MAP_HEIGHT-1,FALSE);\n\n active_map++;\n}\n\nU0 FireTask(I64)\n{\n MyMass *tmpm;\n I64 i;\n if (gun_recoil) return;\n\n tmpm=CAlloc(sizeof(MyMass),Fs->parent_task);\n tmpm->mass=10.0;\n tmpm->drag_profile_factor=0.1;\n tmpm->x=gun_x+27*Cos(gun_theta);\n tmpm->y=gun_y-15+27*Sin(gun_theta);\n tmpm->DxDt=600.0*Cos(gun_theta);\n tmpm->DyDt=600.0*Sin(gun_theta);\n tmpm->collision=FALSE;\n while (sys_task_being_scrn_updated==Fs->parent_task)\n Yield;\n QueIns(tmpm,ode->last_mass);\n\n Fs->task_end_cb=&SndTaskEndCB;\n for (i=0;i<60;i++) {\n Snd(50*Rand+10);\n Sleep(2);\n gun_recoil=i/12;\n }\n for (i=0;i<=60;i++) {\n Sleep(1);\n gun_recoil=5-i/12;\n }\n}\n\nU0 ManageShots()\n{\n I64 i;\n MyMass *tmpm,*tmpm1;\n Bool chged=FALSE;\n tmpm=ode->next_mass;\n while (tmpm!=&ode->next_mass) {\n tmpm1=tmpm->next;\n if (!(0<=tmpm->x<MAP_WIDTH) ||\n tmpm->collision) {\n QueRem(tmpm);\n for (i=tmpm->x-4;i<=tmpm->x+4;i++)\n if (0<=i<MAP_WIDTH)\n elevs[i]=ClampI64(elevs[i]+10-2*AbsI64(i-tmpm->x),0,MAP_HEIGHT-2);\n Free(tmpm);\n chged=TRUE;\n }\n tmpm=tmpm1;\n }\n if (chged)\n DrawMap;\n}\n\nU0 MoveTask(I64)\n{\n static F64 quit_time=0;\n if (quit_time)\n quit_time=tS+0.1;\n else {\n Snd(34);\n Fs->task_end_cb=&SndTaskEndCB;\n quit_time=tS+0.1;\n while (quit_time>tS)\n Yield;\n quit_time=0;\n }\n}\n\nU0 Init()\n{\n CDC *map;\n I64 i,x,y,dy;\n if (!map_dcs[0])\n map_dcs[0]=DCNew(MAP_WIDTH,MAP_HEIGHT);\n if (!map_dcs[1])\n map_dcs[1]=DCNew(MAP_WIDTH,MAP_HEIGHT);\n map=map_dcs[active_map&1];\n Fs->horz_scroll.pos=0;\n Fs->vert_scroll.pos=0;\n\n y=ToI64(0.7*MAP_HEIGHT)<<32;\n dy=0;\n for (x=0;x<MAP_WIDTH;x++) {\n dy=ClampI64(SignI64(RandI16)<<30+dy,-3<<32,3<<32);\n y=ClampI64(y+dy,ToI64(0.3*MAP_HEIGHT)<<32,(MAP_HEIGHT-2)<<32);\n elevs[x]=y.i32[1];\n }\n gun_x=RandU32%(MAP_WIDTH-100)+50;\n gun_y=elevs[gun_x];\n gun_theta=0;\n gun_recoil=0;\n for (x=gun_x-20;x<=gun_x+20;x++)\n elevs[x]=gun_y;\n\n wind_x=RandI16/250.0;\n for (i=0;i<DUST_NUM;i++) {\n dust_x[i]=RandU16%MAP_WIDTH;\n dust_y[i]=RandU16%MAP_HEIGHT;\n }\n\n ode=ODENew(0,1e-4,ODEF_HAS_MASSES);\n ode->derive=&MyDerivative;\n ode->drag_v2=0.002;\n ode->drag_v3=0.0001;\n ode->acceleration_limit=5e5;\n QueIns(ode,Fs->last_ode);\n Fs->horz_scroll.min=0;\n Fs->horz_scroll.max=MAP_WIDTH-Fs->pix_width;\n Fs->horz_scroll.pos=gun_x-Fs->pix_width/2;\n Fs->vert_scroll.min=0;\n Fs->vert_scroll.max=MAP_HEIGHT-Fs->pix_height;\n Fs->vert_scroll.pos=0;\n TaskDerivedValsUpdate;\n\n DrawMap;\n}\n\nU0 CleanUp(CMathODE *ode)\n{\n if (ode) {\n QueRem(ode);\n QueDel(&ode->next_mass,TRUE);\n ODEDel(ode);\n }\n}\n\nU0 BigGuns()\n{\n I64 ch,sc;\n\n PopUpOk(\n \"I refuse to rip-off the original\\n\"\n \"so this is intentionally crappy\\n\"\n \"and included for demonstration\\n\"\n \"purposes.\\n\\n\"\n \"Write games, don't play them.\\n\");\n\n PopUpOk(\"The map scrolls.\\n\");\n\n SettingsPush; //See SettingsPush\n\n MenuPush(\n \"File {\"\n \" Abort(,CH_SHIFT_ESC);\"\n \" Exit(,CH_ESC);\"\n \"}\"\n \"Play {\"\n \" Restart(,'\\n');\"\n \" Fire(,CH_SPACE);\"\n \" Left(,,SC_CURSOR_LEFT);\"\n \" Right(,,SC_CURSOR_RIGHT);\"\n \"}\"\n );\n\n AutoComplete;\n WinBorder(ON);\n WinMax;\n DocCursor;\n DocClear;\n DocScroll;\n Init;\n Fs->draw_it=&DrawIt;\n try {\n while (TRUE) {\n while (ScanKey(&ch,&sc))\n switch (ch) {\n case 0:\n switch (sc.u8[0]) {\n case SC_CURSOR_RIGHT:\n gun_theta+=2.0*pi/180;\n if (gun_theta>0)\n gun_theta=0;\n else\n Spawn(&MoveTask,NULL,\"Move\",,Fs);\n break;\n case SC_CURSOR_LEFT:\n gun_theta-=2.0*pi/180;\n if (gun_theta<-pi)\n gun_theta=-pi;\n else\n Spawn(&MoveTask,NULL,\"Move\",,Fs);\n break;\n }\n break;\n case '\\n':\n CleanUp(ode);\n Init;\n break;\n case CH_SPACE:\n Spawn(&FireTask,NULL,\"Fire\",,Fs);\n break;\n case CH_SHIFT_ESC:\n case CH_ESC:\n goto bg_done;\n }\n ManageShots;\n Refresh;\n }\nbg_done:\n } catch\n PutExcept;\n SettingsPop;\n DCDel(map_dcs[0]); map_dcs[0]=NULL;\n DCDel(map_dcs[1]); map_dcs[1]=NULL;\n CleanUp(ode);\n MenuPop;\n}\n\nBigGuns;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\OSTestSuite-Misc.html
// Date: unknown-date
// Language: HolyC
I64 ts_i;
F64 ts_t0;
U0 TS(U8 *desc)
{//We must set these because an app can call ProgressBarsRst.
U8 *st=MStrPrint("%d. %s",ts_i,desc);
if (*desc)
progress3_max=1;
else
progress3_max=0;
StrPrint(progress3_desc,"%*hc%s",
(PROGRESS_DESC_LEN-StrLen(st))>>1,CH_SPACE,st);
Free(st);
progress4=ts_i++;
progress4_max=171;
progress4_t0=ts_t0;
*progress4_desc=0;
RegExe("TempleOS/OSTestSuite");
}
U0 TSFile(U8 *name,I64 mS=750)
{
CTask *task=User("#include \"%s\";Sleep(%d);\n",name,mS);
DeathWait(&task,TRUE);
}
U0 TSFileChar(U8 *name,I64 mS=750,I64 ch=CH_SPACE,Bool wait=TRUE)
{
CTask *task=User;
if (wait)
XTalkWait(task,"#include \"%s\";\n",name);
else
XTalk(task,"#include \"%s\";\n",name);
Sleep(mS);
if (ch)
PostMsgWait(task,MSG_KEY_DOWN_UP,ch,0);
DeathWait(&task,TRUE);
}
/*
U0 DoMouseDemo()
{
XTalkWait(task,"#include \"::/Demo/Graphics/MouseDemo\";\n");
}
U0 DoPullDownMenu()
{
XTalkWait(task,"#include \"::/Demo/PullDownMenu\";\n");
}
U0 DoTicTacToe()
{
XTalkWait(task,"#include \"::/Demo/Games/TicTacToe\";\n");
}
U0 DoLife()
{
XTalkWait(task,"#include \"::/Demo/Graphics/Life\";\n");
}
U0 DoZing()
{
XTalkWait(task,"#include \"::/Demo/Games/Zing\";\n");
}
U0 DoSlider()
{
XTalkWait(task,"#include \"::/Demo/Graphics/Slider\";\n");
}
U0 DoScrollBars()
{
XTalkWait(task,"#include \"::/Demo/Graphics/ScrollBars\";\n");
}
U0 DoWhap()
{
XTalkWait(task,"#include \"::/Demo/Games/Whap\";\n");
}
U0 DoDataBase()
{
XTalkWait(task,"#include \"::/Demo/Dsk/DataBase\";\n");
}
U0 DoDskRaw()
{
XTalkWait(task,"#include \"::/Demo/Dsk/DskRaw\";\n");
}
U0 DoTimeClock()
{
XTalkWait(task,"#include \"::/Apps/TimeClock\";\n");
}
U0 DoLectures()
{
XTalkWait(task,"#include \"::/Demo/Lectures\";\n");
}
U0 DoInFile()
{
XTalkWait(task,"#include \"::/Demo/InFile\";\n");
}
U0 DoSpy()
{
XTalkWait(task,"#include \"::/Demo/Spy\";\n");
}
U0 DoUnusedDefine()
{
XTalkWait(task,"#include \"::/Demo/DolDoc/UnusedDefine\";\n");
}
U0 DoOnceDemo()
{
XTalkWait(task,"#include \"::/Demo/OnceDemo\";\n");
}
*/
U0 DoRandDemo()
{
CTask *task=User;
XTalkWait(task,"#include \"::/Demo/RandDemo\";\n");
XTalkWait(task," ");
XTalkWait(task," ");
Sleep(750);
DeathWait(&task,TRUE);
}
U0 DoLowPassFilter()
{
CTask *task=User;
XTalkWait(task,"#include \"::/Demo/Graphics/LowPassFilter\";\n");
Sleep(300);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
Sleep(300);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
Sleep(300);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
Sleep(300);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
Sleep(300);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
DeathWait(&task,TRUE);
}
U0 DoMathAudioDemo()
{
CTask *task=User;
XTalkWait(task,"#include \"::/Demo/Graphics/MathAudioDemo\";\n");
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
Sleep(500);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
Sleep(500);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
Sleep(500);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
DeathWait(&task,TRUE);
}
U0 DoMsgLoop()
{
CTask *task=User;
XTalkWait(task,"#include \"::/Demo/MsgLoop\";\n");
Sleep(300);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
Sleep(300);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
DeathWait(&task,TRUE);
}
U0 DoASCIIOrgan()
{
CTask *task=User;
XTalkWait(task,"#include \"::/Demo/Snd/ASCIIOrgan\";\n");
Sleep(100);
PostMsgWait(task,MSG_KEY_DOWN_UP,'A',0);
Sleep(200);
PostMsgWait(task,MSG_KEY_DOWN_UP,'B',0);
Sleep(200);
PostMsgWait(task,MSG_KEY_DOWN_UP,'C',0);
Sleep(200);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
DeathWait(&task,TRUE);
}
U0 DoDoodle()
{
CTask *task=User;
XTalkWait(task,"#include \"::/Demo/Graphics/Doodle\";\n");
PostMsgWait(task,MSG_MS_L_DOWN,10,10);
PostMsgWait(task,MSG_MS_L_UP,100,200);
Sleep(500);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
DeathWait(&task,TRUE);
}
U0 DoSpeedLine()
{
I64 i=PURPLE+1; //+1 because TRANSPARENT
CTask *task=User;
XTalkWait(task,"#include \"::/Demo/Graphics/Speedline\";\n");
PostMsgWait(task,MSG_MS_L_DOWN,10,10);
PostMsgWait(task,MSG_MS_L_UP,100,200);
PostMsg(task,MSG_MS_R_DOWN_UP,0,0);
BirthWait(&task->popup_task);
while (i--)
PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_ESC,0);
TaskWait(task);
PostMsgWait(task,MSG_MS_L_DOWN,50,10);
PostMsgWait(task,MSG_MS_L_UP,150,200);
Sleep(1000);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
DeathWait(&task,TRUE);
}
U0 DoKeyBitMap()
{
I64 i_sc=Char2ScanCode('i');
CTask *task=User("#include \"::/Demo/KeyBitMap\";\n");
Sleep(50);
LBts(kbd.down_bitmap,i_sc);
Sleep(500);
LBtr(kbd.down_bitmap,i_sc);
Sleep(50);
DeathWait(&task,TRUE);
}
U0 DoDigits()
{
CTask *task=User;
XTalkWait(task,"#include \"::/Demo/Games/Digits\";\n");
Sleep(100);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
Sleep(100);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
Sleep(250);
PostMsgWait(task,MSG_KEY_DOWN_UP,'1',0);
Sleep(250);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
DeathWait(&task,TRUE);
}
U0 DoSymmetry()
{
CTask *task=User;
XTalkWait(task,"#include \"::/Demo/Graphics/Symmetry\";\n");
PostMsgWait(task,MSG_MS_R_DOWN,100,100);
PostMsgWait(task,MSG_MS_R_UP,200,200);
Sleep(100);
PostMsgWait(task,MSG_MS_L_DOWN,10,10);
PostMsgWait(task,MSG_MS_L_UP,100,200);
Sleep(250);
PostMsgWait(task,MSG_MS_L_DOWN,100,200);
PostMsgWait(task,MSG_MS_L_UP,400,400);
Sleep(250);
PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
DeathWait(&task,TRUE);
}
U0 DoBSpline()
{
CTask *task=User;
XTalkWait(task,"#include \"::/Demo/Graphics/BSpline\";\n");
PostMsgWait(task,MSG_MS_L_DO
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\OSTestSuite-Misc.html\n// Date: unknown-date\n// Language: HolyC\n\nI64 ts_i;\nF64 ts_t0;\n\nU0 TS(U8 *desc)\n{//We must set these because an app can call ProgressBarsRst.\n U8 *st=MStrPrint(\"%d. %s\",ts_i,desc);\n if (*desc)\n progress3_max=1;\n else\n progress3_max=0;\n StrPrint(progress3_desc,\"%*hc%s\",\n (PROGRESS_DESC_LEN-StrLen(st))>>1,CH_SPACE,st);\n Free(st);\n progress4=ts_i++;\n progress4_max=171;\n progress4_t0=ts_t0;\n *progress4_desc=0;\n RegExe(\"TempleOS/OSTestSuite\");\n}\n\nU0 TSFile(U8 *name,I64 mS=750)\n{\n CTask *task=User(\"#include \\\"%s\\\";Sleep(%d);\\n\",name,mS);\n DeathWait(&task,TRUE);\n}\n\nU0 TSFileChar(U8 *name,I64 mS=750,I64 ch=CH_SPACE,Bool wait=TRUE)\n{\n CTask *task=User;\n if (wait)\n XTalkWait(task,\"#include \\\"%s\\\";\\n\",name);\n else\n XTalk(task,\"#include \\\"%s\\\";\\n\",name);\n Sleep(mS);\n if (ch)\n PostMsgWait(task,MSG_KEY_DOWN_UP,ch,0);\n DeathWait(&task,TRUE);\n}\n\n/*\nU0 DoMouseDemo()\n{\n XTalkWait(task,\"#include \\\"::/Demo/Graphics/MouseDemo\\\";\\n\");\n}\nU0 DoPullDownMenu()\n{\n XTalkWait(task,\"#include \\\"::/Demo/PullDownMenu\\\";\\n\");\n}\nU0 DoTicTacToe()\n{\n XTalkWait(task,\"#include \\\"::/Demo/Games/TicTacToe\\\";\\n\");\n}\nU0 DoLife()\n{\n XTalkWait(task,\"#include \\\"::/Demo/Graphics/Life\\\";\\n\");\n}\nU0 DoZing()\n{\n XTalkWait(task,\"#include \\\"::/Demo/Games/Zing\\\";\\n\");\n}\nU0 DoSlider()\n{\n XTalkWait(task,\"#include \\\"::/Demo/Graphics/Slider\\\";\\n\");\n}\nU0 DoScrollBars()\n{\n XTalkWait(task,\"#include \\\"::/Demo/Graphics/ScrollBars\\\";\\n\");\n}\nU0 DoWhap()\n{\n XTalkWait(task,\"#include \\\"::/Demo/Games/Whap\\\";\\n\");\n}\nU0 DoDataBase()\n{\n XTalkWait(task,\"#include \\\"::/Demo/Dsk/DataBase\\\";\\n\");\n}\nU0 DoDskRaw()\n{\n XTalkWait(task,\"#include \\\"::/Demo/Dsk/DskRaw\\\";\\n\");\n}\nU0 DoTimeClock()\n{\n XTalkWait(task,\"#include \\\"::/Apps/TimeClock\\\";\\n\");\n}\nU0 DoLectures()\n{\n XTalkWait(task,\"#include \\\"::/Demo/Lectures\\\";\\n\");\n}\nU0 DoInFile()\n{\n XTalkWait(task,\"#include \\\"::/Demo/InFile\\\";\\n\");\n}\nU0 DoSpy()\n{\n XTalkWait(task,\"#include \\\"::/Demo/Spy\\\";\\n\");\n}\nU0 DoUnusedDefine()\n{\n XTalkWait(task,\"#include \\\"::/Demo/DolDoc/UnusedDefine\\\";\\n\");\n}\nU0 DoOnceDemo()\n{\n XTalkWait(task,\"#include \\\"::/Demo/OnceDemo\\\";\\n\");\n}\n*/\n\nU0 DoRandDemo()\n{\n CTask *task=User;\n XTalkWait(task,\"#include \\\"::/Demo/RandDemo\\\";\\n\");\n XTalkWait(task,\" \");\n XTalkWait(task,\" \");\n Sleep(750);\n DeathWait(&task,TRUE);\n}\n\nU0 DoLowPassFilter()\n{\n CTask *task=User;\n XTalkWait(task,\"#include \\\"::/Demo/Graphics/LowPassFilter\\\";\\n\");\n Sleep(300);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);\n Sleep(300);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);\n Sleep(300);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);\n Sleep(300);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);\n Sleep(300);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);\n DeathWait(&task,TRUE);\n}\n\nU0 DoMathAudioDemo()\n{\n CTask *task=User;\n XTalkWait(task,\"#include \\\"::/Demo/Graphics/MathAudioDemo\\\";\\n\");\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);\n Sleep(500);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);\n\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);\n Sleep(500);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);\n\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);\n Sleep(500);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);\n DeathWait(&task,TRUE);\n}\n\nU0 DoMsgLoop()\n{\n CTask *task=User;\n XTalkWait(task,\"#include \\\"::/Demo/MsgLoop\\\";\\n\");\n Sleep(300);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);\n Sleep(300);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);\n DeathWait(&task,TRUE);\n}\n\nU0 DoASCIIOrgan()\n{\n CTask *task=User;\n XTalkWait(task,\"#include \\\"::/Demo/Snd/ASCIIOrgan\\\";\\n\");\n Sleep(100);\n PostMsgWait(task,MSG_KEY_DOWN_UP,'A',0);\n Sleep(200);\n PostMsgWait(task,MSG_KEY_DOWN_UP,'B',0);\n Sleep(200);\n PostMsgWait(task,MSG_KEY_DOWN_UP,'C',0);\n Sleep(200);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);\n DeathWait(&task,TRUE);\n}\n\nU0 DoDoodle()\n{\n CTask *task=User;\n XTalkWait(task,\"#include \\\"::/Demo/Graphics/Doodle\\\";\\n\");\n PostMsgWait(task,MSG_MS_L_DOWN,10,10);\n PostMsgWait(task,MSG_MS_L_UP,100,200);\n Sleep(500);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);\n DeathWait(&task,TRUE);\n}\n\nU0 DoSpeedLine()\n{\n I64 i=PURPLE+1; //+1 because TRANSPARENT\n CTask *task=User;\n XTalkWait(task,\"#include \\\"::/Demo/Graphics/Speedline\\\";\\n\");\n PostMsgWait(task,MSG_MS_L_DOWN,10,10);\n PostMsgWait(task,MSG_MS_L_UP,100,200);\n PostMsg(task,MSG_MS_R_DOWN_UP,0,0);\n BirthWait(&task->popup_task);\n while (i--)\n PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);\n PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_ESC,0);\n TaskWait(task);\n PostMsgWait(task,MSG_MS_L_DOWN,50,10);\n PostMsgWait(task,MSG_MS_L_UP,150,200);\n Sleep(1000);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);\n DeathWait(&task,TRUE);\n}\n\nU0 DoKeyBitMap()\n{\n I64 i_sc=Char2ScanCode('i');\n CTask *task=User(\"#include \\\"::/Demo/KeyBitMap\\\";\\n\");\n Sleep(50);\n LBts(kbd.down_bitmap,i_sc);\n Sleep(500);\n LBtr(kbd.down_bitmap,i_sc);\n Sleep(50);\n DeathWait(&task,TRUE);\n}\n\nU0 DoDigits()\n{\n CTask *task=User;\n XTalkWait(task,\"#include \\\"::/Demo/Games/Digits\\\";\\n\");\n Sleep(100);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);\n Sleep(100);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);\n Sleep(250);\n PostMsgWait(task,MSG_KEY_DOWN_UP,'1',0);\n Sleep(250);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);\n DeathWait(&task,TRUE);\n}\n\nU0 DoSymmetry()\n{\n CTask *task=User;\n XTalkWait(task,\"#include \\\"::/Demo/Graphics/Symmetry\\\";\\n\");\n PostMsgWait(task,MSG_MS_R_DOWN,100,100);\n PostMsgWait(task,MSG_MS_R_UP,200,200);\n Sleep(100);\n PostMsgWait(task,MSG_MS_L_DOWN,10,10);\n PostMsgWait(task,MSG_MS_L_UP,100,200);\n Sleep(250);\n PostMsgWait(task,MSG_MS_L_DOWN,100,200);\n PostMsgWait(task,MSG_MS_L_UP,400,400);\n Sleep(250);\n PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);\n DeathWait(&task,TRUE);\n}\n\nU0 DoBSpline()\n{\n CTask *task=User;\n XTalkWait(task,\"#include \\\"::/Demo/Graphics/BSpline\\\";\\n\");\n PostMsgWait(task,MSG_MS_L_DO"
}
]
}
|
// Source: D:\TempleOS-Projects\html\Maze-Games-Demo.html
// Date: unknown-date
// Language: HolyC
//See TextBase Layer.
#define ATTR (BLACK<<12+WHITE<<8)
U32 text[TEXT_ROWS][TEXT_COLS];
U0 DrawIt(CTask *task,CDC *)
{ //gr.text_base gets clear 30fps, so we must use our own permanent text array.
MemCpy(gr.text_base+TEXT_COLS,text,(TEXT_ROWS-1)*TEXT_COLS*sizeof(U32));
// You can copy it this way, if you like:
// I64 i,j;
// for (j=0;j<TEXT_ROWS;j++)
// for (i=0;i<TEXT_COLS;i++)
// TextChar(task,,i,j,text[j][i]);
TextPrint(task,0,0,ATTR>>8,"Draw a maze with left bttn.");
TextPrint(task,0,1,ATTR>>8,"Solve maze starting at right click.");
}
#define STK_SIZE 2048
//We would put these as local vars
//in SolveMaze() but the system stk size
//is limited, so it's a bad habit. The heap
//is the normal TempleOS technique, but
//it's a pain in this case.
I64 stk_ptr,
stk_x [STK_SIZE],
stk_y [STK_SIZE],
stk_dir[STK_SIZE];
//Four directions:
// 0=Up,1=right,2=down,3=left
I64 dir_x[4]={ 0,+1, 0,-1}, // Could use gr_x_offsets2,gr_y_offsets2
dir_y[4]={+1, 0,-1, 0};
U0 SolveMaze(I64 x,I64 y)
{
I64 dir=0;
stk_ptr=0;
stk_x[stk_ptr]=x;
stk_y[stk_ptr]=y;
stk_dir[stk_ptr++]=dir;
while (TRUE) {
if (!(0<=x<MinI64(Fs->win_width,TEXT_COLS)) ||
!(0<=y<MinI64(Fs->win_height,TEXT_ROWS)) ) {
Beep;Beep;
break;
}
if (!text[y][x].u8[0])
text[y][x]='.'+ATTR;
x+=dir_x[dir];
y+=dir_y[dir];
//u8.[0] is the ASCII
if (text[y][x].u8[0]) {
x-=dir_x[dir];
y-=dir_y[dir];
if (++dir==4) {
if (--stk_ptr<0) return;
x=stk_x[stk_ptr];
y=stk_y[stk_ptr];
dir=stk_dir[stk_ptr];
}
} else {
dir=0;
stk_x[stk_ptr]=x;
stk_y[stk_ptr]=y;
stk_dir[stk_ptr++]=dir;
if (stk_ptr==STK_SIZE) return;
Sleep(100);
if (ScanChar)
throw;
}
}
}
U0 Maze()
{
I64 ch,x,y;
SettingsPush; //See SettingsPush
AutoComplete;
WinBorder;
WinMax;
DocCursor;
DocClear;
Fs->draw_it=&DrawIt;
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
try
do {
MemSet(text,0,sizeof(text));
while (!(ch=ScanChar)) {
x=ms.pos_text.x-Fs->win_left-Fs->scroll_x/FONT_WIDTH;
y=ms.pos_text.y-Fs->win_top-Fs->scroll_y/FONT_HEIGHT;
if (ms.lb&&!winmgr.grab_scroll)
text[y][x]=CH_SPACE+ATTRF_INVERT+ATTR;
if (ms.rb&&!winmgr.grab_scroll) {
text[y][x]='*'+ATTR;
SolveMaze(x,y);
ch=GetChar;
break;
}
Refresh;
}
} while (ch!=CH_SHIFT_ESC && ch!=CH_ESC);
catch
PutExcept;
SettingsPop;
}
Maze;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Maze-Games-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\n//See TextBase Layer.\n\n#define ATTR (BLACK<<12+WHITE<<8)\n\nU32 text[TEXT_ROWS][TEXT_COLS];\n\nU0 DrawIt(CTask *task,CDC *)\n{ //gr.text_base gets clear 30fps, so we must use our own permanent text array.\n MemCpy(gr.text_base+TEXT_COLS,text,(TEXT_ROWS-1)*TEXT_COLS*sizeof(U32));\n\n // You can copy it this way, if you like:\n // I64 i,j;\n // for (j=0;j<TEXT_ROWS;j++)\n // for (i=0;i<TEXT_COLS;i++)\n // TextChar(task,,i,j,text[j][i]);\n\n TextPrint(task,0,0,ATTR>>8,\"Draw a maze with left bttn.\");\n TextPrint(task,0,1,ATTR>>8,\"Solve maze starting at right click.\");\n}\n\n#define STK_SIZE 2048\n//We would put these as local vars\n//in SolveMaze() but the system stk size\n//is limited, so it's a bad habit. The heap\n//is the normal TempleOS technique, but\n//it's a pain in this case.\nI64 stk_ptr,\n stk_x [STK_SIZE],\n stk_y [STK_SIZE],\n stk_dir[STK_SIZE];\n\n//Four directions:\n// 0=Up,1=right,2=down,3=left\nI64 dir_x[4]={ 0,+1, 0,-1}, // Could use gr_x_offsets2,gr_y_offsets2\n dir_y[4]={+1, 0,-1, 0};\n\nU0 SolveMaze(I64 x,I64 y)\n{\n I64 dir=0;\n stk_ptr=0;\n stk_x[stk_ptr]=x;\n stk_y[stk_ptr]=y;\n stk_dir[stk_ptr++]=dir;\n while (TRUE) {\n if (!(0<=x<MinI64(Fs->win_width,TEXT_COLS)) ||\n !(0<=y<MinI64(Fs->win_height,TEXT_ROWS)) ) {\n Beep;Beep;\n break;\n }\n if (!text[y][x].u8[0])\n text[y][x]='.'+ATTR;\n x+=dir_x[dir];\n y+=dir_y[dir];\n//u8.[0] is the ASCII\n if (text[y][x].u8[0]) {\n x-=dir_x[dir];\n y-=dir_y[dir];\n if (++dir==4) {\n if (--stk_ptr<0) return;\n x=stk_x[stk_ptr];\n y=stk_y[stk_ptr];\n dir=stk_dir[stk_ptr];\n }\n } else {\n dir=0;\n stk_x[stk_ptr]=x;\n stk_y[stk_ptr]=y;\n stk_dir[stk_ptr++]=dir;\n if (stk_ptr==STK_SIZE) return;\n Sleep(100);\n if (ScanChar)\n throw;\n }\n }\n}\n\nU0 Maze()\n{\n I64 ch,x,y;\n\n SettingsPush; //See SettingsPush\n AutoComplete;\n WinBorder;\n WinMax;\n DocCursor;\n DocClear;\n Fs->draw_it=&DrawIt;\n Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;\n\n try\n do {\n MemSet(text,0,sizeof(text));\n while (!(ch=ScanChar)) {\n x=ms.pos_text.x-Fs->win_left-Fs->scroll_x/FONT_WIDTH;\n y=ms.pos_text.y-Fs->win_top-Fs->scroll_y/FONT_HEIGHT;\n if (ms.lb&&!winmgr.grab_scroll)\n text[y][x]=CH_SPACE+ATTRF_INVERT+ATTR;\n if (ms.rb&&!winmgr.grab_scroll) {\n text[y][x]='*'+ATTR;\n SolveMaze(x,y);\n ch=GetChar;\n break;\n }\n Refresh;\n }\n } while (ch!=CH_SHIFT_ESC && ch!=CH_ESC);\n catch\n PutExcept;\n SettingsPop;\n}\n\nMaze;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\SpriteSideBar-Gr-Adam.html
// Date: unknown-date
// Language: HolyC
#help_index "Graphics/Sprite;Sprites"
CSprite *SpriteSideBar2SpriteQue(CDoc *doc,CSprite *head,I64 *_cur_elem_num)
{//For the side-bar
CSprite *res=CAlloc(sizeof(CSprite)),*tmpg;
CDocEntry *doc_e=doc->head.next;
Bool found=FALSE;
I64 num=0;
QueInit(res);
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_MENU_VAL && doc_e->left_exp>=0) {
tmpg=SpriteSetSettings(,head,doc_e->left_exp);
if (tmpg!=head) {
tmpg=MAllocIdent(tmpg);
BEqu(&tmpg->type,SPf_SEL,Bt(&doc_e->type,DOCEt_SEL));
if (*_cur_elem_num==doc_e->left_exp) {
*_cur_elem_num=num;
found=TRUE;
}
QueIns(tmpg,res->last);
num++;
}
}
doc_e=doc_e->next;
}
if (!found)
*_cur_elem_num=num;
QueDel(head);
Free(head);
return res;
}
U0 SpriteSideBarPickNew(CDoc *doc,CSprite *head,I64 old_num)
{
CSprite *tmpg;
CDocEntry *doc_cur_e=NULL,*doc_e;
I64 cur_elem_num=0;
U8 *st;
DocPrint(doc,"$PURPLE$$TX+CX,\"Sprite SideBar\"$\n"
"$LK+PU+CX,\"Click for Help\","
"A=\"FI:::/Doc/SpriteSideBar.DD.Z\"$\n\n");
tmpg=head->next;
while (tmpg!=head) {
st=SpriteElem2Summary(tmpg);
if (cur_elem_num==old_num)
doc_cur_e=doc_e=
DocPrint(doc,"$LTRED$$MU-UL,\"%$Q\",LE=%d$\n",st,cur_elem_num++);
else
doc_e=DocPrint(doc,"$LTBLUE$$MU-UL,\"%$Q\",LE=%d$\n",st,cur_elem_num++);
BEqu(&doc_e->de_flags,DOCEf_SEL,Bt(&tmpg->type,&SPf_SEL));
BEqu(&doc_e->type,DOCEt_SEL,Bt(&tmpg->type,SPf_SEL));
Free(st);
tmpg=tmpg->next;
}
if (cur_elem_num==old_num)
doc_cur_e=DocPrint(doc,"$LTRED$$MU-UL,\"END\",LE=%d$\n",cur_elem_num);
else
DocPrint(doc,"$LTBLUE$$MU-UL,\"END\",LE=%d$\n",cur_elem_num);
if (doc_cur_e)
doc->cur_entry=doc_cur_e;
}
U0 SpriteSideBarTask2(CTask *grand_parent)
{
I64 w,h;
CTask *parent=Fs->parent_task,*pu_task;
while (TRUE) {
pu_task=grand_parent->popup_task;
if (TaskValidate(pu_task)) {
w=parent->win_right-parent->win_left;
WinHorz(pu_task->win_right+2,pu_task->win_right+2+w,parent);
h=parent->win_bottom-parent->win_top;
WinVert(pu_task->win_top,pu_task->win_top+h,parent);
}
Refresh;
}
}
U0 SpriteSideBarTask(CTask *parent,CSprite **_head,I64 *_cur_elem_num)
{
CDocEntry *doc_e;
CDoc *doc=DocPut;
Spawn(&SpriteSideBarTask2,parent,"CSpriteTask",,Fs);
doc->flags|=DOCF_SIZE_MIN|DOCF_FORM;
while (TRUE) {
SpriteSideBarPickNew(doc,*_head,*_cur_elem_num);
DocHighlightCursor(,doc);
View;
doc_e=doc->cur_entry;
if (doc_e->type_u8==DOCT_MENU_VAL)
*_cur_elem_num=doc_e->left_exp;
*_head=SpriteSideBar2SpriteQue(doc,*_head,_cur_elem_num);
DocClear(doc);
}
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\SpriteSideBar-Gr-Adam.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"Graphics/Sprite;Sprites\"\n\nCSprite *SpriteSideBar2SpriteQue(CDoc *doc,CSprite *head,I64 *_cur_elem_num)\n{//For the side-bar\n CSprite *res=CAlloc(sizeof(CSprite)),*tmpg;\n CDocEntry *doc_e=doc->head.next;\n Bool found=FALSE;\n I64 num=0;\n QueInit(res);\n while (doc_e!=doc) {\n if (doc_e->type_u8==DOCT_MENU_VAL && doc_e->left_exp>=0) {\n tmpg=SpriteSetSettings(,head,doc_e->left_exp);\n if (tmpg!=head) {\n tmpg=MAllocIdent(tmpg);\n BEqu(&tmpg->type,SPf_SEL,Bt(&doc_e->type,DOCEt_SEL));\n if (*_cur_elem_num==doc_e->left_exp) {\n *_cur_elem_num=num;\n found=TRUE;\n }\n QueIns(tmpg,res->last);\n num++;\n }\n }\n doc_e=doc_e->next;\n }\n if (!found)\n *_cur_elem_num=num;\n QueDel(head);\n Free(head);\n return res;\n}\n\nU0 SpriteSideBarPickNew(CDoc *doc,CSprite *head,I64 old_num)\n{\n CSprite *tmpg;\n CDocEntry *doc_cur_e=NULL,*doc_e;\n I64 cur_elem_num=0;\n U8 *st;\n DocPrint(doc,\"$PURPLE$$TX+CX,\\\"Sprite SideBar\\\"$\\n\"\n \"$LK+PU+CX,\\\"Click for Help\\\",\"\n \"A=\\\"FI:::/Doc/SpriteSideBar.DD.Z\\\"$\\n\\n\");\n tmpg=head->next;\n while (tmpg!=head) {\n st=SpriteElem2Summary(tmpg);\n if (cur_elem_num==old_num)\n doc_cur_e=doc_e=\n DocPrint(doc,\"$LTRED$$MU-UL,\\\"%$Q\\\",LE=%d$\\n\",st,cur_elem_num++);\n else\n doc_e=DocPrint(doc,\"$LTBLUE$$MU-UL,\\\"%$Q\\\",LE=%d$\\n\",st,cur_elem_num++);\n BEqu(&doc_e->de_flags,DOCEf_SEL,Bt(&tmpg->type,&SPf_SEL));\n BEqu(&doc_e->type,DOCEt_SEL,Bt(&tmpg->type,SPf_SEL));\n Free(st);\n tmpg=tmpg->next;\n }\n if (cur_elem_num==old_num)\n doc_cur_e=DocPrint(doc,\"$LTRED$$MU-UL,\\\"END\\\",LE=%d$\\n\",cur_elem_num);\n else\n DocPrint(doc,\"$LTBLUE$$MU-UL,\\\"END\\\",LE=%d$\\n\",cur_elem_num);\n if (doc_cur_e)\n doc->cur_entry=doc_cur_e;\n}\n\nU0 SpriteSideBarTask2(CTask *grand_parent)\n{\n I64 w,h;\n CTask *parent=Fs->parent_task,*pu_task;\n while (TRUE) {\n pu_task=grand_parent->popup_task;\n if (TaskValidate(pu_task)) {\n w=parent->win_right-parent->win_left;\n WinHorz(pu_task->win_right+2,pu_task->win_right+2+w,parent);\n h=parent->win_bottom-parent->win_top;\n WinVert(pu_task->win_top,pu_task->win_top+h,parent);\n }\n Refresh;\n }\n}\n\nU0 SpriteSideBarTask(CTask *parent,CSprite **_head,I64 *_cur_elem_num)\n{\n CDocEntry *doc_e;\n CDoc *doc=DocPut;\n Spawn(&SpriteSideBarTask2,parent,\"CSpriteTask\",,Fs);\n doc->flags|=DOCF_SIZE_MIN|DOCF_FORM;\n while (TRUE) {\n SpriteSideBarPickNew(doc,*_head,*_cur_elem_num);\n DocHighlightCursor(,doc);\n View;\n doc_e=doc->cur_entry;\n if (doc_e->type_u8==DOCT_MENU_VAL)\n *_cur_elem_num=doc_e->left_exp;\n *_head=SpriteSideBar2SpriteQue(doc,*_head,_cur_elem_num);\n DocClear(doc);\n }\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\TerryQEMU-Web-AppStore-Home.html
// Date: unknown-date
// Language: HolyC
TempleOS App Store
If you want to be like Terry A. Davis, this video shows how to make your QEMU
set-up pretty close. Otherwise, use the standard /Home files.
In TempleOS, run the following command after you have downloaded all these ISO
files and it will automate the process.
>TOSStdIns;
* Free Supplemental ISO #1 by Terry A. Davis
Contents of Supplemental ISO #1.
QEMU: Change to monitor using <CTRL-ALT-2>
#info block
#eject ide1-cd0
#change ide1-cd0 /home/tad/Downloads/TempleOSSup1.ISO.C
Change back <CTRL-ALT-1>
>DskChg('T');
>CopyTree("T:/","C:/Home/Sup1");
* Free www.templeos.org ISO by Terry A. Davis
QEMU: Change to monitor using <CTRL-ALT-2>
#info block
#eject ide1-cd0
#change ide1-cd0 /home/tad/Downloads/TempleOSWeb.ISO.C
Change back <CTRL-ALT-1>
>DskChg('T');
>CopyTree("T:/","C:/Home/Web");
* Free Books ISO #1 (16.4 MB) by Terry A. Davis
Contents of Books ISO #1.
QEMU: Change to monitor using <CTRL-ALT-2>
#info block
#eject ide1-cd0
#change ide1-cd0 /home/tad/Downloads/TempleOSBooks1.ISO.C
Change back <CTRL-ALT-1>
>DskChg('T');
>CopyTree("T:/","C:/Home/Books1");
* Free Books ISO #2 (18.7 MB) by Terry A. Davis
Contents of Books ISO #2.
QEMU: Change to monitor using <CTRL-ALT-2>
#info block
#eject ide1-cd0
#change ide1-cd0 /home/tad/Downloads/TempleOSBooks2.ISO.C
Change back <CTRL-ALT-1>
>DskChg('T');
>CopyTree("T:/","C:/Home/Books2");
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\TerryQEMU-Web-AppStore-Home.html\n// Date: unknown-date\n// Language: HolyC\n\nTempleOS App Store\n\n\nIf you want to be like Terry A. Davis, this video shows how to make your QEMU \nset-up pretty close. Otherwise, use the standard /Home files.\n\n\n\nIn TempleOS, run the following command after you have downloaded all these ISO \nfiles and it will automate the process.\n\n>TOSStdIns;\n\n\n* Free Supplemental ISO #1 by Terry A. Davis\n Contents of Supplemental ISO #1.\n\n QEMU: Change to monitor using <CTRL-ALT-2>\n #info block\n #eject ide1-cd0\n #change ide1-cd0 /home/tad/Downloads/TempleOSSup1.ISO.C\n Change back <CTRL-ALT-1>\n >DskChg('T');\n >CopyTree(\"T:/\",\"C:/Home/Sup1\");\n\n* Free www.templeos.org ISO by Terry A. Davis\n QEMU: Change to monitor using <CTRL-ALT-2>\n #info block\n #eject ide1-cd0\n #change ide1-cd0 /home/tad/Downloads/TempleOSWeb.ISO.C\n Change back <CTRL-ALT-1>\n >DskChg('T');\n >CopyTree(\"T:/\",\"C:/Home/Web\");\n\n* Free Books ISO #1 (16.4 MB) by Terry A. Davis\n Contents of Books ISO #1.\n\n QEMU: Change to monitor using <CTRL-ALT-2>\n #info block\n #eject ide1-cd0\n #change ide1-cd0 /home/tad/Downloads/TempleOSBooks1.ISO.C\n Change back <CTRL-ALT-1>\n >DskChg('T');\n >CopyTree(\"T:/\",\"C:/Home/Books1\");\n\n* Free Books ISO #2 (18.7 MB) by Terry A. Davis\n Contents of Books ISO #2.\n\n QEMU: Change to monitor using <CTRL-ALT-2>\n #info block\n #eject ide1-cd0\n #change ide1-cd0 /home/tad/Downloads/TempleOSBooks2.ISO.C\n Change back <CTRL-ALT-1>\n >DskChg('T');\n >CopyTree(\"T:/\",\"C:/Home/Books2\");"
}
]
}
|
// Source: D:\TempleOS-Projects\html\Load-GrModels-Apps.html
// Date: unknown-date
// Language: HolyC
#help_index "Misc"
Cd(__DIR__);;
#include "ManGen"
#include "BallGen"
#include "Models"
#help_index ""
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Load-GrModels-Apps.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"Misc\"\n\nCd(__DIR__);;\n#include \"ManGen\"\n#include \"BallGen\"\n#include \"Models\"\n\n#help_index \"\""
}
]
}
|
// Source: D:\TempleOS-Projects\html\Sched-Kernel.html
// Date: unknown-date
// Language: HolyC
/*On each core, tasks are linked in a
circular doubly-linked list queue with
the Seth task as the head. On Core0,
the queue order represents the front-to-back
window stack order with the window mgr
as the wallpaper.
The scheduler is round-robin. It checks
if a task is ready and runs it or skips it.
Swapping tasks just involves storing and
restoring regs (no disk I/O for virtual
memory and no addr map changes). It is
always fully identity-mapped on all cores.
Tasks can be switched in half a microsecond.
The scheduler checks if a task is
waiting for a certain time or waiting
on a message and skips if not ready.
A task runs until it voluntarily yields ctrl
with a call to Yield(). Tasks waiting on I/O
often loop, checking for a status and
Yielding. This does not really degrade
performance, but pegs the CPU Load.
The scheduler checks for a few keys:
<CTRL-ALT-x> kill a task.
<CTRL-ALT-DEL> reboots.
<CTRL-ALT-n> Next task.
<CTRL-ALT-c> breaks execution of a program.
Each core has its own circular task queue.
For AP processors, they have a "Seth" task
which stays in a loop waiting for jobs or
requests to spawn tasks. See CoreAPSethTask().
*/
U0 TaskFocusNext()
{
CTask *task,*_task=sys_focus_task;
sys_focus_task=NULL;
if (!_task) _task=adam_task;
task=_task->next_task;
do {
if (!Bt(&task->win_inhibit,WIf_SELF_FOCUS)) {
sys_focus_task=task;
CallExtNum(EXT_WIN_TO_TOP,task,TRUE);
return;
}
task=task->next_task;
} while (task!=_task);
}
asm {
TASK_CONTEXT_SAVE::
//OUT: RSI=FS
PUSH RSI
PUSHFD
XOR RSI,RSI
MOV RSI,FS:CTask.addr[RSI]
POP U64 CTask.rflags[RSI]
POP U64 CTask.rsi[RSI]
MOV U64 CTask.rax[RSI],RAX
/*Divert the stk to the Task memory
and push onto it and divert it back.
It's a little faster.
*/
MOV RAX,RSP
LEA RSP,U64 CTask.r15+8[RSI]
PUSH R15
PUSH R14
PUSH R13
PUSH R12
PUSH R11
PUSH R10
PUSH R9
PUSH R8
PUSH RDI
PUSH RBP
PUSH RBX
PUSH RDX
PUSH RCX
MOV RSP,RAX
MOV RAX,U64 CTask.fpu_mmx[RSI]
FXSAVE U64 [RAX]
MOV RDX,U64 CTask.bpt_lst[RSI]
@@05: TEST RDX,RDX
JZ @@10
MOV RDI,U64 CBpt.addr[RDX]
MOV AL,U8 CBpt.val[RDX]
MOV U8 [RDI],AL
MOV RDX,U64 CBpt.next[RDX]
JMP @@05
@@10: RET
//************************************
_TASK_CONTEXT_RESTORE::
XOR RAX,RAX
INC U64 GS:CCPU.swap_cnter[RAX]
MOV RSI,FS:CTask.addr[RAX]
BT U32 CTask.rflags[RSI],RFLAGf_INT
JNC @@05
BTS U32 GS:CCPU.cpu_flags[RAX],CPUf_RAN_A_TASK
@@05: BT U64 CTask.task_flags[RSI],TASKf_DISABLE_BPTS
JC @@15
MOV RDX,U64 CTask.bpt_lst[RSI]
@@10: TEST RDX,RDX
JZ @@15
MOV RDI,U64 CBpt.addr[RDX]
MOV U8 [RDI],OC_BPT
MOV RDX,U64 CBpt.next[RDX]
JMP @@10
@@15: INC U64 CTask.swap_cnter[RSI]
MOV RAX,U64 CTask.fpu_mmx[RSI]
FXRSTOR U64 [RAX]
MOV RAX,RSP
LEA RSP,U64 CTask.rcx[RSI]
POP RCX
POP RDX
POP RBX
POP RBP
POP RDI
POP R8
POP R9
POP R10
POP R11
POP R12
POP R13
POP R14
POP R15
MOV RSP,RAX
MOV RAX,U64 CTask.rax[RSI]
PUSH CGDT.ds
PUSH U64 CTask.rsp[RSI]
PUSH U64 CTask.rflags[RSI]
PUSH CGDT.cs64
PUSH U64 CTask.rip[RSI]
MOV RSI,U64 CTask.rsi[RSI]
IRET
//************************************
END_RSI_TASK:
MOV RAX,RSI
CALL SET_FS_BASE
_TASK_END_NOW::
CALL &TaskEnd
MOV RSI,RAX
CALL SET_FS_BASE
JMP I8 RESTORE_RSI_TASK
_YIELD::
PUSHFD
TEST U8 [SYS_SEMAS+SEMA_SINGLE_USER*DFT_CACHE_LINE_WIDTH],1
JZ @@05
POPFD //If single user, don't change task.
RET
@@05: CLI
CALL TASK_CONTEXT_SAVE
MOV EBX,U32 _RET
MOV U64 CTask.rip[RSI],RBX
POP U64 CTask.rflags[RSI]
MOV U64 CTask.rsp[RSI],RSP
MOV RSI,U64 CTask.next_task[RSI]
RESTORE_RSI_TASK:
TEST U64 [SYS_CTRL_ALT_FLAGS],1<<CTRL_ALT_DEL|
1<<CTRL_ALT_TAB|1<<CTRL_ALT_X|1<<CTRL_ALT_C
JNZ HANDLE_SYSF_KEY_EVENT
RESTORE_RSI_TASK2:
@@20: BT U64 CTask.task_flags[RSI],TASKf_KILL_TASK
JC END_RSI_TASK
TEST U64 CTask.task_flags[RSI],
1<<TASKf_AWAITING_MSG|1<<TASKf_SUSPENDED
JNZ @@25
MOV RAX,U64 [&cnts.jiffies]
CMP U64 CTask.wake_jiffy[RSI],RAX
JG @@25 //Jmp if not ready, yet.
MOV RAX,RSI
CALL SET_FS_BASE
JMP I32 _TASK_CONTEXT_RESTORE
@@25: MOV RSI,U64 CTask.next_task[RSI]
XOR RAX,RAX
CMP U64 GS:CCPU.seth_task[RAX],RSI
JNE @@20 //Jmp if not Seth
BTR U32 GS:CCPU.cpu_flags[RAX],CPUf_RAN_A_TASK
JC @@20 //Jmp if had chance for IRQ already
MOV RAX,U64 GS:CCPU.idle_task[RAX]
MOV RSP,U64 CTask.stk[RAX]
ADD RSP,MEM_DFT_STK+CTaskStk.stk_base //Rst to top
CALL SET_FS_BASE
STI //Restore idle task so we can unmask IRQs.
HLT
SYS_IDLE_PT::
CLI
RESTORE_SETH_TASK_IF_READY:
XOR RAX,RAX
MOV RSI,GS:CCPU.seth_task[RAX]
JMP RESTORE_RSI_TASK
HANDLE_SYSF_KEY_EVENT:
MOV RAX,RSI
CALL SET_FS_BASE
XOR RBX,RBX
MOV RAX,GS:CCPU.num[RBX]
TEST RAX,RAX
JNZ I32 RESTORE_RSI_TASK2
MOV EAX,U32 SYS_CTRL_ALT_
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Sched-Kernel.html\n// Date: unknown-date\n// Language: HolyC\n\n/*On each core, tasks are linked in a\ncircular doubly-linked list queue with\nthe Seth task as the head. On Core0,\nthe queue order represents the front-to-back\nwindow stack order with the window mgr\nas the wallpaper.\n\nThe scheduler is round-robin. It checks\nif a task is ready and runs it or skips it.\nSwapping tasks just involves storing and\nrestoring regs (no disk I/O for virtual\nmemory and no addr map changes). It is\nalways fully identity-mapped on all cores.\nTasks can be switched in half a microsecond.\n\nThe scheduler checks if a task is\nwaiting for a certain time or waiting\non a message and skips if not ready.\nA task runs until it voluntarily yields ctrl\nwith a call to Yield(). Tasks waiting on I/O\noften loop, checking for a status and\nYielding. This does not really degrade\nperformance, but pegs the CPU Load.\n\nThe scheduler checks for a few keys:\n\n<CTRL-ALT-x> kill a task.\n<CTRL-ALT-DEL> reboots.\n<CTRL-ALT-n> Next task.\n<CTRL-ALT-c> breaks execution of a program.\n\nEach core has its own circular task queue.\nFor AP processors, they have a \"Seth\" task\nwhich stays in a loop waiting for jobs or\nrequests to spawn tasks. See CoreAPSethTask().\n*/\n\nU0 TaskFocusNext()\n{\n CTask *task,*_task=sys_focus_task;\n sys_focus_task=NULL;\n if (!_task) _task=adam_task;\n task=_task->next_task;\n do {\n if (!Bt(&task->win_inhibit,WIf_SELF_FOCUS)) {\n sys_focus_task=task;\n CallExtNum(EXT_WIN_TO_TOP,task,TRUE);\n return;\n }\n task=task->next_task;\n } while (task!=_task);\n}\n\nasm {\nTASK_CONTEXT_SAVE::\n//OUT: RSI=FS\n PUSH RSI\n PUSHFD\n XOR RSI,RSI\n MOV RSI,FS:CTask.addr[RSI]\n POP U64 CTask.rflags[RSI]\n POP U64 CTask.rsi[RSI]\n MOV U64 CTask.rax[RSI],RAX\n\n/*Divert the stk to the Task memory\nand push onto it and divert it back.\nIt's a little faster.\n*/\n MOV RAX,RSP\n LEA RSP,U64 CTask.r15+8[RSI]\n PUSH R15\n PUSH R14\n PUSH R13\n PUSH R12\n PUSH R11\n PUSH R10\n PUSH R9\n PUSH R8\n PUSH RDI\n PUSH RBP\n PUSH RBX\n PUSH RDX\n PUSH RCX\n MOV RSP,RAX\n\n MOV RAX,U64 CTask.fpu_mmx[RSI]\n FXSAVE U64 [RAX]\n\n MOV RDX,U64 CTask.bpt_lst[RSI]\n@@05: TEST RDX,RDX\n JZ @@10\n MOV RDI,U64 CBpt.addr[RDX]\n MOV AL,U8 CBpt.val[RDX]\n MOV U8 [RDI],AL\n MOV RDX,U64 CBpt.next[RDX]\n JMP @@05\n@@10: RET\n//************************************\n_TASK_CONTEXT_RESTORE::\n XOR RAX,RAX\n INC U64 GS:CCPU.swap_cnter[RAX]\n MOV RSI,FS:CTask.addr[RAX]\n BT U32 CTask.rflags[RSI],RFLAGf_INT\n JNC @@05\n BTS U32 GS:CCPU.cpu_flags[RAX],CPUf_RAN_A_TASK\n@@05: BT U64 CTask.task_flags[RSI],TASKf_DISABLE_BPTS\n JC @@15\n MOV RDX,U64 CTask.bpt_lst[RSI]\n@@10: TEST RDX,RDX\n JZ @@15\n MOV RDI,U64 CBpt.addr[RDX]\n MOV U8 [RDI],OC_BPT\n MOV RDX,U64 CBpt.next[RDX]\n JMP @@10\n\n@@15: INC U64 CTask.swap_cnter[RSI]\n\n MOV RAX,U64 CTask.fpu_mmx[RSI]\n FXRSTOR U64 [RAX]\n\n MOV RAX,RSP\n LEA RSP,U64 CTask.rcx[RSI]\n POP RCX\n POP RDX\n POP RBX\n POP RBP\n POP RDI\n POP R8\n POP R9\n POP R10\n POP R11\n POP R12\n POP R13\n POP R14\n POP R15\n MOV RSP,RAX\n\n MOV RAX,U64 CTask.rax[RSI]\n PUSH CGDT.ds\n PUSH U64 CTask.rsp[RSI]\n PUSH U64 CTask.rflags[RSI]\n PUSH CGDT.cs64\n PUSH U64 CTask.rip[RSI]\n MOV RSI,U64 CTask.rsi[RSI]\n IRET\n//************************************\nEND_RSI_TASK:\n MOV RAX,RSI\n CALL SET_FS_BASE\n_TASK_END_NOW::\n CALL &TaskEnd\n MOV RSI,RAX\n CALL SET_FS_BASE\n JMP I8 RESTORE_RSI_TASK\n\n_YIELD::\n PUSHFD\n TEST U8 [SYS_SEMAS+SEMA_SINGLE_USER*DFT_CACHE_LINE_WIDTH],1\n JZ @@05\n POPFD //If single user, don't change task.\n RET\n\n@@05: CLI\n CALL TASK_CONTEXT_SAVE\n MOV EBX,U32 _RET\n MOV U64 CTask.rip[RSI],RBX\n POP U64 CTask.rflags[RSI]\n MOV U64 CTask.rsp[RSI],RSP\n MOV RSI,U64 CTask.next_task[RSI]\n\nRESTORE_RSI_TASK:\n TEST U64 [SYS_CTRL_ALT_FLAGS],1<<CTRL_ALT_DEL|\n1<<CTRL_ALT_TAB|1<<CTRL_ALT_X|1<<CTRL_ALT_C\n JNZ HANDLE_SYSF_KEY_EVENT\n\nRESTORE_RSI_TASK2:\n@@20: BT U64 CTask.task_flags[RSI],TASKf_KILL_TASK\n JC END_RSI_TASK\n TEST U64 CTask.task_flags[RSI],\n 1<<TASKf_AWAITING_MSG|1<<TASKf_SUSPENDED\n JNZ @@25\n\n MOV RAX,U64 [&cnts.jiffies]\n CMP U64 CTask.wake_jiffy[RSI],RAX\n JG @@25 //Jmp if not ready, yet.\n\n MOV RAX,RSI\n CALL SET_FS_BASE\n JMP I32 _TASK_CONTEXT_RESTORE\n\n@@25: MOV RSI,U64 CTask.next_task[RSI]\n XOR RAX,RAX\n CMP U64 GS:CCPU.seth_task[RAX],RSI\n JNE @@20 //Jmp if not Seth\n BTR U32 GS:CCPU.cpu_flags[RAX],CPUf_RAN_A_TASK\n JC @@20 //Jmp if had chance for IRQ already\n MOV RAX,U64 GS:CCPU.idle_task[RAX]\n MOV RSP,U64 CTask.stk[RAX]\n ADD RSP,MEM_DFT_STK+CTaskStk.stk_base //Rst to top\n CALL SET_FS_BASE\n STI //Restore idle task so we can unmask IRQs.\n HLT\nSYS_IDLE_PT::\n CLI\n\nRESTORE_SETH_TASK_IF_READY:\n XOR RAX,RAX\n MOV RSI,GS:CCPU.seth_task[RAX]\n JMP RESTORE_RSI_TASK\n\nHANDLE_SYSF_KEY_EVENT:\n MOV RAX,RSI\n CALL SET_FS_BASE\n XOR RBX,RBX\n MOV RAX,GS:CCPU.num[RBX]\n TEST RAX,RAX\n JNZ I32 RESTORE_RSI_TASK2\n\n MOV EAX,U32 SYS_CTRL_ALT_"
}
]
}
|
// Source: D:\TempleOS-Projects\html\DblSpaceScan-Sup1-Sup1Utils-Home.html
// Date: unknown-date
// Language: HolyC
I64 DblSpaceScanFile(U8 *filename)
{
CDoc *doc=DocRead(filename);
I64 i,res=0;
CDocEntry *doc_e=doc->head.next;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_NEW_LINE &&
doc_e->next->type_u8==DOCT_NEW_LINE &&
doc_e->next->next->type_u8==DOCT_NEW_LINE) {
i=0;
while (doc_e->type_u8==DOCT_NEW_LINE) {
i++;
doc_e=doc_e->next;
}
"%02d:",i;
PutFileLink(doc->filename.name,,doc_e->y);
'\n';
res+=i;
} else
doc_e=doc_e->next;
}
DocDel(doc);
return res;
}
I64 DblSpaceScanLst(CDirEntry *tmpde)
{
I64 res=0;
CDirEntry *tmpde1;
while (tmpde) {
tmpde1=tmpde->next;
if (tmpde->attr & RS_ATTR_DIR) {
if (tmpde->sub) {
"Scanning Directory: %s\n",tmpde->full_name;
res+=DblSpaceScanLst(tmpde->sub);
}
} else
res+=DblSpaceScanFile(tmpde->full_name);
DirEntryDel(tmpde);
tmpde=tmpde1;
}
return res;
}
public I64 DblSpaceScan(U8 *files_find_mask="*",U8 *fu_flags=NULL)
{
I64 f=0;
ScanFlags(&f,Define("ST_FILE_UTIL_FLAGS"),"+r+S");
ScanFlags(&f,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
return DblSpaceScanLst(FilesFind(files_find_mask,f));
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\DblSpaceScan-Sup1-Sup1Utils-Home.html\n// Date: unknown-date\n// Language: HolyC\n\nI64 DblSpaceScanFile(U8 *filename)\n{\n CDoc *doc=DocRead(filename);\n I64 i,res=0;\n CDocEntry *doc_e=doc->head.next;\n while (doc_e!=doc) {\n if (doc_e->type_u8==DOCT_NEW_LINE &&\n doc_e->next->type_u8==DOCT_NEW_LINE &&\n doc_e->next->next->type_u8==DOCT_NEW_LINE) {\n i=0;\n while (doc_e->type_u8==DOCT_NEW_LINE) {\n i++;\n doc_e=doc_e->next;\n }\n \"%02d:\",i;\n PutFileLink(doc->filename.name,,doc_e->y);\n '\\n';\n res+=i;\n } else\n doc_e=doc_e->next;\n }\n DocDel(doc);\n return res;\n}\n\nI64 DblSpaceScanLst(CDirEntry *tmpde)\n{\n I64 res=0;\n CDirEntry *tmpde1;\n while (tmpde) {\n tmpde1=tmpde->next;\n if (tmpde->attr & RS_ATTR_DIR) {\n if (tmpde->sub) {\n \"Scanning Directory: %s\\n\",tmpde->full_name;\n res+=DblSpaceScanLst(tmpde->sub);\n }\n } else\n res+=DblSpaceScanFile(tmpde->full_name);\n DirEntryDel(tmpde);\n tmpde=tmpde1;\n }\n return res;\n}\n\npublic I64 DblSpaceScan(U8 *files_find_mask=\"*\",U8 *fu_flags=NULL)\n{\n I64 f=0;\n ScanFlags(&f,Define(\"ST_FILE_UTIL_FLAGS\"),\"+r+S\");\n ScanFlags(&f,Define(\"ST_FILE_UTIL_FLAGS\"),fu_flags);\n return DblSpaceScanLst(FilesFind(files_find_mask,f));\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\medians-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has words
-] Reward1
CallExtStr("JukeReward",""
-] Reward2
"dykes Sprint bequest calcine "
"glaucoma bo's'n buttressed cheesecake "
"triumphing attend eucalyptus's Novocain's "
"incongruously Ionic's Lestrade Yakut's "
"Pennsylvanian's insentient Mithridates's mottle "
);
U0 Song()
{
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.480;
music.stacatto_factor= 0.902;
try {
while (!ScanKey) {
Play("5etDDDeCDECqD4eB5DFEDCqD",
"Road \0to \0Hell? \0 \0 \0Side\0walk's \0full.\n\0"
" \0 \0 \0 \0 \0 \0 \0");
Play("etDDDeCDECqD4eB5DFEDCqD",
"Get \0a \0Pell? \0 \0 \0Grav\0ity's \0pull.\n\0"
" \0 \0 \0 \0 \0 \0 \0");
Play("sF4G5eE4sB5G4eA5C4A5sEGeEetECF4eAAqGA",
"Mean \0 \0time? \0 \0 \0 \0Fail\0ure.\n\0"
" \0 \0 \0 \0 \0 \0 \0 \0 \0 \0");
Play("5sF4G5eE4sB5G4eA5C4A5sEGeEetECF4eAAqGA",
"Thine \0 \0dime? \0 \0 \0 \0Mail\0er.\n\0"
" \0 \0 \0 \0 \0 \0 \0 \0 \0 \0");
}
} catch
PutExcept;
Snd;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\medians-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has words\n\n-] Reward1\n CallExtStr(\"JukeReward\",\"\"\n -] Reward2\n \n \"dykes Sprint bequest calcine \"\n \"glaucoma bo's'n buttressed cheesecake \"\n \"triumphing attend eucalyptus's Novocain's \"\n \"incongruously Ionic's Lestrade Yakut's \"\n \"Pennsylvanian's insentient Mithridates's mottle \"\n \n );\n\nU0 Song()\n{\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 2.480;\n music.stacatto_factor= 0.902;\n try {\n while (!ScanKey) {\n Play(\"5etDDDeCDECqD4eB5DFEDCqD\",\n \"Road \\0to \\0Hell? \\0 \\0 \\0Side\\0walk's \\0full.\\n\\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"etDDDeCDECqD4eB5DFEDCqD\",\n \"Get \\0a \\0Pell? \\0 \\0 \\0Grav\\0ity's \\0pull.\\n\\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"sF4G5eE4sB5G4eA5C4A5sEGeEetECF4eAAqGA\",\n \"Mean \\0 \\0time? \\0 \\0 \\0 \\0Fail\\0ure.\\n\\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5sF4G5eE4sB5G4eA5C4A5sEGeEetECF4eAAqGA\",\n \"Thine \\0 \\0dime? \\0 \\0 \\0 \\0Mail\\0er.\\n\\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n }\n } catch\n PutExcept;\n Snd;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\Grid-Graphics-Demo.html
// Date: unknown-date
// Language: HolyC
#define GRID 5
U0 DrawMyMs(CDC *dc,I64 x,I64 y)
{
dc->thick=1;
dc->flags&=~(DCF_TRANSFORMATION|DCF_SYMMETRY);
GrRect(dc,x,y,GRID,GRID);
}
U0 GridDemo()
{
CGridGlbls old_grid;
U0 (*old_draw_ms)(CDC *dc,I64 x,I64 y); //Can't init this type of var.
MemCpy(&old_grid,&ms_grid,sizeof(CGridGlbls));
GridInit;
ms_grid.snap=TRUE; //You can set other stuff.
ms_grid.x=GRID;
ms_grid.y=GRID;
old_draw_ms=gr.fp_draw_ms;
gr.fp_draw_ms=&DrawMyMs;
while (!ms.lb) {//Left bttn to exit.
GrPlot(,ms.pos.x,ms.pos.y);
Yield;
}
DCFill;
gr.fp_draw_ms=old_draw_ms;
MemCpy(&ms_grid,&old_grid,sizeof(CGridGlbls));
}
GridDemo;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Grid-Graphics-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\n#define GRID 5\n\nU0 DrawMyMs(CDC *dc,I64 x,I64 y)\n{\n dc->thick=1;\n dc->flags&=~(DCF_TRANSFORMATION|DCF_SYMMETRY);\n GrRect(dc,x,y,GRID,GRID);\n}\n\nU0 GridDemo()\n{\n CGridGlbls old_grid;\n U0 (*old_draw_ms)(CDC *dc,I64 x,I64 y); //Can't init this type of var.\n MemCpy(&old_grid,&ms_grid,sizeof(CGridGlbls));\n GridInit;\n ms_grid.snap=TRUE; //You can set other stuff.\n ms_grid.x=GRID;\n ms_grid.y=GRID;\n old_draw_ms=gr.fp_draw_ms;\n gr.fp_draw_ms=&DrawMyMs;\n while (!ms.lb) {//Left bttn to exit.\n GrPlot(,ms.pos.x,ms.pos.y);\n Yield;\n }\n DCFill;\n gr.fp_draw_ms=old_draw_ms;\n MemCpy(&ms_grid,&old_grid,sizeof(CGridGlbls));\n}\n\nGridDemo;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\readier-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has words
U0 Song()
{
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.646;
music.stacatto_factor= 0.989;
try {
while (!ScanKey) {
Play("4q.G5sCC4qAeBBqG5C4eAAqB");
Play("5q.CsCCeCCCC4B5DDDDD4qB",
" \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0Go!\n\0");
Play("4e.AsA5DC4eA5etDDD4eA5sEG4eB5FsFDFDeEsF4A5CGeC",
" \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0"
" \0 \0 \0 \0 \0 \0 \0 \0 \0 \0Go!\n\0");
Play("4e.AsA5DC4eA5etDDD4eA5sEG4eB5FsFDFDeEsF4A5CGeC");
}
} catch
PutExcept;
Snd;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\readier-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has words\nU0 Song()\n{\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 2.646;\n music.stacatto_factor= 0.989;\n try {\n while (!ScanKey) {\n Play(\"4q.G5sCC4qAeBBqG5C4eAAqB\");\n Play(\"5q.CsCCeCCCC4B5DDDDD4qB\",\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0Go!\\n\\0\");\n Play(\"4e.AsA5DC4eA5etDDD4eA5sEG4eB5FsFDFDeEsF4A5CGeC\",\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0Go!\\n\\0\");\n Play(\"4e.AsA5DC4eA5etDDD4eA5sEG4eB5FsFDFDeEsF4A5CGeC\");\n }\n } catch\n PutExcept;\n Snd;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\TTFDraw-ToTheFront-Apps.html
// Date: unknown-date
// Language: HolyC
<1>/* Graphics Not Rendered in HTML */
U0 UnitDraw(CDC *dc,Unit *tmpu,I64 x,I64 y,F64 f)
{
x+=x0; y+=y0;
if (tmpu->infantry)
Sprite3(dc,x,y,0,tmpu->img);
else
Sprite3ZB(dc,x,y,0,tmpu->img,f);
if (phase&~1==PHASE_INDIRECT && tmpu->indirect_fire &&
!tmpu->fired && tmpu->player==cur_player) {
dc->thick=2;
if (cur_player)
dc->color=PURPLE;
else
dc->color=CYAN;
GrCircle3(dc,x,y,0,20*Saw(4*tS,2.0));
GrCircle3(dc,x,y,0,20*Saw(4*tS+1.0,2.0));
dc->thick=1;
}
}
U0 UnitsDraw(CDC *dc)
{
I64 i,j;
F64 x,y;
Unit *tmpu;
for (j=0;j<2;j++) {
for (i=0;i<UNITS_NUM;i++) {
tmpu=&units[j][i];
if (tmpu==target_unit) {
if (target_hit)
dc->color=RED;
else
dc->color=GREEN;
} else {
if (j)
dc->color=LTPURPLE;
else
dc->color=LTCYAN;
}
if (tmpu->life>0 && Bt(&tmpu->vis[view_player],0) &&
tmpu!=moving_unit) {
RowCol2XY(&x,&y,tmpu->row,tmpu->col);
if (phase&~1==PHASE_MOVE && tmpu->remaining_movement ||
(phase&~1==PHASE_INDIRECT&& tmpu->indirect_fire||
phase&~1==PHASE_DIRECT&&!tmpu->indirect_fire) && !tmpu->fired ||
Blink(5))
UnitDraw(dc,tmpu,x,y,tmpu->facing*60.0*pi/180.0);
}
}
}
}
U0 DrawIt(CTask *task,CDC *dc)
{
F64 x,y;
I64 i,j,r,c;
U8 buf[STR_LEN];
IndirectOrders *tmpi;
//Erase text beneath.
dc->color=WHITE;
GrRect(dc,-task->scroll_x,-task->scroll_y,dc->width,dc->height);
map_dc->flags|=DCF_NO_TRANSPARENTS;
GrBlot(dc,x0,y0,map_dc);
i=ms.pos.x-task->pix_left-task->scroll_x;
j=ms.pos.y-task->pix_top -task->scroll_y;
if (CursorInWin(task,i,j)) {
i-=x0; j-=y0;
CursorUpdate(task,i,j);
}
RowCol2XY(&x,&y,cursor_row,cursor_col);
//Roads require multiple cursor fills
dc->color=YELLOW;
c=terrain[cursor_row][cursor_col];
for (i=-(HEX_SIDE+DCOS)/2;i<=(HEX_SIDE+DCOS)/2;i++) {
if (GrPeek(dc,x+i+x0,y+y0)==c)
GrFloodFill(dc,x+i+x0,y+y0);
for (j=-HEX_SIDE/2;j<=HEX_SIDE/2;j++)
if (GrPeek(dc,x+j+x0,y+i+y0)==c)
GrFloodFill(dc,x+j+x0,y+i+y0);
}
UnitsDraw(dc);
if (firing) {
dc->color=BLACK;
GrCircle(dc,fire_x+x0,fire_y+y0,2);
}
if (indirect_explosion) {
for (i=0;i<7;i++) {
if (indirect_row&1)
c=indirect_col+col_offsets_odd[i];
else
c=indirect_col+col_offsets_even[i];
r=indirect_row+row_offsets[i];
if (0<=r<map_rows && 0<=c<map_cols) {
RowCol2XY(&x,&y,r,c);
for (j=0;j<10;j++) {
if (j&1)
dc->color=LTRED;
else
dc->color=YELLOW;
GrCircle(dc,x+RandU16%HEX_SIDE-HEX_SIDE/2+x0,
y+RandU16%HEX_SIDE-HEX_SIDE/2+y0,2);
}
}
}
}
if (moving_unit && moving_unit->vis[view_player]) {
dc->color=YELLOW;
UnitDraw(dc,moving_unit,move_x,move_y,move_facing);
}
ProgressBarsRst;
if (moving_unit) {
if (ms.pos.y<GR_HEIGHT/2) {
progress4_max=moving_unit->movement;
progress4=moving_unit->remaining_movement;
} else {
progress1_max=moving_unit->movement;
progress1=moving_unit->remaining_movement;
}
}
if (fire_radius) {
dc->color=YELLOW;
GrCircle(dc,fire_radius_x+x0,fire_radius_y+y0,fire_radius-1);
GrCircle(dc,fire_radius_x+x0,fire_radius_y+y0,fire_radius+1);
dc->color=RED;
GrCircle(dc,fire_radius_x+x0,fire_radius_y+y0,fire_radius);
}
if (Blink(10)) {
tmpi=indirect_head.next;
while (tmpi!=&indirect_head) {
if (tmpi->attacker->player==view_player) {
RowCol2XY(&x,&y,tmpi->row,tmpi->col);
Sprite3(dc,x+x0,y+y0,0,<1>);
}
tmpi=tmpi->next;
}
}
if (Bt(kbd.down_bitmap,SC_SHIFT)) {
if (show_vis_row!=cursor_row || show_vis_col!=cursor_col) {
show_vis_row=cursor_row;
show_vis_col=cursor_col;
VisRecalcMap(show_vis_row,show_vis_col);
}
dc->color=LTGRAY;
for (j=0;j<map_rows;j++)
for (i=0;i<map_cols;i++)
if (!vis_map[j][i]) {
RowCol2XY(&x,&y,j,i);
GrLine(dc,x-6+x0,y-6+y0,x+6+x0,y+6+y0);
GrLine(dc,x+6+x0,y-6+y0,x-6+x0,y+6+y0);
GrLine(dc,x+x0,y-6+y0,x+x0,y+6+y0);
GrLine(dc,x+6+x0,y+y0,x-6+x0,y+y0);
}
}
if (i=StrLen(msg_buf)*FONT_WIDTH) {
dc->color=BLACK;
GrRect(dc,(task->pix_width-i)>>1-10-task->scroll_x,
(task->pix_height-FONT_HEIGHT)>>1-10-task->scroll_y,
i+20,FONT_HEIGHT+20);
dc->color=YELLOW;
GrRect(dc,(task->pix_width-i)>>1-7-task->scroll_x,
(task->pix_height-FONT_HEIGHT)>>1-7-task->scroll_y,
i+14,FONT_HEIGHT+14);
dc->color=RED;
GrPrint(dc,(task->pix_width-i)>>1-task->scroll_x,
(task->pix_height-FONT_HEIGHT)>>1-task->scroll_y,
msg_buf);
if (msg_off_timeout) {
if (msg_off_timeout-cnts.jiffies<3*JIFFY_FREQ/2*animation_delay)
Snd;
if (cnts.jiffies>msg_off_timeout)
*msg_buf=0;
}
}
dc->color=WHITE;
GrRect(dc,-task->scroll_x,-task->scroll_y,
(13+7+10+10)*FONT_WIDTH,FONT_HEIGHT);
if (phase&~1==PHASE_INDIRECT)
StrPrint(buf,"Turn:%2d Artillery",turn);
else if (phase&~1==PHASE_MOVE)
StrPrint(buf,"Turn:%2d Move",turn);
else
StrPrint(buf,"Turn:%2d Fire",turn);
dc->color=BLACK;
GrPrint(dc,-task->scroll_x,-task->scroll_y,buf);
StrPrint(buf,"%3d Units",alive_cnt[0]);
if (cur_player || Blink)
dc->color=CYAN;
else
dc->color=LTCYAN;
GrPrint(dc,-task->scroll_x+(13+7)*FONT_WIDTH,-task->scroll_y,buf);
StrPrint(buf,"%3d Units",alive_cnt[1]);
if (!cur_player || Blink)
dc->color=PURPLE;
else
dc->color=LTPURPLE;
GrPrint(dc,-task->scroll_x+(13+7+10)*FONT_WIDTH,-task->scroll_y,buf);
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\TTFDraw-ToTheFront-Apps.html\n// Date: unknown-date\n// Language: HolyC\n\n<1>/* Graphics Not Rendered in HTML */\n\nU0 UnitDraw(CDC *dc,Unit *tmpu,I64 x,I64 y,F64 f)\n{\n x+=x0; y+=y0;\n if (tmpu->infantry)\n Sprite3(dc,x,y,0,tmpu->img);\n else\n Sprite3ZB(dc,x,y,0,tmpu->img,f);\n if (phase&~1==PHASE_INDIRECT && tmpu->indirect_fire &&\n !tmpu->fired && tmpu->player==cur_player) {\n dc->thick=2;\n if (cur_player)\n dc->color=PURPLE;\n else\n dc->color=CYAN;\n GrCircle3(dc,x,y,0,20*Saw(4*tS,2.0));\n GrCircle3(dc,x,y,0,20*Saw(4*tS+1.0,2.0));\n dc->thick=1;\n }\n}\n\nU0 UnitsDraw(CDC *dc)\n{\n I64 i,j;\n F64 x,y;\n Unit *tmpu;\n for (j=0;j<2;j++) {\n for (i=0;i<UNITS_NUM;i++) {\n tmpu=&units[j][i];\n if (tmpu==target_unit) {\n if (target_hit)\n dc->color=RED;\n else\n dc->color=GREEN;\n } else {\n if (j)\n dc->color=LTPURPLE;\n else\n dc->color=LTCYAN;\n }\n if (tmpu->life>0 && Bt(&tmpu->vis[view_player],0) &&\n tmpu!=moving_unit) {\n RowCol2XY(&x,&y,tmpu->row,tmpu->col);\n if (phase&~1==PHASE_MOVE && tmpu->remaining_movement ||\n (phase&~1==PHASE_INDIRECT&& tmpu->indirect_fire||\n phase&~1==PHASE_DIRECT&&!tmpu->indirect_fire) && !tmpu->fired ||\n Blink(5))\n UnitDraw(dc,tmpu,x,y,tmpu->facing*60.0*pi/180.0);\n }\n }\n }\n}\n\nU0 DrawIt(CTask *task,CDC *dc)\n{\n F64 x,y;\n I64 i,j,r,c;\n U8 buf[STR_LEN];\n IndirectOrders *tmpi;\n\n //Erase text beneath.\n dc->color=WHITE;\n GrRect(dc,-task->scroll_x,-task->scroll_y,dc->width,dc->height);\n\n map_dc->flags|=DCF_NO_TRANSPARENTS;\n GrBlot(dc,x0,y0,map_dc);\n\n i=ms.pos.x-task->pix_left-task->scroll_x;\n j=ms.pos.y-task->pix_top -task->scroll_y;\n if (CursorInWin(task,i,j)) {\n i-=x0; j-=y0;\n CursorUpdate(task,i,j);\n }\n RowCol2XY(&x,&y,cursor_row,cursor_col);\n\n //Roads require multiple cursor fills\n dc->color=YELLOW;\n c=terrain[cursor_row][cursor_col];\n for (i=-(HEX_SIDE+DCOS)/2;i<=(HEX_SIDE+DCOS)/2;i++) {\n if (GrPeek(dc,x+i+x0,y+y0)==c)\n GrFloodFill(dc,x+i+x0,y+y0);\n for (j=-HEX_SIDE/2;j<=HEX_SIDE/2;j++)\n if (GrPeek(dc,x+j+x0,y+i+y0)==c)\n GrFloodFill(dc,x+j+x0,y+i+y0);\n }\n\n UnitsDraw(dc);\n if (firing) {\n dc->color=BLACK;\n GrCircle(dc,fire_x+x0,fire_y+y0,2);\n }\n if (indirect_explosion) {\n for (i=0;i<7;i++) {\n if (indirect_row&1)\n c=indirect_col+col_offsets_odd[i];\n else\n c=indirect_col+col_offsets_even[i];\n r=indirect_row+row_offsets[i];\n if (0<=r<map_rows && 0<=c<map_cols) {\n RowCol2XY(&x,&y,r,c);\n for (j=0;j<10;j++) {\n if (j&1)\n dc->color=LTRED;\n else\n dc->color=YELLOW;\n GrCircle(dc,x+RandU16%HEX_SIDE-HEX_SIDE/2+x0,\n y+RandU16%HEX_SIDE-HEX_SIDE/2+y0,2);\n }\n }\n }\n }\n if (moving_unit && moving_unit->vis[view_player]) {\n dc->color=YELLOW;\n UnitDraw(dc,moving_unit,move_x,move_y,move_facing);\n }\n ProgressBarsRst;\n if (moving_unit) {\n if (ms.pos.y<GR_HEIGHT/2) {\n progress4_max=moving_unit->movement;\n progress4=moving_unit->remaining_movement;\n } else {\n progress1_max=moving_unit->movement;\n progress1=moving_unit->remaining_movement;\n }\n }\n if (fire_radius) {\n dc->color=YELLOW;\n GrCircle(dc,fire_radius_x+x0,fire_radius_y+y0,fire_radius-1);\n GrCircle(dc,fire_radius_x+x0,fire_radius_y+y0,fire_radius+1);\n dc->color=RED;\n GrCircle(dc,fire_radius_x+x0,fire_radius_y+y0,fire_radius);\n }\n if (Blink(10)) {\n tmpi=indirect_head.next;\n while (tmpi!=&indirect_head) {\n if (tmpi->attacker->player==view_player) {\n RowCol2XY(&x,&y,tmpi->row,tmpi->col);\n Sprite3(dc,x+x0,y+y0,0,<1>);\n }\n tmpi=tmpi->next;\n }\n }\n if (Bt(kbd.down_bitmap,SC_SHIFT)) {\n if (show_vis_row!=cursor_row || show_vis_col!=cursor_col) {\n show_vis_row=cursor_row;\n show_vis_col=cursor_col;\n VisRecalcMap(show_vis_row,show_vis_col);\n }\n\n dc->color=LTGRAY;\n for (j=0;j<map_rows;j++)\n for (i=0;i<map_cols;i++)\n if (!vis_map[j][i]) {\n RowCol2XY(&x,&y,j,i);\n GrLine(dc,x-6+x0,y-6+y0,x+6+x0,y+6+y0);\n GrLine(dc,x+6+x0,y-6+y0,x-6+x0,y+6+y0);\n GrLine(dc,x+x0,y-6+y0,x+x0,y+6+y0);\n GrLine(dc,x+6+x0,y+y0,x-6+x0,y+y0);\n }\n }\n if (i=StrLen(msg_buf)*FONT_WIDTH) {\n dc->color=BLACK;\n GrRect(dc,(task->pix_width-i)>>1-10-task->scroll_x,\n (task->pix_height-FONT_HEIGHT)>>1-10-task->scroll_y,\n i+20,FONT_HEIGHT+20);\n\n dc->color=YELLOW;\n GrRect(dc,(task->pix_width-i)>>1-7-task->scroll_x,\n (task->pix_height-FONT_HEIGHT)>>1-7-task->scroll_y,\n i+14,FONT_HEIGHT+14);\n\n dc->color=RED;\n GrPrint(dc,(task->pix_width-i)>>1-task->scroll_x,\n (task->pix_height-FONT_HEIGHT)>>1-task->scroll_y,\n msg_buf);\n if (msg_off_timeout) {\n if (msg_off_timeout-cnts.jiffies<3*JIFFY_FREQ/2*animation_delay)\n Snd;\n if (cnts.jiffies>msg_off_timeout)\n *msg_buf=0;\n }\n }\n\n dc->color=WHITE;\n GrRect(dc,-task->scroll_x,-task->scroll_y,\n (13+7+10+10)*FONT_WIDTH,FONT_HEIGHT);\n\n if (phase&~1==PHASE_INDIRECT)\n StrPrint(buf,\"Turn:%2d Artillery\",turn);\n else if (phase&~1==PHASE_MOVE)\n StrPrint(buf,\"Turn:%2d Move\",turn);\n else\n StrPrint(buf,\"Turn:%2d Fire\",turn);\n dc->color=BLACK;\n GrPrint(dc,-task->scroll_x,-task->scroll_y,buf);\n\n StrPrint(buf,\"%3d Units\",alive_cnt[0]);\n if (cur_player || Blink)\n dc->color=CYAN;\n else\n dc->color=LTCYAN;\n GrPrint(dc,-task->scroll_x+(13+7)*FONT_WIDTH,-task->scroll_y,buf);\n\n StrPrint(buf,\"%3d Units\",alive_cnt[1]);\n if (!cur_player || Blink)\n dc->color=PURPLE;\n else\n dc->color=LTPURPLE;\n GrPrint(dc,-task->scroll_x+(13+7+10)*FONT_WIDTH,-task->scroll_y,buf);\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\TOSIns-AcctExample-TOS-Demo.html
// Date: unknown-date
// Language: HolyC
#help_index "Misc/Blog"
U8 *YouTubeGet(U8 *filename="~/Sup1/Sup1Blog/YouTube.DD.Z",U8 *needle)
{
I64 i=0,line=I64_MIN;
CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR),
*doc2=DocNew;
U8 *title,*code,*res;
while (DocFind(doc,line,needle)) {
if (!(doc->cur_entry->y&1)) {
title=doc->cur_entry->tag;
DocGoToLine(doc,doc->cur_entry->y+2);
if (doc->cur_entry->type_u8==DOCT_TEXT) {
code=doc->cur_entry->tag;
DocPrint(doc2,"$MU-UL,\"%s\",LE=0x%X$\n",title,code);
i++;
}
}
line=doc->cur_entry->y+2;
}
switch (i) {
case 0:
res=NULL;
break;
case 1:
res=StrNew(code);
break;
default:
res=PopUpMenu(doc2);
if (res==DOCM_CANCEL)
res=NULL;
else
res=StrNew(res);
}
DocDel(doc);
DocDel(doc2);
return res;
}
U0 YouTubeAdd(U8 *filename="~/Sup1/Sup1Blog/YouTube.DD.Z",
U8 *title,U8 *code)
{
CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
if (!DocFind(doc,,title)) {
DocBottom(doc);
DocPrint(doc,"%s\n%s\n",title,code);
DocTop(doc);
DocWrite(doc);
Sort(filename,,2);
}
DocDel(doc);
}
U8 *WebBookMarks(U8 *filename="~/Sup1/Sup1Blog/Bookmarks.html")
{
U8 *st;
CDocEntry *doc_e;
CDoc *doc=DocNew;
CCmpCtrl *cc=CmpCtrlNew(MStrPrint("#include \"%s\"",filename));
while (Lex(cc))
if (cc->token==TK_STR && *cc->cur_str(U32 *)=='http') {
DocPrint(doc,"$MU-UL,\"%$Q\",LE=0x%X$\n",cc->cur_str,cc->cur_str);
cc->cur_str=NULL;
}
CmpCtrlDel(cc);
if ((st=PopUpMenu(doc))!=DOCM_CANCEL)
st=StrNew(st);
else
st=NULL;
doc_e=doc->head.next;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_MENU_VAL)
Free(doc_e->left_exp);
doc_e=doc_e->next;
}
DocDel(doc);
return st;
}
U0 FamilyPhoto()
{
CFamilyPhotoForm *fp=CAlloc(sizeof(CFamilyPhotoForm));
fp->width=900;
fp->height=600;
fp->part=1;
if (DocForm(fp)) {
"$HC,\"<center><img src=\\\"/%s/part%d/%s\\\" "
"width=\\\"%d\\\" height=\\\"%d\\\" alt=\\\"\\\"></center>\"$",
DefineSub(fp->volume,"ST_FAMLY_PHOTOS"),
fp->part,fp->picture,fp->width,fp->height;
}
}
U0 BlogImg()
{
U8 *st=BlogWebDir;
CBlogImgForm *bi=CAlloc(sizeof(CBlogImgForm));
bi->width=900;
bi->height=600;
if (DocForm(bi)) {
"$HC,\"<center><img src=\\\"%s/%s\\\" "
"width=\\\"%d\\\" height=\\\"%d\\\" alt=\\\"\\\"></center>\"$",
st,bi->picture,bi->width,bi->height;
}
}
U0 TOSIns()
{
CWebBibleForm *url=CAlloc(sizeof(CWebBibleForm));
U8 *tag,*st,*st2;
switch (PopUpPickLst("BiblePassage\0BibleVerse\0"
"YouTube\0Imgur\0Wikipedia\0WebBookMark\0FamilyPhoto\0BlogImg\0")) {
case:
if (DocForm(url(CWebBibleForm *))) {
tag=url->special;
st2=URLPercentSpaces(url->special);
st=MStrPrint("http://www.biblegateway.com/passage/"
"?search=%s&version=NIV",st2);
Free(st2);
if (*url->tag)
tag=url->tag;
"$TX,\"%$Q\",HTML=\"%$Q\"$",tag,st;
Free(st);
}
break;
case:
if (DocForm(url(CWebBibleForm *))) {
tag=url->special;
st2=URLPercentSpaces(url->special);
st=MStrPrint(
"http://www.biblegateway.com/verse/en/%s",st2);
Free(st2);
if (*url->tag)
tag=url->tag;
"$TX,\"%$Q\",HTML=\"%$Q\"$",tag,st;
Free(st);
}
break;
case:
if (DocForm(url(CYouTubeForm *))) {
if (*url->special==CH_SPACE)
st2=YouTubeGet(,url->tag);
else
st2=StrNew(url->special);
if (st2 && *st2!=CH_SPACE) {
if (url->min || url->sec)
st=MStrPrint("%s&hl=enUS&start=%d",st2,url->min*60+url->sec);
else
st=StrNew(st2);
if (*url->special!=CH_SPACE && *url->tag)
YouTubeAdd(,url->tag,st);
"$HC,\"<object width=\\\"640\\\" "
"height=\\\"520\\\"><param name=\\\"movie\\\" "
"value=\\\"http://www.youtube.com/v/%s\\\"></param><param "
"name=\\\"allowscriptaccess\\\" "
"value=\\\"always\\\"></param><embed "
"src=\\\"http://www.youtube.com/v/%s\\\" "
"type=\\\"application/x-shockwave-flash\\\" "
"allowscriptaccess=\\\"always\\\" "
"width=\\\"640\\\" height=\\\"520\\\">"
"</embed></object>\"$\n",st,st;
Free(st);
Free(st2);
}
}
break;
case:
if (DocForm(url(CImgurForm *))) {
"$HC,\"<center><img src=\\\"http://i.imgur.com/%s\\\" "
"width=\\\"%d\\\" height=\\\"%d\\\" "
"alt=\\\"\\\"></center>\"$\n",
url->special,url->min,url->sec;
}
break;
case:
if (DocForm(url(CWikipediaForm *))) {
tag=url->special;
st=MStrPrint("http://en.wikipedia.org/wiki/%s",url->special);
if (*url->tag)
tag=url->tag;
"$TX,\"%$Q\",HTML=\"%$Q\"$",tag,st;
Free(st);
}
break;
case:
if (DocForm(url(CWebBookMarkForm *))) {
tag=st=WebBookMarks;
if (*url->tag)
tag=url->tag;
"$TX,\"%$Q\",HTML=\"%$Q\"$",tag,st;
Free(st);
}
break;
case:
FamilyPhoto;
break;
case:
BlogImg;
break;
}
Free(url);
}
#help_index "Misc/TOS/God;God/TOS"
public U0 GodCodeJmp()
{//Jump to rand code in OS. See ::/Adam/God/HSNotes.DD.
CDirEntry *tmpde1=FilesFind("/*",
FUF_JUST_FILES|FUF_RECURSE|FUF_JUST_SRC|FUF_CLUS_ORDER),
*tmpde=tmpde1;
I64 cnt=0,num;
CDoc *doc;
U8 *st;
while (tmpde) {
doc=DocRead(tmpde->full_name);
tmpde->user_data=doc->head.y;
cnt+=doc->head.y;
DocDel(doc);
tmpde=tmpde->next;
}
FifoU8Flush(god.fifo);
GodBitsIns(GOD_GOOD_BITS,KbdMsEvtTime>>GOD_BAD_BITS);
num=GodBits(GOD_GOOD_BITS)%cnt;
tmpde=tmpde1;
while (tmpde) {
num-=tmpde->user_data;
if (num<0) {
st=MStrPrint("FL:%s,%d",tmpde->full_name,-num);
break;
}
tmpde=tmpde->next;
}
DirTreeDel(tmpde1);
Ed(st);
Free(st);
}
U0 GodOffer()
{
switch (PopUpPickLst("MosesComic\0Fiction\0")) {
case:
"---- Moses Comic ---- "
"(Set in the Numbers 11 "
"part of the story.)\n"
"Moses says, \"\"\n"
"God says, \"\"\n";
break;
case:
"---- Collaborative Fiction ----\n"
"Once upon a time ";
break;
}
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\TOSIns-AcctExample-TOS-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"Misc/Blog\"\n\nU8 *YouTubeGet(U8 *filename=\"~/Sup1/Sup1Blog/YouTube.DD.Z\",U8 *needle)\n{\n I64 i=0,line=I64_MIN;\n CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR),\n *doc2=DocNew;\n U8 *title,*code,*res;\n while (DocFind(doc,line,needle)) {\n if (!(doc->cur_entry->y&1)) {\n title=doc->cur_entry->tag;\n DocGoToLine(doc,doc->cur_entry->y+2);\n if (doc->cur_entry->type_u8==DOCT_TEXT) {\n code=doc->cur_entry->tag;\n DocPrint(doc2,\"$MU-UL,\\\"%s\\\",LE=0x%X$\\n\",title,code);\n i++;\n }\n }\n line=doc->cur_entry->y+2;\n }\n switch (i) {\n case 0:\n res=NULL;\n break;\n case 1:\n res=StrNew(code);\n break;\n default:\n res=PopUpMenu(doc2);\n if (res==DOCM_CANCEL)\n res=NULL;\n else\n res=StrNew(res);\n }\n DocDel(doc);\n DocDel(doc2);\n return res;\n}\n\nU0 YouTubeAdd(U8 *filename=\"~/Sup1/Sup1Blog/YouTube.DD.Z\",\n U8 *title,U8 *code)\n{\n CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);\n if (!DocFind(doc,,title)) {\n DocBottom(doc);\n DocPrint(doc,\"%s\\n%s\\n\",title,code);\n DocTop(doc);\n DocWrite(doc);\n Sort(filename,,2);\n }\n DocDel(doc);\n}\n\nU8 *WebBookMarks(U8 *filename=\"~/Sup1/Sup1Blog/Bookmarks.html\")\n{\n U8 *st;\n CDocEntry *doc_e;\n CDoc *doc=DocNew;\n CCmpCtrl *cc=CmpCtrlNew(MStrPrint(\"#include \\\"%s\\\"\",filename));\n while (Lex(cc))\n if (cc->token==TK_STR && *cc->cur_str(U32 *)=='http') {\n DocPrint(doc,\"$MU-UL,\\\"%$Q\\\",LE=0x%X$\\n\",cc->cur_str,cc->cur_str);\n cc->cur_str=NULL;\n }\n CmpCtrlDel(cc);\n\n if ((st=PopUpMenu(doc))!=DOCM_CANCEL)\n st=StrNew(st);\n else\n st=NULL;\n\n doc_e=doc->head.next;\n while (doc_e!=doc) {\n if (doc_e->type_u8==DOCT_MENU_VAL)\n Free(doc_e->left_exp);\n doc_e=doc_e->next;\n }\n DocDel(doc);\n\n return st;\n}\n\nU0 FamilyPhoto()\n{\n CFamilyPhotoForm *fp=CAlloc(sizeof(CFamilyPhotoForm));\n fp->width=900;\n fp->height=600;\n fp->part=1;\n if (DocForm(fp)) {\n \"$HC,\\\"<center><img src=\\\\\\\"/%s/part%d/%s\\\\\\\" \"\n \"width=\\\\\\\"%d\\\\\\\" height=\\\\\\\"%d\\\\\\\" alt=\\\\\\\"\\\\\\\"></center>\\\"$\",\n DefineSub(fp->volume,\"ST_FAMLY_PHOTOS\"),\n fp->part,fp->picture,fp->width,fp->height;\n }\n}\n\nU0 BlogImg()\n{\n U8 *st=BlogWebDir;\n CBlogImgForm *bi=CAlloc(sizeof(CBlogImgForm));\n bi->width=900;\n bi->height=600;\n if (DocForm(bi)) {\n \"$HC,\\\"<center><img src=\\\\\\\"%s/%s\\\\\\\" \"\n \"width=\\\\\\\"%d\\\\\\\" height=\\\\\\\"%d\\\\\\\" alt=\\\\\\\"\\\\\\\"></center>\\\"$\",\n st,bi->picture,bi->width,bi->height;\n }\n}\n\nU0 TOSIns()\n{\n CWebBibleForm *url=CAlloc(sizeof(CWebBibleForm));\n U8 *tag,*st,*st2;\n\n switch (PopUpPickLst(\"BiblePassage\\0BibleVerse\\0\"\n \"YouTube\\0Imgur\\0Wikipedia\\0WebBookMark\\0FamilyPhoto\\0BlogImg\\0\")) {\n case:\n if (DocForm(url(CWebBibleForm *))) {\n tag=url->special;\n st2=URLPercentSpaces(url->special);\n st=MStrPrint(\"http://www.biblegateway.com/passage/\"\n \"?search=%s&version=NIV\",st2);\n Free(st2);\n if (*url->tag)\n tag=url->tag;\n \"$TX,\\\"%$Q\\\",HTML=\\\"%$Q\\\"$\",tag,st;\n Free(st);\n }\n break;\n case:\n if (DocForm(url(CWebBibleForm *))) {\n tag=url->special;\n st2=URLPercentSpaces(url->special);\n st=MStrPrint(\n \"http://www.biblegateway.com/verse/en/%s\",st2);\n Free(st2);\n if (*url->tag)\n tag=url->tag;\n \"$TX,\\\"%$Q\\\",HTML=\\\"%$Q\\\"$\",tag,st;\n Free(st);\n }\n break;\n case:\n if (DocForm(url(CYouTubeForm *))) {\n if (*url->special==CH_SPACE)\n st2=YouTubeGet(,url->tag);\n else\n st2=StrNew(url->special);\n if (st2 && *st2!=CH_SPACE) {\n if (url->min || url->sec)\n st=MStrPrint(\"%s&hl=enUS&start=%d\",st2,url->min*60+url->sec);\n else\n st=StrNew(st2);\n if (*url->special!=CH_SPACE && *url->tag)\n YouTubeAdd(,url->tag,st);\n \"$HC,\\\"<object width=\\\\\\\"640\\\\\\\" \"\n \"height=\\\\\\\"520\\\\\\\"><param name=\\\\\\\"movie\\\\\\\" \"\n \"value=\\\\\\\"http://www.youtube.com/v/%s\\\\\\\"></param><param \"\n \"name=\\\\\\\"allowscriptaccess\\\\\\\" \"\n \"value=\\\\\\\"always\\\\\\\"></param><embed \"\n \"src=\\\\\\\"http://www.youtube.com/v/%s\\\\\\\" \"\n \"type=\\\\\\\"application/x-shockwave-flash\\\\\\\" \"\n \"allowscriptaccess=\\\\\\\"always\\\\\\\" \"\n \"width=\\\\\\\"640\\\\\\\" height=\\\\\\\"520\\\\\\\">\"\n \"</embed></object>\\\"$\\n\",st,st;\n Free(st);\n Free(st2);\n }\n }\n break;\n case:\n if (DocForm(url(CImgurForm *))) {\n \"$HC,\\\"<center><img src=\\\\\\\"http://i.imgur.com/%s\\\\\\\" \"\n \"width=\\\\\\\"%d\\\\\\\" height=\\\\\\\"%d\\\\\\\" \"\n \"alt=\\\\\\\"\\\\\\\"></center>\\\"$\\n\",\n url->special,url->min,url->sec;\n }\n break;\n case:\n if (DocForm(url(CWikipediaForm *))) {\n tag=url->special;\n st=MStrPrint(\"http://en.wikipedia.org/wiki/%s\",url->special);\n if (*url->tag)\n tag=url->tag;\n \"$TX,\\\"%$Q\\\",HTML=\\\"%$Q\\\"$\",tag,st;\n Free(st);\n }\n break;\n case:\n if (DocForm(url(CWebBookMarkForm *))) {\n tag=st=WebBookMarks;\n if (*url->tag)\n tag=url->tag;\n \"$TX,\\\"%$Q\\\",HTML=\\\"%$Q\\\"$\",tag,st;\n Free(st);\n }\n break;\n case:\n FamilyPhoto;\n break;\n case:\n BlogImg;\n break;\n }\n Free(url);\n}\n\n#help_index \"Misc/TOS/God;God/TOS\"\n\npublic U0 GodCodeJmp()\n{//Jump to rand code in OS. See ::/Adam/God/HSNotes.DD.\n CDirEntry *tmpde1=FilesFind(\"/*\",\n FUF_JUST_FILES|FUF_RECURSE|FUF_JUST_SRC|FUF_CLUS_ORDER),\n *tmpde=tmpde1;\n I64 cnt=0,num;\n CDoc *doc;\n U8 *st;\n while (tmpde) {\n doc=DocRead(tmpde->full_name);\n tmpde->user_data=doc->head.y;\n cnt+=doc->head.y;\n DocDel(doc);\n tmpde=tmpde->next;\n }\n\n FifoU8Flush(god.fifo);\n GodBitsIns(GOD_GOOD_BITS,KbdMsEvtTime>>GOD_BAD_BITS);\n num=GodBits(GOD_GOOD_BITS)%cnt;\n\n tmpde=tmpde1;\n while (tmpde) {\n num-=tmpde->user_data;\n if (num<0) {\n st=MStrPrint(\"FL:%s,%d\",tmpde->full_name,-num);\n break;\n }\n tmpde=tmpde->next;\n }\n DirTreeDel(tmpde1);\n Ed(st);\n Free(st);\n}\n\nU0 GodOffer()\n{\n switch (PopUpPickLst(\"MosesComic\\0Fiction\\0\")) {\n case:\n \"---- Moses Comic ---- \"\n \"(Set in the Numbers 11 \"\n \"part of the story.)\\n\"\n \"Moses says, \\\"\\\"\\n\"\n \"God says, \\\"\\\"\\n\";\n break;\n case:\n \"---- Collaborative Fiction ----\\n\"\n \"Once upon a time \";\n break;\n }\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\image-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has graphics
#define WIDTH 17.0
#define X 290
#define Y 25
F64 t0=Beat;
U0 DrawIt(CTask *,CDC *dc)
{
F64 dt=Beat-t0,d,y,x1,y1,x2,y2;
I64 i,j;
dc->color=BLACK;
dc->thick=7;
for (i=0;i<4;i++) {
y=0;
d=dt%4;
if (d<1) {
d+=0.25*i;
if (d<1.0)
y=Tri(d,1)`2.0;
}
x1=X+(i-2.5)*WIDTH;
y1=50-20*y;
GrLine3(dc,x1,y1,0,(X*3+x1)/4,Y,0);
}
x1=X+1.3*WIDTH;
y1=37;
GrLine3(dc,x1,y1,0,(X*3+x1)/4,Y,0);
for (i=0;i<4;i++) {
y=0;
d=dt%4;
if (d<1) {
d+=0.25*i;
if (d<1.0)
y=Tri(d,1)`2.0;
}
x1=X+(i-2.5)*WIDTH;
y1=50-20*y;
dc->color=YELLOW;
dc->thick=5;
GrLine3(dc,x1,y1,0,(X*3+x1)/4,Y,0);
dc->color=BLACK;
for (j=0;j<4;j++) {
x2=(x1*(4-j)+(X*3+x1)/4*j)/4;
y2=(y1*(4-j)+Y*j)/4;
GrLine(dc,x2-2,y2,x2,y2-1);
GrLine(dc,x2,y2-1,x2+1,y2);
}
}
x1=X+1.3*WIDTH;
y1=37;
dc->color=YELLOW;
dc->thick=5;
GrLine3(dc,x1,y1,0,(X*3+x1)/4,Y,0);
dc->color=BLACK;
x2=0.6*x1+0.4*(X*3+x1)/4;
y2=0.6*y1+0.4*Y;
GrLine(dc,x2,y2-1,x2-1,y2+1);
x2=0.2*x1+0.8*(X*3+x1)/4;
y2=0.2*y1+0.8*Y;
GrLine(dc,x2-1,y2,x2-1,y2+2);
}
U0 Song()
{
SettingsPush; //See SettingsPush
Fs->draw_it=&DrawIt;
CTask *task;
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo=2.5;
try {
task=PopUpViewPrint(
"Asking God for stuff is like knocking on the door\n"
"of a neighbor in the middle of the night.\n"
"It's annoying! We're supposed to love God!\n"
"BF:Luke,11:5\n");
TaskWait(task);
WinHorz(Fs->win_left,TEXT_COLS-10,task);
WinVert(Fs->win_bottom+3,Fs->win_bottom+15,task);
while (!ScanKey) {
t0=Beat;
Play("4qBB5E4GG5FFC",
"We \0are \0in \0the \0image \0of \0God.\n\0 \0");
Play("4BB5E4GG5FFC",
"Some \0people's \0prayer \0is \0ver\0y \0odd.\n\0 \0");
Play("5eGDqC4BG5eGEqEC4G",
"They \0don't \0love \0Him.\n\0 \0"
"They \0love \0their \0neigh\0bor.\n\0");
Play("5eGDqC4BG5eGEqEC4G",
"Pest\0er\0ing \0Him.\n\0 \0Ask\0ing \0for \0fav\0ors.\n\0");
}
} catch
PutExcept;
SettingsPop;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\image-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has graphics\n\n#define WIDTH 17.0\n#define X 290\n#define Y 25\n\nF64 t0=Beat;\nU0 DrawIt(CTask *,CDC *dc)\n{\n F64 dt=Beat-t0,d,y,x1,y1,x2,y2;\n I64 i,j;\n\n dc->color=BLACK;\n dc->thick=7;\n for (i=0;i<4;i++) {\n y=0;\n d=dt%4;\n if (d<1) {\n d+=0.25*i;\n if (d<1.0)\n y=Tri(d,1)`2.0;\n }\n x1=X+(i-2.5)*WIDTH;\n y1=50-20*y;\n GrLine3(dc,x1,y1,0,(X*3+x1)/4,Y,0);\n }\n\n x1=X+1.3*WIDTH;\n y1=37;\n GrLine3(dc,x1,y1,0,(X*3+x1)/4,Y,0);\n\n for (i=0;i<4;i++) {\n y=0;\n d=dt%4;\n if (d<1) {\n d+=0.25*i;\n if (d<1.0)\n y=Tri(d,1)`2.0;\n }\n x1=X+(i-2.5)*WIDTH;\n y1=50-20*y;\n dc->color=YELLOW;\n dc->thick=5;\n GrLine3(dc,x1,y1,0,(X*3+x1)/4,Y,0);\n\n dc->color=BLACK;\n for (j=0;j<4;j++) {\n x2=(x1*(4-j)+(X*3+x1)/4*j)/4;\n y2=(y1*(4-j)+Y*j)/4;\n GrLine(dc,x2-2,y2,x2,y2-1);\n GrLine(dc,x2,y2-1,x2+1,y2);\n }\n }\n\n x1=X+1.3*WIDTH;\n y1=37;\n dc->color=YELLOW;\n dc->thick=5;\n GrLine3(dc,x1,y1,0,(X*3+x1)/4,Y,0);\n dc->color=BLACK;\n x2=0.6*x1+0.4*(X*3+x1)/4;\n y2=0.6*y1+0.4*Y;\n GrLine(dc,x2,y2-1,x2-1,y2+1);\n x2=0.2*x1+0.8*(X*3+x1)/4;\n y2=0.2*y1+0.8*Y;\n GrLine(dc,x2-1,y2,x2-1,y2+2);\n}\n\nU0 Song()\n{\n SettingsPush; //See SettingsPush\n Fs->draw_it=&DrawIt;\n CTask *task;\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo=2.5;\n try {\n task=PopUpViewPrint(\n \"Asking God for stuff is like knocking on the door\\n\"\n \"of a neighbor in the middle of the night.\\n\"\n \"It's annoying! We're supposed to love God!\\n\"\n \"BF:Luke,11:5\\n\");\n TaskWait(task);\n WinHorz(Fs->win_left,TEXT_COLS-10,task);\n WinVert(Fs->win_bottom+3,Fs->win_bottom+15,task);\n while (!ScanKey) {\n t0=Beat;\n Play(\"4qBB5E4GG5FFC\",\n \"We \\0are \\0in \\0the \\0image \\0of \\0God.\\n\\0 \\0\");\n Play(\"4BB5E4GG5FFC\",\n \"Some \\0people's \\0prayer \\0is \\0ver\\0y \\0odd.\\n\\0 \\0\");\n Play(\"5eGDqC4BG5eGEqEC4G\",\n \"They \\0don't \\0love \\0Him.\\n\\0 \\0\"\n \"They \\0love \\0their \\0neigh\\0bor.\\n\\0\");\n Play(\"5eGDqC4BG5eGEqEC4G\",\n \"Pest\\0er\\0ing \\0Him.\\n\\0 \\0Ask\\0ing \\0for \\0fav\\0ors.\\n\\0\");\n }\n } catch\n PutExcept;\n SettingsPop;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\Registry1-Templates-Demo.html
// Date: unknown-date
// Language: HolyC
RegDft("MyCompany/MyApp","F64 best_score=9999;\n");
RegExe("MyCompany/MyApp");
U0 Main()
{
GetChar;
RegWrite("MyCompany/MyApp","F64 best_score=%5.4f;\n",best_score);
}
Main;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Registry1-Templates-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\nRegDft(\"MyCompany/MyApp\",\"F64 best_score=9999;\\n\");\nRegExe(\"MyCompany/MyApp\");\n\nU0 Main()\n{\n GetChar;\n RegWrite(\"MyCompany/MyApp\",\"F64 best_score=%5.4f;\\n\",best_score);\n}\n\nMain;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\TourC-Tour-Misc.html
// Date: unknown-date
// Language: HolyC
TourPut(
"We will now run a test-suite that automatically executes most TempleOS "
"demos. It takes a few minutes, so kick-back.\n\n"
"Press $GREEN$<ENTER>$FG$.\n");
"#include \"::/Misc/OSTestSuite\";";
InGetStr("\n");
if (LBtr(&tour_put->display_flags,DISPLAYf_SHOW))
WinZBufUpdate;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\TourC-Tour-Misc.html\n// Date: unknown-date\n// Language: HolyC\n\nTourPut(\n\"We will now run a test-suite that automatically executes most TempleOS \"\n\"demos. It takes a few minutes, so kick-back.\\n\\n\"\n\"Press $GREEN$<ENTER>$FG$.\\n\");\n\n\"#include \\\"::/Misc/OSTestSuite\\\";\";\nInGetStr(\"\\n\");\n\nif (LBtr(&tour_put->display_flags,DISPLAYf_SHOW))\n WinZBufUpdate;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\psalm-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has words
U0 Song()
{
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 3.360;
music.stacatto_factor= 0.846;
try {
while (!ScanKey) {
Play("M5/4");
Play("4qGGG5qtC4BAqGGG5qtC4etBBqtA",
"Hymn's \0not \0long.\n\0 \0 \0 \0"
"Nor \0this \0song.\n\0 \0 \0 \0 \0");
Play("5qEeCCqDqtC4BAM4/4",
"For\0 \0 \0give!\n\0 \0 \0 \0");
Play("5qD4eAG5DG4G5DFF4A5C4qGeA5E",
"That's \0 \0 \0all \0 \0I \0 \0say.\n\0 \0 \0 \0 \0 \0 \0");
Play("5qD4eAG5DG4G5DFF4A5C4qGeA5E",
"This \0 \0 \0I \0 \0 \0 \0pray.\n\0 \0 \0 \0 \0 \0 \0");
}
} catch
PutExcept;
Snd;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\psalm-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has words\nU0 Song()\n{\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 3.360;\n music.stacatto_factor= 0.846;\n try {\n while (!ScanKey) {\n Play(\"M5/4\");\n Play(\"4qGGG5qtC4BAqGGG5qtC4etBBqtA\",\n \"Hymn's \\0not \\0long.\\n\\0 \\0 \\0 \\0\"\n \"Nor \\0this \\0song.\\n\\0 \\0 \\0 \\0 \\0\");\n Play(\"5qEeCCqDqtC4BAM4/4\",\n \"For\\0 \\0 \\0give!\\n\\0 \\0 \\0 \\0\");\n Play(\"5qD4eAG5DG4G5DFF4A5C4qGeA5E\",\n \"That's \\0 \\0 \\0all \\0 \\0I \\0 \\0say.\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5qD4eAG5DG4G5DFF4A5C4qGeA5E\",\n \"This \\0 \\0 \\0I \\0 \\0 \\0 \\0pray.\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n }\n } catch\n PutExcept;\n Snd;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\TTFFire-ToTheFront-Apps.html
// Date: unknown-date
// Language: HolyC
U0 AttackHeader(Unit *tmpu,U8 *st,Unit *target)
{
I64 i=9+StrLen(st);
if (target) {
i+=9;
if (target->armor)
i+=8;
else
i+=10;
}
'\n\n';
"$BLACK$%h*c$FG$\n",i,'-';
if (tmpu->player)
"$PURPLE$Player 2$FG$ ";
else
"$CYAN$Player 1$FG$ ";
"%s",st;
if (target) {
if (target->player)
" $PURPLE$Player 2";
else
" $CYAN$Player 1";
if (target->armor)
" Armored";
else
" Unarmored";
'$FG$';
}
'\n';
"$BLACK$%h*c$FG$\n",i,'-';
}
F64 HitDamage(Unit *tmpu,Unit *target,I64 facing=1,F64 range_factor=0)
{
F64 d,res=200.0*Rand;
"\nRoll Out of 200\t\t:%6.2f Damage\n",res;
if (target->armor) {
d=target->armor/100.0*(5-facing)/5.0;
if (d>=0) {
"Armor Attack\t\t:%6.2f\n",ToF64(tmpu->armored_attack);
res*=(tmpu->armored_attack/100.0)/d;
} else
res=0;
"Armor(%z) Defense\t:%6.2f\n",facing,
"Front\0FrontSide\0RearSide\0Rear\0",100*d;
} else {
d=1.0-range_factor;
if (d>0) {
"Unarmored Attack\t:%6.2f\n",ToF64(tmpu->unarmored_attack);
"Range Adjust\t\t:%6.2f%%\n",100*d;
res*=(tmpu->unarmored_attack/100.0)*d;
} else
res=0;
}
"Attack/Defense Adjusted\t:%6.2f Damage\n",res;
return Round(res);
}
Bool DamageDo(Unit *target,F64 damage)
{
if (damage>0) {
if (target->armor)
"Armor Hit Score %6.2f\t:",damage;
else
"%3d Life - %3f Damage\t=",target->life,damage;
if (damage>=target->life) {
"$RED$Killed$FG$\n";
Noise(1000*animation_delay,74,98);
Sleep(1000*animation_delay);
target->life=0;
VisRecalc(VR_FRIENDLY_UNIT_DIED,target);
alive_cnt[target->player]--;
return TRUE;
} else {
if (target->armor) {
if (damage>0.6*target->life) {
target->movement=0;
"$RED$Immobilized$FG$\n";
} else
"$GREEN$No Penetration$FG$\n";
} else {
target->life-=damage;
"$RED$%6.2f Life$FG$\n",ToF64(target->life);
}
return FALSE;
}
} else
return FALSE;
}
U0 IndirectAdd(Unit *tmpu,I64 row,I64 col)
{
IndirectOrders *tmpi;
if (tmpu->life<=0 || tmpu->range<=0)
return;
tmpu->fired=TRUE;
tmpi=CAlloc(sizeof(IndirectOrders));
tmpi->attacker=tmpu;
tmpi->row=row;
tmpi->col=col;
QueIns(tmpi,indirect_head.last);
}
Bool BulletPlot(U0,I64 x,I64 y,I64)
{
fire_x=x; fire_y=y;
firing=TRUE;
Sleep(3*animation_delay);
return TRUE;
}
U0 UnitDirectFire(Unit *tmpu,Unit *target)
{
I64 r,c,facing,
t1=terrain[tmpu->row][tmpu->col],t2=terrain[target->row][target->col];
F64 x1,y1,x2,y2,d,a,range_factor;
if (tmpu->life<=0 || target->life<=0 || tmpu->range<=0)
return;
AttackHeader(tmpu,"DirectFire",target);
RowCol2XY(&x1,&y1,tmpu->row,tmpu->col);
RowCol2XY(&x2,&y2,target->row,target->col);
d=100*Rand;
"+%5.2f Roll\n",d;
d+=tmpu->accuracy;
"+%2d.00 Accuracy\n",tmpu->accuracy;
range_factor=Sqrt(Sqr(x2-x1)+Sqr(y2-y1))/(tmpu->range*2*DSIN);
"-%5.2f%% of Range\n",100*range_factor;
d-=100*range_factor;
if (t2==TREES) {
"-30.00 Target in Trees Penalty\n";
d-=30;
}
if (t1==MOUNTAINS && t2!=MOUNTAINS) {
"+30.00 High Ground Bonus\n";
d+=30;
}
"_______\n";
target_unit=target;
if (d>=0) {
"+%5.2f Hit\n",d;
target_hit=TRUE;
Noise(500*animation_delay,34,41);
Sleep(500*animation_delay);
Line(NULL,x1,y1,0,x2,y2,0,&BulletPlot);
} else {
"-%5.2f Miss\n",-d;
target_hit=FALSE;
Noise(1000*animation_delay,69,74);
Sleep(1000*animation_delay);
a=pi*2*Rand;
d=(0.5-d/100)*HEX_SIDE;
Line(NULL,x1,y1,0,x2+d*Cos(a),y2+d*Sin(a),0,&BulletPlot);
}
firing=FALSE;
tmpu->fired=TRUE;
if (target_hit) {
r=target->row;c=target->col;
if ((facing=HexMoveOne(&r,&c,x1,y1))>=0)
facing=FacingChg(facing,target->facing);
else
facing=0;
DamageDo(target,HitDamage(tmpu,target,facing,range_factor));
}
while (snd.ona!=ONA_REST) //see Snd()
Yield;
target_unit=NULL;
}
Bool HexOccupy(Bool overrun,Unit *tmpu,Unit *target)
{
I64 t2=terrain[target->row][target->col];
F64 damage;
if (tmpu->life<=0 || target->life<=0)
return FALSE;
if (overrun)
AttackHeader(tmpu,"OverRun",target);
else
AttackHeader(tmpu,"CloseAssault",target);
Noise(500*animation_delay,34,41);
Sleep(500*animation_delay);
tmpu->fired=TRUE;
target->fired=TRUE;
damage=HitDamage(tmpu,target);
if (overrun) {
damage*=2.0;
"x2 OverRun Bonus\t=%6.2f Damage\n",damage;
if (t2!=PLAINS) {
damage/=2.0;
"/2 Terrain Penalty\t=%6.2f Damage\n",damage;
}
} else {
damage*=3.0;
"x3 CloseAssault Bonus\t=%6.2f Damage\n",damage;
}
if (DamageDo(target,Round(damage))) {
"$RED$Success$FG$\n";
while (snd.ona!=ONA_REST) //see Snd()
Yield;
return TRUE;
} else {
tmpu->life=0;
VisRecalc(VR_FRIENDLY_UNIT_DIED,tmpu);
alive_cnt[tmpu->player]--;
"$RED$Failure$FG$\n";
while (snd.ona!=ONA_REST) //see Snd()
Yield;
return FALSE;
}
}
U0 IndirectResolveAll()
{
I64 i,r,c;
F64 x1,y1,x2,y2,d,range_factor;
Unit *tmpu,*target;
IndirectOrders *tmpi=indirect_head.next,*tmpi1;
while (tmpi!=*indirect_head) {
tmpi1=tmpi->next;
tmpu=tmpi->attacker;
AttackHeader(tmpu,"IndirectFire",NULL);
RowCol2XY(&x1,&y1,tmpu->row,tmpu->col);
RowCol2XY(&x2,&y2,tmpi->row,tmpi->col);
d=100*Rand;
"+%5.2f Roll\n",d;
d+=tmpu->accuracy;
"+%2d.00 Accuracy\n",tmpu->accuracy;
range_factor=Sqrt(Sqr(x2-x1)+Sqr(y2-y1))/(tmpu->range*2*DSIN);
"-%5.2f%% of Range\n",100*range_factor;
d-=100*range_factor;
'_______\n';
if (d>=0) {
"+%5.2f Hit\n",d;
Noise(500*animation_delay,34,41);
Sleep(500*animation_delay);
} else {
"-%5.2f Miss\n",-d;
Noise(1000*animation_delay,69,74);
Sleep(1000*animation_delay);
i=RandU16%6;
if (tmpi->row&1)
tmpi->col+=col_offsets_odd[i];
else
tmpi->col+=col_offsets_even[i];
tmpi->row+=row_offsets[i];
RowCol2XY(&x2,&y2,tmpi->row,tmpi->col);
}
Line(NULL,x1,y1,0,x2,y2,0,&BulletPlot);
firing=FALSE;
tmpu->fired=TRUE;
indirect_row=tmpi->row;
indirect_col=tmpi->col;
indirect_explosion=TRUE;
for (i=0;i<7;i++) {
if (tmpi->row&1)
c=tmpi->col+col_offsets_odd[i];
else
c=tmpi->col+col_offsets_even[i];
r=tmpi->row+row_offsets[i];
if (0<=r<map_rows && 0<=c<map_cols && (target=UnitFind(r,c))) {
AttackHeader(tmpu,"IndirectFire",target);
DamageDo(target,HitDamage(tmpu,target));
}
}
Noise(2000*animation_delay,70,74);
Sleep(2000*animation_delay);
while (snd.ona!=ONA_REST) //see Snd()
Yield;
indirect_explosion=FALSE;
QueRem(tmpi);
Free(tmpi);
tmpi=tmpi1;
}
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\TTFFire-ToTheFront-Apps.html\n// Date: unknown-date\n// Language: HolyC\n\nU0 AttackHeader(Unit *tmpu,U8 *st,Unit *target)\n{\n I64 i=9+StrLen(st);\n if (target) {\n i+=9;\n if (target->armor)\n i+=8;\n else\n i+=10;\n }\n '\\n\\n';\n \"$BLACK$%h*c$FG$\\n\",i,'-';\n if (tmpu->player)\n \"$PURPLE$Player 2$FG$ \";\n else\n \"$CYAN$Player 1$FG$ \";\n \"%s\",st;\n if (target) {\n if (target->player)\n \" $PURPLE$Player 2\";\n else\n \" $CYAN$Player 1\";\n if (target->armor)\n \" Armored\";\n else\n \" Unarmored\";\n '$FG$';\n }\n '\\n';\n \"$BLACK$%h*c$FG$\\n\",i,'-';\n}\n\nF64 HitDamage(Unit *tmpu,Unit *target,I64 facing=1,F64 range_factor=0)\n{\n F64 d,res=200.0*Rand;\n \"\\nRoll Out of 200\\t\\t:%6.2f Damage\\n\",res;\n if (target->armor) {\n d=target->armor/100.0*(5-facing)/5.0;\n if (d>=0) {\n \"Armor Attack\\t\\t:%6.2f\\n\",ToF64(tmpu->armored_attack);\n res*=(tmpu->armored_attack/100.0)/d;\n } else\n res=0;\n \"Armor(%z) Defense\\t:%6.2f\\n\",facing,\n \"Front\\0FrontSide\\0RearSide\\0Rear\\0\",100*d;\n } else {\n d=1.0-range_factor;\n if (d>0) {\n \"Unarmored Attack\\t:%6.2f\\n\",ToF64(tmpu->unarmored_attack);\n \"Range Adjust\\t\\t:%6.2f%%\\n\",100*d;\n res*=(tmpu->unarmored_attack/100.0)*d;\n } else\n res=0;\n }\n \"Attack/Defense Adjusted\\t:%6.2f Damage\\n\",res;\n return Round(res);\n}\n\nBool DamageDo(Unit *target,F64 damage)\n{\n if (damage>0) {\n if (target->armor)\n \"Armor Hit Score %6.2f\\t:\",damage;\n else\n \"%3d Life - %3f Damage\\t=\",target->life,damage;\n if (damage>=target->life) {\n \"$RED$Killed$FG$\\n\";\n Noise(1000*animation_delay,74,98);\n Sleep(1000*animation_delay);\n target->life=0;\n VisRecalc(VR_FRIENDLY_UNIT_DIED,target);\n alive_cnt[target->player]--;\n return TRUE;\n } else {\n if (target->armor) {\n if (damage>0.6*target->life) {\n target->movement=0;\n \"$RED$Immobilized$FG$\\n\";\n } else\n \"$GREEN$No Penetration$FG$\\n\";\n } else {\n target->life-=damage;\n \"$RED$%6.2f Life$FG$\\n\",ToF64(target->life);\n }\n return FALSE;\n }\n } else\n return FALSE;\n}\n\nU0 IndirectAdd(Unit *tmpu,I64 row,I64 col)\n{\n IndirectOrders *tmpi;\n if (tmpu->life<=0 || tmpu->range<=0)\n return;\n tmpu->fired=TRUE;\n tmpi=CAlloc(sizeof(IndirectOrders));\n tmpi->attacker=tmpu;\n tmpi->row=row;\n tmpi->col=col;\n QueIns(tmpi,indirect_head.last);\n}\n\nBool BulletPlot(U0,I64 x,I64 y,I64)\n{\n fire_x=x; fire_y=y;\n firing=TRUE;\n Sleep(3*animation_delay);\n return TRUE;\n}\n\nU0 UnitDirectFire(Unit *tmpu,Unit *target)\n{\n I64 r,c,facing,\n t1=terrain[tmpu->row][tmpu->col],t2=terrain[target->row][target->col];\n F64 x1,y1,x2,y2,d,a,range_factor;\n if (tmpu->life<=0 || target->life<=0 || tmpu->range<=0)\n return;\n AttackHeader(tmpu,\"DirectFire\",target);\n RowCol2XY(&x1,&y1,tmpu->row,tmpu->col);\n RowCol2XY(&x2,&y2,target->row,target->col);\n d=100*Rand;\n \"+%5.2f Roll\\n\",d;\n d+=tmpu->accuracy;\n \"+%2d.00 Accuracy\\n\",tmpu->accuracy;\n\n range_factor=Sqrt(Sqr(x2-x1)+Sqr(y2-y1))/(tmpu->range*2*DSIN);\n \"-%5.2f%% of Range\\n\",100*range_factor;\n d-=100*range_factor;\n if (t2==TREES) {\n \"-30.00 Target in Trees Penalty\\n\";\n d-=30;\n }\n if (t1==MOUNTAINS && t2!=MOUNTAINS) {\n \"+30.00 High Ground Bonus\\n\";\n d+=30;\n }\n \"_______\\n\";\n target_unit=target;\n if (d>=0) {\n \"+%5.2f Hit\\n\",d;\n target_hit=TRUE;\n Noise(500*animation_delay,34,41);\n Sleep(500*animation_delay);\n Line(NULL,x1,y1,0,x2,y2,0,&BulletPlot);\n } else {\n \"-%5.2f Miss\\n\",-d;\n target_hit=FALSE;\n Noise(1000*animation_delay,69,74);\n Sleep(1000*animation_delay);\n a=pi*2*Rand;\n d=(0.5-d/100)*HEX_SIDE;\n Line(NULL,x1,y1,0,x2+d*Cos(a),y2+d*Sin(a),0,&BulletPlot);\n }\n firing=FALSE;\n tmpu->fired=TRUE;\n if (target_hit) {\n r=target->row;c=target->col;\n if ((facing=HexMoveOne(&r,&c,x1,y1))>=0)\n facing=FacingChg(facing,target->facing);\n else\n facing=0;\n DamageDo(target,HitDamage(tmpu,target,facing,range_factor));\n }\n while (snd.ona!=ONA_REST) //see Snd()\n Yield;\n target_unit=NULL;\n}\n\nBool HexOccupy(Bool overrun,Unit *tmpu,Unit *target)\n{\n I64 t2=terrain[target->row][target->col];\n F64 damage;\n if (tmpu->life<=0 || target->life<=0)\n return FALSE;\n if (overrun)\n AttackHeader(tmpu,\"OverRun\",target);\n else\n AttackHeader(tmpu,\"CloseAssault\",target);\n Noise(500*animation_delay,34,41);\n Sleep(500*animation_delay);\n tmpu->fired=TRUE;\n target->fired=TRUE;\n damage=HitDamage(tmpu,target);\n if (overrun) {\n damage*=2.0;\n \"x2 OverRun Bonus\\t=%6.2f Damage\\n\",damage;\n if (t2!=PLAINS) {\n damage/=2.0;\n \"/2 Terrain Penalty\\t=%6.2f Damage\\n\",damage;\n }\n } else {\n damage*=3.0;\n \"x3 CloseAssault Bonus\\t=%6.2f Damage\\n\",damage;\n }\n if (DamageDo(target,Round(damage))) {\n \"$RED$Success$FG$\\n\";\n while (snd.ona!=ONA_REST) //see Snd()\n Yield;\n return TRUE;\n } else {\n tmpu->life=0;\n VisRecalc(VR_FRIENDLY_UNIT_DIED,tmpu);\n alive_cnt[tmpu->player]--;\n \"$RED$Failure$FG$\\n\";\n while (snd.ona!=ONA_REST) //see Snd()\n Yield;\n return FALSE;\n }\n}\n\nU0 IndirectResolveAll()\n{\n I64 i,r,c;\n F64 x1,y1,x2,y2,d,range_factor;\n Unit *tmpu,*target;\n IndirectOrders *tmpi=indirect_head.next,*tmpi1;\n while (tmpi!=*indirect_head) {\n tmpi1=tmpi->next;\n tmpu=tmpi->attacker;\n AttackHeader(tmpu,\"IndirectFire\",NULL);\n RowCol2XY(&x1,&y1,tmpu->row,tmpu->col);\n RowCol2XY(&x2,&y2,tmpi->row,tmpi->col);\n d=100*Rand;\n \"+%5.2f Roll\\n\",d;\n d+=tmpu->accuracy;\n \"+%2d.00 Accuracy\\n\",tmpu->accuracy;\n range_factor=Sqrt(Sqr(x2-x1)+Sqr(y2-y1))/(tmpu->range*2*DSIN);\n \"-%5.2f%% of Range\\n\",100*range_factor;\n d-=100*range_factor;\n '_______\\n';\n\n\n if (d>=0) {\n \"+%5.2f Hit\\n\",d;\n Noise(500*animation_delay,34,41);\n Sleep(500*animation_delay);\n } else {\n \"-%5.2f Miss\\n\",-d;\n Noise(1000*animation_delay,69,74);\n Sleep(1000*animation_delay);\n i=RandU16%6;\n if (tmpi->row&1)\n tmpi->col+=col_offsets_odd[i];\n else\n tmpi->col+=col_offsets_even[i];\n tmpi->row+=row_offsets[i];\n RowCol2XY(&x2,&y2,tmpi->row,tmpi->col);\n }\n\n Line(NULL,x1,y1,0,x2,y2,0,&BulletPlot);\n firing=FALSE;\n tmpu->fired=TRUE;\n indirect_row=tmpi->row;\n indirect_col=tmpi->col;\n indirect_explosion=TRUE;\n for (i=0;i<7;i++) {\n if (tmpi->row&1)\n c=tmpi->col+col_offsets_odd[i];\n else\n c=tmpi->col+col_offsets_even[i];\n r=tmpi->row+row_offsets[i];\n if (0<=r<map_rows && 0<=c<map_cols && (target=UnitFind(r,c))) {\n AttackHeader(tmpu,\"IndirectFire\",target);\n DamageDo(target,HitDamage(tmpu,target));\n }\n }\n Noise(2000*animation_delay,70,74);\n Sleep(2000*animation_delay);\n while (snd.ona!=ONA_REST) //see Snd()\n Yield;\n indirect_explosion=FALSE;\n\n QueRem(tmpi);\n Free(tmpi);\n tmpi=tmpi1;\n }\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\Menu-Adam.html
// Date: unknown-date
// Language: HolyC
#help_index "Menus"
#help_file "::/Doc/Menus"
CTask *MenuTask()
{
CTask *res=sys_focus_task;
while (res && !res->cur_menu)
res=res->parent_task;
return res;
}
CMenuEntry *sys_cur_submenu_entry=NULL;
public CMenuEntry *MenuSubEntryFind(
CMenuEntry *haystack_first,U8 *needle_entry_name)
{//You probably don't need this. Use dir / and MenuEntryFind().
while (haystack_first) {
if (!StrCmp(haystack_first->name,needle_entry_name))
return haystack_first;
haystack_first=haystack_first->next;
}
return NULL;
}
public CMenuEntry *MenuEntryFind(CMenu *haystack_menu,U8 *needle_full_name)
{//Find pulldown entry. Fs->cur_menu is probably the menu you want.
//Just 2 levels -- across top and down are valid, currently.
U8 *st,*st2;
CMenuEntry *tmpse;
if (!haystack_menu || !needle_full_name)
return NULL;
st=StrNew(needle_full_name);
st2=StrNew(needle_full_name);
tmpse=(&haystack_menu->sub)(U8 *)-offset(CMenuEntry.sub);
while (*st && tmpse) {
StrFirstRem(st,"/",st2);
tmpse=MenuSubEntryFind(tmpse->sub,st2);
}
Free(st);
Free(st2);
return tmpse;
}
CMenuEntry *MenuNewSub(CCmpCtrl *cc,CTask *task)
{
CMenuEntry *tmpme=NULL,*tmpse;
if (cc->token==TK_IDENT) {
tmpme=CAlloc(sizeof(CMenuEntry),task);
if (StrLen(cc->cur_str)>31)
cc->cur_str[31]=0;
StrCpy(tmpme->name,cc->cur_str);
if (Lex(cc)=='(') {
tmpme->msg_code=MSG_KEY_DOWN_UP;
if (Lex(cc)!=',' && cc->token!=')')
tmpme->msg_code=LexExpressionI64(cc);
if (cc->token==',')
Lex(cc);
if (cc->token!=',' && cc->token!=')')
tmpme->arg1=LexExpressionI64(cc);
if (cc->token==',')
Lex(cc);
if (cc->token!=',' && cc->token!=')')
tmpme->arg2=LexExpressionI64(cc);
if (cc->token!=')')
LexExcept(cc,"Missing ')' at ");
if (Lex(cc)!=';')
LexExcept(cc,"Missing ';' at");
Lex(cc); //Skip ;
} else if (cc->token=='{') {
Lex(cc); //Skip {
tmpme->dir=TRUE;
tmpse=&tmpme->sub;
while (tmpse && cc->token!='}')
tmpse=tmpse->next=MenuNewSub(cc,task);
if (cc->token!='}')
LexExcept(cc,"Missing '}' at ");
else
Lex(cc); //Skip }
} else
LexExcept(cc,"Expecting '{' at ");
}
return tmpme;
}
public CMenu *MenuNew(U8 *st,I64 flags=0,CTask *task=NULL)
{//Parse a menu. You probably don't need this.
CMenu *m;
CMenuEntry *tmpse;
CCmpCtrl *cc=CmpCtrlNew(st,CCF_DONT_FREE_BUF);
if (!task) task=Fs;
Lex(cc);
m=CAlloc(sizeof(CMenu),task);
m->task=task;
m->flags=flags;
m->attr =BLUE<<4+YELLOW;
tmpse=&m->sub;
while (tmpse)
tmpse=tmpse->next=MenuNewSub(cc,task);
CmpCtrlDel(cc);
return m;
}
public CMenu *MenuFile(U8 *filename,I64 flags=0,CTask *task=NULL)
{//Parse a pulldown menu file. You probably don't need this.
CMenu *m;
U8 *st=MStrPrint("#include \"%s\"",filename);
m=MenuNew(st,flags,task);
Free(st);
return m;
}
U0 MenuDelSub(CMenuEntry *tmpme)
{
CMenuEntry *tmpse,*tmpse1;
if (tmpme) {
tmpse=tmpme->sub;
while (tmpse) {
tmpse1=tmpse->next;
MenuDelSub(tmpse);
tmpse=tmpse1;
}
Free(tmpme);
}
}
public U0 MenuDel(CMenu *m)
{//Delete a manu. You probably don't need this.
CMenuEntry *tmpme,*tmpme1;
if (!m) return;
tmpme=m->sub;
while (tmpme) {
tmpme1=tmpme->next;
MenuDelSub(tmpme);
tmpme=tmpme1;
}
Free(m);
}
I64 MenuEntryWidth(CMenuEntry *tmpme)
{
I64 res=StrLen(tmpme->name);
CMenuEntry *tmpse=tmpme->sub;
while (tmpse) {
res=MaxI64(res,StrLen(tmpse->name));
tmpse=tmpse->next;
}
return res+1;
}
public CMenu *MenuPush(U8 *st)
{//Save old pulldown menu and replace with new from str.
CMenu *m=MenuNew(st);
m->next=Fs->cur_menu;
Fs->cur_menu=m;
return m;
}
public CMenu *MenuFilePush(U8 *filename)
{//Save old pulldown menu and replace with new from file.
CMenu *m=MenuFile(filename);
m->next=Fs->cur_menu;
Fs->cur_menu=m;
return m;
}
public U0 MenuPop()
{//Restore old pulldown menu. Delete just-deactivated menu.
CMenu *m=Fs->cur_menu;
if (!m) return;
Fs->cur_menu=m->next;
MenuDel(m);
}
U0 DrawMenu(CDC *dc)
{
CMenu *m;
CMenuEntry *tmpme,*tmpse,*cur_submenu=NULL;
U8 *st=NULL;
CTask *task=MenuTask;
I64 i,w,x0,y0,x1=ms.pos.x,y1=ms.pos.y;
if (!TaskValidate(task) || !(m=task->cur_menu)) {
sys_cur_submenu_entry=NULL;
return;
}
dc->color=m->attr>>4;
GrRect(dc,0,0,GR_WIDTH,FONT_HEIGHT);
x0=0;
tmpme=m->sub;
while (tmpme) {
w=MenuEntryWidth(tmpme)*FONT_WIDTH;
if (x0<=x1<x0+w) {
if (0<=y1<FONT_HEIGHT) {
dc->color=m->attr&15;
GrRect(dc,x0,0,w,FONT_HEIGHT);
dc->color=m->attr>>4;
} else
dc->color=m->attr&15;
GrPrint(dc,x0,0,"%s",tmpme->name);
y0=FONT_HEIGHT;
tmpse=tmpme->sub;
while (tmpse) {
if (tmpse->checked)
i=m->attr^0xFF;
else
i=m->attr;
if (y0<=y1<y0+FONT_HEIGHT) {
if (tmpse->msg_code==MSG_KEY_DOWN||
tmpse->msg_code==MSG_KEY_DOWN_UP) {
if (!tmpse->arg2)
tmpse->arg2=Char2ScanCode(tmpse->arg1);
st=ScanCode2KeyName(tmpse->arg2);
}
sys_cur_submenu_entry=cur_submenu=tmpse;
dc->color=i&15;
GrRect(dc,x0,y0,w,FONT_HEIGHT);
dc->color=i>>4;
GrPrint(dc,x0,y0,"%s",tmpse->name);
if (st) {
dc->color=i>>4;
GrRect(dc,x0+w,y0-FONT_HEIGHT,
(StrLen(st)+1)*FONT_WIDTH,FONT_HEIGHT*3);
dc->color=i&15;
GrPrint(dc,x0+w,y0,"%s",st);
Free(st);
}
} else {
dc->color=i>>4;
GrRect(dc,x0,y0,w,FONT_HEIGHT);
dc->color=i&15;
GrPrint(dc,x0,y0,"%s",tmpse->name);
}
y0+=FONT_HEIGHT;
tmpse=tmpse->next;
}
} else {
dc->color=m->attr&15;
GrPrint(dc,x0,0,"%s",tmpme->name);
}
x0+=w;
tmpme=tmpme->next;
}
sys_cur_submenu_entry=cur_submenu;
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Menu-Adam.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"Menus\"\n#help_file \"::/Doc/Menus\"\n\nCTask *MenuTask()\n{\n CTask *res=sys_focus_task;\n while (res && !res->cur_menu)\n res=res->parent_task;\n return res;\n}\n\nCMenuEntry *sys_cur_submenu_entry=NULL;\n\npublic CMenuEntry *MenuSubEntryFind(\n CMenuEntry *haystack_first,U8 *needle_entry_name)\n{//You probably don't need this. Use dir / and MenuEntryFind().\n while (haystack_first) {\n if (!StrCmp(haystack_first->name,needle_entry_name))\n return haystack_first;\n haystack_first=haystack_first->next;\n }\n return NULL;\n}\n\npublic CMenuEntry *MenuEntryFind(CMenu *haystack_menu,U8 *needle_full_name)\n{//Find pulldown entry. Fs->cur_menu is probably the menu you want.\n//Just 2 levels -- across top and down are valid, currently.\n U8 *st,*st2;\n CMenuEntry *tmpse;\n if (!haystack_menu || !needle_full_name)\n return NULL;\n st=StrNew(needle_full_name);\n st2=StrNew(needle_full_name);\n tmpse=(&haystack_menu->sub)(U8 *)-offset(CMenuEntry.sub);\n while (*st && tmpse) {\n StrFirstRem(st,\"/\",st2);\n tmpse=MenuSubEntryFind(tmpse->sub,st2);\n }\n Free(st);\n Free(st2);\n return tmpse;\n}\n\nCMenuEntry *MenuNewSub(CCmpCtrl *cc,CTask *task)\n{\n CMenuEntry *tmpme=NULL,*tmpse;\n if (cc->token==TK_IDENT) {\n tmpme=CAlloc(sizeof(CMenuEntry),task);\n if (StrLen(cc->cur_str)>31)\n cc->cur_str[31]=0;\n StrCpy(tmpme->name,cc->cur_str);\n if (Lex(cc)=='(') {\n tmpme->msg_code=MSG_KEY_DOWN_UP;\n if (Lex(cc)!=',' && cc->token!=')')\n tmpme->msg_code=LexExpressionI64(cc);\n if (cc->token==',')\n Lex(cc);\n if (cc->token!=',' && cc->token!=')')\n tmpme->arg1=LexExpressionI64(cc);\n if (cc->token==',')\n Lex(cc);\n if (cc->token!=',' && cc->token!=')')\n tmpme->arg2=LexExpressionI64(cc);\n if (cc->token!=')')\n LexExcept(cc,\"Missing ')' at \");\n if (Lex(cc)!=';')\n LexExcept(cc,\"Missing ';' at\");\n Lex(cc); //Skip ;\n } else if (cc->token=='{') {\n Lex(cc); //Skip {\n tmpme->dir=TRUE;\n tmpse=&tmpme->sub;\n while (tmpse && cc->token!='}')\n tmpse=tmpse->next=MenuNewSub(cc,task);\n if (cc->token!='}')\n LexExcept(cc,\"Missing '}' at \");\n else\n Lex(cc); //Skip }\n } else\n LexExcept(cc,\"Expecting '{' at \");\n }\n return tmpme;\n}\n\npublic CMenu *MenuNew(U8 *st,I64 flags=0,CTask *task=NULL)\n{//Parse a menu. You probably don't need this.\n CMenu *m;\n CMenuEntry *tmpse;\n CCmpCtrl *cc=CmpCtrlNew(st,CCF_DONT_FREE_BUF);\n if (!task) task=Fs;\n Lex(cc);\n m=CAlloc(sizeof(CMenu),task);\n m->task=task;\n m->flags=flags;\n m->attr =BLUE<<4+YELLOW;\n tmpse=&m->sub;\n while (tmpse)\n tmpse=tmpse->next=MenuNewSub(cc,task);\n CmpCtrlDel(cc);\n return m;\n}\n\npublic CMenu *MenuFile(U8 *filename,I64 flags=0,CTask *task=NULL)\n{//Parse a pulldown menu file. You probably don't need this.\n CMenu *m;\n U8 *st=MStrPrint(\"#include \\\"%s\\\"\",filename);\n m=MenuNew(st,flags,task);\n Free(st);\n return m;\n}\n\nU0 MenuDelSub(CMenuEntry *tmpme)\n{\n CMenuEntry *tmpse,*tmpse1;\n if (tmpme) {\n tmpse=tmpme->sub;\n while (tmpse) {\n tmpse1=tmpse->next;\n MenuDelSub(tmpse);\n tmpse=tmpse1;\n }\n Free(tmpme);\n }\n}\n\npublic U0 MenuDel(CMenu *m)\n{//Delete a manu. You probably don't need this.\n CMenuEntry *tmpme,*tmpme1;\n if (!m) return;\n tmpme=m->sub;\n while (tmpme) {\n tmpme1=tmpme->next;\n MenuDelSub(tmpme);\n tmpme=tmpme1;\n }\n Free(m);\n}\n\nI64 MenuEntryWidth(CMenuEntry *tmpme)\n{\n I64 res=StrLen(tmpme->name);\n CMenuEntry *tmpse=tmpme->sub;\n while (tmpse) {\n res=MaxI64(res,StrLen(tmpse->name));\n tmpse=tmpse->next;\n }\n return res+1;\n}\n\npublic CMenu *MenuPush(U8 *st)\n{//Save old pulldown menu and replace with new from str.\n CMenu *m=MenuNew(st);\n m->next=Fs->cur_menu;\n Fs->cur_menu=m;\n return m;\n}\n\npublic CMenu *MenuFilePush(U8 *filename)\n{//Save old pulldown menu and replace with new from file.\n CMenu *m=MenuFile(filename);\n m->next=Fs->cur_menu;\n Fs->cur_menu=m;\n return m;\n}\n\npublic U0 MenuPop()\n{//Restore old pulldown menu. Delete just-deactivated menu.\n CMenu *m=Fs->cur_menu;\n if (!m) return;\n Fs->cur_menu=m->next;\n MenuDel(m);\n}\n\nU0 DrawMenu(CDC *dc)\n{\n CMenu *m;\n CMenuEntry *tmpme,*tmpse,*cur_submenu=NULL;\n U8 *st=NULL;\n CTask *task=MenuTask;\n I64 i,w,x0,y0,x1=ms.pos.x,y1=ms.pos.y;\n if (!TaskValidate(task) || !(m=task->cur_menu)) {\n sys_cur_submenu_entry=NULL;\n return;\n }\n dc->color=m->attr>>4;\n GrRect(dc,0,0,GR_WIDTH,FONT_HEIGHT);\n x0=0;\n tmpme=m->sub;\n while (tmpme) {\n w=MenuEntryWidth(tmpme)*FONT_WIDTH;\n if (x0<=x1<x0+w) {\n if (0<=y1<FONT_HEIGHT) {\n dc->color=m->attr&15;\n GrRect(dc,x0,0,w,FONT_HEIGHT);\n dc->color=m->attr>>4;\n } else\n dc->color=m->attr&15;\n GrPrint(dc,x0,0,\"%s\",tmpme->name);\n y0=FONT_HEIGHT;\n tmpse=tmpme->sub;\n while (tmpse) {\n if (tmpse->checked)\n i=m->attr^0xFF;\n else\n i=m->attr;\n if (y0<=y1<y0+FONT_HEIGHT) {\n if (tmpse->msg_code==MSG_KEY_DOWN||\n tmpse->msg_code==MSG_KEY_DOWN_UP) {\n if (!tmpse->arg2)\n tmpse->arg2=Char2ScanCode(tmpse->arg1);\n st=ScanCode2KeyName(tmpse->arg2);\n }\n sys_cur_submenu_entry=cur_submenu=tmpse;\n dc->color=i&15;\n GrRect(dc,x0,y0,w,FONT_HEIGHT);\n dc->color=i>>4;\n GrPrint(dc,x0,y0,\"%s\",tmpse->name);\n if (st) {\n dc->color=i>>4;\n GrRect(dc,x0+w,y0-FONT_HEIGHT,\n (StrLen(st)+1)*FONT_WIDTH,FONT_HEIGHT*3);\n dc->color=i&15;\n GrPrint(dc,x0+w,y0,\"%s\",st);\n Free(st);\n }\n } else {\n dc->color=i>>4;\n GrRect(dc,x0,y0,w,FONT_HEIGHT);\n dc->color=i&15;\n GrPrint(dc,x0,y0,\"%s\",tmpse->name);\n }\n y0+=FONT_HEIGHT;\n tmpse=tmpse->next;\n }\n } else {\n dc->color=m->attr&15;\n GrPrint(dc,x0,0,\"%s\",tmpme->name);\n }\n x0+=w;\n tmpme=tmpme->next;\n }\n sys_cur_submenu_entry=cur_submenu;\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\TTFMove-ToTheFront-Apps.html
// Date: unknown-date
// Language: HolyC
U8 movement_costs[16];
movement_costs[PLAINS]=2;
movement_costs[TREES]=6;
movement_costs[MOUNTAINS]=10;
I64 HexMoveOneCost(Unit *tmpu,I64 r,I64 c,I64 facing)
{
I64 res;
if (tmpu->infantry)
res=0;
else {
res=FacingChg(facing,tmpu->facing);
if (res>0) res--;
}
if (roads[r][c] && roads[tmpu->row][tmpu->col])
res+=1;
else {
if (tmpu->infantry)
res+=2;
else {
res+=movement_costs[terrain[r][c]];
if (rivers[r][c])
res=tmpu->movement;
}
}
return res;
}
I64 HexMoveOne(I64 *_row,I64 *_col,F64 x,F64 y)
{
I64 direction,best_direction=-1,r,c;
F64 dd,best_dd,x1,y1;
RowCol2XY(&x1,&y1,*_row,*_col);
best_dd=Sqr(x1-x)+Sqr(y1-y);
for (direction=0;direction<6;direction++) {
r=*_row; c=*_col;
Toward(&r,&c,direction);
RowCol2XY(&x1,&y1,r,c);
dd=Sqr(x1-x)+Sqr(y1-y);
if (0<=r<map_rows && 0<=c<map_cols && dd<best_dd) {
best_dd=dd;
best_direction=direction;
}
}
if (best_direction>=0) {
Toward(_row,_col,best_direction);
return best_direction;
} else
return -1;
}
Bool UnitMovePlot(U0,I64 x,I64 y,I64)
{
move_x=x; move_y=y;
Sleep(5*animation_delay);
return TRUE;
}
U0 UnitMoveAnimation(Unit *tmpu,I64 r,I64 c,I64 facing)
{
F64 x1,y1,x2,y2,f=facing*60.0*pi/180.0;
moving_unit=tmpu;
RowCol2XY(&x1,&y1,tmpu->row,tmpu->col);
move_x=x1; move_y=y1;
moving=TRUE;
if (tmpu->infantry)
Snd(53);
else {
move_facing=tmpu->facing*60.0*pi/180.0;
Snd(41);
while (Wrap(f-move_facing,-pi)<=0) {
move_facing-=0.03;
Sleep(5*animation_delay);
}
while (Wrap(f-move_facing,-pi)>0) {
move_facing+=0.03;
Sleep(5*animation_delay);
}
Snd(34);
}
move_facing=f;
RowCol2XY(&x2,&y2,r,c);
Line(NULL,x1,y1,0,x2,y2,0,&UnitMovePlot);
Snd;
moving_unit=NULL;
moving=FALSE;
}
Bool UnitMove(Unit *tmpu,I64 x,I64 y)
{
Unit *target;
I64 r,c,r0=tmpu->row,c0=tmpu->col,i,facing;
while (tmpu->remaining_movement>0) {
r=tmpu->row;
c=tmpu->col;
if ((facing=HexMoveOne(&r,&c,x,y))<0)
break;
else {
i=HexMoveOneCost(tmpu,r,c,facing);
if (i>tmpu->movement)
i=tmpu->movement;
if (!tmpu->fired && tmpu->remaining_movement>=i &&
tmpu->remaining_movement>=tmpu->movement>>1 &&
(target=UnitFind(r,c)) && target->player!=tmpu->player &&
tmpu->infantry!=target->infantry) {
if (!HexOccupy(ToBool(target->infantry),tmpu,target)) {
tmpu=NULL;
break;
}
i=tmpu->remaining_movement;
}
if (tmpu->remaining_movement>=i && !UnitFind(r,c)) {
UnitMoveAnimation(tmpu,r,c,facing);
tmpu->facing=facing;
tmpu->remaining_movement-=i;
tmpu->row=r;
tmpu->col=c;
VisRecalc(VR_UPDATE_FRIENDLY_UNIT,tmpu);
LBEqu(&tmpu->vis[enemy_player],0,
VisRecalc(VR_ONE_ENEMY_UNIT,tmpu));
} else
break;
}
}
if (!tmpu || tmpu->row!=r0 || tmpu->col!=c0)
return TRUE;
else
return FALSE;
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\TTFMove-ToTheFront-Apps.html\n// Date: unknown-date\n// Language: HolyC\n\nU8 movement_costs[16];\nmovement_costs[PLAINS]=2;\nmovement_costs[TREES]=6;\nmovement_costs[MOUNTAINS]=10;\n\nI64 HexMoveOneCost(Unit *tmpu,I64 r,I64 c,I64 facing)\n{\n I64 res;\n if (tmpu->infantry)\n res=0;\n else {\n res=FacingChg(facing,tmpu->facing);\n if (res>0) res--;\n }\n if (roads[r][c] && roads[tmpu->row][tmpu->col])\n res+=1;\n else {\n if (tmpu->infantry)\n res+=2;\n else {\n res+=movement_costs[terrain[r][c]];\n if (rivers[r][c])\n res=tmpu->movement;\n }\n }\n return res;\n}\n\nI64 HexMoveOne(I64 *_row,I64 *_col,F64 x,F64 y)\n{\n I64 direction,best_direction=-1,r,c;\n F64 dd,best_dd,x1,y1;\n RowCol2XY(&x1,&y1,*_row,*_col);\n best_dd=Sqr(x1-x)+Sqr(y1-y);\n for (direction=0;direction<6;direction++) {\n r=*_row; c=*_col;\n Toward(&r,&c,direction);\n RowCol2XY(&x1,&y1,r,c);\n dd=Sqr(x1-x)+Sqr(y1-y);\n if (0<=r<map_rows && 0<=c<map_cols && dd<best_dd) {\n best_dd=dd;\n best_direction=direction;\n }\n }\n if (best_direction>=0) {\n Toward(_row,_col,best_direction);\n return best_direction;\n } else\n return -1;\n}\n\nBool UnitMovePlot(U0,I64 x,I64 y,I64)\n{\n move_x=x; move_y=y;\n Sleep(5*animation_delay);\n return TRUE;\n}\n\nU0 UnitMoveAnimation(Unit *tmpu,I64 r,I64 c,I64 facing)\n{\n F64 x1,y1,x2,y2,f=facing*60.0*pi/180.0;\n moving_unit=tmpu;\n RowCol2XY(&x1,&y1,tmpu->row,tmpu->col);\n move_x=x1; move_y=y1;\n moving=TRUE;\n if (tmpu->infantry)\n Snd(53);\n else {\n move_facing=tmpu->facing*60.0*pi/180.0;\n Snd(41);\n while (Wrap(f-move_facing,-pi)<=0) {\n move_facing-=0.03;\n Sleep(5*animation_delay);\n }\n while (Wrap(f-move_facing,-pi)>0) {\n move_facing+=0.03;\n Sleep(5*animation_delay);\n }\n Snd(34);\n }\n move_facing=f;\n RowCol2XY(&x2,&y2,r,c);\n Line(NULL,x1,y1,0,x2,y2,0,&UnitMovePlot);\n Snd;\n moving_unit=NULL;\n moving=FALSE;\n}\n \nBool UnitMove(Unit *tmpu,I64 x,I64 y)\n{\n Unit *target;\n I64 r,c,r0=tmpu->row,c0=tmpu->col,i,facing;\n while (tmpu->remaining_movement>0) {\n r=tmpu->row;\n c=tmpu->col;\n if ((facing=HexMoveOne(&r,&c,x,y))<0)\n break;\n else {\n i=HexMoveOneCost(tmpu,r,c,facing);\n if (i>tmpu->movement)\n i=tmpu->movement;\n if (!tmpu->fired && tmpu->remaining_movement>=i &&\n tmpu->remaining_movement>=tmpu->movement>>1 &&\n (target=UnitFind(r,c)) && target->player!=tmpu->player &&\n tmpu->infantry!=target->infantry) {\n if (!HexOccupy(ToBool(target->infantry),tmpu,target)) {\n tmpu=NULL;\n break;\n }\n i=tmpu->remaining_movement;\n }\n if (tmpu->remaining_movement>=i && !UnitFind(r,c)) {\n UnitMoveAnimation(tmpu,r,c,facing);\n tmpu->facing=facing;\n tmpu->remaining_movement-=i;\n tmpu->row=r;\n tmpu->col=c;\n VisRecalc(VR_UPDATE_FRIENDLY_UNIT,tmpu);\n LBEqu(&tmpu->vis[enemy_player],0,\n VisRecalc(VR_ONE_ENEMY_UNIT,tmpu));\n } else\n break;\n }\n }\n if (!tmpu || tmpu->row!=r0 || tmpu->col!=c0)\n return TRUE;\n else\n return FALSE;\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\InEd-InFile-Demo.html
// Date: unknown-date
// Language: HolyC
/* To run this, do a directory, right click on
this file's name and sel "InFile".
Or, type InFile(filename);
See InFile in the glossary for more info.
This InFile will renum the defines in
InEd.DD.Z. Test it by numbering a few wrong
and running this demo.
*/
U8 i;
"Ed(\"InEd.DD.Z\");\n";
//Go to start of file
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
for (i=0;i<=0xC3;i++) {
if (i)
Msg(MSG_KEY_DOWN_UP,0,SC_F3);
else
"%c0x%c",CH_CTRLF,CH_ESC;
Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);
Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);
"%02X",i;
Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);
Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);
"%c%c",CH_BACKSPACE,CH_BACKSPACE;
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\InEd-InFile-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\n/* To run this, do a directory, right click on\nthis file's name and sel \"InFile\".\nOr, type InFile(filename);\nSee InFile in the glossary for more info.\n\nThis InFile will renum the defines in\nInEd.DD.Z. Test it by numbering a few wrong\nand running this demo.\n\n*/\n\nU8 i;\n\n\"Ed(\\\"InEd.DD.Z\\\");\\n\";\n//Go to start of file\nMsg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);\nfor (i=0;i<=0xC3;i++) {\n if (i)\n Msg(MSG_KEY_DOWN_UP,0,SC_F3);\n else\n \"%c0x%c\",CH_CTRLF,CH_ESC;\n Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);\n Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);\n \"%02X\",i;\n Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);\n Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);\n \"%c%c\",CH_BACKSPACE,CH_BACKSPACE;\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\Mount-ABlkDev-Adam.html
// Date: unknown-date
// Language: HolyC
#help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically);"
U8 Mount2(U8 boot_drv_let,CDoc *_doc,Bool _caller_is_prtdsk)
{//If _doc, called by ::/Kernel/KCfg.HC else called by Mount().
I64 cnt,total=0,num_hints,drv_let,type,unit,prt_num;
U8 blks_buf[STR_LEN],addr_buf[STR_LEN],base0_buf[STR_LEN],base1_buf[STR_LEN],
*filename=NULL,*filename2=NULL,res=0;
CATARep *head=NULL,*tmpha;
Bool whole_drv,make_free;
CDoc *doc;
if (boot_drv_let)
boot_drv_let=Let2Let(boot_drv_let);
do {
cnt=0;
if (!_doc)
DrvRep;
"\n****** Mount Drives ******\n"
"$GREEN$A$FG$-$GREEN$B$FG$ are RAM drives.\n"
"$GREEN$C$FG$-$GREEN$L$FG$ are ATA hard drives.\n"
"$GREEN$M$FG$-$GREEN$P$FG$ are ISO file read drives.\n"
"$GREEN$Q$FG$-$GREEN$S$FG$ are ISO file write drives.\n"
"$GREEN$T$FG$-$GREEN$Z$FG$ are ATAPI CD/DVD drives.\n"
"\nDrive Letter ($PURPLE$<ENTER>$FG$ to exit):";
drv_let=Let2Let(GetChar);
'\n';
if (type=Let2BlkDevType(drv_let)) {
whole_drv=FALSE;
if (_doc) { //Called by ::/Kernel/KCfg.HC
doc=_doc;
make_free=FALSE;
} else { //Called by Mount()
doc=DocNew;
DocPrint(doc,"CBlkDev *bd;\n");
make_free=TRUE;
}
unit=0;
prt_num=I64_MIN;
switch (type) {
case BDT_RAM:
"Addr of RAM disk ($PURPLE$<ENTER>$FG$ to MAlloc):";
GetS(addr_buf,STR_LEN);
case BDT_ISO_FILE_WRITE:
"Blks of 512 bytes:";
GetS(blks_buf,STR_LEN);
break;
case BDT_ISO_FILE_READ:
filename=GetStr("File Name:");
break;
case BDT_ATA:
prt_num=GetI64("Partition Num (Default=All):",prt_num);
case BDT_ATAPI:
num_hints=ATARep(,,&head);
if (type==BDT_ATAPI && boot_drv_let)
"<ENTER> to use booted CD/DVD\n"; //Only ::/Kernel/KCfg.HC
do {
if (num_hints)
"Enter dev number or\nport with $PURPLE$0x$FG$ prefix.\n"
"I/O Port Base0:\n";
else
"Include $PURPLE$0x$FG$ prefix.\nI/O Port Base0:\n";
GetS(base0_buf,STR_LEN);
} while (!Str2I64(base0_buf) && (type!=BDT_ATAPI || !boot_drv_let));
if (1<=Str2I64(base0_buf)<=num_hints) {
tmpha=ATARepFind(head,Str2I64(base0_buf));
StrPrint(base0_buf,"0x%X",tmpha->base0);
StrPrint(base1_buf,"0x%X",tmpha->base1);
unit=tmpha->unit;
} else if (type!=BDT_ATAPI || *base0_buf) {
if (type==BDT_ATAPI)
StrCpy(base1_buf,"0");
else
do {
"I/O Port Base1:\n";
GetS(base1_buf,STR_LEN);
} while (!Str2I64(base1_buf));
do {
"\t$PURPLE$0$FG$=Master\n\t$PURPLE$1$FG$=Slave\nUnit:";
unit=GetChar-'0';
} while (!(0<=unit<=1));
'\n';
}
LinkedLstDel(head);
break;
}
DocPrint(doc,"bd=BlkDevNextFreeSlot(\'%C\',%d);bd->unit=%d;\n",
drv_let,type,unit);
switch (type) {
case BDT_RAM:
if (!*addr_buf) StrCpy(addr_buf,"0");
DocPrint(doc,"bd->RAM_dsk=%s;\n",addr_buf);
case BDT_ISO_FILE_WRITE:
if (!*blks_buf) StrCpy(blks_buf,"0");
DocPrint(doc,"bd->max_blk=(%s)-1;\n",blks_buf);
DocPrint(doc,"bd->drv_offset=19<<2+"
"(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;\n");
break;
case BDT_ISO_FILE_READ:
filename2=FileNameAbs(filename);
DocPrint(doc,"bd->file_dsk_name=AStrNew(\"%s\");\n",filename2);
DocPrint(doc,"bd->drv_offset=19<<2+"
"(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;\n");
break;
case BDT_ATA:
case BDT_ATAPI:
if (type==BDT_ATAPI && !*base0_buf) {
DocPrint(doc,"GetBaseUnit(bd);\n"); //Only ::/Kernel/KCfg.HC
if (drv_let==boot_drv_let)
make_free=TRUE;
} else
DocPrint(doc,"bd->base0=%s;bd->base1=%s;\n",base0_buf,base1_buf);
if (type==BDT_ATA && _caller_is_prtdsk) {
"\nReformat WHOLE drive!";
whole_drv=YorN;
}
break;
}
DocPrint(doc,"BlkDevAdd(bd,%d,%d,%d);\n",prt_num,whole_drv,make_free);
if (_doc) //Called by ::/Kernel/KCfg.HC
cnt++;
else { //Called by Mount()
if ((cnt=ExeDoc(doc)) && whole_drv) {
if (_caller_is_prtdsk) {
res=drv_let;
DskPrt(drv_let,1.0); //First mount whole drive.
} else
DskPrt(drv_let);
}
DocDel(doc);
}
}
total+=cnt;
} while (cnt && !_caller_is_prtdsk ||
!total && _doc); //At least 1 if Called by ::/Kernel/KCfg.HC
Free(filename);
Free(filename2);
return res;
}
public U8 Mount(Bool caller_is_prtdsk=FALSE)
{//Mount drives. Called from DskPrt(Mount).
return Mount2(0,NULL,caller_is_prtdsk);
}
public U0 Unmount(U8 drv_let=0)
{//Unmount drive(s).
BlkDevDel(Let2BlkDev(drv_let));
}
public U8 MountFile(U8 *filename)
{//Mount ISO.C file.
U8 *filename2=ExtDft(filename,"ISO.C"),*filename3=FileNameAbs(filename2);
CDrv *dv=DrvMakeFreeSlot(DrvNextFreeLet('M')); //First BDT_ISO_FILE_READ
CBlkDev *bd=BlkDevNextFreeSlot(dv->drv_let,BDT_ISO_FILE_READ);
bd->drv_offset=19<<2+(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;
bd->file_dsk_name=AStrNew(filename3);
BlkDevAdd(bd,,TRUE,TRUE);
Free(filename3);
Free(filename2);
return dv->drv_let;
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Mount-ABlkDev-Adam.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"Install;File/Cmd Line (Typically);Cmd Line (Typically);\"\nU8 Mount2(U8 boot_drv_let,CDoc *_doc,Bool _caller_is_prtdsk)\n{//If _doc, called by ::/Kernel/KCfg.HC else called by Mount().\n I64 cnt,total=0,num_hints,drv_let,type,unit,prt_num;\n U8 blks_buf[STR_LEN],addr_buf[STR_LEN],base0_buf[STR_LEN],base1_buf[STR_LEN],\n *filename=NULL,*filename2=NULL,res=0;\n CATARep *head=NULL,*tmpha;\n Bool whole_drv,make_free;\n CDoc *doc;\n if (boot_drv_let)\n boot_drv_let=Let2Let(boot_drv_let);\n do {\n cnt=0;\n if (!_doc)\n DrvRep;\n \"\\n****** Mount Drives ******\\n\"\n \"$GREEN$A$FG$-$GREEN$B$FG$ are RAM drives.\\n\"\n \"$GREEN$C$FG$-$GREEN$L$FG$ are ATA hard drives.\\n\"\n \"$GREEN$M$FG$-$GREEN$P$FG$ are ISO file read drives.\\n\"\n \"$GREEN$Q$FG$-$GREEN$S$FG$ are ISO file write drives.\\n\"\n \"$GREEN$T$FG$-$GREEN$Z$FG$ are ATAPI CD/DVD drives.\\n\"\n \"\\nDrive Letter ($PURPLE$<ENTER>$FG$ to exit):\";\n drv_let=Let2Let(GetChar);\n '\\n';\n if (type=Let2BlkDevType(drv_let)) {\n whole_drv=FALSE;\n if (_doc) { //Called by ::/Kernel/KCfg.HC\n doc=_doc;\n make_free=FALSE;\n } else { //Called by Mount()\n doc=DocNew;\n DocPrint(doc,\"CBlkDev *bd;\\n\");\n make_free=TRUE;\n }\n unit=0;\n prt_num=I64_MIN;\n switch (type) {\n case BDT_RAM:\n \"Addr of RAM disk ($PURPLE$<ENTER>$FG$ to MAlloc):\";\n GetS(addr_buf,STR_LEN);\n case BDT_ISO_FILE_WRITE:\n \"Blks of 512 bytes:\";\n GetS(blks_buf,STR_LEN);\n break;\n case BDT_ISO_FILE_READ:\n filename=GetStr(\"File Name:\");\n break;\n case BDT_ATA:\n prt_num=GetI64(\"Partition Num (Default=All):\",prt_num);\n case BDT_ATAPI:\n num_hints=ATARep(,,&head);\n if (type==BDT_ATAPI && boot_drv_let)\n \"<ENTER> to use booted CD/DVD\\n\"; //Only ::/Kernel/KCfg.HC\n do {\n if (num_hints)\n \"Enter dev number or\\nport with $PURPLE$0x$FG$ prefix.\\n\"\n \"I/O Port Base0:\\n\";\n else\n \"Include $PURPLE$0x$FG$ prefix.\\nI/O Port Base0:\\n\";\n GetS(base0_buf,STR_LEN);\n } while (!Str2I64(base0_buf) && (type!=BDT_ATAPI || !boot_drv_let));\n if (1<=Str2I64(base0_buf)<=num_hints) {\n tmpha=ATARepFind(head,Str2I64(base0_buf));\n StrPrint(base0_buf,\"0x%X\",tmpha->base0);\n StrPrint(base1_buf,\"0x%X\",tmpha->base1);\n unit=tmpha->unit;\n } else if (type!=BDT_ATAPI || *base0_buf) {\n if (type==BDT_ATAPI)\n StrCpy(base1_buf,\"0\");\n else\n do {\n \"I/O Port Base1:\\n\";\n GetS(base1_buf,STR_LEN);\n } while (!Str2I64(base1_buf));\n do {\n \"\\t$PURPLE$0$FG$=Master\\n\\t$PURPLE$1$FG$=Slave\\nUnit:\";\n unit=GetChar-'0';\n } while (!(0<=unit<=1));\n '\\n';\n }\n LinkedLstDel(head);\n break;\n }\n DocPrint(doc,\"bd=BlkDevNextFreeSlot(\\'%C\\',%d);bd->unit=%d;\\n\",\n drv_let,type,unit);\n switch (type) {\n case BDT_RAM:\n if (!*addr_buf) StrCpy(addr_buf,\"0\");\n DocPrint(doc,\"bd->RAM_dsk=%s;\\n\",addr_buf);\n case BDT_ISO_FILE_WRITE:\n if (!*blks_buf) StrCpy(blks_buf,\"0\");\n DocPrint(doc,\"bd->max_blk=(%s)-1;\\n\",blks_buf);\n DocPrint(doc,\"bd->drv_offset=19<<2+\"\n \"(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;\\n\");\n break;\n case BDT_ISO_FILE_READ:\n filename2=FileNameAbs(filename);\n DocPrint(doc,\"bd->file_dsk_name=AStrNew(\\\"%s\\\");\\n\",filename2);\n DocPrint(doc,\"bd->drv_offset=19<<2+\"\n \"(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;\\n\");\n break;\n case BDT_ATA:\n case BDT_ATAPI:\n if (type==BDT_ATAPI && !*base0_buf) {\n DocPrint(doc,\"GetBaseUnit(bd);\\n\"); //Only ::/Kernel/KCfg.HC\n if (drv_let==boot_drv_let)\n make_free=TRUE;\n } else\n DocPrint(doc,\"bd->base0=%s;bd->base1=%s;\\n\",base0_buf,base1_buf);\n if (type==BDT_ATA && _caller_is_prtdsk) {\n \"\\nReformat WHOLE drive!\";\n whole_drv=YorN;\n }\n break;\n }\n DocPrint(doc,\"BlkDevAdd(bd,%d,%d,%d);\\n\",prt_num,whole_drv,make_free);\n if (_doc) //Called by ::/Kernel/KCfg.HC\n cnt++;\n else { //Called by Mount()\n if ((cnt=ExeDoc(doc)) && whole_drv) {\n if (_caller_is_prtdsk) {\n res=drv_let;\n DskPrt(drv_let,1.0); //First mount whole drive.\n } else\n DskPrt(drv_let);\n }\n DocDel(doc);\n }\n }\n total+=cnt;\n } while (cnt && !_caller_is_prtdsk ||\n !total && _doc); //At least 1 if Called by ::/Kernel/KCfg.HC\n Free(filename);\n Free(filename2);\n return res;\n}\n\npublic U8 Mount(Bool caller_is_prtdsk=FALSE)\n{//Mount drives. Called from DskPrt(Mount).\n return Mount2(0,NULL,caller_is_prtdsk);\n}\n\npublic U0 Unmount(U8 drv_let=0)\n{//Unmount drive(s).\n BlkDevDel(Let2BlkDev(drv_let));\n}\n\npublic U8 MountFile(U8 *filename)\n{//Mount ISO.C file.\n U8 *filename2=ExtDft(filename,\"ISO.C\"),*filename3=FileNameAbs(filename2);\n CDrv *dv=DrvMakeFreeSlot(DrvNextFreeLet('M')); //First BDT_ISO_FILE_READ\n CBlkDev *bd=BlkDevNextFreeSlot(dv->drv_let,BDT_ISO_FILE_READ);\n bd->drv_offset=19<<2+(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;\n bd->file_dsk_name=AStrNew(filename3);\n BlkDevAdd(bd,,TRUE,TRUE);\n Free(filename3);\n Free(filename2);\n return dv->drv_let;\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\GrGlbls-Gr-Adam.html
// Date: unknown-date
// Language: HolyC
#help_index "Graphics"
public class CGrGlbls
{
I64 *to_8_bits,*to_8_colors;
CDC *scrn_image, //Read only.
*dc, //Persistent
*dc1,
*dc2, //Updated every refresh
*dc_cache,
*zoomed_dc;
U32 *text_base; //See TextBase Layer. (Similar to 0xB8000 but 32 bits)
U16 *win_z_buf;
#define SPHT_ELEM_CODE 1
CHashTable *sprite_hash;
U16 *win_uncovered_bitmap;
I64 highest_uncovered;
U16 *vga_text_cache;
I64 pan_text_x,pan_text_y; //[-7,7]
U0 (*fp_final_scrn_update)(CDC *dc);//Mouse cursor is handled here.
U0 (*fp_wall_paper)(CTask *task);
U0 (*fp_draw_ms)(CDC *dc,I64 x,I64 y);
U0 (*fp_draw_grab_ms)(CDC *dc,I64 x,I64 y,Bool closed);
U8 *empty_sprite; //Gets assigned gr.empty_sprite
#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_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.
Bool continuous_scroll,
hide_row,hide_col;
} gr;
//See RLf_VGA
//See SysGrInit()
//Allows consts to be used instead of vars.
HashPublic("GR_WIDTH",HTT_DEFINE_STR);;
HashPublic("GR_HEIGHT",HTT_DEFINE_STR);;
#help_index "Char;TextBase Layer/Char"
DefinePrint("TEXT_ROWS","%d",text.rows);;;
HashPublic("TEXT_ROWS",HTT_DEFINE_STR);;;
DefinePrint("TEXT_COLS","%d",text.cols);;;
HashPublic("TEXT_COLS",HTT_DEFINE_STR);;;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\GrGlbls-Gr-Adam.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"Graphics\"\n\npublic class CGrGlbls\n{\n I64 *to_8_bits,*to_8_colors;\n CDC *scrn_image, //Read only.\n *dc, //Persistent\n *dc1,\n *dc2, //Updated every refresh\n *dc_cache,\n *zoomed_dc;\n U32 *text_base; //See TextBase Layer. (Similar to 0xB8000 but 32 bits)\n U16 *win_z_buf;\n\n #define SPHT_ELEM_CODE 1\n CHashTable *sprite_hash;\n\n U16 *win_uncovered_bitmap;\n I64 highest_uncovered;\n U16 *vga_text_cache;\n I64 pan_text_x,pan_text_y; //[-7,7]\n U0 (*fp_final_scrn_update)(CDC *dc);//Mouse cursor is handled here.\n U0 (*fp_wall_paper)(CTask *task);\n U0 (*fp_draw_ms)(CDC *dc,I64 x,I64 y);\n U0 (*fp_draw_grab_ms)(CDC *dc,I64 x,I64 y,Bool closed);\n U8 *empty_sprite; //Gets assigned gr.empty_sprite\n\n #define GR_PEN_BRUSHES_NUM 64\n CDC *pen_brushes[GR_PEN_BRUSHES_NUM],\n *collision_pen_brushes[GR_PEN_BRUSHES_NUM],\n *even_pen_brushes[GR_PEN_BRUSHES_NUM],\n *odd_pen_brushes[GR_PEN_BRUSHES_NUM];\n I8 circle_lo[GR_PEN_BRUSHES_NUM][GR_PEN_BRUSHES_NUM],\n circle_hi[GR_PEN_BRUSHES_NUM][GR_PEN_BRUSHES_NUM];\n\n #define GR_SCRN_ZOOM_MAX 8\n U8 *scrn_zoom_tables[GR_SCRN_ZOOM_MAX+1];\n I64 scrn_zoom,sx,sy;\n\n //When zoomed, this keeps the mouse centered.\n Bool continuous_scroll,\n hide_row,hide_col;\n} gr;\n\n//See RLf_VGA\n//See SysGrInit()\n//Allows consts to be used instead of vars.\nHashPublic(\"GR_WIDTH\",HTT_DEFINE_STR);;\nHashPublic(\"GR_HEIGHT\",HTT_DEFINE_STR);;\n\n#help_index \"Char;TextBase Layer/Char\"\nDefinePrint(\"TEXT_ROWS\",\"%d\",text.rows);;;\nHashPublic(\"TEXT_ROWS\",HTT_DEFINE_STR);;;\nDefinePrint(\"TEXT_COLS\",\"%d\",text.cols);;;\nHashPublic(\"TEXT_COLS\",HTT_DEFINE_STR);;;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\Load-TimeClock-Apps.html
// Date: unknown-date
// Language: HolyC
#help_index "Misc"
Cd(__DIR__);;
#include "TimeClk"
#include "Install" //Might as well always install
#help_index ""
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Load-TimeClock-Apps.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"Misc\"\n\nCd(__DIR__);;\n#include \"TimeClk\"\n#include \"Install\" //Might as well always install\n\n#help_index \"\""
}
]
}
|
// Source: D:\TempleOS-Projects\html\UnusedDefine-DolDoc-Demo.html
// Date: unknown-date
// Language: HolyC
/*Scans the sym table and checks
each HTT_DEFINE_STR entry to see if
it only occurs once in files.
It's a brute force solution, but
gets the job done... slowly.
Find() returns a count of matches.
FileOcc() is Find() with
output Silent().
*/
U0 UnusedDefineScan()
{
CDoc *old_put_doc,*old_display_doc,*doc;
I64 i,cnt=0;
CHashTable *table;
CHash *tmph;
CDocEntry *doc_e,*doc_e2;
Bool old_silent=IsSilent;
try {
table=Fs->hash_table;
while (table) {
for (i=0;i<=table->mask;i++) {
tmph=table->body[i];
while (tmph) {
if (tmph->type&HTT_DEFINE_STR)
cnt++;
tmph=tmph->next;
}
}
table=table->next;
}
progress1=0;
progress1_max=cnt;
StrCpy(progress1_desc,"Define Scan");
table=Fs->hash_table;
while (table) {
for (i=0;i<=table->mask;i++) {
tmph=table->body[i];
while (tmph) {
if (tmph->type&HTT_DEFINE_STR) {
progress1++;
if (FileOcc(tmph->str,"/*","+l-i+$")==1) {
doc=DocNew;
old_put_doc=DocPut;
old_display_doc=DocDisplay;
Fs->put_doc=Fs->display_doc=doc;
Find(tmph->str,"/*","+l-i+$");
Fs->put_doc=old_put_doc;
Fs->display_doc=old_display_doc;
doc_e=doc->head.next;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_LINK) {
"%s ",tmph->str;
doc_e2=DocEntryCopy(doc,doc_e);
DocInsEntry(old_put_doc,doc_e2);
'\n';
}
doc_e=doc_e->next;
}
DocDel(doc);
}
}
tmph=tmph->next;
}
}
table=table->next;
}
} catch
PutExcept;
Silent(old_silent);
'\n';
ProgressBarsRst;
}
UnusedDefineScan;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\UnusedDefine-DolDoc-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\n/*Scans the sym table and checks\neach HTT_DEFINE_STR entry to see if\nit only occurs once in files.\n\nIt's a brute force solution, but\ngets the job done... slowly.\n\nFind() returns a count of matches.\n\nFileOcc() is Find() with\noutput Silent().\n*/\n\nU0 UnusedDefineScan()\n{\n CDoc *old_put_doc,*old_display_doc,*doc;\n I64 i,cnt=0;\n CHashTable *table;\n CHash *tmph;\n CDocEntry *doc_e,*doc_e2;\n Bool old_silent=IsSilent;\n\n try {\n table=Fs->hash_table;\n while (table) {\n for (i=0;i<=table->mask;i++) {\n tmph=table->body[i];\n while (tmph) {\n if (tmph->type&HTT_DEFINE_STR)\n cnt++;\n tmph=tmph->next;\n }\n }\n table=table->next;\n }\n\n progress1=0;\n progress1_max=cnt;\n StrCpy(progress1_desc,\"Define Scan\");\n\n table=Fs->hash_table;\n while (table) {\n for (i=0;i<=table->mask;i++) {\n tmph=table->body[i];\n while (tmph) {\n if (tmph->type&HTT_DEFINE_STR) {\n progress1++;\n if (FileOcc(tmph->str,\"/*\",\"+l-i+$\")==1) {\n doc=DocNew;\n old_put_doc=DocPut;\n old_display_doc=DocDisplay;\n Fs->put_doc=Fs->display_doc=doc;\n Find(tmph->str,\"/*\",\"+l-i+$\");\n Fs->put_doc=old_put_doc;\n Fs->display_doc=old_display_doc;\n doc_e=doc->head.next;\n while (doc_e!=doc) {\n if (doc_e->type_u8==DOCT_LINK) {\n \"%s \",tmph->str;\n doc_e2=DocEntryCopy(doc,doc_e);\n DocInsEntry(old_put_doc,doc_e2);\n '\\n';\n }\n doc_e=doc_e->next;\n }\n DocDel(doc);\n }\n }\n tmph=tmph->next;\n }\n }\n table=table->next;\n }\n } catch\n PutExcept;\n\n Silent(old_silent);\n '\\n';\n ProgressBarsRst;\n}\n\nUnusedDefineScan;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\Rev-RevFileDemo-Demo.html
// Date: unknown-date
// Language: HolyC
/*We use the internal routines from the text editor
to cut and paste lines to rev the order of
lines in a text file.
*/
Cd(__DIR__);;
U0 Rev(U8 *in_name,U8 *out_name)
{
CDoc *doc_in =DocRead(in_name),
*doc_out=DocNew(out_name);
DocTop(doc_in);
while (doc_in->head.next!=doc_in) {
EdLineDown(doc_in,SC_CURSOR_DOWN|SCF_SHIFT);
ClipCut(doc_in);
DocTop(doc_out);
ClipPaste(doc_out);
}
DocWrite(doc_out);
}
Rev("DemoPoemBwd.DD.Z","~/DemoPoemFwd.DD.Z");
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Rev-RevFileDemo-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\n/*We use the internal routines from the text editor\nto cut and paste lines to rev the order of\nlines in a text file.\n*/\n\nCd(__DIR__);;\n\nU0 Rev(U8 *in_name,U8 *out_name)\n{\n CDoc *doc_in =DocRead(in_name),\n *doc_out=DocNew(out_name);\n DocTop(doc_in);\n while (doc_in->head.next!=doc_in) {\n EdLineDown(doc_in,SC_CURSOR_DOWN|SCF_SHIFT);\n ClipCut(doc_in);\n DocTop(doc_out);\n ClipPaste(doc_out);\n }\n DocWrite(doc_out);\n}\n\nRev(\"DemoPoemBwd.DD.Z\",\"~/DemoPoemFwd.DD.Z\");"
}
]
}
|
// Source: D:\TempleOS-Projects\html\TOSDistro-TOS-Home.html
// Date: unknown-date
// Language: HolyC
//The CFG defines are ~/TOS/TOSCfg.HC.
#help_index "Misc/TOS/Distro"
#define MAKE_STD 1
#define MAKE_STD_RS 0
#define MAKE_ULTRA 1
#define MAKE_ULTRA_RS 0
#define MAKE_SUP1 1
#define MAKE_WEB 1
#define MAKE_BOOKS1 0
#define MAKE_BOOKS2 0
#define MAKE_DBG 0
#define MAKE_STAFF 1
#define PROFANITY_CHK 0
public U8 TOSGetDrv()
{//Pmt for drv let.
I64 res;
"Drive (%s):",TOS_HDS;
res=Let2Let(GetChar);
'\n';
return res;
}
public U0 TOSBootHDIns(U8 drv_let=0)
{//Make Compiler and Kernel. Reinstall Kernel.
drv_let=Let2Let(drv_let);
In(TOS_CFG);
BootHDIns(drv_let);
if (StrOcc(TOS_MASTER_BOOT_DRVS,drv_let))
BootMHDIns(drv_let);
}
public U0 TOSCopyDrv(U8 src,U8 dst)
{//Fmt dst and copy entire drv.
U8 buf_s[STR_LEN],buf_d[STR_LEN];
src=Let2Let(src);
dst=Let2Let(dst);
Fmt(dst,,FALSE,FSt_FAT32);
StrPrint(buf_s,"%c:/",src);
StrPrint(buf_d,"%c:/",dst);
CopyTree(buf_s,buf_d);
DocClear;
Drv(dst);
TOSBootHDIns(dst);
}
public U0 TOSPmtAndCopyDrv()
{//Pmt for drv lets. Then, Fmt dst and copy entire drv.
I64 src,dst;
"$RED$\nCopy Src Drive:\n$FG$";
src=TOSGetDrv;
"$RED$\nCopy Dst Drive:\n$FG$";
dst=TOSGetDrv;
TOSCopyDrv(src,dst);
}
U0 DistroSongsPrep(U8 threshold='7')
{
CDoc *doc;
CDocEntry *doc_e;
CDirEntry *tmpde=FilesFind("/Home/Sup1/Sup1Hymns/*.HC*",
FUF_CLUS_ORDER),*tmpde1=tmpde;
DelTree("/Apps/Psalmody/Examples");
DirMk("/Apps/Psalmody/Examples");
while (tmpde) {
doc=DocRead(tmpde->full_name);
doc_e=doc->head.next;
if (doc_e->type_u8==DOCT_TEXT && doc_e->tag[2]>=threshold)
Copy(tmpde->full_name,"/Apps/Psalmody/Examples");
DocDel(doc);
tmpde=tmpde->next;
}
DirTreeDel(tmpde1);
}
U0 DistroPrep()
{
AOnceFlush; //Don't want in Registry
OnceFlush;
Del("/Home/Demo*");
DelTree("/Home/*Tmp.DD.Z");
if (FileFind("/Home/Sup1/Sup1Hymns"))
DistroSongsPrep;
DelTree("/Tmp");
DirMk("/Tmp");
DirMk("/Tmp/ScrnShots");
Touch("/PersonalMenu.DD.Z","+T");
Touch("/Home/PersonalMenu.DD.Z","+T");
DelTree("/Demo/AcctExample");
CopyTree("/Home","/Demo/AcctExample");
DelTree("/Demo/AcctExample/ALM");
DelTree("/Demo/AcctExample/TAD");
DelTree("/Demo/AcctExample/Sup1");
DelTree("/Demo/AcctExample/Books1");
DelTree("/Demo/AcctExample/Books2");
DelTree("/Demo/AcctExample/Web");
Del("/Demo/AcctExample/Test*");
Copy("/Home/Web/index.DD.Z",
"/Demo/ToHtmlToTXTDemo/DemoInPage.DD.Z");
if (FileFind("~/Sup1/Sup1Utils/SortHeaders.HC.Z"))
ExeFile("~/Sup1/Sup1Utils/SortHeaders.HC.Z");
if (FileFind("~/Sup1/Sup1Blog/YouTube.DD.Z"))
Sort("~/Sup1/Sup1Blog/YouTube.DD.Z",,2);
//Once in a while, do ~/Sup1/Sup1Utils/DblSpaceScan.HC.
CursorRem("/*");
DelTree("/Demo/*.BI*");
S2T("/*","+r+S");
DocOpt("/*","+R");
Move(ACD_DEF_FILENAME,ACD_DEF_FILENAME_Z);
}
U0 DbgDistroFilePrep()
{
CBlkDev *bd;
if (!Let2Drv('A',FALSE)) {
In(CFG_DBG_DISTRO "\n");
Mount;
}
bd=Let2BlkDev('A');
Fmt('A',,FALSE,FSt_REDSEA);
DirMk("A:/Compiler");
Copy("C:/Compiler/Compiler.BIN.Z", "A:/Compiler");
Copy("C:/Compiler/OpCodes.DD.Z", "A:/Compiler");
Copy("C:/Compiler/CompilerA.HH.Z", "A:/Compiler");
Copy("C:/Compiler/CompilerB.HH.Z", "A:/Compiler");
DirMk("A:/Kernel");
Copy("C:/Kernel/*.HH*", "A:/Kernel");
CopyTree("C:/Kernel/BlkDev", "A:/Kernel/BlkDev");
Copy("C:/Home/Sup1/Sup1Distro/DbgStartOS.HC.Z","A:/StartOS.HC.Z");
DirMk("A:/Adam");
Copy("C:/Home/Sup1/Sup1Distro/DbgMakeAdam.HC.Z","A:/Adam/MakeAdam.HC.Z");
Copy("C:/Home/Sup1/Sup1Distro/DbgMount.HC.Z","A:/Adam");
Copy("C:/Adam/AExts.HC.Z", "A:/Adam");
Copy("C:/Adam/AMath.HC.Z", "A:/Adam");
Copy("C:/Adam/Training.HC.Z","A:/Adam");
Copy("C:/Adam/AMem.HC.Z", "A:/Adam");
Copy("C:/Adam/TaskRep.HC.Z", "A:/Adam");
FileWrite("C:" CFG_DBG_DISTRO_FILE,
bd->RAM_dsk,(bd->max_blk+1)<<BLK_SIZE_BITS);
}
U0 MakeSymFiles()
{
CDoc *doc;
U8 *st;
DocClear;
DocMax;
HashTablePurge(adam_task->hash_table);
Who;
if (doc=DocPut) {
st=StrNew(doc->filename.name);
StrCpy(doc->filename.name,"D:/Wb/Home/Web/SymsAlpha.DD.Z");
DocWrite(doc);
StrCpy(doc->filename.name,st);
Free(st);
}
DocClear;
DocMax;
Who("+m");
if (doc=DocPut) {
st=StrNew(doc->filename.name);
StrCpy(doc->filename.name,"D:/Wb/Home/Web/SymsAddress.DD.Z");
DocWrite(doc);
StrCpy(doc->filename.name,st);
Free(st);
}
DocClear;
}
I64 MakeLineRepFile()
{
U8 *st;
CDoc *doc;
I64 res,official;
DocClear;
Drv('C');
DistroPrep;
Cd("C:/");
DelTree("B:/TOS/TOS");
CopyTree("C:/Home","B:/TOS/TOS");
DelTree("C:/Home");
DocMax;
DocClear;
res=LineRep;
if (doc=DocPut) {
st=StrNew(doc->filename.name);
StrCpy(doc->filename.name,"B:/TOS/TOS/Web/LineRep.DD.Z");
DocWrite(doc);
StrCpy(doc->filename.name,st);
Free(st);
}
DocClear;
official=LineRep("C:/*","-r")+
LineRep("C:/Adam/*")+
LineRep("C:/Compiler/*","-S+$")+
LineRep("C:/Kernel/*");
DocClear;
CopyTree("B:/TOS/TOS","C:/Home");
DelTree("B:/TOS/TOS");
DocTreeFWrite("C:/Adam/ADefine.HC.Z","LineRep",
"DefinePrint(\"DD_TEMPLEOS_LOC\",\"%,d\");\n",res);
DocTreeFAppend("C:/Adam/ADefine.HC.Z","LineRep",
"DefinePrint(\"DD_TEMPLEOS_LOC_OFFICIAL\",\"%,d\");\n",official);
DefinePrint("DD_TEMPLEOS_LOC","%,d",res);
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","%,d",official);
"Total LOC:%12,d\n\n",res;
return res;
}
U0 StaffDistroPrep()
{
Drv('C');
DistroPrep;
In(TOS_DVD_CFG);
BootDVDIns('C');
Fmt('B',,FALSE,FSt_REDSEA);
DelTree(TOS_DISTRO_DIR);
CopyTree("C:/",TOS_DISTRO_DIR "/");
DelTree(TOS_DISTRO_DIR "/Home/Sup1");
DelTree(TOS_DISTRO_DIR "/Home/Books1");
DelTree(TOS_DISTRO_DIR "/Home/Books2");
Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
}
U0 MakeStaffDistro()
{
StaffDistroPrep;
ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\TOSDistro-TOS-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//The CFG defines are ~/TOS/TOSCfg.HC.\n\n#help_index \"Misc/TOS/Distro\"\n\n#define MAKE_STD 1\n#define MAKE_STD_RS 0\n#define MAKE_ULTRA 1\n#define MAKE_ULTRA_RS 0\n#define MAKE_SUP1 1\n#define MAKE_WEB 1\n#define MAKE_BOOKS1 0\n#define MAKE_BOOKS2 0\n#define MAKE_DBG 0\n#define MAKE_STAFF 1\n#define PROFANITY_CHK 0\n\npublic U8 TOSGetDrv()\n{//Pmt for drv let.\n I64 res;\n \"Drive (%s):\",TOS_HDS;\n res=Let2Let(GetChar);\n '\\n';\n return res;\n}\n\npublic U0 TOSBootHDIns(U8 drv_let=0)\n{//Make Compiler and Kernel. Reinstall Kernel.\n drv_let=Let2Let(drv_let);\n In(TOS_CFG);\n BootHDIns(drv_let);\n if (StrOcc(TOS_MASTER_BOOT_DRVS,drv_let))\n BootMHDIns(drv_let);\n}\n\npublic U0 TOSCopyDrv(U8 src,U8 dst)\n{//Fmt dst and copy entire drv.\n U8 buf_s[STR_LEN],buf_d[STR_LEN];\n src=Let2Let(src);\n dst=Let2Let(dst);\n\n Fmt(dst,,FALSE,FSt_FAT32);\n\n StrPrint(buf_s,\"%c:/\",src);\n StrPrint(buf_d,\"%c:/\",dst);\n CopyTree(buf_s,buf_d);\n\n DocClear;\n Drv(dst);\n TOSBootHDIns(dst);\n}\n\npublic U0 TOSPmtAndCopyDrv()\n{//Pmt for drv lets. Then, Fmt dst and copy entire drv.\n I64 src,dst;\n \"$RED$\\nCopy Src Drive:\\n$FG$\";\n src=TOSGetDrv;\n \"$RED$\\nCopy Dst Drive:\\n$FG$\";\n dst=TOSGetDrv;\n TOSCopyDrv(src,dst);\n}\n\nU0 DistroSongsPrep(U8 threshold='7')\n{\n CDoc *doc;\n CDocEntry *doc_e;\n CDirEntry *tmpde=FilesFind(\"/Home/Sup1/Sup1Hymns/*.HC*\",\n FUF_CLUS_ORDER),*tmpde1=tmpde;\n DelTree(\"/Apps/Psalmody/Examples\");\n DirMk(\"/Apps/Psalmody/Examples\");\n while (tmpde) {\n doc=DocRead(tmpde->full_name);\n doc_e=doc->head.next;\n if (doc_e->type_u8==DOCT_TEXT && doc_e->tag[2]>=threshold)\n Copy(tmpde->full_name,\"/Apps/Psalmody/Examples\");\n DocDel(doc);\n tmpde=tmpde->next;\n }\n DirTreeDel(tmpde1);\n}\n\nU0 DistroPrep()\n{\n AOnceFlush; //Don't want in Registry\n OnceFlush;\n\n Del(\"/Home/Demo*\");\n DelTree(\"/Home/*Tmp.DD.Z\");\n if (FileFind(\"/Home/Sup1/Sup1Hymns\"))\n DistroSongsPrep;\n\n DelTree(\"/Tmp\");\n DirMk(\"/Tmp\");\n DirMk(\"/Tmp/ScrnShots\");\n\n Touch(\"/PersonalMenu.DD.Z\",\"+T\");\n Touch(\"/Home/PersonalMenu.DD.Z\",\"+T\");\n\n DelTree(\"/Demo/AcctExample\");\n CopyTree(\"/Home\",\"/Demo/AcctExample\");\n DelTree(\"/Demo/AcctExample/ALM\");\n DelTree(\"/Demo/AcctExample/TAD\");\n DelTree(\"/Demo/AcctExample/Sup1\");\n DelTree(\"/Demo/AcctExample/Books1\");\n DelTree(\"/Demo/AcctExample/Books2\");\n DelTree(\"/Demo/AcctExample/Web\");\n Del(\"/Demo/AcctExample/Test*\");\n Copy(\"/Home/Web/index.DD.Z\",\n \"/Demo/ToHtmlToTXTDemo/DemoInPage.DD.Z\");\n if (FileFind(\"~/Sup1/Sup1Utils/SortHeaders.HC.Z\"))\n ExeFile(\"~/Sup1/Sup1Utils/SortHeaders.HC.Z\");\n\n if (FileFind(\"~/Sup1/Sup1Blog/YouTube.DD.Z\"))\n Sort(\"~/Sup1/Sup1Blog/YouTube.DD.Z\",,2);\n\n //Once in a while, do ~/Sup1/Sup1Utils/DblSpaceScan.HC.\n\n CursorRem(\"/*\");\n DelTree(\"/Demo/*.BI*\");\n S2T(\"/*\",\"+r+S\");\n DocOpt(\"/*\",\"+R\");\n Move(ACD_DEF_FILENAME,ACD_DEF_FILENAME_Z);\n}\n\nU0 DbgDistroFilePrep()\n{\n CBlkDev *bd;\n if (!Let2Drv('A',FALSE)) {\n In(CFG_DBG_DISTRO \"\\n\");\n Mount;\n }\n bd=Let2BlkDev('A');\n Fmt('A',,FALSE,FSt_REDSEA);\n\n DirMk(\"A:/Compiler\");\n Copy(\"C:/Compiler/Compiler.BIN.Z\", \"A:/Compiler\");\n Copy(\"C:/Compiler/OpCodes.DD.Z\", \"A:/Compiler\");\n Copy(\"C:/Compiler/CompilerA.HH.Z\", \"A:/Compiler\");\n Copy(\"C:/Compiler/CompilerB.HH.Z\", \"A:/Compiler\");\n\n DirMk(\"A:/Kernel\");\n Copy(\"C:/Kernel/*.HH*\", \"A:/Kernel\");\n CopyTree(\"C:/Kernel/BlkDev\", \"A:/Kernel/BlkDev\");\n\n Copy(\"C:/Home/Sup1/Sup1Distro/DbgStartOS.HC.Z\",\"A:/StartOS.HC.Z\");\n\n DirMk(\"A:/Adam\");\n Copy(\"C:/Home/Sup1/Sup1Distro/DbgMakeAdam.HC.Z\",\"A:/Adam/MakeAdam.HC.Z\");\n Copy(\"C:/Home/Sup1/Sup1Distro/DbgMount.HC.Z\",\"A:/Adam\");\n Copy(\"C:/Adam/AExts.HC.Z\", \"A:/Adam\");\n Copy(\"C:/Adam/AMath.HC.Z\", \"A:/Adam\");\n Copy(\"C:/Adam/Training.HC.Z\",\"A:/Adam\");\n Copy(\"C:/Adam/AMem.HC.Z\", \"A:/Adam\");\n Copy(\"C:/Adam/TaskRep.HC.Z\", \"A:/Adam\");\n\n FileWrite(\"C:\" CFG_DBG_DISTRO_FILE,\n bd->RAM_dsk,(bd->max_blk+1)<<BLK_SIZE_BITS);\n}\n\nU0 MakeSymFiles()\n{\n CDoc *doc;\n U8 *st;\n\n DocClear;\n DocMax;\n HashTablePurge(adam_task->hash_table);\n Who;\n if (doc=DocPut) {\n st=StrNew(doc->filename.name);\n StrCpy(doc->filename.name,\"D:/Wb/Home/Web/SymsAlpha.DD.Z\");\n DocWrite(doc);\n StrCpy(doc->filename.name,st);\n Free(st);\n }\n DocClear;\n DocMax;\n Who(\"+m\");\n if (doc=DocPut) {\n st=StrNew(doc->filename.name);\n StrCpy(doc->filename.name,\"D:/Wb/Home/Web/SymsAddress.DD.Z\");\n DocWrite(doc);\n StrCpy(doc->filename.name,st);\n Free(st);\n }\n DocClear;\n}\n\nI64 MakeLineRepFile()\n{\n U8 *st;\n CDoc *doc;\n I64 res,official;\n\n DocClear;\n Drv('C');\n DistroPrep;\n\n Cd(\"C:/\");\n DelTree(\"B:/TOS/TOS\");\n CopyTree(\"C:/Home\",\"B:/TOS/TOS\");\n DelTree(\"C:/Home\");\n\n DocMax;\n DocClear;\n res=LineRep;\n if (doc=DocPut) {\n st=StrNew(doc->filename.name);\n StrCpy(doc->filename.name,\"B:/TOS/TOS/Web/LineRep.DD.Z\");\n DocWrite(doc);\n StrCpy(doc->filename.name,st);\n Free(st);\n }\n DocClear;\n official=LineRep(\"C:/*\",\"-r\")+\n LineRep(\"C:/Adam/*\")+\n LineRep(\"C:/Compiler/*\",\"-S+$\")+\n LineRep(\"C:/Kernel/*\");\n DocClear;\n CopyTree(\"B:/TOS/TOS\",\"C:/Home\");\n DelTree(\"B:/TOS/TOS\");\n\n DocTreeFWrite(\"C:/Adam/ADefine.HC.Z\",\"LineRep\",\n \"DefinePrint(\\\"DD_TEMPLEOS_LOC\\\",\\\"%,d\\\");\\n\",res);\n DocTreeFAppend(\"C:/Adam/ADefine.HC.Z\",\"LineRep\",\n \"DefinePrint(\\\"DD_TEMPLEOS_LOC_OFFICIAL\\\",\\\"%,d\\\");\\n\",official);\n\n DefinePrint(\"DD_TEMPLEOS_LOC\",\"%,d\",res);\n DefinePrint(\"DD_TEMPLEOS_LOC_OFFICIAL\",\"%,d\",official);\n\n \"Total LOC:%12,d\\n\\n\",res;\n return res;\n}\n\nU0 StaffDistroPrep()\n{\n Drv('C');\n DistroPrep;\n In(TOS_DVD_CFG);\n BootDVDIns('C');\n Fmt('B',,FALSE,FSt_REDSEA);\n DelTree(TOS_DISTRO_DIR);\n CopyTree(\"C:/\",TOS_DISTRO_DIR \"/\");\n DelTree(TOS_DISTRO_DIR \"/Home/Sup1\");\n DelTree(TOS_DISTRO_DIR \"/Home/Books1\");\n DelTree(TOS_DISTRO_DIR \"/Home/Books2\");\n Del(TOS_DISTRO_DIR \"/\" KERNEL_BIN_C);\n}\nU0 MakeStaffDistro()\n{\n StaffDistroPrep;\n ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR \"/*\",,\n TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN"
}
]
}
|
// Source: D:\TempleOS-Projects\html\Camp-Sup1-Sup1Games-AfterEgypt-Home.html
// Date: unknown-date
// Language: HolyC
//Uses fixed-point.
#define CO_PERSON 1
#define CO_TENT 2
class Obj
{
I64 x,y,z;
I64 dx,dy,dz;
I64 type;
};
#define PEOPLE_NUM 1024
#define TENT_RATIO 40
#define TENTS_NUM (PEOPLE_NUM/TENT_RATIO+1)
<1>/* Graphics Not Rendered in HTML */
<2>/* Graphics Not Rendered in HTML */
<3>/* Graphics Not Rendered in HTML */
<4>/* Graphics Not Rendered in HTML */
<5>/* Graphics Not Rendered in HTML */
<6>/* Graphics Not Rendered in HTML */
U8 *right_imgs[4]={<2>,<1>,<3>,<1>},
*left_imgs[4]={<5>,<4>,<6>,<4>};
<7>/* Graphics Not Rendered in HTML */
U8 *tent_img=<7>;
<8>/* Graphics Not Rendered in HTML */
<9>/* Graphics Not Rendered in HTML */ //Pointer to sprite in Mountain.HC file
I64 num_objs;
Obj objs[PEOPLE_NUM+TENTS_NUM];
Obj camp_view_pt;
#define CAMP_WIDTH 600
#define CAMP_SCALE 300
#define CAMP_Z_CLIP 10
U0 CTransform(CDC *dc,I64 *_x,I64 *_y,I64 *_z)
{
I64 x=*_x-camp_view_pt.x,y=*_y-camp_view_pt.y,z=*_z-camp_view_pt.z;
Mat4x4MulXYZ(dc->r,&x,&y,&z);
if (z<0) {
x=x*-CAMP_SCALE/z;
y=y*-CAMP_SCALE/z;
}
*_x=dc->x+x;
*_y=dc->y-y;
*_z=dc->z-z;
}
I64 mp_not_done_flags;
I64 cx,cy,*r1; //could put these in a record and pass in
F64 frame;
I32 *depth_buf;
U0 MPDrawMeeting(CTask *task)
{
CDC *dc=DCAlias(gr.dc2,task);
F64 s;
U8 *img,*img1,*img2;
I64 i,x,y,z,*r2,*old_r=dc->r,
lo= Gs->num *num_objs/mp_cnt,
hi=(Gs->num+1)*num_objs/mp_cnt;
dc->flags|=DCF_TRANSFORMATION;
dc->depth_buf=depth_buf;
dc->x=cx;
dc->y=cy;
dc->z=0;
dc->transform=&DCTransform;
for (i=lo;i<hi;i++) {
DCMat4x4Set(dc,r1);
dc->x=cx;
dc->y=cy;
dc->z=0;
x=objs[i].x.i32[1];
y=objs[i].y.i32[1];
z=objs[i].z.i32[1];
CTransform(dc,&x,&y,&z);
if (z>CAMP_Z_CLIP) {
s=0.5*ToF64(CAMP_SCALE)/z;
if (objs[i].type==CO_PERSON) {
if (objs[i].dx>=0) {
img1=right_imgs[(i+ToI64(frame))&3];
img2=right_imgs[(i+ToI64(frame)+1)&3];
} else {
img1=left_imgs[(i+ToI64(frame))&3];
img2=left_imgs[(i+ToI64(frame)+1)&3];
}
img=SpriteInterpolate(frame%1.0,img1,img2);
} else
img=tent_img;
r2=Mat4x4New(old_r);
Mat4x4Scale(r2,s);
DCMat4x4Set(dc,r2);
Sprite3B(dc,x,y,z,img);
Free(r2);
if (objs[i].type==CO_PERSON)
Free(img);
}
}
dc->r=old_r;
dc->depth_buf=NULL;
DCDel(dc);
LBtr(&mp_not_done_flags,Gs->num);
}
U0 DrawMeeting(CTask *task,CDC *dc)
{
static Bool calf=FALSE,determined=FALSE;
I64 i,x,y,z,*r2,*old_r;
F64 s;
frame=4.0*Saw(tS,0.5);
cx=task->pix_width/2;
cy=task->pix_height/2;
camp_view_pt.x=0;
camp_view_pt.y=200-100*Sin(tS);
camp_view_pt.z=225+100*Cos(tS);
DCDepthBufAlloc(dc);
depth_buf=dc->depth_buf;
r1=Mat4x4IdentNew(task);
Mat4x4RotX(r1,23.0*pi/180.0);
old_r=dc->r;
dc->transform=&CTransform;
dc->x=cx;
dc->y=cy;
dc->z=0;
DCMat4x4Set(dc,r1);
x=0;y=0;z=-16*CAMP_WIDTH;
dc->transform(dc,&x,&y,&z);
Sprite3(dc,0,y,0,<9>);
dc->flags|=DCF_TRANSFORMATION;
dc->color=LTGRAY;
GrLine3(dc,-CAMP_WIDTH/2,0,0,CAMP_WIDTH/2,0,0,6);
GrLine3(dc,-CAMP_WIDTH/2,0,-CAMP_WIDTH,CAMP_WIDTH/2,0,-CAMP_WIDTH,6);
GrLine3(dc,-CAMP_WIDTH/2,0,0,-CAMP_WIDTH/2,0,-CAMP_WIDTH,6);
GrLine3(dc,CAMP_WIDTH/2,0,0,CAMP_WIDTH/2,0,-CAMP_WIDTH,6);
dc->transform=&DCTransform;
if (tS%10<5) {
calf=FALSE;
determined=FALSE;
} else {
if (!determined) {
determined=TRUE;
if (RandU16<U16_MAX/2)
calf=TRUE;
}
}
if (calf) {
x=0;
y=0;
z=-CAMP_WIDTH/2;
CTransform(dc,&x,&y,&z);
s=0.5*ToF64(CAMP_SCALE)/z;
r2=Mat4x4New(old_r,task);
Mat4x4Scale(r2,s);
DCMat4x4Set(dc,r2);
Sprite3B(dc,x,y,z,<8>);
Free(r2);
}
mp_not_done_flags=1<<mp_cnt-1;
for (i=0;i<mp_cnt;i++)
JobQue(&MPDrawMeeting,task,i);
DCMat4x4Set(dc,old_r);
while (mp_not_done_flags)
Yield;
Free(r1);
if (calf && Blink(4.0)) {
dc->color=LTRED;
GrPrint(dc,cx-(15*FONT_WIDTH)/2,cy-3*FONT_HEIGHT,"!!Golden Calf!!");
}
}
#define SPEED_MAX 2<<32
U0 AnimateTask(I64)
{
I64 i,x,z,dx,dz;
F64 d;
while (TRUE) {
Refresh;
for (i=0;i<num_objs;i++)
if (objs[i].type==CO_PERSON) {
if (tS%10<5) {
objs[i].dx+=RandI32;
objs[i].dz+=RandI32;
} else {//Form circle
x=CAMP_WIDTH/4*Cos((1.0+1.0/TENT_RATIO)*i*pi*2/num_objs);
z=CAMP_WIDTH/4*Sin((1.0+1.0/TENT_RATIO)*i*pi*2/num_objs)-CAMP_WIDTH/2;
dx=x-objs[i].x.i32[1];
dz=z-objs[i].z.i32[1];
d=Sqrt(SqrI64(dx)+SqrI64(dz));
objs[i].dx=SPEED_MAX*(dx/d);
objs[i].dz=SPEED_MAX*(dz/d);
}
objs[i].dx=ClampI64(objs[i].dx,-SPEED_MAX,SPEED_MAX);
objs[i].dy=ClampI64(objs[i].dy,-SPEED_MAX,SPEED_MAX);
objs[i].dz=ClampI64(objs[i].dz,-SPEED_MAX,SPEED_MAX);
objs[i].x+=objs[i].dx;
objs[i].y+=objs[i].dy;
objs[i].z+=objs[i].dz;
if (objs[i].x.i32[1]<-CAMP_WIDTH>>1) {
objs[i].x=-CAMP_WIDTH>>1<<32;
objs[i].dx=-objs[i].dx;
}
if (objs[i].x.i32[1]>CAMP_WIDTH>>1) {
objs[i].x=CAMP_WIDTH>>1<<32;
objs[i].dx=-objs[i].dx;
}
if (objs[i].z.i32[1]<-CAMP_WIDTH) {
objs[i].z=-CAMP_WIDTH<<32;
objs[i].dz=-objs[i].dz;
}
if (objs[i].z.i32[1]>0) {
objs[i].z=0;
objs[i].dz=-objs[i].dz;
}
}
Sleep(20);
}
}
U0 Camp(I64 num_people=100)
{
I64 i,j=0,num_tents;
if (num_people>PEOPLE_NUM)
num_people=PEOPLE_NUM;
MemSet(objs,0,sizeof(objs));
for (i=0;i<num_people;i++) {
objs[j].x=(RandU32%CAMP_WIDTH-CAMP_WIDTH>>1)<<32;
objs[j].y=0;
objs[j].z=-(RandU32%CAMP_WIDTH)<<32;
objs[j].type=CO_PERSON;
j++;
}
num_tents=(num_people+TENT_RATIO-1)/TENT_RATIO;
for (i=0;i<num_tents;i++) {
objs[j].x=(RandU32%CAMP_WIDTH-CAMP_WIDTH>>1)<<32;
objs[j].y=0;
objs[j].z=-(RandU32%CAMP_WIDTH)<<32;
objs[j].type=CO_TENT;
j++;
}
num_objs=j;
SettingsPush(Fs,TSF_SAME_SONG); //See SettingsPush
Fs->text_attr=YELLOW<<4+WHITE; //bk/fg
AutoComplete;
DocCursor;
DocClear;
try {
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
Fs->draw_it=&DrawMeeting;
GetChar;
} catch
PutExcept;
SettingsPop(Fs,TSF_SAME_SONG);
}
#if __CMD_LINE__
WinBorder;
WinMax;
Camp;
#endif
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Camp-Sup1-Sup1Games-AfterEgypt-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//Uses fixed-point.\n\n#define CO_PERSON 1\n#define CO_TENT 2\n\nclass Obj\n{\n I64 x,y,z;\n I64 dx,dy,dz;\n I64 type;\n};\n\n#define PEOPLE_NUM 1024\n#define TENT_RATIO 40\n#define TENTS_NUM (PEOPLE_NUM/TENT_RATIO+1)\n\n\n\n\n\n\n <1>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n <2>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n <3>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n <4>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n <5>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n <6>/* Graphics Not Rendered in HTML */\n\nU8 *right_imgs[4]={<2>,<1>,<3>,<1>},\n *left_imgs[4]={<5>,<4>,<6>,<4>};\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n <7>/* Graphics Not Rendered in HTML */\n\nU8 *tent_img=<7>;\n\n\n <8>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<9>/* Graphics Not Rendered in HTML */ //Pointer to sprite in Mountain.HC file\n\nI64 num_objs;\nObj objs[PEOPLE_NUM+TENTS_NUM];\nObj camp_view_pt;\n\n#define CAMP_WIDTH 600\n#define CAMP_SCALE 300\n#define CAMP_Z_CLIP 10\n\nU0 CTransform(CDC *dc,I64 *_x,I64 *_y,I64 *_z)\n{\n I64 x=*_x-camp_view_pt.x,y=*_y-camp_view_pt.y,z=*_z-camp_view_pt.z;\n Mat4x4MulXYZ(dc->r,&x,&y,&z);\n if (z<0) {\n x=x*-CAMP_SCALE/z;\n y=y*-CAMP_SCALE/z;\n }\n *_x=dc->x+x;\n *_y=dc->y-y;\n *_z=dc->z-z;\n}\n\nI64 mp_not_done_flags;\nI64 cx,cy,*r1; //could put these in a record and pass in\nF64 frame;\nI32 *depth_buf;\nU0 MPDrawMeeting(CTask *task)\n{\n CDC *dc=DCAlias(gr.dc2,task);\n F64 s;\n U8 *img,*img1,*img2;\n I64 i,x,y,z,*r2,*old_r=dc->r,\n lo= Gs->num *num_objs/mp_cnt,\n hi=(Gs->num+1)*num_objs/mp_cnt;\n dc->flags|=DCF_TRANSFORMATION;\n dc->depth_buf=depth_buf;\n dc->x=cx;\n dc->y=cy;\n dc->z=0;\n dc->transform=&DCTransform;\n for (i=lo;i<hi;i++) {\n DCMat4x4Set(dc,r1);\n dc->x=cx;\n dc->y=cy;\n dc->z=0;\n x=objs[i].x.i32[1];\n y=objs[i].y.i32[1];\n z=objs[i].z.i32[1];\n CTransform(dc,&x,&y,&z);\n if (z>CAMP_Z_CLIP) {\n s=0.5*ToF64(CAMP_SCALE)/z;\n if (objs[i].type==CO_PERSON) {\n if (objs[i].dx>=0) {\n img1=right_imgs[(i+ToI64(frame))&3];\n img2=right_imgs[(i+ToI64(frame)+1)&3];\n } else {\n img1=left_imgs[(i+ToI64(frame))&3];\n img2=left_imgs[(i+ToI64(frame)+1)&3];\n }\n img=SpriteInterpolate(frame%1.0,img1,img2);\n } else\n img=tent_img;\n\n r2=Mat4x4New(old_r);\n Mat4x4Scale(r2,s);\n DCMat4x4Set(dc,r2);\n Sprite3B(dc,x,y,z,img);\n Free(r2);\n if (objs[i].type==CO_PERSON)\n Free(img);\n }\n }\n dc->r=old_r;\n dc->depth_buf=NULL;\n DCDel(dc);\n LBtr(&mp_not_done_flags,Gs->num);\n}\n\nU0 DrawMeeting(CTask *task,CDC *dc)\n{\n static Bool calf=FALSE,determined=FALSE;\n\n I64 i,x,y,z,*r2,*old_r;\n F64 s;\n\n frame=4.0*Saw(tS,0.5);\n cx=task->pix_width/2;\n cy=task->pix_height/2;\n\n camp_view_pt.x=0;\n camp_view_pt.y=200-100*Sin(tS);\n camp_view_pt.z=225+100*Cos(tS);\n\n DCDepthBufAlloc(dc);\n depth_buf=dc->depth_buf;\n r1=Mat4x4IdentNew(task);\n Mat4x4RotX(r1,23.0*pi/180.0);\n old_r=dc->r;\n\n dc->transform=&CTransform;\n dc->x=cx;\n dc->y=cy;\n dc->z=0;\n DCMat4x4Set(dc,r1);\n\n x=0;y=0;z=-16*CAMP_WIDTH;\n dc->transform(dc,&x,&y,&z);\n Sprite3(dc,0,y,0,<9>);\n dc->flags|=DCF_TRANSFORMATION;\n\n dc->color=LTGRAY;\n GrLine3(dc,-CAMP_WIDTH/2,0,0,CAMP_WIDTH/2,0,0,6);\n GrLine3(dc,-CAMP_WIDTH/2,0,-CAMP_WIDTH,CAMP_WIDTH/2,0,-CAMP_WIDTH,6);\n GrLine3(dc,-CAMP_WIDTH/2,0,0,-CAMP_WIDTH/2,0,-CAMP_WIDTH,6);\n GrLine3(dc,CAMP_WIDTH/2,0,0,CAMP_WIDTH/2,0,-CAMP_WIDTH,6);\n\n dc->transform=&DCTransform;\n\n if (tS%10<5) {\n calf=FALSE;\n determined=FALSE;\n } else {\n if (!determined) {\n determined=TRUE;\n if (RandU16<U16_MAX/2)\n calf=TRUE;\n }\n }\n\n if (calf) {\n x=0;\n y=0;\n z=-CAMP_WIDTH/2;\n CTransform(dc,&x,&y,&z);\n s=0.5*ToF64(CAMP_SCALE)/z;\n r2=Mat4x4New(old_r,task);\n Mat4x4Scale(r2,s);\n DCMat4x4Set(dc,r2);\n Sprite3B(dc,x,y,z,<8>);\n Free(r2);\n }\n\n mp_not_done_flags=1<<mp_cnt-1;\n for (i=0;i<mp_cnt;i++)\n JobQue(&MPDrawMeeting,task,i);\n\n DCMat4x4Set(dc,old_r);\n while (mp_not_done_flags)\n Yield;\n Free(r1);\n\n if (calf && Blink(4.0)) {\n dc->color=LTRED;\n GrPrint(dc,cx-(15*FONT_WIDTH)/2,cy-3*FONT_HEIGHT,\"!!Golden Calf!!\");\n }\n}\n\n#define SPEED_MAX 2<<32\n\nU0 AnimateTask(I64)\n{\n I64 i,x,z,dx,dz;\n F64 d;\n while (TRUE) {\n Refresh;\n for (i=0;i<num_objs;i++)\n if (objs[i].type==CO_PERSON) {\n if (tS%10<5) {\n objs[i].dx+=RandI32;\n objs[i].dz+=RandI32;\n } else {//Form circle\n x=CAMP_WIDTH/4*Cos((1.0+1.0/TENT_RATIO)*i*pi*2/num_objs);\n z=CAMP_WIDTH/4*Sin((1.0+1.0/TENT_RATIO)*i*pi*2/num_objs)-CAMP_WIDTH/2;\n dx=x-objs[i].x.i32[1];\n dz=z-objs[i].z.i32[1];\n d=Sqrt(SqrI64(dx)+SqrI64(dz));\n objs[i].dx=SPEED_MAX*(dx/d);\n objs[i].dz=SPEED_MAX*(dz/d);\n }\n objs[i].dx=ClampI64(objs[i].dx,-SPEED_MAX,SPEED_MAX);\n objs[i].dy=ClampI64(objs[i].dy,-SPEED_MAX,SPEED_MAX);\n objs[i].dz=ClampI64(objs[i].dz,-SPEED_MAX,SPEED_MAX);\n objs[i].x+=objs[i].dx;\n objs[i].y+=objs[i].dy;\n objs[i].z+=objs[i].dz;\n if (objs[i].x.i32[1]<-CAMP_WIDTH>>1) {\n objs[i].x=-CAMP_WIDTH>>1<<32;\n objs[i].dx=-objs[i].dx;\n }\n if (objs[i].x.i32[1]>CAMP_WIDTH>>1) {\n objs[i].x=CAMP_WIDTH>>1<<32;\n objs[i].dx=-objs[i].dx;\n }\n if (objs[i].z.i32[1]<-CAMP_WIDTH) {\n objs[i].z=-CAMP_WIDTH<<32;\n objs[i].dz=-objs[i].dz;\n }\n if (objs[i].z.i32[1]>0) {\n objs[i].z=0;\n objs[i].dz=-objs[i].dz;\n }\n }\n Sleep(20);\n }\n}\n\nU0 Camp(I64 num_people=100)\n{\n I64 i,j=0,num_tents;\n\n if (num_people>PEOPLE_NUM)\n num_people=PEOPLE_NUM;\n\n MemSet(objs,0,sizeof(objs));\n for (i=0;i<num_people;i++) {\n objs[j].x=(RandU32%CAMP_WIDTH-CAMP_WIDTH>>1)<<32;\n objs[j].y=0;\n objs[j].z=-(RandU32%CAMP_WIDTH)<<32;\n objs[j].type=CO_PERSON;\n j++;\n }\n num_tents=(num_people+TENT_RATIO-1)/TENT_RATIO;\n for (i=0;i<num_tents;i++) {\n objs[j].x=(RandU32%CAMP_WIDTH-CAMP_WIDTH>>1)<<32;\n objs[j].y=0;\n objs[j].z=-(RandU32%CAMP_WIDTH)<<32;\n objs[j].type=CO_TENT;\n j++;\n }\n num_objs=j;\n\n SettingsPush(Fs,TSF_SAME_SONG); //See SettingsPush\n Fs->text_attr=YELLOW<<4+WHITE; //bk/fg\n AutoComplete;\n DocCursor;\n DocClear;\n try {\n Fs->animate_task=Spawn(&AnimateTask,NULL,\"Animate\",,Fs);\n Fs->draw_it=&DrawMeeting;\n\n GetChar;\n } catch\n PutExcept;\n SettingsPop(Fs,TSF_SAME_SONG);\n}\n\n#if __CMD_LINE__\nWinBorder;\nWinMax;\nCamp;\n#endif"
}
]
}
|
// Source: D:\TempleOS-Projects\html\DskAddDev-BlkDev-Kernel.html
// Date: unknown-date
// Language: HolyC
U0 BlkDevLockFwdingSet(CBlkDev *bd)
{ //If two blkdevs on same controller, use just one lock
CBlkDev *bd1;
I64 i;
switch (bd->type) {
case BDT_RAM:
break;
case BDT_ISO_FILE_READ:
case BDT_ISO_FILE_WRITE:
bd->lock_fwding=Let2BlkDev(*bd->file_dsk_name);
break;
case BDT_ATA:
case BDT_ATAPI:
for (i=0;i<BLKDEVS_NUM;i++) {
bd1=&blkdev.blkdevs[i];
if (bd1->bd_signature==BD_SIGNATURE_VAL && bd!=bd1 &&
(bd1->type==BDT_ATAPI || bd1->type==BDT_ATA) &&
bd1->base0==bd->base0) {
bd->lock_fwding=bd1;
break;
}
}
break;
}
}
I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
Bool whole_drv,Bool make_free)
{//It will mount just one partition of prt_num>=0.
//When repartitioing whole drive, whole_drv=TRUE.
I64 i,j,ext_base,offset,res=0,num=0;
CDrv *dv;
CRedSeaBoot br;
CMasterBoot mbr;
bd->bd_signature=BD_SIGNATURE_VAL;
if (make_free)
dv=DrvMakeFreeSlot(bd->first_drv_let);
else
dv=DrvMakeFreeSlot(DrvNextFreeLet(bd->first_drv_let));
dv->bd=bd;
dv->drv_offset=bd->drv_offset;
dv->size=bd->max_blk+1-bd->drv_offset;
switch (bd->type) {
case BDT_RAM:
case BDT_ISO_FILE_READ:
case BDT_ISO_FILE_WRITE:
dv->dv_signature=DRV_SIGNATURE_VAL;
dv->prt_num=num;
dv->fs_type=FSt_REDSEA;
//This is to force creation of a RAM
//drive during boot, so it is probably
//MAlloced to the same addr and can
//be assumed to be already formatted.
//If this line is removed, RAM Drives
//will be alloced on a just-in-time
//basis.
if (BlkDevInit(bd))
res++;
else
dv->dv_signature=0;
break;
case BDT_ATA:
dv->dv_signature=DRV_SIGNATURE_VAL; //Temporarily validate
if (!BlkDevInit(bd))
dv->dv_signature=0; //Revoke validation
else {
dv->dv_signature=0; //Revoke validation
if (whole_drv) {
dv->dv_signature=DRV_SIGNATURE_VAL;
dv->prt_num=num;
res++;
dv->fs_type=FSt_REDSEA;
dv->size=bd->max_blk+1-bd->drv_offset;
//The following read is a test read.
//if it hangs, the drive is not supported.
ATAReadBlks(bd,&mbr,0,1);
break;
}
offset=0;
ext_base=INVALID_CLUS;
while (prt_num<0 || num<=prt_num) {
ATAReadBlks(bd,&mbr,offset,1);
if (mbr.signature!=0xAA55)
break;
j=-1;
for (i=0;i<4 && (prt_num<0 || num<=prt_num);i++) {
if (mbr.p[i].type) {
if (make_free)
dv=DrvMakeFreeSlot(bd->first_drv_let+res);
else
dv=DrvMakeFreeSlot(DrvNextFreeLet(bd->first_drv_let+res));
dv->bd=bd;
dv->drv_offset=mbr.p[i].offset+offset;
dv->size =mbr.p[i].size;
switch (mbr.p[i].type) {
case MBR_PT_REDSEA:
dv->dv_signature=DRV_SIGNATURE_VAL;
dv->prt_num=num;
res++;
dv->fs_type=FSt_REDSEA;
RedSeaInit(dv);
break;
case MBR_PT_FAT32a:
case MBR_PT_FAT32b:
case MBR_PT_FAT32c:
case MBR_PT_FAT32d:
case MBR_PT_FAT32e:
case MBR_PT_FAT32f:
ATAReadBlks(bd,&br,dv->drv_offset,1);
dv->dv_signature=DRV_SIGNATURE_VAL;
dv->prt_num=num;
res++;
if (br.signature==MBR_PT_REDSEA) {
dv->fs_type=FSt_REDSEA;
RedSeaInit(dv);
} else {
dv->fs_type=FSt_FAT32;
FAT32Init(dv);
}
break;
case MBR_PT_NTFS:
dv->dv_signature=DRV_SIGNATURE_VAL;
dv->prt_num=num;
res++;
dv->fs_type=FSt_NTFS;
break;
case 5:
case 15:
j=i;
break;
default:
dv->dv_signature=DRV_SIGNATURE_VAL;
dv->prt_num=num;
res++;
dv->fs_type=FSt_UNKNOWN;
}
num++;
}
}
if (Let2BlkDevType(bd->first_drv_let+res)!=bd->type)
break;
if (j<0)
break;
if (!mbr.p[j].offset)
break;
if (ext_base==INVALID_CLUS) {
offset=mbr.p[j].offset;
ext_base=offset;
} else
offset=mbr.p[j].offset+ext_base;
}
}
break;
case BDT_ATAPI:
dv->dv_signature=DRV_SIGNATURE_VAL;
dv->prt_num=num;
res++;
dv->fs_type=FSt_ISO9660; //Start with this
dv->size=0;
break;
}
if (res)
BlkDevLockFwdingSet(bd);
else
BlkDevDel(bd);
return res;
}
Bool DrvEnable(U8 drv_let,Bool val)
{//Can unmount or remount, but not mount the first time.
CDrv *dv;
if (dv=Let2Drv(drv_let,FALSE))
return !LBEqu(&dv->fs_type,FStf_DISABLE,!val);
else
return FALSE;
}
I64 SysGetI64()
{
U8 st[STR_LEN];
GetS(st,STR_LEN,FALSE);
return Str2I64(st,16);
}
Bool GetBaseUnit(CBlkDev *bd)
{
I64 ch;
Bool probe;
#exe {
if (kernel_cfg->opts[CFG_DONT_PROBE])
StreamPrint("probe=FALSE;");
else
StreamPrint("probe=TRUE;");
};
if (!probe || !BootDVDProbeAll(bd)) {
"\nDon't worry. This is not a product\n"
"registration. TempleOS just needs the\n"
"I/O port numbers for the CD/DVD.\n"
"\nRetry the ports above or check Windows\n"
"system information under I/O ports for\n"
"'IDE', 'ATA' or 'SATA'.\n"
"In Linux, use 'lspci -v' for ports.\n"
"\n\nEnter 4-digit hex I/O Port number.\n"
"CD/DVD I/O Port Base0: 0x";
bd->base0=SysGetI64;
bd->base1=0;
bd->unit =0;
if (bd->base0) {
"\nUnit (0 or 1): ";
do ch=GetChar(,FALSE);
while (!('0'<=ch<='1'));
'' ch;
bd->unit=ch-'0';
blkdev.dvd_boot_is_good=BootDVDProbe(bd);
return TRUE;
} else {
blkdev.dvd_boot_is_good=FALSE;
return FALSE;
}
}
return FALSE;
}
U0 BlkDevsInitAll()
{
CBlkDev *bd;
I64 i;
blkdev.blkdevs=CAlloc(sizeof(CBlkDev)*BLKDEVS_NUM);
blkdev.drvs=CAlloc(sizeof(CDrv)*DRVS_NUM);
for (i=0;i<DRVS_NUM;i++)
blkdev.let_to_drv[i]=&blkdev.drvs[i];
#exe {
if (kernel_cfg->opts[CFG_MOUNT_IDE_AUTO])
StreamPrint("MountIDEAuto;");
StreamPrint("#exe {Option(OPTf_WARN_PAREN,OFF);}");
StreamDoc(kernel_cfg->add_dev);
StreamPrint("#exe {Option(OPTf_WARN_PAREN,ON);}");
};
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\DskAddDev-BlkDev-Kernel.html\n// Date: unknown-date\n// Language: HolyC\n\nU0 BlkDevLockFwdingSet(CBlkDev *bd)\n{ //If two blkdevs on same controller, use just one lock\n CBlkDev *bd1;\n I64 i;\n switch (bd->type) {\n case BDT_RAM:\n break;\n case BDT_ISO_FILE_READ:\n case BDT_ISO_FILE_WRITE:\n bd->lock_fwding=Let2BlkDev(*bd->file_dsk_name);\n break;\n case BDT_ATA:\n case BDT_ATAPI:\n for (i=0;i<BLKDEVS_NUM;i++) {\n bd1=&blkdev.blkdevs[i];\n if (bd1->bd_signature==BD_SIGNATURE_VAL && bd!=bd1 &&\n (bd1->type==BDT_ATAPI || bd1->type==BDT_ATA) &&\n bd1->base0==bd->base0) {\n bd->lock_fwding=bd1;\n break;\n }\n }\n break;\n }\n}\n\nI64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,\n Bool whole_drv,Bool make_free)\n{//It will mount just one partition of prt_num>=0.\n//When repartitioing whole drive, whole_drv=TRUE.\n I64 i,j,ext_base,offset,res=0,num=0;\n CDrv *dv;\n CRedSeaBoot br;\n CMasterBoot mbr;\n\n bd->bd_signature=BD_SIGNATURE_VAL;\n if (make_free)\n dv=DrvMakeFreeSlot(bd->first_drv_let);\n else\n dv=DrvMakeFreeSlot(DrvNextFreeLet(bd->first_drv_let));\n dv->bd=bd;\n dv->drv_offset=bd->drv_offset;\n dv->size=bd->max_blk+1-bd->drv_offset;\n switch (bd->type) {\n case BDT_RAM:\n case BDT_ISO_FILE_READ:\n case BDT_ISO_FILE_WRITE:\n dv->dv_signature=DRV_SIGNATURE_VAL;\n dv->prt_num=num;\n dv->fs_type=FSt_REDSEA;\n//This is to force creation of a RAM\n //drive during boot, so it is probably\n //MAlloced to the same addr and can\n //be assumed to be already formatted.\n //If this line is removed, RAM Drives\n //will be alloced on a just-in-time\n //basis.\n if (BlkDevInit(bd))\n res++;\n else\n dv->dv_signature=0;\n break;\n case BDT_ATA:\n dv->dv_signature=DRV_SIGNATURE_VAL; //Temporarily validate\n if (!BlkDevInit(bd))\n dv->dv_signature=0; //Revoke validation\n else {\n dv->dv_signature=0; //Revoke validation\n if (whole_drv) {\n dv->dv_signature=DRV_SIGNATURE_VAL;\n dv->prt_num=num;\n res++;\n dv->fs_type=FSt_REDSEA;\n dv->size=bd->max_blk+1-bd->drv_offset;\n//The following read is a test read.\n //if it hangs, the drive is not supported.\n ATAReadBlks(bd,&mbr,0,1);\n break;\n }\n offset=0;\n ext_base=INVALID_CLUS;\n while (prt_num<0 || num<=prt_num) {\n ATAReadBlks(bd,&mbr,offset,1);\n if (mbr.signature!=0xAA55)\n break;\n j=-1;\n for (i=0;i<4 && (prt_num<0 || num<=prt_num);i++) {\n if (mbr.p[i].type) {\n if (make_free)\n dv=DrvMakeFreeSlot(bd->first_drv_let+res);\n else\n dv=DrvMakeFreeSlot(DrvNextFreeLet(bd->first_drv_let+res));\n dv->bd=bd;\n dv->drv_offset=mbr.p[i].offset+offset;\n dv->size =mbr.p[i].size;\n switch (mbr.p[i].type) {\n case MBR_PT_REDSEA:\n dv->dv_signature=DRV_SIGNATURE_VAL;\n dv->prt_num=num;\n res++;\n dv->fs_type=FSt_REDSEA;\n RedSeaInit(dv);\n break;\n case MBR_PT_FAT32a:\n case MBR_PT_FAT32b:\n case MBR_PT_FAT32c:\n case MBR_PT_FAT32d:\n case MBR_PT_FAT32e:\n case MBR_PT_FAT32f:\n ATAReadBlks(bd,&br,dv->drv_offset,1);\n dv->dv_signature=DRV_SIGNATURE_VAL;\n dv->prt_num=num;\n res++;\n if (br.signature==MBR_PT_REDSEA) {\n dv->fs_type=FSt_REDSEA;\n RedSeaInit(dv);\n } else {\n dv->fs_type=FSt_FAT32;\n FAT32Init(dv);\n }\n break;\n case MBR_PT_NTFS:\n dv->dv_signature=DRV_SIGNATURE_VAL;\n dv->prt_num=num;\n res++;\n dv->fs_type=FSt_NTFS;\n break;\n case 5:\n case 15:\n j=i;\n break;\n default:\n dv->dv_signature=DRV_SIGNATURE_VAL;\n dv->prt_num=num;\n res++;\n dv->fs_type=FSt_UNKNOWN;\n }\n num++;\n }\n }\n if (Let2BlkDevType(bd->first_drv_let+res)!=bd->type)\n break;\n if (j<0)\n break;\n if (!mbr.p[j].offset)\n break;\n if (ext_base==INVALID_CLUS) {\n offset=mbr.p[j].offset;\n ext_base=offset;\n } else\n offset=mbr.p[j].offset+ext_base;\n }\n }\n break;\n case BDT_ATAPI:\n dv->dv_signature=DRV_SIGNATURE_VAL;\n dv->prt_num=num;\n res++;\n dv->fs_type=FSt_ISO9660; //Start with this\n dv->size=0;\n break;\n }\n if (res)\n BlkDevLockFwdingSet(bd);\n else\n BlkDevDel(bd);\n return res;\n}\n\nBool DrvEnable(U8 drv_let,Bool val)\n{//Can unmount or remount, but not mount the first time.\n CDrv *dv;\n if (dv=Let2Drv(drv_let,FALSE))\n return !LBEqu(&dv->fs_type,FStf_DISABLE,!val);\n else\n return FALSE;\n}\n\nI64 SysGetI64()\n{\n U8 st[STR_LEN];\n GetS(st,STR_LEN,FALSE);\n return Str2I64(st,16);\n}\n\nBool GetBaseUnit(CBlkDev *bd)\n{\n I64 ch;\n Bool probe;\n #exe {\n if (kernel_cfg->opts[CFG_DONT_PROBE])\n StreamPrint(\"probe=FALSE;\");\n else\n StreamPrint(\"probe=TRUE;\");\n };\n if (!probe || !BootDVDProbeAll(bd)) {\n \"\\nDon't worry. This is not a product\\n\"\n \"registration. TempleOS just needs the\\n\"\n \"I/O port numbers for the CD/DVD.\\n\"\n \"\\nRetry the ports above or check Windows\\n\"\n \"system information under I/O ports for\\n\"\n \"'IDE', 'ATA' or 'SATA'.\\n\"\n \"In Linux, use 'lspci -v' for ports.\\n\"\n \"\\n\\nEnter 4-digit hex I/O Port number.\\n\"\n \"CD/DVD I/O Port Base0: 0x\";\n bd->base0=SysGetI64;\n bd->base1=0;\n bd->unit =0;\n if (bd->base0) {\n \"\\nUnit (0 or 1): \";\n do ch=GetChar(,FALSE);\n while (!('0'<=ch<='1'));\n '' ch;\n bd->unit=ch-'0';\n blkdev.dvd_boot_is_good=BootDVDProbe(bd);\n return TRUE;\n } else {\n blkdev.dvd_boot_is_good=FALSE;\n return FALSE;\n }\n }\n return FALSE;\n}\n\nU0 BlkDevsInitAll()\n{\n CBlkDev *bd;\n I64 i;\n blkdev.blkdevs=CAlloc(sizeof(CBlkDev)*BLKDEVS_NUM);\n blkdev.drvs=CAlloc(sizeof(CDrv)*DRVS_NUM);\n for (i=0;i<DRVS_NUM;i++)\n blkdev.let_to_drv[i]=&blkdev.drvs[i];\n #exe {\n if (kernel_cfg->opts[CFG_MOUNT_IDE_AUTO])\n StreamPrint(\"MountIDEAuto;\");\n StreamPrint(\"#exe {Option(OPTf_WARN_PAREN,OFF);}\");\n StreamDoc(kernel_cfg->add_dev);\n StreamPrint(\"#exe {Option(OPTf_WARN_PAREN,ON);}\");\n };\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\tungsten-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has graphics
<1>/* Graphics Not Rendered in HTML */
<2>/* Graphics Not Rendered in HTML */
U0 DrawIt(CTask *,CDC *dc)
{
Sprite3(dc,216,0,0,<2>);
}
U0 Song()
{
SettingsPush; //See SettingsPush
Fs->text_attr=DKGRAY<<4+YELLOW;
Fs->draw_it=&DrawIt;
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 1.930;
music.stacatto_factor= 0.681;
try {
while (!ScanKey) {
Play("5eD4A5CC4qG5eD4A5CCqFeFAGA",
"Tip \0 \0of \0the \0tongue...\n\0Can't \0 \0"
"clear \0my \0head...\n\0Toss \0and \0turn \0 \0");
Play("5FEsEEGG4qAB5eD4A5CC4qG5eD4A",
" \0 \0on \0 \0my \0 \0bed.\n\0So, \0this \0 \0"
"ain't \0 \0fun.\n\0My \0 \0");
Play("5CCqFeFAGAFEsEEGG4qA5eEC",
"mind \0is \0dead.\n\0Slow\0ly \0burn \0 \0"
"through\n\0 \0 \0 \0all \0of \0them.\n\0 \0 \0");
Play("5F4sA5EeG4BAsAGA5D4A5DeD4A5F4G5GG4qA",
"Try \0 \0hard?\n\0 \0 \0 \0 \0 \0 \0Get \0 \0"
"luck\0y.\n\0 \0 \0 \0 \0 \0 \0");
Play("5eF4sA5EeG4BAsAGA5D4A5DeD4A5F4G5GG4qA",
"Try \0 \0hard?\n\0 \0 \0 \0 \0 \0 \0Get \0 \0"
"luck\0y.\n\0 \0 \0 \0 \0 \0 \0");
}
} catch
PutExcept;
SettingsPop;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\tungsten-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has graphics\n\n<1>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<2>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n\n\n\n\nU0 DrawIt(CTask *,CDC *dc)\n{\n Sprite3(dc,216,0,0,<2>);\n}\n\nU0 Song()\n{\n SettingsPush; //See SettingsPush\n Fs->text_attr=DKGRAY<<4+YELLOW;\n Fs->draw_it=&DrawIt;\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 1.930;\n music.stacatto_factor= 0.681;\n try {\n while (!ScanKey) {\n Play(\"5eD4A5CC4qG5eD4A5CCqFeFAGA\",\n \"Tip \\0 \\0of \\0the \\0tongue...\\n\\0Can't \\0 \\0\"\n \"clear \\0my \\0head...\\n\\0Toss \\0and \\0turn \\0 \\0\");\n Play(\"5FEsEEGG4qAB5eD4A5CC4qG5eD4A\",\n \" \\0 \\0on \\0 \\0my \\0 \\0bed.\\n\\0So, \\0this \\0 \\0\"\n \"ain't \\0 \\0fun.\\n\\0My \\0 \\0\");\n Play(\"5CCqFeFAGAFEsEEGG4qA5eEC\",\n \"mind \\0is \\0dead.\\n\\0Slow\\0ly \\0burn \\0 \\0\"\n \"through\\n\\0 \\0 \\0 \\0all \\0of \\0them.\\n\\0 \\0 \\0\");\n Play(\"5F4sA5EeG4BAsAGA5D4A5DeD4A5F4G5GG4qA\",\n \"Try \\0 \\0hard?\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0Get \\0 \\0\"\n \"luck\\0y.\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5eF4sA5EeG4BAsAGA5D4A5DeD4A5F4G5GG4qA\",\n \"Try \\0 \\0hard?\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0Get \\0 \\0\"\n \"luck\\0y.\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n }\n } catch\n PutExcept;\n SettingsPop;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\ToHtml-ToHtmlToTXTDemo-Demo.html
// Date: unknown-date
// Language: HolyC
#help_index "DolDoc/Conversion"
//See ::/Doc/Credits.DD.
#define DOCET_UNDEF_COLOR 0x100000000
#define DOCET_LINK_UNDERLINE 0x200000000
U0 HtmlPutS(CDoc *doc,I64 u32_attr,I64 *_old_u32_attr,Bool underline_update,
U8 *st,I64 *_col,U8 *style_bitmap=NULL)
{
U8 *ch,*ptr;
u32_attr&=0xFFFFFF00;
if (u32_attr&DOCET_INVERT)
u32_attr.u8[1]=(u32_attr.u8[1]&15)<<4|u32_attr.u8[1]>>4;
if (underline_update &&
!(u32_attr&DOCET_UNDERLINE) && *_old_u32_attr&DOCET_UNDERLINE) {
if (!(*_old_u32_attr&DOCET_LINK_UNDERLINE))
DocPrint(doc,"</u>");
*_old_u32_attr&=~DOCET_LINK_UNDERLINE;
}
if (!(u32_attr&DOCET_BLINK) && *_old_u32_attr&DOCET_BLINK)
DocPrint(doc,"</blink>");
if (u32_attr&0xFF00!=*_old_u32_attr&0xFF00) {
if (!(*_old_u32_attr&DOCET_UNDEF_COLOR))
DocPrint(doc,"</span>");
DocPrint(doc,"<span class=c%02X>",u32_attr.u8[1]);
if (style_bitmap)
LBts(style_bitmap,u32_attr.u8[1]);
}
if (u32_attr&DOCET_BLINK && !(*_old_u32_attr&DOCET_BLINK))
DocPrint(doc,"<blink>");
if (underline_update) {
if (u32_attr&DOCET_UNDERLINE && !(*_old_u32_attr&DOCET_UNDERLINE))
DocPrint(doc,"<u>");
} else //Keep same underline status.
u32_attr=u32_attr&~DOCET_UNDERLINE | *_old_u32_attr&DOCET_UNDERLINE;
*_old_u32_attr=u32_attr | *_old_u32_attr&DOCET_LINK_UNDERLINE;
while (ch=*st++) {
switch (ch) {
case '\t':
do {
DocPutKey(doc,CH_SPACE,0);
*_col=*_col+1;
} while (*_col&7);
break;
start:
case 'pi': ptr="pi"; break;
case 'theta': ptr="theta"; break;
case 'phi': ptr="phi"; break;
case 'omega': ptr="omega"; break;
case 'inf': ptr="inf"; break;
case 'u': ptr="u"; break;
end:
DocPrint(doc,ptr);
*_col=*_col+StrLen(ptr);
break;
start:
case CH_SHIFT_SPACE: ptr=" "; break;
case '&': ptr="&"; break;
case '<': ptr="<"; break;
case '>': ptr=">"; break;
case '"': ptr="""; break;
end:
DocPrint(doc,ptr);
*_col=*_col+1;
break;
default:
if (CH_SPACE<=ch<0x7F || ch=='\n')
DocPutKey(doc,ch,0);
else
DocPrint(doc,".");
*_col=*_col+1;
}
}
}
U8 *TOSLinkCvt2(U8 *filename,I64 line_num)
{// ::/ --> /Wb/
//Make your own LinkCvt routine
U8 *res=NULL,*st;
if (filename) {
st=ExtChg(filename,"html");
if (st && StrLen(st)>3 && !StrNCmp(st+1,":/",2))
res=MStrPrint("/Wb/%s#l%d",st+3,line_num);
Free(st);
}
return res;
}
U8 *URLBibleGateway(U8 *src)
{
U8 buf[STR_LEN],*dst=buf;
if (!MemCmp(src,"BF:",3))
src+=3;
while (*src) {
if (*src==CH_SPACE || *src==',')
*dst++='+';
else
*dst++=*src;
src++;
}
*dst=0;
if (StrOcc(buf,'-'))
return MStrPrint(
"http://www.biblegateway.com/passage/?search=%s&version=NIV",buf);
else
return MStrPrint(
"http://www.biblegateway.com/verse/en/%s",buf);
}
U8 *TOSLinkCvt1(U8 *link_st)
{
static CDoc *bible=NULL;
static I64 locks=0;
U8 *res=NULL,*filename,*needle;
I64 i,num;
if (link_st) {
switch (i=EdLinkCvt(link_st,&filename,&needle,&num)) {
case LK_FILE_LINE:
case LK_PLAIN_LINE:
case LK_FILE:
res=TOSLinkCvt2(filename,num);
break;
case -1:
case LK_DEF:
case LK_HELP_INDEX:
case LK_DOC:
case LK_DOC_ANCHOR:
case LK_DOC_FIND:
case LK_DOC_LINE:
break;
case LK_BIBLE_FIND:
while (LBts(&locks,0))
Yield;
if (!bible)
bible=Adam("DocRead(\"%s\");",filename);
if (DocFind(bible,num,needle))
res=URLBibleGateway(link_st);
LBtr(&locks,0);
break;
default:
if (DocFileEd(i,filename,needle,&num,EDF_UNCOLLAPSE|EDF_BAIL))
res=TOSLinkCvt2(filename,num);
}
Free(filename);
Free(needle);
}
return res;
}
public CDoc *Doc2Html(CDoc *doc_in,U8 *html_header=NULL,U8 *body_header=NULL,
U8 *body_footer=NULL,U8 *html_footer=NULL,Bool line_anchors=TRUE,
U8 (*link_cvt)(U8 *link_st)=&TOSLinkCvt1,Bool line_nums=FALSE)
{//Cvt DolDocdoc to HTML file.
CDocEntry *doc_e,*style,*doc_e2;
I64 i,y,old_y=I64_MIN,col,old_u32_attr=DOCET_UNDEF_COLOR,old_attr,digits;
U32 *hl,*src;
U8 *st,st_2[2],*link_st,*style_bitmap=CAlloc(256/8);
CBGR48 p[COLORS_NUM];
GrPaletteGet(p);
CDoc *doc_out=DocNew;
Bool unlock_doc_in=DocLock(doc_in),no_bwd;
old_attr=doc_in->win_task->text_attr;
doc_in->win_task->text_attr=DOC_ATTR_DFT_TEXT;
for (i=0xF0;i<=0xFF;i++)
LBts(style_bitmap,i);
DocRecalc(doc_in,RECALCt_NORMAL|RECALCF_TO_HTML);
digits=Log10(doc_in->head.last->y+1)+1;
st_2[0]=0; st_2[1]=0;
doc_out->flags|=DOCF_PLAIN_TEXT|DOCF_NO_CURSOR;
if (!html_header) html_header=
"<!DOCTYPE HTML>\n"
"<html>\n"
"<head>\n"
"<meta http-equiv=\"Content-Type\" "
"content=\"text/html;charset=US-ASCII\">\n"
"<meta name=\"generator\" content=\"TempleOS V5.03\">\n";
if (!body_header) body_header=
"<body>\n"
"<pre style=\"font-family:courier;font-size:10pt\">\n";
if (!body_footer) body_footer=
"</pre></body>\n</html>\n";
if (!html_footer) html_footer=
"</html>\n";
DocPrint(doc_out,"%s",html_header);
DocPrint(doc_out,"<style type=\"text/css\">\n");
style=doc_out->cur_entry->last;
DocPrint(doc_out,
"</style>\n"
"</head>\n");
DocPrint(doc_out,"%s",body_header);
doc_e=doc_in->head.next;
col=doc_e->x;
y=doc_e->y;
while (doc_e!=doc_in) {
if (!(doc_e->de_flags&DOCEF_SKIP)) {
if (y!=old_y) {
if (line_anchors)
DocPrint(doc_out,"<a name=\"l%d\"></a>",y+1);
if (line_nums)
DocPrint(doc_out,"%0*d ",digits,y+1);
old_y=y;
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\ToHtml-ToHtmlToTXTDemo-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"DolDoc/Conversion\"\n\n//See ::/Doc/Credits.DD.\n\n#define DOCET_UNDEF_COLOR 0x100000000\n#define DOCET_LINK_UNDERLINE 0x200000000\nU0 HtmlPutS(CDoc *doc,I64 u32_attr,I64 *_old_u32_attr,Bool underline_update,\n U8 *st,I64 *_col,U8 *style_bitmap=NULL)\n{\n U8 *ch,*ptr;\n u32_attr&=0xFFFFFF00;\n if (u32_attr&DOCET_INVERT)\n u32_attr.u8[1]=(u32_attr.u8[1]&15)<<4|u32_attr.u8[1]>>4;\n if (underline_update &&\n !(u32_attr&DOCET_UNDERLINE) && *_old_u32_attr&DOCET_UNDERLINE) {\n if (!(*_old_u32_attr&DOCET_LINK_UNDERLINE))\n DocPrint(doc,\"</u>\");\n *_old_u32_attr&=~DOCET_LINK_UNDERLINE;\n }\n if (!(u32_attr&DOCET_BLINK) && *_old_u32_attr&DOCET_BLINK)\n DocPrint(doc,\"</blink>\");\n if (u32_attr&0xFF00!=*_old_u32_attr&0xFF00) {\n if (!(*_old_u32_attr&DOCET_UNDEF_COLOR))\n DocPrint(doc,\"</span>\");\n DocPrint(doc,\"<span class=c%02X>\",u32_attr.u8[1]);\n if (style_bitmap)\n LBts(style_bitmap,u32_attr.u8[1]);\n }\n if (u32_attr&DOCET_BLINK && !(*_old_u32_attr&DOCET_BLINK))\n DocPrint(doc,\"<blink>\");\n if (underline_update) {\n if (u32_attr&DOCET_UNDERLINE && !(*_old_u32_attr&DOCET_UNDERLINE))\n DocPrint(doc,\"<u>\");\n } else //Keep same underline status.\n u32_attr=u32_attr&~DOCET_UNDERLINE | *_old_u32_attr&DOCET_UNDERLINE;\n\n *_old_u32_attr=u32_attr | *_old_u32_attr&DOCET_LINK_UNDERLINE;\n\n while (ch=*st++) {\n switch (ch) {\n case '\\t':\n do {\n DocPutKey(doc,CH_SPACE,0);\n *_col=*_col+1;\n } while (*_col&7);\n break;\n\n start:\n case 'pi': ptr=\"pi\"; break;\n case 'theta': ptr=\"theta\"; break;\n case 'phi': ptr=\"phi\"; break;\n case 'omega': ptr=\"omega\"; break;\n case 'inf': ptr=\"inf\"; break;\n case 'u': ptr=\"u\"; break;\n end:\n DocPrint(doc,ptr);\n *_col=*_col+StrLen(ptr);\n break;\n\n start:\n case CH_SHIFT_SPACE: ptr=\" \"; break;\n case '&': ptr=\"&\"; break;\n case '<': ptr=\"<\"; break;\n case '>': ptr=\">\"; break;\n case '\"': ptr=\""\"; break;\n end:\n DocPrint(doc,ptr);\n *_col=*_col+1;\n break;\n\n default:\n if (CH_SPACE<=ch<0x7F || ch=='\\n')\n DocPutKey(doc,ch,0);\n else\n DocPrint(doc,\".\");\n *_col=*_col+1;\n }\n }\n}\n\nU8 *TOSLinkCvt2(U8 *filename,I64 line_num)\n{// ::/ --> /Wb/\n//Make your own LinkCvt routine\n U8 *res=NULL,*st;\n if (filename) {\n st=ExtChg(filename,\"html\");\n if (st && StrLen(st)>3 && !StrNCmp(st+1,\":/\",2))\n res=MStrPrint(\"/Wb/%s#l%d\",st+3,line_num);\n Free(st);\n }\n return res;\n}\n\nU8 *URLBibleGateway(U8 *src)\n{\n U8 buf[STR_LEN],*dst=buf;\n if (!MemCmp(src,\"BF:\",3))\n src+=3;\n while (*src) {\n if (*src==CH_SPACE || *src==',')\n *dst++='+';\n else\n *dst++=*src;\n src++;\n }\n *dst=0;\n if (StrOcc(buf,'-'))\n return MStrPrint(\n \"http://www.biblegateway.com/passage/?search=%s&version=NIV\",buf);\n else\n return MStrPrint(\n \"http://www.biblegateway.com/verse/en/%s\",buf);\n}\n\nU8 *TOSLinkCvt1(U8 *link_st)\n{\n static CDoc *bible=NULL;\n static I64 locks=0;\n U8 *res=NULL,*filename,*needle;\n I64 i,num;\n if (link_st) {\n switch (i=EdLinkCvt(link_st,&filename,&needle,&num)) {\n case LK_FILE_LINE:\n case LK_PLAIN_LINE:\n case LK_FILE:\n res=TOSLinkCvt2(filename,num);\n break;\n case -1:\n case LK_DEF:\n case LK_HELP_INDEX:\n case LK_DOC:\n case LK_DOC_ANCHOR:\n case LK_DOC_FIND:\n case LK_DOC_LINE:\n break;\n case LK_BIBLE_FIND:\n while (LBts(&locks,0))\n Yield;\n if (!bible)\n bible=Adam(\"DocRead(\\\"%s\\\");\",filename);\n if (DocFind(bible,num,needle))\n res=URLBibleGateway(link_st);\n LBtr(&locks,0);\n break;\n default:\n if (DocFileEd(i,filename,needle,&num,EDF_UNCOLLAPSE|EDF_BAIL))\n res=TOSLinkCvt2(filename,num);\n }\n Free(filename);\n Free(needle);\n }\n return res;\n}\n\npublic CDoc *Doc2Html(CDoc *doc_in,U8 *html_header=NULL,U8 *body_header=NULL,\n U8 *body_footer=NULL,U8 *html_footer=NULL,Bool line_anchors=TRUE,\n U8 (*link_cvt)(U8 *link_st)=&TOSLinkCvt1,Bool line_nums=FALSE)\n{//Cvt DolDocdoc to HTML file.\n CDocEntry *doc_e,*style,*doc_e2;\n I64 i,y,old_y=I64_MIN,col,old_u32_attr=DOCET_UNDEF_COLOR,old_attr,digits;\n U32 *hl,*src;\n U8 *st,st_2[2],*link_st,*style_bitmap=CAlloc(256/8);\n CBGR48 p[COLORS_NUM];\n GrPaletteGet(p);\n CDoc *doc_out=DocNew;\n Bool unlock_doc_in=DocLock(doc_in),no_bwd;\n\n old_attr=doc_in->win_task->text_attr;\n doc_in->win_task->text_attr=DOC_ATTR_DFT_TEXT;\n\n for (i=0xF0;i<=0xFF;i++)\n LBts(style_bitmap,i);\n\n DocRecalc(doc_in,RECALCt_NORMAL|RECALCF_TO_HTML);\n\n digits=Log10(doc_in->head.last->y+1)+1;\n\n st_2[0]=0; st_2[1]=0;\n doc_out->flags|=DOCF_PLAIN_TEXT|DOCF_NO_CURSOR;\n\n if (!html_header) html_header=\n \"<!DOCTYPE HTML>\\n\"\n \"<html>\\n\"\n \"<head>\\n\"\n \"<meta http-equiv=\\\"Content-Type\\\" \"\n \"content=\\\"text/html;charset=US-ASCII\\\">\\n\"\n \"<meta name=\\\"generator\\\" content=\\\"TempleOS V5.03\\\">\\n\";\n if (!body_header) body_header=\n \"<body>\\n\"\n \"<pre style=\\\"font-family:courier;font-size:10pt\\\">\\n\";\n if (!body_footer) body_footer=\n \"</pre></body>\\n</html>\\n\";\n if (!html_footer) html_footer=\n \"</html>\\n\";\n\n DocPrint(doc_out,\"%s\",html_header);\n\n DocPrint(doc_out,\"<style type=\\\"text/css\\\">\\n\");\n style=doc_out->cur_entry->last;\n DocPrint(doc_out,\n \"</style>\\n\"\n \"</head>\\n\");\n DocPrint(doc_out,\"%s\",body_header);\n\n doc_e=doc_in->head.next;\n col=doc_e->x;\n y=doc_e->y;\n while (doc_e!=doc_in) {\n if (!(doc_e->de_flags&DOCEF_SKIP)) {\n if (y!=old_y) {\n if (line_anchors)\n DocPrint(doc_out,\"<a name=\\\"l%d\\\"></a>\",y+1);\n if (line_nums)\n DocPrint(doc_out,\"%0*d \",digits,y+1);\n old_y=y;\n }\n "
}
]
}
|
// Source: D:\TempleOS-Projects\html\adopted-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has words
-] Reward1
CallExtStr("JukeReward",""
-] Reward2
"reek servility Brest thermal "
"Agni's marabous aborigine's apportions "
"clues Nova constraints inoculates "
"Wilda's dismayed shoehorn's Mekong "
"summarize mores's Ebola ferrying "
);
U0 Song()
{
CTask *task;
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.480;
music.stacatto_factor= 0.902;
try {
task=PopUpViewPrint(
"Exodus,2:5-10\n");
TaskWait(task);
WinHorz(Fs->win_left,TEXT_COLS-10,task);
WinVert(Fs->win_bottom+3,Fs->win_bottom+15,task);
while (!ScanKey) {
Play("4qB5eCCqDeDDqECD4B",
"Park \0the \0 \0boat\n\0 \0 \0 \0 \0 \0 \0");
Play("5eC4sAGeABGAFAGGqGhG",
" \0 \0 \0 \0 \0 \0 \0 \0 \0Drive \0it \0 \0home\n\0");
Play("qB5eCEqDeDsCDqECD4B",
"Rams \0and \0 \0goat\n\0 \0 \0 \0 \0 \0 \0 \0");
Play("5eC4sAGeABGAFAGsGFeGGhG",
" \0 \0 \0 \0 \0 \0 \0 \0 \0To \0 \0 \0the \0 \0bone\n\0");
Play("5eGGAAGAqFGDsEeDsDqD",
" \0 \0 \0 \0 \0 \0 \0Voice \0my \0soul\n\0 \0 \0 \0");
Play("M3/4");
Play("GeFFGAM4/4");
Play("qtFDChD#M4/4","Cho\0ic\0est \0coal\n\0");
}
} catch
PutExcept;
Snd;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\adopted-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has words\n\n-] Reward1\n CallExtStr(\"JukeReward\",\"\"\n -] Reward2\n \n \"reek servility Brest thermal \"\n \"Agni's marabous aborigine's apportions \"\n \"clues Nova constraints inoculates \"\n \"Wilda's dismayed shoehorn's Mekong \"\n \"summarize mores's Ebola ferrying \"\n \n );\n\nU0 Song()\n{\n CTask *task;\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 2.480;\n music.stacatto_factor= 0.902;\n try {\n task=PopUpViewPrint(\n \"Exodus,2:5-10\\n\");\n TaskWait(task);\n WinHorz(Fs->win_left,TEXT_COLS-10,task);\n WinVert(Fs->win_bottom+3,Fs->win_bottom+15,task);\n while (!ScanKey) {\n Play(\"4qB5eCCqDeDDqECD4B\",\n \"Park \\0the \\0 \\0boat\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5eC4sAGeABGAFAGGqGhG\",\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0Drive \\0it \\0 \\0home\\n\\0\");\n Play(\"qB5eCEqDeDsCDqECD4B\",\n \"Rams \\0and \\0 \\0goat\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5eC4sAGeABGAFAGsGFeGGhG\",\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0To \\0 \\0 \\0the \\0 \\0bone\\n\\0\");\n Play(\"5eGGAAGAqFGDsEeDsDqD\",\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0Voice \\0my \\0soul\\n\\0 \\0 \\0 \\0\");\n Play(\"M3/4\");\n Play(\"GeFFGAM4/4\");\n Play(\"qtFDChD#M4/4\",\"Cho\\0ic\\0est \\0coal\\n\\0\");\n }\n } catch\n PutExcept;\n Snd;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\SpanNew-Span-Apps.html
// Date: unknown-date
// Language: HolyC
CMathODE *SpanNew()
{
CMathODE *ode=ODENew(0,1e-4,ODEF_HAS_MASSES|ODEF_PAUSED);
ode->derive=&MyDerivative;
ode->drag_v2=0.002;
ode->drag_v3=0.00001;
ode->acceleration_limit=5e3;
QueIns(ode,Fs->last_ode);
return ode;
}
U0 SpanDel(CMathODE *ode)
{
if (ode) {
QueRem(ode);
QueDel(&ode->next_mass,TRUE);
QueDel(&ode->next_spring,TRUE);
ODEDel(ode);
}
}
#define M_SIZE (sizeof(MyMass) -offset(CMass.start))
#define S_SIZE (sizeof(MySpring)-offset(CSpring.start))
U8 *SpanSave(CMathODE *ode,I64 *_size=NULL)
{
I64 cnt;
U8 *res,*ptr;
MyMass *tmpm;
MySpring *tmps;
SpanHeader h;
ODERenum(ode);
h.version=SPAN_VERSION;
if (ode->next_mass!=&ode->next_mass)
h.num_masses=ode->last_mass->num+1;
else
h.num_masses=0;
if (ode->next_spring!=&ode->next_spring)
h.num_springs=ode->last_spring->num+1;
else
h.num_springs=0;
cnt=sizeof(SpanHeader)+h.num_masses*M_SIZE+h.num_springs*S_SIZE;
ptr=res=MAlloc(cnt);
MemCpy(ptr,&h,sizeof(SpanHeader));
ptr+=sizeof(SpanHeader);
tmpm=ode->next_mass;
while (tmpm!=&ode->next_mass) {
MemCpy(ptr,&tmpm->start,M_SIZE);
ptr+=M_SIZE;
tmpm=tmpm->next;
}
tmps=ode->next_spring;
while (tmps!=&ode->next_spring) {
MemCpy(ptr,&tmps->start,S_SIZE);
ptr+=S_SIZE;
tmps=tmps->next;
}
if (_size) *_size=cnt;
return res;
}
Bool SpanWrite(CMathODE *ode)
{
U8 *name,*buf;
I64 size;
Bool res=FALSE,old_silent=Silent;
DirMk("~/Span");
Silent(old_silent);
if (name=PopUpFileName("~/Span/Game.DATA")) {
if (buf=SpanSave(ode,&size)) {
FileWrite(name,buf,size);
Free(buf);
res=TRUE;
}
Free(name);
}
return res;
}
U0 SpanLoad(CMathODE *ode,U8 *src)
{
I64 i;
MyMass *tmpm;
MySpring *tmps;
SpanHeader h;
if (!src) return;
MemCpy(&h,src,sizeof(SpanHeader));
src+=sizeof(SpanHeader);
for (i=0;i<h.num_masses;i++) {
tmpm=CAlloc(sizeof(MyMass));
MemCpy(&tmpm->start,src,M_SIZE);
src+=M_SIZE;
QueIns(tmpm,ode->last_mass);
}
for (i=0;i<h.num_springs;i++) {
tmps=CAlloc(sizeof(MySpring));
MemCpy(&tmps->start,src,S_SIZE);
src+=S_SIZE;
QueIns(tmps,ode->last_spring);
tmps->end1=MassFindNum(ode,tmps->end1_num);
tmps->end2=MassFindNum(ode,tmps->end2_num);
}
}
U8 *SpanRead()
{
U8 *src=NULL,*name;
Bool old_silent=Silent;
DirMk("~/Span");
Silent(old_silent);
if (name=PopUpPickFile("~/Span")) {
src=FileRead(name);
Free(name);
}
return src;
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\SpanNew-Span-Apps.html\n// Date: unknown-date\n// Language: HolyC\n\nCMathODE *SpanNew()\n{\n CMathODE *ode=ODENew(0,1e-4,ODEF_HAS_MASSES|ODEF_PAUSED);\n ode->derive=&MyDerivative;\n ode->drag_v2=0.002;\n ode->drag_v3=0.00001;\n ode->acceleration_limit=5e3;\n QueIns(ode,Fs->last_ode);\n return ode;\n}\n\nU0 SpanDel(CMathODE *ode)\n{\n if (ode) {\n QueRem(ode);\n QueDel(&ode->next_mass,TRUE);\n QueDel(&ode->next_spring,TRUE);\n ODEDel(ode);\n }\n}\n\n#define M_SIZE (sizeof(MyMass) -offset(CMass.start))\n#define S_SIZE (sizeof(MySpring)-offset(CSpring.start))\n\nU8 *SpanSave(CMathODE *ode,I64 *_size=NULL)\n{\n I64 cnt;\n U8 *res,*ptr;\n MyMass *tmpm;\n MySpring *tmps;\n SpanHeader h;\n\n ODERenum(ode);\n h.version=SPAN_VERSION;\n if (ode->next_mass!=&ode->next_mass)\n h.num_masses=ode->last_mass->num+1;\n else\n h.num_masses=0;\n if (ode->next_spring!=&ode->next_spring)\n h.num_springs=ode->last_spring->num+1;\n else\n h.num_springs=0;\n\n cnt=sizeof(SpanHeader)+h.num_masses*M_SIZE+h.num_springs*S_SIZE;\n\n ptr=res=MAlloc(cnt);\n MemCpy(ptr,&h,sizeof(SpanHeader));\n ptr+=sizeof(SpanHeader);\n\n tmpm=ode->next_mass;\n while (tmpm!=&ode->next_mass) {\n MemCpy(ptr,&tmpm->start,M_SIZE);\n ptr+=M_SIZE;\n tmpm=tmpm->next;\n }\n\n tmps=ode->next_spring;\n while (tmps!=&ode->next_spring) {\n MemCpy(ptr,&tmps->start,S_SIZE);\n ptr+=S_SIZE;\n tmps=tmps->next;\n }\n if (_size) *_size=cnt;\n return res;\n}\n\nBool SpanWrite(CMathODE *ode)\n{\n U8 *name,*buf;\n I64 size;\n Bool res=FALSE,old_silent=Silent;\n DirMk(\"~/Span\");\n Silent(old_silent);\n if (name=PopUpFileName(\"~/Span/Game.DATA\")) {\n if (buf=SpanSave(ode,&size)) {\n FileWrite(name,buf,size);\n Free(buf);\n res=TRUE;\n }\n Free(name);\n }\n return res;\n}\n\nU0 SpanLoad(CMathODE *ode,U8 *src)\n{\n I64 i;\n MyMass *tmpm;\n MySpring *tmps;\n SpanHeader h;\n\n if (!src) return;\n\n MemCpy(&h,src,sizeof(SpanHeader));\n src+=sizeof(SpanHeader);\n\n for (i=0;i<h.num_masses;i++) {\n tmpm=CAlloc(sizeof(MyMass));\n MemCpy(&tmpm->start,src,M_SIZE);\n src+=M_SIZE;\n QueIns(tmpm,ode->last_mass);\n }\n\n for (i=0;i<h.num_springs;i++) {\n tmps=CAlloc(sizeof(MySpring));\n MemCpy(&tmps->start,src,S_SIZE);\n src+=S_SIZE;\n QueIns(tmps,ode->last_spring);\n tmps->end1=MassFindNum(ode,tmps->end1_num);\n tmps->end2=MassFindNum(ode,tmps->end2_num);\n }\n}\n\nU8 *SpanRead()\n{\n U8 *src=NULL,*name;\n Bool old_silent=Silent;\n DirMk(\"~/Span\");\n Silent(old_silent);\n if (name=PopUpPickFile(\"~/Span\")) {\n src=FileRead(name);\n Free(name);\n }\n return src;\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\KHashB-Kernel.html
// Date: unknown-date
// Language: HolyC
I64 HashTypeNum(CHash *tmph)
{//Return bit num of hash type, limited to just types.
if (tmph)
return Bsf(tmph->type&HTG_TYPE_MASK);
else
return -1;
}
I64 HashVal(CHash *tmph)
{//Returns most likely desired value.
switch [HashTypeNum(tmph)] {
case HTt_EXPORT_SYS_SYM:
return tmph(CHashExport *)->val;
case HTt_IMPORT_SYS_SYM:
return tmph(CHashImport *)->module_base;
case HTt_DEFINE_STR:
case HTt_CLASS:
case HTt_INTERNAL_TYPE:
case HTt_WORD:
case HTt_DICT_WORD:
case HTt_OPCODE:
case HTt_HELP_FILE:
return tmph;
case HTt_GLBL_VAR:
if (tmph(CHashGlblVar *)->flags&GVF_EXTERN)
return &tmph(CHashGlblVar *)->data_addr;
else
return tmph(CHashGlblVar *)->data_addr;
case HTt_FUN:
if (Bt(&tmph(CHashFun *)->flags,Cf_EXTERN))
return tmph;
else
return tmph(CHashFun *)->exe_addr;
case HTt_REG:
return tmph(CHashReg *)->reg_num|tmph(CHashReg *)->reg_type<<8;
case HTt_KEYWORD:
case HTt_ASM_KEYWORD:
case HTt_MODULE:
case HTt_FILE:
case HTt_FRAME_PTR:
return tmph(CHashGeneric *)->user_data0;
case -1: //nobound switch
case HTt_TYPES_NUM: //nobound switch
default:
return 0;
}
}
CHashTable *HashTableNew(I64 size,CTask *mem_task=NULL)
{//New hash table, power-of-two in size.
CHashTable *table;
table=CAlloc(sizeof(CHashTable),mem_task);
table->body=CAlloc(size<<3,mem_task);
table->mask=size-1;
return table;
}
U0 HashDel(CHashSrcSym *tmph)
{//Free a std TempleOS system hash entry.
if (!tmph) return;
if (!(tmph->type&HTT_DICT_WORD))
Free(tmph->str);
if (tmph->type & HTG_SRC_SYM) {
Free(tmph->src_link);
Free(tmph->idx);
Free(tmph->import_name);
LinkedLstDel(tmph->ie_lst);
if (tmph->type & (HTT_FUN | HTT_EXPORT_SYS_SYM))
Free(tmph->dbg_info);
if (tmph->type & (HTT_FUN | HTT_CLASS))
//Assumes code not on heap, so doesn't Free.
//ClassMemberLstDel() is an import to the Kernel module
ClassMemberLstDel(tmph);
else if (tmph->type&HTT_DEFINE_STR)
Free(tmph(CHashDefineStr *)->data);
else if (tmph->type & HTT_GLBL_VAR) {
if (!(tmph(CHashGlblVar *)->flags&GVF_ALIAS))
Free(tmph(CHashGlblVar *)->data_addr);
LinkedLstDel(tmph(CHashGlblVar *)->dim.next);
if (tmph(CHashGlblVar *)->fun_ptr)
HashDel(tmph(CHashGlblVar *)->fun_ptr
-tmph(CHashGlblVar *)->fun_ptr->ptr_stars_cnt);
}
} else if (tmph->type & HTT_FILE)
Free(tmph(CHashGeneric *)->user_data0);
Free(tmph);
}
U0 HashTableDel(CHashTable *table)
{//Free std system hash table, calling HashDel() on entries.
I64 i;
CHashSrcSym *tmph,*tmph1;
if (!table) return;
for (i=0;i<=table->mask;i++) {
tmph=table->body[i];
while (tmph) {
tmph1=tmph->next;
HashDel(tmph);
tmph=tmph1;
}
}
Free(table->body);
Free(table);
}
I64 HashTablePurge(CHashTable *table)
{//Eliminate ExportSysSyms that have been usurped.
I64 i,res=0;
CHashSrcSym *tmph,*tmph1,*tmph2;
if (!table) return 0;
PUSHFD
CLI //Precaution
for (i=0;i<=table->mask;i++) {
tmph=table->body[i];
while (tmph) {
tmph1=tmph->next; //We delete only older ones
if (tmph->type&(HTT_FUN|HTT_GLBL_VAR)) {
tmph2=tmph->next; //Older always later in chain
while (tmph2) {
if ((tmph2->type&HTT_EXPORT_SYS_SYM ||
tmph2->type&HTG_TYPE_MASK==HTT_INVALID) &&
!StrCmp(tmph2->str,tmph->str)) {
if (tmph2->type&HTG_TYPE_MASK==HTT_INVALID)
tmph2->type=HTT_KEYWORD;//Won't delete HTT_INVALID
HashRemDel(tmph2,table);
res++;
break;
}
tmph2=tmph2->next;
}
}
tmph=tmph1;
}
}
POPFD
return res;
}
CHashGeneric *HashGenericAdd(U8 *name,I64 type,
I64 u0=0,I64 u1=0,I64 u2=0,CTask *task=NULL)
{//Add any type to task hash_table, 3 user_data values.
if (!task) task=Fs;
CHashGeneric *res=CAlloc(sizeof(CHashGeneric),task);
res->type=type;
res->user_data0=u0;
res->user_data1=u1;
res->user_data2=u2;
res->str=StrNew(name,task);
HashAdd(res,task->hash_table);
return res;
}
U0 HashSrcFileSet(CCmpCtrl *cc,CHashSrcSym *h,I64 line_num_offset=0)
{//Set CHashSrcSym link and help_index by cur cc pos.
CLexFile *tmpf=cc->lex_include_stk;
I64 line_num=tmpf->line_num+line_num_offset;
if (line_num<1) line_num=1;
Free(h->src_link);
h->src_link=MStrPrint("FL:%s,%d",tmpf->full_name,line_num);
if (Bt(&cc->opts,OPTf_KEEP_PRIVATE))
h->type|=HTF_PRIVATE;
Free(h->idx);
if (cc->cur_help_idx && *cc->cur_help_idx)
h->idx=StrNew(cc->cur_help_idx);
else
h->idx=NULL;
}
CHashGeneric *HashPublic(U8 *st,I64 mask,Bool val=TRUE)
{//Mark a hash entry as public and HashSrcFileSet().
CHashGeneric *res;
if (res=HashFind(st,Fs->hash_table,mask)) {
if (val)
res->type|=HTF_PUBLIC;
else
res->type&=~HTF_PUBLIC;
if (res->type&HTG_SRC_SYM)
HashSrcFileSet(Fs->last_cc,res);
return res;
} else
return NULL;
}
I64 HashLstAdd(U8 *lst,I64 type,CHashTable *table)
{//Add a list to a hash table.
I64 i=0;
CHashGeneric *tmph;
if (lst) {
while (*lst) {
if (*lst=='@')
lst++;
else
i++;
tmph=CAlloc(sizeof(CHashGeneric));
tmph->user_data0=i-1;
tmph->str=StrNew(lst);
tmph->type=type;
HashAdd(tmph,table);
while (*lst++);
}
}
return i;
}
I64 HashDefineLstAdd(U8 *dname,I64 type,CHashTable *table)
{//Add define list to a hash table. See ::/Adam/DolDoc/DocInit.HC.
CHashDefineStr *tmph;
if (tmph=HashFind(dname,Fs->hash_table,HTT_DEFINE_STR))
return HashLstAdd(tmph->data,type,table);
else
return 0;
}
I64 FramePtr(U8 *name,CTask *task=NULL)
{//Find entry in task->hash_table, Return user_data.
CHashGeneric *tmph;
if (!task) task=Fs;
if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR))
return tmph->user_data0;
else
return 0;
}
CHashGeneric *FramePtrAdd(U8 *name,I64 val=0,CTask *task=NULL)
{//Add named value to task->hash_table.
return HashGenericAdd(name,HTT_FRAME_PTR,val,0,0,task);
}
I64 FramePtrSet(U8 *name,I64 val,CTask *task=NULL)
{//Find hash entry in task->hash_table. Change user_data0.
CHashGeneric *tmph;
if (!task) task=Fs;
if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR))
return LXchgI64(&tmph->user_data0,val);
else
return 0;
}
I64 FramePtrDel(U8 *name,CTask *task=NULL)
{//Remove entry and delete.
CHashGeneric *tmph;
I64 res=0;
if (!task) task=Fs;
if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR)) {
res=tmph->user_data0;
HashRemDel(tmph,task->hash_table);
}
return res;
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\KHashB-Kernel.html\n// Date: unknown-date\n// Language: HolyC\n\nI64 HashTypeNum(CHash *tmph)\n{//Return bit num of hash type, limited to just types.\n if (tmph)\n return Bsf(tmph->type&HTG_TYPE_MASK);\n else\n return -1;\n}\n\nI64 HashVal(CHash *tmph)\n{//Returns most likely desired value.\n switch [HashTypeNum(tmph)] {\n case HTt_EXPORT_SYS_SYM:\n return tmph(CHashExport *)->val;\n case HTt_IMPORT_SYS_SYM:\n return tmph(CHashImport *)->module_base;\n case HTt_DEFINE_STR:\n case HTt_CLASS:\n case HTt_INTERNAL_TYPE:\n case HTt_WORD:\n case HTt_DICT_WORD:\n case HTt_OPCODE:\n case HTt_HELP_FILE:\n return tmph;\n case HTt_GLBL_VAR:\n if (tmph(CHashGlblVar *)->flags&GVF_EXTERN)\n return &tmph(CHashGlblVar *)->data_addr;\n else\n return tmph(CHashGlblVar *)->data_addr;\n case HTt_FUN:\n if (Bt(&tmph(CHashFun *)->flags,Cf_EXTERN))\n return tmph;\n else\n return tmph(CHashFun *)->exe_addr;\n case HTt_REG:\n return tmph(CHashReg *)->reg_num|tmph(CHashReg *)->reg_type<<8;\n case HTt_KEYWORD:\n case HTt_ASM_KEYWORD:\n case HTt_MODULE:\n case HTt_FILE:\n case HTt_FRAME_PTR:\n return tmph(CHashGeneric *)->user_data0;\n\n case -1: //nobound switch\n case HTt_TYPES_NUM: //nobound switch\n default:\n return 0;\n }\n}\n\nCHashTable *HashTableNew(I64 size,CTask *mem_task=NULL)\n{//New hash table, power-of-two in size.\n CHashTable *table;\n table=CAlloc(sizeof(CHashTable),mem_task);\n table->body=CAlloc(size<<3,mem_task);\n table->mask=size-1;\n return table;\n}\n\nU0 HashDel(CHashSrcSym *tmph)\n{//Free a std TempleOS system hash entry.\n if (!tmph) return;\n if (!(tmph->type&HTT_DICT_WORD))\n Free(tmph->str);\n if (tmph->type & HTG_SRC_SYM) {\n Free(tmph->src_link);\n Free(tmph->idx);\n Free(tmph->import_name);\n LinkedLstDel(tmph->ie_lst);\n if (tmph->type & (HTT_FUN | HTT_EXPORT_SYS_SYM))\n Free(tmph->dbg_info);\n if (tmph->type & (HTT_FUN | HTT_CLASS))\n//Assumes code not on heap, so doesn't Free.\n //ClassMemberLstDel() is an import to the Kernel module\n ClassMemberLstDel(tmph);\n else if (tmph->type&HTT_DEFINE_STR)\n Free(tmph(CHashDefineStr *)->data);\n else if (tmph->type & HTT_GLBL_VAR) {\n if (!(tmph(CHashGlblVar *)->flags&GVF_ALIAS))\n Free(tmph(CHashGlblVar *)->data_addr);\n LinkedLstDel(tmph(CHashGlblVar *)->dim.next);\n if (tmph(CHashGlblVar *)->fun_ptr)\n HashDel(tmph(CHashGlblVar *)->fun_ptr\n -tmph(CHashGlblVar *)->fun_ptr->ptr_stars_cnt);\n }\n } else if (tmph->type & HTT_FILE)\n Free(tmph(CHashGeneric *)->user_data0);\n Free(tmph);\n}\n\nU0 HashTableDel(CHashTable *table)\n{//Free std system hash table, calling HashDel() on entries.\n I64 i;\n CHashSrcSym *tmph,*tmph1;\n if (!table) return;\n for (i=0;i<=table->mask;i++) {\n tmph=table->body[i];\n while (tmph) {\n tmph1=tmph->next;\n HashDel(tmph);\n tmph=tmph1;\n }\n }\n Free(table->body);\n Free(table);\n}\n\nI64 HashTablePurge(CHashTable *table)\n{//Eliminate ExportSysSyms that have been usurped.\n I64 i,res=0;\n CHashSrcSym *tmph,*tmph1,*tmph2;\n if (!table) return 0;\n PUSHFD\n CLI //Precaution\n for (i=0;i<=table->mask;i++) {\n tmph=table->body[i];\n while (tmph) {\n tmph1=tmph->next; //We delete only older ones\n if (tmph->type&(HTT_FUN|HTT_GLBL_VAR)) {\n tmph2=tmph->next; //Older always later in chain\n while (tmph2) {\n if ((tmph2->type&HTT_EXPORT_SYS_SYM ||\n tmph2->type&HTG_TYPE_MASK==HTT_INVALID) &&\n !StrCmp(tmph2->str,tmph->str)) {\n if (tmph2->type&HTG_TYPE_MASK==HTT_INVALID)\n tmph2->type=HTT_KEYWORD;//Won't delete HTT_INVALID\n HashRemDel(tmph2,table);\n res++;\n break;\n }\n tmph2=tmph2->next;\n }\n }\n tmph=tmph1;\n }\n }\n POPFD\n return res;\n}\n\nCHashGeneric *HashGenericAdd(U8 *name,I64 type,\n I64 u0=0,I64 u1=0,I64 u2=0,CTask *task=NULL)\n{//Add any type to task hash_table, 3 user_data values.\n if (!task) task=Fs;\n CHashGeneric *res=CAlloc(sizeof(CHashGeneric),task);\n res->type=type;\n res->user_data0=u0;\n res->user_data1=u1;\n res->user_data2=u2;\n res->str=StrNew(name,task);\n HashAdd(res,task->hash_table);\n return res;\n}\n\nU0 HashSrcFileSet(CCmpCtrl *cc,CHashSrcSym *h,I64 line_num_offset=0)\n{//Set CHashSrcSym link and help_index by cur cc pos.\n CLexFile *tmpf=cc->lex_include_stk;\n I64 line_num=tmpf->line_num+line_num_offset;\n if (line_num<1) line_num=1;\n Free(h->src_link);\n h->src_link=MStrPrint(\"FL:%s,%d\",tmpf->full_name,line_num);\n if (Bt(&cc->opts,OPTf_KEEP_PRIVATE))\n h->type|=HTF_PRIVATE;\n Free(h->idx);\n if (cc->cur_help_idx && *cc->cur_help_idx)\n h->idx=StrNew(cc->cur_help_idx);\n else\n h->idx=NULL;\n}\n\nCHashGeneric *HashPublic(U8 *st,I64 mask,Bool val=TRUE)\n{//Mark a hash entry as public and HashSrcFileSet().\n CHashGeneric *res;\n if (res=HashFind(st,Fs->hash_table,mask)) {\n if (val)\n res->type|=HTF_PUBLIC;\n else\n res->type&=~HTF_PUBLIC;\n if (res->type&HTG_SRC_SYM)\n HashSrcFileSet(Fs->last_cc,res);\n return res;\n } else\n return NULL;\n}\n\nI64 HashLstAdd(U8 *lst,I64 type,CHashTable *table)\n{//Add a list to a hash table.\n I64 i=0;\n CHashGeneric *tmph;\n if (lst) {\n while (*lst) {\n if (*lst=='@')\n lst++;\n else\n i++;\n tmph=CAlloc(sizeof(CHashGeneric));\n tmph->user_data0=i-1;\n tmph->str=StrNew(lst);\n tmph->type=type;\n HashAdd(tmph,table);\n while (*lst++);\n }\n }\n return i;\n}\n\nI64 HashDefineLstAdd(U8 *dname,I64 type,CHashTable *table)\n{//Add define list to a hash table. See ::/Adam/DolDoc/DocInit.HC.\n CHashDefineStr *tmph;\n if (tmph=HashFind(dname,Fs->hash_table,HTT_DEFINE_STR))\n return HashLstAdd(tmph->data,type,table);\n else\n return 0;\n}\n\nI64 FramePtr(U8 *name,CTask *task=NULL)\n{//Find entry in task->hash_table, Return user_data.\n CHashGeneric *tmph;\n if (!task) task=Fs;\n if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR))\n return tmph->user_data0;\n else\n return 0;\n}\n\nCHashGeneric *FramePtrAdd(U8 *name,I64 val=0,CTask *task=NULL)\n{//Add named value to task->hash_table.\n return HashGenericAdd(name,HTT_FRAME_PTR,val,0,0,task);\n}\n\nI64 FramePtrSet(U8 *name,I64 val,CTask *task=NULL)\n{//Find hash entry in task->hash_table. Change user_data0.\n CHashGeneric *tmph;\n if (!task) task=Fs;\n if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR))\n return LXchgI64(&tmph->user_data0,val);\n else\n return 0;\n}\n\nI64 FramePtrDel(U8 *name,CTask *task=NULL)\n{//Remove entry and delete.\n CHashGeneric *tmph;\n I64 res=0;\n if (!task) task=Fs;\n if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR)) {\n res=tmph->user_data0;\n HashRemDel(tmph,task->hash_table);\n }\n return res;\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\GrBitMap-Gr-Adam.html
// Date: unknown-date
// Language: HolyC
#help_index "Graphics"
Option(OPTf_WARN_HEADER_MISMATCH,OFF);
public Bool GrPlot0(CDC *dc=gr.dc,I64 x,I64 y)
{//2D. No clipping or transformation or thick.
U8 *dst;
I32 *db;
I64 d,dist;
CColorROPU32 c,color=dc->color,bkcolor=dc->bkcolor;
if (dc->flags & DCF_LOCATE_NEAREST) {
dist=DistSqrI64(x,y,dc->cur_x,dc->cur_y);
if (dist<=dc->nearest_dist)
dc->nearest_dist=dist;
}
if (dc->flags & DCF_RECORD_EXTENTS) {
if (x<dc->min_x) dc->min_x=x;
if (x>dc->max_x) dc->max_x=x;
if (y<dc->min_y) dc->min_y=y;
if (y>dc->max_y) dc->max_y=y;
}
if (dc->flags & DCF_DONT_DRAW)
return TRUE;
d=dc->width_internal*y+x;
if (db=dc->depth_buf) {
db+=d;
if (0<=dc->db_z<=*db)
*db=dc->db_z;
else
return TRUE;
}
if (color.c1.rop&(ROPBF_DITHER|ROPBF_PROBABILITY_DITHER)) {
if (color.c1.rop&ROPBF_PROBABILITY_DITHER) {
if (RandU16<dc->dither_probability_u16) {
color.c1.rop=color.c0.rop;
color.c0=color.c1;
}
} else {
if ((x^y)&1) {
color.c1.rop=color.c0.rop;
color.c0=color.c1;
}
}
}
dst=dc->body+d;
switch [color.c0.rop] {
case ROPB_EQU:
case ROPB_MONO:
*dst=color.c0.color;
break;
case ROPB_COLLISION:
c=*dst;
if (c!=TRANSPARENT && c!=bkcolor.c0.color)
dc->collision_cnt++;
break;
case ROPB_XOR:
*dst^=color.c0.color;
break;
}
return TRUE;
}
Option(OPTf_WARN_HEADER_MISMATCH,ON);
public I64 GrPeek0(CDC *dc=gr.dc,I64 x,I64 y)
{//2D. No clipping or transformation.
return dc->body[dc->width_internal*y+x];
}
#help_index "Graphics;Graphics/Device Contexts"
public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
{//2D. Clipping but not transformation..
I64 i,j,k,k1,kk,kk1,w1,h1,w2,h2,dist,
leading_pixels,leading_pixel_mask,whole_I64s,
trailing_pixels,trailing_pixel_mask,
reg bit_shift,win_z_buf_line_inc,win_z_buf_line_dec,win_z_num,
color_mask;
U8 reg *dst,*src;
I32 *db;
U16 reg *win_z_buf_ptr;
CColorROPU32 color,c,old_color;
CTask *win_task;
if (dc->flags & DCF_SCRN_BITMAP) {
win_task=dc->win_task;
x+=win_task->scroll_x;
y+=win_task->scroll_y;
}
if (x<0)
w1=-x;
else
w1=0;
if (y<0)
h1=-y;
else
h1=0;
w2=img->width;
h2=img->height;
if (dc->flags & DCF_SCRN_BITMAP) {
x+=win_task->pix_left;
y+=win_task->pix_top;
}
if (dc->flags & DCF_LOCATE_NEAREST) {
dist=DistSqrI64(x+img->width>>1,y+img->height>>1,dc->cur_x,dc->cur_y);
if (dist<=dc->nearest_dist)
dc->nearest_dist=dist;
}
if (dc->flags & DCF_SCRN_BITMAP) {
if (x+w1<0) w1=-x;
if (x+w2>win_task->pix_right+1)
w2=win_task->pix_right+1-x;
if (y+h1<0) h1=-y;
if (y+h2>win_task->pix_bottom+1)
h2=win_task->pix_bottom+1-y;
}
if (x+w2>dc->width)
w2=dc->width-x;
if (y+h2>dc->height)
h2=dc->height-y;
if (w1<w2<=img->width && h1<h2<=img->height) {
if (dc->flags & DCF_RECORD_EXTENTS) {
if (x+w1<dc->min_x) dc->min_x=x+w1;
if (x+w2-1>dc->max_x) dc->max_x=x+w2-1;
if (y+h1<dc->min_y) dc->min_y=y+h1;
if (y+h2-1>dc->max_y) dc->max_y=y+h2-1;
}
if (dc->flags & DCF_DONT_DRAW)
return 1;
old_color=dc->color;
db=dc->depth_buf;
dc->depth_buf=NULL;
dc->color&=~ROPF_DITHER;
color=dc->color;
leading_pixels=-(w1+x)&7;
leading_pixel_mask=gr.to_8_bits[0xFF>>leading_pixels];
bit_shift=-x&7;
whole_I64s=(w2-w1-leading_pixels)>>3;
if (whole_I64s<0) whole_I64s=0;
trailing_pixels=(x+w2)&7;
trailing_pixel_mask=gr.to_8_bits[0xFF<<trailing_pixels&0xFF];
if (leading_pixels+trailing_pixels>w2-w1) {
leading_pixel_mask|=trailing_pixel_mask;
trailing_pixels=0;
}
switch (color.c0.rop) {
case ROPB_COLLISION: //TODO: Might want to check win_z_buf
color =dc->bkcolor.c0.color;
k=h1*img->width_internal;
k1=(h1+y)*dc->width_internal+x;
for (j=h2-h1;j;j--) {
for (i=w1;i<w2;i++) {
c=dc->body[k1+i];
if (c!=TRANSPARENT&&c!=color&&img->body[k+i]!=TRANSPARENT)
dc->collision_cnt++;
}
k+=img->width_internal;
k1+=dc->width_internal;
}
break;
case ROPB_MONO:
color_mask=gr.to_8_colors[color.c0.color];
if (img->flags&DCF_NO_TRANSPARENTS) {
if (!(dc->flags & DCF_SCRN_BITMAP) || dc->flags&DCF_ON_TOP)
win_z_buf_ptr=NULL;
else {
win_z_num=win_task->win_z_num;
win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+
(w1+x)/FONT_WIDTH)*sizeof(U16);
win_z_buf_line_dec=whole_I64s;
if (leading_pixels)
win_z_buf_line_dec++;
if (trailing_pixels)
win_z_buf_line_dec++;
win_z_buf_line_dec*=sizeof(U16);
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
}
kk = h1 *img ->width_internal+w1;
kk1=(h1+y)*dc->width_internal+x+w1;
kk =(kk-bit_shift)&~7+bit_shift;
bit_shift*=8;
if (win_z_buf_ptr)
for (j=h1;j<h2;j++) {
src=img->body+kk&~7;
dst=dc->body+kk1&~7;
if (leading_pixels) {
if (win_z_num>=*win_z_buf_ptr++) {
if (bit_shift)
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
(*src(U64 *)++>>bit_shift|
*src(I64 *)<<(64-bit_shift))&
~leading_pixel_mask&color_mask;
else
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
*src(I64 *)++&~leading_pixel_mask&color_mask;
} else {
src(I64 *)++;
dst(I64 *)++;
}
}
if (bit_shift)
for (i=0;i<whole_I64s;i++)
if (win_z_num>=*wi
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\GrBitMap-Gr-Adam.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"Graphics\"\n\nOption(OPTf_WARN_HEADER_MISMATCH,OFF);\npublic Bool GrPlot0(CDC *dc=gr.dc,I64 x,I64 y)\n{//2D. No clipping or transformation or thick.\n U8 *dst;\n I32 *db;\n I64 d,dist;\n CColorROPU32 c,color=dc->color,bkcolor=dc->bkcolor;\n\n if (dc->flags & DCF_LOCATE_NEAREST) {\n dist=DistSqrI64(x,y,dc->cur_x,dc->cur_y);\n if (dist<=dc->nearest_dist)\n dc->nearest_dist=dist;\n }\n if (dc->flags & DCF_RECORD_EXTENTS) {\n if (x<dc->min_x) dc->min_x=x;\n if (x>dc->max_x) dc->max_x=x;\n if (y<dc->min_y) dc->min_y=y;\n if (y>dc->max_y) dc->max_y=y;\n }\n if (dc->flags & DCF_DONT_DRAW)\n return TRUE;\n d=dc->width_internal*y+x;\n if (db=dc->depth_buf) {\n db+=d;\n if (0<=dc->db_z<=*db)\n *db=dc->db_z;\n else\n return TRUE;\n }\n if (color.c1.rop&(ROPBF_DITHER|ROPBF_PROBABILITY_DITHER)) {\n if (color.c1.rop&ROPBF_PROBABILITY_DITHER) {\n if (RandU16<dc->dither_probability_u16) {\n color.c1.rop=color.c0.rop;\n color.c0=color.c1;\n }\n } else {\n if ((x^y)&1) {\n color.c1.rop=color.c0.rop;\n color.c0=color.c1;\n }\n }\n }\n dst=dc->body+d;\n switch [color.c0.rop] {\n case ROPB_EQU:\n case ROPB_MONO:\n *dst=color.c0.color;\n break;\n case ROPB_COLLISION:\n c=*dst;\n if (c!=TRANSPARENT && c!=bkcolor.c0.color)\n dc->collision_cnt++;\n break;\n case ROPB_XOR:\n *dst^=color.c0.color;\n break;\n }\n return TRUE;\n}\nOption(OPTf_WARN_HEADER_MISMATCH,ON);\n\npublic I64 GrPeek0(CDC *dc=gr.dc,I64 x,I64 y)\n{//2D. No clipping or transformation.\n return dc->body[dc->width_internal*y+x];\n}\n\n#help_index \"Graphics;Graphics/Device Contexts\"\n\npublic I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)\n{//2D. Clipping but not transformation..\n I64 i,j,k,k1,kk,kk1,w1,h1,w2,h2,dist,\n leading_pixels,leading_pixel_mask,whole_I64s,\n trailing_pixels,trailing_pixel_mask,\n reg bit_shift,win_z_buf_line_inc,win_z_buf_line_dec,win_z_num,\n color_mask;\n U8 reg *dst,*src;\n I32 *db;\n U16 reg *win_z_buf_ptr;\n CColorROPU32 color,c,old_color;\n CTask *win_task;\n\n if (dc->flags & DCF_SCRN_BITMAP) {\n win_task=dc->win_task;\n x+=win_task->scroll_x;\n y+=win_task->scroll_y;\n }\n if (x<0)\n w1=-x;\n else\n w1=0;\n if (y<0)\n h1=-y;\n else\n h1=0;\n w2=img->width;\n h2=img->height;\n if (dc->flags & DCF_SCRN_BITMAP) {\n x+=win_task->pix_left;\n y+=win_task->pix_top;\n }\n if (dc->flags & DCF_LOCATE_NEAREST) {\n dist=DistSqrI64(x+img->width>>1,y+img->height>>1,dc->cur_x,dc->cur_y);\n if (dist<=dc->nearest_dist)\n dc->nearest_dist=dist;\n }\n if (dc->flags & DCF_SCRN_BITMAP) {\n if (x+w1<0) w1=-x;\n if (x+w2>win_task->pix_right+1)\n w2=win_task->pix_right+1-x;\n\n if (y+h1<0) h1=-y;\n if (y+h2>win_task->pix_bottom+1)\n h2=win_task->pix_bottom+1-y;\n }\n if (x+w2>dc->width)\n w2=dc->width-x;\n if (y+h2>dc->height)\n h2=dc->height-y;\n if (w1<w2<=img->width && h1<h2<=img->height) {\n if (dc->flags & DCF_RECORD_EXTENTS) {\n if (x+w1<dc->min_x) dc->min_x=x+w1;\n if (x+w2-1>dc->max_x) dc->max_x=x+w2-1;\n if (y+h1<dc->min_y) dc->min_y=y+h1;\n if (y+h2-1>dc->max_y) dc->max_y=y+h2-1;\n }\n if (dc->flags & DCF_DONT_DRAW)\n return 1;\n old_color=dc->color;\n db=dc->depth_buf;\n dc->depth_buf=NULL;\n dc->color&=~ROPF_DITHER;\n color=dc->color;\n leading_pixels=-(w1+x)&7;\n leading_pixel_mask=gr.to_8_bits[0xFF>>leading_pixels];\n bit_shift=-x&7;\n whole_I64s=(w2-w1-leading_pixels)>>3;\n if (whole_I64s<0) whole_I64s=0;\n trailing_pixels=(x+w2)&7;\n trailing_pixel_mask=gr.to_8_bits[0xFF<<trailing_pixels&0xFF];\n if (leading_pixels+trailing_pixels>w2-w1) {\n leading_pixel_mask|=trailing_pixel_mask;\n trailing_pixels=0;\n }\n switch (color.c0.rop) {\n case ROPB_COLLISION: //TODO: Might want to check win_z_buf\n color =dc->bkcolor.c0.color;\n k=h1*img->width_internal;\n k1=(h1+y)*dc->width_internal+x;\n for (j=h2-h1;j;j--) {\n for (i=w1;i<w2;i++) {\n c=dc->body[k1+i];\n if (c!=TRANSPARENT&&c!=color&&img->body[k+i]!=TRANSPARENT)\n dc->collision_cnt++;\n }\n k+=img->width_internal;\n k1+=dc->width_internal;\n }\n break;\n case ROPB_MONO:\n color_mask=gr.to_8_colors[color.c0.color];\n if (img->flags&DCF_NO_TRANSPARENTS) {\n if (!(dc->flags & DCF_SCRN_BITMAP) || dc->flags&DCF_ON_TOP)\n win_z_buf_ptr=NULL;\n else {\n win_z_num=win_task->win_z_num;\n win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+\n (w1+x)/FONT_WIDTH)*sizeof(U16);\n win_z_buf_line_dec=whole_I64s;\n if (leading_pixels)\n win_z_buf_line_dec++;\n if (trailing_pixels)\n win_z_buf_line_dec++;\n win_z_buf_line_dec*=sizeof(U16);\n win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;\n }\n kk = h1 *img ->width_internal+w1;\n kk1=(h1+y)*dc->width_internal+x+w1;\n kk =(kk-bit_shift)&~7+bit_shift;\n bit_shift*=8;\n if (win_z_buf_ptr)\n for (j=h1;j<h2;j++) {\n src=img->body+kk&~7;\n dst=dc->body+kk1&~7;\n if (leading_pixels) {\n if (win_z_num>=*win_z_buf_ptr++) {\n if (bit_shift)\n *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|\n (*src(U64 *)++>>bit_shift|\n *src(I64 *)<<(64-bit_shift))&\n ~leading_pixel_mask&color_mask;\n else\n *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|\n *src(I64 *)++&~leading_pixel_mask&color_mask;\n } else {\n src(I64 *)++;\n dst(I64 *)++;\n }\n }\n if (bit_shift)\n for (i=0;i<whole_I64s;i++)\n if (win_z_num>=*wi"
}
]
}
|
// Source: D:\TempleOS-Projects\html\savour-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has words
U0 Song()
{
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.480;
music.stacatto_factor= 0.902;
try {
while (!ScanKey) {
Play("5qFCeE4A5E4A5qDeCE4qBA",
"This \0 \0 \0 \0 \0 \0sand\0wich \0is \0bland.\n\0 \0");
Play("5eCCqDeDDqE4eA5ECECE4qA",
"God \0 \0damn, \0my \0 \0tastes \0 \0 \0 \0"
"sure \0 \0are \0grand.\n\0");
Play("M6/8");
Play("5FE4BGsA5GeCqE",
"Ho \0hum. \0 \0 \0 \0How \0 \0rude!\n\0");
Play("5FE4BGsA5GeCqE",
"That \0bum \0 \0 \0 \0likes \0his \0food.\n\0");
Play("4GsA5GeDqGFE4B",
" \0 \0Likes \0his \0food!\n\0 \0 \0 \0");
Play("4GsAA5eEqD4G5sD4B5D4BeGG");
Play("4A5sED4qAeAsB5GE4B5E4BqG5sD4B5D4B");
Play("4eGGA5sED4qAeAsB5GE4B5E4B");
}
} catch
PutExcept;
Snd;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\savour-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has words\nU0 Song()\n{\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 2.480;\n music.stacatto_factor= 0.902;\n try {\n while (!ScanKey) {\n Play(\"5qFCeE4A5E4A5qDeCE4qBA\",\n \"This \\0 \\0 \\0 \\0 \\0 \\0sand\\0wich \\0is \\0bland.\\n\\0 \\0\");\n Play(\"5eCCqDeDDqE4eA5ECECE4qA\",\n \"God \\0 \\0damn, \\0my \\0 \\0tastes \\0 \\0 \\0 \\0\"\n \"sure \\0 \\0are \\0grand.\\n\\0\");\n Play(\"M6/8\");\n Play(\"5FE4BGsA5GeCqE\",\n \"Ho \\0hum. \\0 \\0 \\0 \\0How \\0 \\0rude!\\n\\0\");\n Play(\"5FE4BGsA5GeCqE\",\n \"That \\0bum \\0 \\0 \\0 \\0likes \\0his \\0food.\\n\\0\");\n Play(\"4GsA5GeDqGFE4B\",\n \" \\0 \\0Likes \\0his \\0food!\\n\\0 \\0 \\0 \\0\");\n Play(\"4GsAA5eEqD4G5sD4B5D4BeGG\");\n Play(\"4A5sED4qAeAsB5GE4B5E4BqG5sD4B5D4B\");\n Play(\"4eGGA5sED4qAeAsB5GE4B5E4B\");\n }\n } catch\n PutExcept;\n Snd;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\PreProcessor-Doc.html
// Date: unknown-date
// Language: HolyC
PreProcessor
There is no separate preprocessor pass. The parser front-end calls Lex() which
has the preprocessor built-in. The compiler looks ahead a token, most of the
time, so you might throw an extra semicolon after a directive if it's not taking
affect right away.
Put an extra semicolon #exe {Cd("DirName");;} in case a #include follows.
#include "" There is no angle bracket <> form of this directive.
#exe {} Will execute code at compile-time and can be used to insert code
into the stream being compiled using StreamPrint().
#define Define string const
#assert Print a warning during compilation if an expression is not true.
#if Include code if an expresion is true.
#else
#endif
#ifdef,#ifndef Include code if a sym is defined.
#ifaot,#ifjit Include code if in AOT compiler mode.
defined() Is a function that can be used in expressions.
#help_index, #help_file See Help System.
See PreProcessor.
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\PreProcessor-Doc.html\n// Date: unknown-date\n// Language: HolyC\n\nPreProcessor\n\nThere is no separate preprocessor pass. The parser front-end calls Lex() which \nhas the preprocessor built-in. The compiler looks ahead a token, most of the \ntime, so you might throw an extra semicolon after a directive if it's not taking \naffect right away.\n\nPut an extra semicolon #exe {Cd(\"DirName\");;} in case a #include follows.\n\n#include \"\" There is no angle bracket <> form of this directive.\n#exe {} Will execute code at compile-time and can be used to insert code \ninto the stream being compiled using StreamPrint().\n#define Define string const\n#assert Print a warning during compilation if an expression is not true. \n#if Include code if an expresion is true.\n#else\n#endif\n#ifdef,#ifndef Include code if a sym is defined.\n#ifaot,#ifjit Include code if in AOT compiler mode.\ndefined() Is a function that can be used in expressions.\n#help_index, #help_file See Help System.\n\nSee PreProcessor."
}
]
}
|
// Source: D:\TempleOS-Projects\html\Web.1-Home.html
// Date: unknown-date
// Language: HolyC
The Temple Operating System
Why did they make Solomon's Temple? It was a direction to look, to focus on, a
special place for meditation, to do offerings, a community center, a home to
God's beauty, that encouraged love of God. People cherished God's temple,
beautifying it with gold and all fine things to show love of God, as great
cathedrals were decorated with astounding, awe-striking intricate art and
gargoyles, incredible devotion to God with hours of effort, toiling and
slaving-away for the glory of God, for families with children to see
stained-glass windows and tomes with ridiculously elaborate calligraphy to show
love of God, from a people who did little else but show love toward God, lived
in dire conditions by today's standards, yet with so much difficulty
scraping-by, found the time to devote even all free-time to God!
1 Kings 6:21 (King James)
6:21 So Solomon overlaid the house within with pure gold: and he made
a partition by the chains of gold before the oracle; and he overlaid
it with gold.
6:22 And the whole house he overlaid with gold, until he had finished
all the house: also the whole altar that was by the oracle he overlaid
with gold.
6:23 And within the oracle he made two cherubims of olive tree, each
ten cubits high.
Operating System
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Web.1-Home.html\n// Date: unknown-date\n// Language: HolyC\n\nThe Temple Operating System\n\nWhy did they make Solomon's Temple? It was a direction to look, to focus on, a \nspecial place for meditation, to do offerings, a community center, a home to \nGod's beauty, that encouraged love of God. People cherished God's temple, \nbeautifying it with gold and all fine things to show love of God, as great \ncathedrals were decorated with astounding, awe-striking intricate art and \ngargoyles, incredible devotion to God with hours of effort, toiling and \nslaving-away for the glory of God, for families with children to see \nstained-glass windows and tomes with ridiculously elaborate calligraphy to show \nlove of God, from a people who did little else but show love toward God, lived \nin dire conditions by today's standards, yet with so much difficulty \nscraping-by, found the time to devote even all free-time to God!\n\n\n1 Kings 6:21 (King James)\n\n 6:21 So Solomon overlaid the house within with pure gold: and he made\n a partition by the chains of gold before the oracle; and he overlaid\n it with gold.\n \n 6:22 And the whole house he overlaid with gold, until he had finished\n all the house: also the whole altar that was by the oracle he overlaid\n with gold.\n \n 6:23 And within the oracle he made two cherubims of olive tree, each\n ten cubits high.\n\n\nOperating System"
}
]
}
|
// Source: D:\TempleOS-Projects\html\Run-Vocabulary-Apps.html
// Date: unknown-date
// Language: HolyC
Cd(__DIR__);;
#include "Load"
VocabQuiz;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Run-Vocabulary-Apps.html\n// Date: unknown-date\n// Language: HolyC\n\nCd(__DIR__);;\n#include \"Load\"\nVocabQuiz;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\PsalmodyCtrls-Psalmody-Apps.html
// Date: unknown-date
// Language: HolyC
#define TEMPO_SPACING 15
#define TEMPO_RANGE 80
#define TEMPO_BORDER 2
class TempoState
{
I64 tempo,stacatto;
} tempo_state;
U0 DrawTempoCtrl(CDC *dc,CCtrl *c)
{
TempoState *s=c->state;
dc->color=LTGREEN;
GrRect(dc, c->left,c->top,TEMPO_SPACING*3+2,TEMPO_SPACING*2+TEMPO_RANGE);
dc->color=BLACK;
GrRect(dc, c->left+TEMPO_BORDER,c->top+TEMPO_BORDER,
TEMPO_SPACING*3+2-2*TEMPO_BORDER,
TEMPO_SPACING*2+TEMPO_RANGE-2*TEMPO_BORDER);
dc->color=WHITE;
GrLine(dc,c->left+TEMPO_SPACING,c->top+TEMPO_SPACING,
c->left+TEMPO_SPACING,c->top+TEMPO_SPACING+TEMPO_RANGE-1);
GrLine(dc,c->left+2*TEMPO_SPACING+1,c->top+TEMPO_SPACING,
c->left+2*TEMPO_SPACING+1,c->top+TEMPO_SPACING+TEMPO_RANGE-1);
dc->color=LTGREEN;
GrPrint(dc,c->left+TEMPO_SPACING-FONT_WIDTH/2,
c->top+TEMPO_SPACING+TEMPO_RANGE+3,"%d",s->tempo*10/TEMPO_RANGE);
GrPrint(dc,c->left+2*TEMPO_SPACING+1-FONT_WIDTH/2,
c->top+TEMPO_SPACING+TEMPO_RANGE+3,"%d",
s->stacatto*10/TEMPO_RANGE);
GrRect(dc,c->left+TEMPO_SPACING-3,
c->top+TEMPO_SPACING+TEMPO_RANGE-1-s->tempo-2 ,7,5);
GrRect(dc,c->left+2*TEMPO_SPACING+1-3,
c->top+TEMPO_SPACING+TEMPO_RANGE-1-s->stacatto-2,7,5);
dc->color=YELLOW;
GrRect(dc,c->left+TEMPO_SPACING-2,
c->top+TEMPO_SPACING+TEMPO_RANGE-1-s->tempo-1 ,5,3);
GrRect(dc,c->left+2*TEMPO_SPACING+1-2,
c->top+TEMPO_SPACING+TEMPO_RANGE-1-s->stacatto-1,5,3);
dc->color=GREEN;
GrVPrint(dc,c->left+TEMPO_BORDER+2,c->top+TEMPO_SPACING+2,"Tempo");
GrVPrint(dc,c->right-TEMPO_BORDER-2-FONT_WIDTH,
c->top+TEMPO_SPACING+2,"Stacatto");
}
U0 UpdateDerivedTempoCtrl(CCtrl *c)
{
TempoState *s=c->state;
c->right=c->left+TEMPO_SPACING*3+2;
c->bottom=c->top+TEMPO_SPACING*2+TEMPO_RANGE;
s->tempo =ClampI64(s->tempo,0,TEMPO_RANGE-1);
s->stacatto=ClampI64(s->stacatto,0,TEMPO_RANGE-1);
}
U0 LeftClickTempo(CCtrl *c,I64 x,I64 y,Bool)
{
TempoState *s=c->state;
if (x<(c->right+c->left)/2)
s->tempo=TEMPO_RANGE-1-(y-(c->top+TEMPO_SPACING));
else
s->stacatto=TEMPO_RANGE-1-(y-(c->top+TEMPO_SPACING));
if (c->update_derived_vals)
(*c->update_derived_vals)(c);
}
CCtrl *TempoNew()
{
CCtrl *c=CAlloc(sizeof(CCtrl));
c->win_task=Fs;
c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_MS;
c->type=CTRLT_GENERIC;
c->state=&tempo_state;
c->draw_it=&DrawTempoCtrl;
c->left_click=&LeftClickTempo;
c->update_derived_vals=&UpdateDerivedTempoCtrl;
c->left=396;
c->top=96;
QueIns(c,Fs->last_ctrl);
TaskDerivedValsUpdate;
return c;
}
U0 TempoDel(CCtrl *c)
{
QueRem(c);
Free(c);
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\PsalmodyCtrls-Psalmody-Apps.html\n// Date: unknown-date\n// Language: HolyC\n\n#define TEMPO_SPACING 15\n#define TEMPO_RANGE 80\n#define TEMPO_BORDER 2\n\nclass TempoState\n{\n I64 tempo,stacatto;\n} tempo_state;\n\nU0 DrawTempoCtrl(CDC *dc,CCtrl *c)\n{\n TempoState *s=c->state;\n\n dc->color=LTGREEN;\n GrRect(dc, c->left,c->top,TEMPO_SPACING*3+2,TEMPO_SPACING*2+TEMPO_RANGE);\n dc->color=BLACK;\n GrRect(dc, c->left+TEMPO_BORDER,c->top+TEMPO_BORDER,\n TEMPO_SPACING*3+2-2*TEMPO_BORDER,\n TEMPO_SPACING*2+TEMPO_RANGE-2*TEMPO_BORDER);\n dc->color=WHITE;\n GrLine(dc,c->left+TEMPO_SPACING,c->top+TEMPO_SPACING,\n c->left+TEMPO_SPACING,c->top+TEMPO_SPACING+TEMPO_RANGE-1);\n GrLine(dc,c->left+2*TEMPO_SPACING+1,c->top+TEMPO_SPACING,\n c->left+2*TEMPO_SPACING+1,c->top+TEMPO_SPACING+TEMPO_RANGE-1);\n\n dc->color=LTGREEN;\n GrPrint(dc,c->left+TEMPO_SPACING-FONT_WIDTH/2,\n c->top+TEMPO_SPACING+TEMPO_RANGE+3,\"%d\",s->tempo*10/TEMPO_RANGE);\n GrPrint(dc,c->left+2*TEMPO_SPACING+1-FONT_WIDTH/2,\n c->top+TEMPO_SPACING+TEMPO_RANGE+3,\"%d\",\n s->stacatto*10/TEMPO_RANGE);\n GrRect(dc,c->left+TEMPO_SPACING-3,\n c->top+TEMPO_SPACING+TEMPO_RANGE-1-s->tempo-2 ,7,5);\n GrRect(dc,c->left+2*TEMPO_SPACING+1-3,\n c->top+TEMPO_SPACING+TEMPO_RANGE-1-s->stacatto-2,7,5);\n dc->color=YELLOW;\n GrRect(dc,c->left+TEMPO_SPACING-2,\n c->top+TEMPO_SPACING+TEMPO_RANGE-1-s->tempo-1 ,5,3);\n GrRect(dc,c->left+2*TEMPO_SPACING+1-2,\n c->top+TEMPO_SPACING+TEMPO_RANGE-1-s->stacatto-1,5,3);\n\n dc->color=GREEN;\n GrVPrint(dc,c->left+TEMPO_BORDER+2,c->top+TEMPO_SPACING+2,\"Tempo\");\n GrVPrint(dc,c->right-TEMPO_BORDER-2-FONT_WIDTH,\n c->top+TEMPO_SPACING+2,\"Stacatto\");\n}\n\nU0 UpdateDerivedTempoCtrl(CCtrl *c)\n{\n TempoState *s=c->state;\n c->right=c->left+TEMPO_SPACING*3+2;\n c->bottom=c->top+TEMPO_SPACING*2+TEMPO_RANGE;\n s->tempo =ClampI64(s->tempo,0,TEMPO_RANGE-1);\n s->stacatto=ClampI64(s->stacatto,0,TEMPO_RANGE-1);\n}\n\nU0 LeftClickTempo(CCtrl *c,I64 x,I64 y,Bool)\n{\n TempoState *s=c->state;\n if (x<(c->right+c->left)/2)\n s->tempo=TEMPO_RANGE-1-(y-(c->top+TEMPO_SPACING));\n else\n s->stacatto=TEMPO_RANGE-1-(y-(c->top+TEMPO_SPACING));\n if (c->update_derived_vals)\n (*c->update_derived_vals)(c);\n}\n\nCCtrl *TempoNew()\n{\n CCtrl *c=CAlloc(sizeof(CCtrl));\n c->win_task=Fs;\n c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_MS;\n c->type=CTRLT_GENERIC;\n c->state=&tempo_state;\n c->draw_it=&DrawTempoCtrl;\n c->left_click=&LeftClickTempo;\n c->update_derived_vals=&UpdateDerivedTempoCtrl;\n c->left=396;\n c->top=96;\n QueIns(c,Fs->last_ctrl);\n TaskDerivedValsUpdate;\n return c;\n}\n\nU0 TempoDel(CCtrl *c)\n{\n QueRem(c);\n Free(c);\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\MPRadix-MultiCore-Demo.html
// Date: unknown-date
// Language: HolyC
/*
On an 8-core machine, this takes the top 3-bits
of random numbers and distributes them to the 8 cores
for sorting. Then, it merge sorts them.
*/
#define NUM 1000000
I64 my_mp_cnt=1<<Bsr(mp_cnt);//Power of 2
I32 *arg1,*arg2;
I32 *b[my_mp_cnt],bn[my_mp_cnt];
I64 mp_not_done_flags;
I64 Compare(I32 *e1,I32 *e2)
{
return *e1-*e2;
}
U0 QSortU32(I32 *base,I64 num)
{//By customizing, we dramatically improve it!
//Cut and paste from QSortI64().
I64 i;
I32 *less,*greater,pivot;
if (num>1) {
do {
less=base;
greater=base+num;
pivot=base[num/2];
while (less<greater) {
if (*less<=pivot)
less++;
else {
greater--;
SwapU32(less,greater);
}
}
i=less-base;
if (i==num) {//All less or equ to pivot
//Point greater to first less
do greater--;
while (--i && *greater==pivot);
if (i) {
less=base+num/2; //Pivot was not moved, point to it
if (less<greater)
SwapU32(less,greater);
num=i;
} else //All equ
break;
} else if (i<num/2) {
QSortU32(base,i);
num-=i;
base=greater;
} else {
QSortU32(greater,num-i);
num=i;
}
} while (num>1);
}
}
U0 MPSort(I64 dummy=0)
{
no_warn dummy;
QSortU32(b[Gs->num],bn[Gs->num]);
LBtr(&mp_not_done_flags,Gs->num);
}
U0 MPRadixSortDemo(I64 dummy=0)
{
no_warn dummy;
I64 i,j,k1,k2;
F64 t0;
arg1=MAlloc(NUM*sizeof(I32));
for (i=0;i<NUM;i++)
arg1[i]=RandI32;
arg2=MAlloc(NUM*sizeof(I32));
"$GREEN$QSort$FG$\n";
t0=tS;
MemCpy(arg2,arg1,sizeof(I32)*NUM);
QSort(arg2,NUM,sizeof(I32),&Compare);
"Time:%9.6f\n",tS-t0;
D(arg2+NUM/4);
"$GREEN$QSortU32$FG$\n";
t0=tS;
MemCpy(arg2,arg1,sizeof(I32)*NUM);
QSortU32(arg2,NUM);
"Time:%9.6f\n",tS-t0;
D(arg2+NUM/4);
for (i=0;i<my_mp_cnt;i++) {
//We must do full size, just in case.
//There will be uneven split between cores
//depending on the distribution of rand numbers.
b[i]=MAlloc(NUM*sizeof(I32));
bn[i]=0;
}
if (my_mp_cnt<2) throw('MultCore');
"$GREEN$MP Radix QSortU32$FG$\n";
t0=tS;
k1=32-Bsr(my_mp_cnt);
k2=my_mp_cnt/2;
for (i=0;i<NUM;i++) {
j=arg1[i]>>k1+k2; //This is a preliminary radix sort.
b[j][bn[j]++]=arg1[i];
}
mp_not_done_flags=1<<my_mp_cnt-1;
for (i=0;i<my_mp_cnt;i++)
Spawn(&MPSort,NULL,NULL,i);
while (mp_not_done_flags)
Yield;
j=0;
for (i=0;i<my_mp_cnt;i++) {
MemCpy(&arg2[j],b[i],bn[i]*sizeof(I32));
j+=bn[i];
}
"Time:%9.6f\n",tS-t0;
D(arg2+NUM/4);
Free(arg1);
Free(arg2);
for (i=0;i<my_mp_cnt;i++)
Free(b[i]);
}
MPRadixSortDemo;
/* Results on 8 Cores 3.397GHz Core i7:
QSort
Time: 0.759998
QSortU32
Time: 0.093684
MP Radix QSortU32
Time: 0.045450
*/
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\MPRadix-MultiCore-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\n/*\nOn an 8-core machine, this takes the top 3-bits\nof random numbers and distributes them to the 8 cores\nfor sorting. Then, it merge sorts them.\n*/\n\n#define NUM 1000000\n\nI64 my_mp_cnt=1<<Bsr(mp_cnt);//Power of 2\n\nI32 *arg1,*arg2;\nI32 *b[my_mp_cnt],bn[my_mp_cnt];\nI64 mp_not_done_flags;\n\nI64 Compare(I32 *e1,I32 *e2)\n{\n return *e1-*e2;\n}\n\nU0 QSortU32(I32 *base,I64 num)\n{//By customizing, we dramatically improve it!\n//Cut and paste from QSortI64().\n I64 i;\n I32 *less,*greater,pivot;\n if (num>1) {\n do {\n less=base;\n greater=base+num;\n pivot=base[num/2];\n while (less<greater) {\n if (*less<=pivot)\n less++;\n else {\n greater--;\n SwapU32(less,greater);\n }\n }\n i=less-base;\n if (i==num) {//All less or equ to pivot\n\n //Point greater to first less\n do greater--;\n while (--i && *greater==pivot);\n\n if (i) {\n less=base+num/2; //Pivot was not moved, point to it\n if (less<greater)\n SwapU32(less,greater);\n num=i;\n } else //All equ\n break;\n } else if (i<num/2) {\n QSortU32(base,i);\n num-=i;\n base=greater;\n } else {\n QSortU32(greater,num-i);\n num=i;\n }\n } while (num>1);\n }\n}\n\nU0 MPSort(I64 dummy=0)\n{\n no_warn dummy;\n QSortU32(b[Gs->num],bn[Gs->num]);\n LBtr(&mp_not_done_flags,Gs->num);\n}\n\nU0 MPRadixSortDemo(I64 dummy=0)\n{\n no_warn dummy;\n I64 i,j,k1,k2;\n F64 t0;\n arg1=MAlloc(NUM*sizeof(I32));\n for (i=0;i<NUM;i++)\n arg1[i]=RandI32;\n\n arg2=MAlloc(NUM*sizeof(I32));\n\n \"$GREEN$QSort$FG$\\n\";\n t0=tS;\n MemCpy(arg2,arg1,sizeof(I32)*NUM);\n QSort(arg2,NUM,sizeof(I32),&Compare);\n \"Time:%9.6f\\n\",tS-t0;\n D(arg2+NUM/4);\n\n \"$GREEN$QSortU32$FG$\\n\";\n t0=tS;\n MemCpy(arg2,arg1,sizeof(I32)*NUM);\n QSortU32(arg2,NUM);\n \"Time:%9.6f\\n\",tS-t0;\n D(arg2+NUM/4);\n\n for (i=0;i<my_mp_cnt;i++) {\n//We must do full size, just in case.\n //There will be uneven split between cores\n //depending on the distribution of rand numbers.\n b[i]=MAlloc(NUM*sizeof(I32));\n bn[i]=0;\n }\n\n if (my_mp_cnt<2) throw('MultCore');\n\n \"$GREEN$MP Radix QSortU32$FG$\\n\";\n t0=tS;\n k1=32-Bsr(my_mp_cnt);\n k2=my_mp_cnt/2;\n for (i=0;i<NUM;i++) {\n j=arg1[i]>>k1+k2; //This is a preliminary radix sort.\n b[j][bn[j]++]=arg1[i];\n }\n mp_not_done_flags=1<<my_mp_cnt-1;\n for (i=0;i<my_mp_cnt;i++)\n Spawn(&MPSort,NULL,NULL,i);\n while (mp_not_done_flags)\n Yield;\n j=0;\n for (i=0;i<my_mp_cnt;i++) {\n MemCpy(&arg2[j],b[i],bn[i]*sizeof(I32));\n j+=bn[i];\n }\n \"Time:%9.6f\\n\",tS-t0;\n D(arg2+NUM/4);\n\n Free(arg1);\n Free(arg2);\n for (i=0;i<my_mp_cnt;i++)\n Free(b[i]);\n}\n\nMPRadixSortDemo;\n\n/* Results on 8 Cores 3.397GHz Core i7:\nQSort\nTime: 0.759998\nQSortU32\nTime: 0.093684\nMP Radix QSortU32\nTime: 0.045450\n*/"
}
]
}
|
// Source: D:\TempleOS-Projects\html\TTFLib-ToTheFront-Apps.html
// Date: unknown-date
// Language: HolyC
U0 Toward(I64 *_row,I64 *_col,I64 direction)
{
switch (direction) {
case 0:
*_row-=2;
break;
case 1:
if (*_row&1) *_col+=1;
*_row-=1;
break;
case 2:
if (*_row&1) *_col+=1;
*_row+=1;
break;
case 3:
*_row+=2;
break;
case 4:
if (!(*_row&1)) *_col-=1;
*_row+=1;
break;
case 5:
if (!(*_row&1)) *_col-=1;
*_row-=1;
break;
}
}
I64 FacingChg(I64 f1,I64 f2)
{
I64 res=(f1+6-f2)%6;
if (res>=3)
return 6-res;
else
return res;
}
U0 RowCol2XY(F64 *_x,F64 *_y,I64 row,I64 col)
{
Pt *c;
row=ClampI64(row,0,map_rows);
col=ClampI64(col,0,map_cols);
c=&hex_centers[row][col];
*_x=c->x;
*_y=c->y;
}
U0 XY2RowCol(I64 *_row,I64 *_col,F64 x,F64 y)
{
*_col=(x-DCOS/2)/(HEX_SIDE+DCOS);
if (*_col&1)
*_row=ToI64((y-DSIN)/(2*DSIN))*2+1;
else
*_row=ToI64(y/(2*DSIN))*2;
*_col>>=1;
*_row=ClampI64(*_row,0,map_rows-1);
*_col=ClampI64(*_col,0,map_cols-1);
}
Unit *UnitFind(I64 row,I64 col)
{//Finds unit in a hexagon.
I64 i,j;
for (j=0;j<2;j++)
for (i=0;i<UNITS_NUM;i++)
if (units[j][i].life>0 &&
units[j][i].row==row &&
units[j][i].col==col)
return &units[j][i];
return NULL;
}
Bool CursorInWin(CTask *task,I64 x,I64 y)
{
if (0<=x+task->scroll_x<task->pix_width &&
0<=y+task->scroll_y<task->pix_height)
return TRUE;
else
return FALSE;
}
U0 CursorUpdate(CTask *task,I64 x,I64 y)
{
if (CursorInWin(task,x,y))
XY2RowCol(&cursor_row,&cursor_col,x,y);
}
class LOSCtrl
{
I64 r1,c1,r2,c2,distance;
};
Bool LOSPlot(LOSCtrl *l,I64 x,I64 y,I64 z)
{//We got tricky and used z as the distance from the start of the line.
I64 row,col;
XY2RowCol(&row,&col,x,y);
if ((row!=l->r1 || col!=l->c1) &&
(row!=l->r2 || col!=l->c2) &&
terrain[row][col]!=PLAINS) {
if (terrain[l->r1][l->c1]==MOUNTAINS) {
if (terrain[row][col]==MOUNTAINS || z>l->distance>>1)
return FALSE;
} else if (terrain[l->r2][l->c2]==MOUNTAINS) {
if (terrain[row][col]==MOUNTAINS || z<=l->distance>>1)
return FALSE;
} else
return FALSE;
}
return TRUE;
}
Bool LOS(I64 r1,I64 c1,I64 r2,I64 c2)
{
F64 x1,y1,x2,y2;
LOSCtrl l;
RowCol2XY(&x1,&y1,r1,c1);
RowCol2XY(&x2,&y2,r2,c2);
l.r1=r1; l.c1=c1;
l.r2=r2; l.c2=c2;
l.distance=Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2));
return Line(&l,x1,y1,0,x2,y2,l.distance,&LOSPlot);
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\TTFLib-ToTheFront-Apps.html\n// Date: unknown-date\n// Language: HolyC\n\nU0 Toward(I64 *_row,I64 *_col,I64 direction)\n{\n switch (direction) {\n case 0:\n *_row-=2;\n break;\n case 1:\n if (*_row&1) *_col+=1;\n *_row-=1;\n break;\n case 2:\n if (*_row&1) *_col+=1;\n *_row+=1;\n break;\n case 3:\n *_row+=2;\n break;\n case 4:\n if (!(*_row&1)) *_col-=1;\n *_row+=1;\n break;\n case 5:\n if (!(*_row&1)) *_col-=1;\n *_row-=1;\n break;\n }\n}\n\nI64 FacingChg(I64 f1,I64 f2)\n{\n I64 res=(f1+6-f2)%6;\n if (res>=3)\n return 6-res;\n else\n return res;\n}\n\nU0 RowCol2XY(F64 *_x,F64 *_y,I64 row,I64 col)\n{\n Pt *c;\n row=ClampI64(row,0,map_rows);\n col=ClampI64(col,0,map_cols);\n c=&hex_centers[row][col];\n *_x=c->x;\n *_y=c->y;\n}\n\nU0 XY2RowCol(I64 *_row,I64 *_col,F64 x,F64 y)\n{\n *_col=(x-DCOS/2)/(HEX_SIDE+DCOS);\n if (*_col&1)\n *_row=ToI64((y-DSIN)/(2*DSIN))*2+1;\n else\n *_row=ToI64(y/(2*DSIN))*2;\n *_col>>=1;\n *_row=ClampI64(*_row,0,map_rows-1);\n *_col=ClampI64(*_col,0,map_cols-1);\n}\n\nUnit *UnitFind(I64 row,I64 col)\n{//Finds unit in a hexagon.\n I64 i,j;\n for (j=0;j<2;j++)\n for (i=0;i<UNITS_NUM;i++)\n if (units[j][i].life>0 &&\n units[j][i].row==row &&\n units[j][i].col==col)\n return &units[j][i];\n return NULL;\n}\n\nBool CursorInWin(CTask *task,I64 x,I64 y)\n{\n if (0<=x+task->scroll_x<task->pix_width &&\n 0<=y+task->scroll_y<task->pix_height)\n return TRUE;\n else\n return FALSE;\n}\n\nU0 CursorUpdate(CTask *task,I64 x,I64 y)\n{\n if (CursorInWin(task,x,y))\n XY2RowCol(&cursor_row,&cursor_col,x,y);\n}\n\nclass LOSCtrl\n{\n I64 r1,c1,r2,c2,distance;\n};\n\nBool LOSPlot(LOSCtrl *l,I64 x,I64 y,I64 z)\n{//We got tricky and used z as the distance from the start of the line.\n I64 row,col;\n XY2RowCol(&row,&col,x,y);\n if ((row!=l->r1 || col!=l->c1) &&\n (row!=l->r2 || col!=l->c2) &&\n terrain[row][col]!=PLAINS) {\n if (terrain[l->r1][l->c1]==MOUNTAINS) {\n if (terrain[row][col]==MOUNTAINS || z>l->distance>>1)\n return FALSE;\n } else if (terrain[l->r2][l->c2]==MOUNTAINS) {\n if (terrain[row][col]==MOUNTAINS || z<=l->distance>>1)\n return FALSE;\n } else\n return FALSE;\n }\n return TRUE;\n}\n\nBool LOS(I64 r1,I64 c1,I64 r2,I64 c2)\n{\n F64 x1,y1,x2,y2;\n LOSCtrl l;\n RowCol2XY(&x1,&y1,r1,c1);\n RowCol2XY(&x2,&y2,r2,c2);\n l.r1=r1; l.c1=c1;\n l.r2=r2; l.c2=c2;\n l.distance=Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2));\n return Line(&l,x1,y1,0,x2,y2,l.distance,&LOSPlot);\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\KHashB-Kernel.html
// Date: unknown-date
// Language: HolyC
I64 HashTypeNum(CHash *tmph)
{//Return bit num of hash type, limited to just types.
if (tmph)
return Bsf(tmph->type&HTG_TYPE_MASK);
else
return -1;
}
I64 HashVal(CHash *tmph)
{//Returns most likely desired value.
switch [HashTypeNum(tmph)] {
case HTt_EXPORT_SYS_SYM:
return tmph(CHashExport *)->val;
case HTt_IMPORT_SYS_SYM:
return tmph(CHashImport *)->module_base;
case HTt_DEFINE_STR:
case HTt_CLASS:
case HTt_INTERNAL_TYPE:
case HTt_WORD:
case HTt_DICT_WORD:
case HTt_OPCODE:
case HTt_HELP_FILE:
return tmph;
case HTt_GLBL_VAR:
if (tmph(CHashGlblVar *)->flags&GVF_EXTERN)
return &tmph(CHashGlblVar *)->data_addr;
else
return tmph(CHashGlblVar *)->data_addr;
case HTt_FUN:
if (Bt(&tmph(CHashFun *)->flags,Cf_EXTERN))
return tmph;
else
return tmph(CHashFun *)->exe_addr;
case HTt_REG:
return tmph(CHashReg *)->reg_num|tmph(CHashReg *)->reg_type<<8;
case HTt_KEYWORD:
case HTt_ASM_KEYWORD:
case HTt_MODULE:
case HTt_FILE:
case HTt_FRAME_PTR:
return tmph(CHashGeneric *)->user_data0;
case -1: //nobound switch
case HTt_TYPES_NUM: //nobound switch
default:
return 0;
}
}
CHashTable *HashTableNew(I64 size,CTask *mem_task=NULL)
{//New hash table, power-of-two in size.
CHashTable *table;
table=CAlloc(sizeof(CHashTable),mem_task);
table->body=CAlloc(size<<3,mem_task);
table->mask=size-1;
return table;
}
U0 HashDel(CHashSrcSym *tmph)
{//Free a std TempleOS system hash entry.
if (!tmph) return;
if (!(tmph->type&HTT_DICT_WORD))
Free(tmph->str);
if (tmph->type & HTG_SRC_SYM) {
Free(tmph->src_link);
Free(tmph->idx);
Free(tmph->import_name);
LinkedLstDel(tmph->ie_lst);
if (tmph->type & (HTT_FUN | HTT_EXPORT_SYS_SYM))
Free(tmph->dbg_info);
if (tmph->type & (HTT_FUN | HTT_CLASS))
//Assumes code not on heap, so doesn't Free.
//ClassMemberLstDel() is an import to the Kernel module
ClassMemberLstDel(tmph);
else if (tmph->type&HTT_DEFINE_STR)
Free(tmph(CHashDefineStr *)->data);
else if (tmph->type & HTT_GLBL_VAR) {
if (!(tmph(CHashGlblVar *)->flags&GVF_ALIAS))
Free(tmph(CHashGlblVar *)->data_addr);
LinkedLstDel(tmph(CHashGlblVar *)->dim.next);
if (tmph(CHashGlblVar *)->fun_ptr)
HashDel(tmph(CHashGlblVar *)->fun_ptr
-tmph(CHashGlblVar *)->fun_ptr->ptr_stars_cnt);
}
} else if (tmph->type & HTT_FILE)
Free(tmph(CHashGeneric *)->user_data0);
Free(tmph);
}
U0 HashTableDel(CHashTable *table)
{//Free std system hash table, calling HashDel() on entries.
I64 i;
CHashSrcSym *tmph,*tmph1;
if (!table) return;
for (i=0;i<=table->mask;i++) {
tmph=table->body[i];
while (tmph) {
tmph1=tmph->next;
HashDel(tmph);
tmph=tmph1;
}
}
Free(table->body);
Free(table);
}
I64 HashTablePurge(CHashTable *table)
{//Eliminate ExportSysSyms that have been usurped.
I64 i,res=0;
CHashSrcSym *tmph,*tmph1,*tmph2;
if (!table) return 0;
PUSHFD
CLI //Precaution
for (i=0;i<=table->mask;i++) {
tmph=table->body[i];
while (tmph) {
tmph1=tmph->next; //We delete only older ones
if (tmph->type&(HTT_FUN|HTT_GLBL_VAR)) {
tmph2=tmph->next; //Older always later in chain
while (tmph2) {
if ((tmph2->type&HTT_EXPORT_SYS_SYM ||
tmph2->type&HTG_TYPE_MASK==HTT_INVALID) &&
!StrCmp(tmph2->str,tmph->str)) {
if (tmph2->type&HTG_TYPE_MASK==HTT_INVALID)
tmph2->type=HTT_KEYWORD;//Won't delete HTT_INVALID
HashRemDel(tmph2,table);
res++;
break;
}
tmph2=tmph2->next;
}
}
tmph=tmph1;
}
}
POPFD
return res;
}
CHashGeneric *HashGenericAdd(U8 *name,I64 type,
I64 u0=0,I64 u1=0,I64 u2=0,CTask *task=NULL)
{//Add any type to task hash_table, 3 user_data values.
if (!task) task=Fs;
CHashGeneric *res=CAlloc(sizeof(CHashGeneric),task);
res->type=type;
res->user_data0=u0;
res->user_data1=u1;
res->user_data2=u2;
res->str=StrNew(name,task);
HashAdd(res,task->hash_table);
return res;
}
U0 HashSrcFileSet(CCmpCtrl *cc,CHashSrcSym *h,I64 line_num_offset=0)
{//Set CHashSrcSym link and help_index by cur cc pos.
CLexFile *tmpf=cc->lex_include_stk;
I64 line_num=tmpf->line_num+line_num_offset;
if (line_num<1) line_num=1;
Free(h->src_link);
h->src_link=MStrPrint("FL:%s,%d",tmpf->full_name,line_num);
if (Bt(&cc->opts,OPTf_KEEP_PRIVATE))
h->type|=HTF_PRIVATE;
Free(h->idx);
if (cc->cur_help_idx && *cc->cur_help_idx)
h->idx=StrNew(cc->cur_help_idx);
else
h->idx=NULL;
}
CHashGeneric *HashPublic(U8 *st,I64 mask,Bool val=TRUE)
{//Mark a hash entry as public and HashSrcFileSet().
CHashGeneric *res;
if (res=HashFind(st,Fs->hash_table,mask)) {
if (val)
res->type|=HTF_PUBLIC;
else
res->type&=~HTF_PUBLIC;
if (res->type&HTG_SRC_SYM)
HashSrcFileSet(Fs->last_cc,res);
return res;
} else
return NULL;
}
I64 HashLstAdd(U8 *lst,I64 type,CHashTable *table)
{//Add a list to a hash table.
I64 i=0;
CHashGeneric *tmph;
if (lst) {
while (*lst) {
if (*lst=='@')
lst++;
else
i++;
tmph=CAlloc(sizeof(CHashGeneric));
tmph->user_data0=i-1;
tmph->str=StrNew(lst);
tmph->type=type;
HashAdd(tmph,table);
while (*lst++);
}
}
return i;
}
I64 HashDefineLstAdd(U8 *dname,I64 type,CHashTable *table)
{//Add define list to a hash table. See ::/Adam/DolDoc/DocInit.HC.
CHashDefineStr *tmph;
if (tmph=HashFind(dname,Fs->hash_table,HTT_DEFINE_STR))
return HashLstAdd(tmph->data,type,table);
else
return 0;
}
I64 FramePtr(U8 *name,CTask *task=NULL)
{//Find entry in task->hash_table, Return user_data.
CHashGeneric *tmph;
if (!task) task=Fs;
if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR))
return tmph->user_data0;
else
return 0;
}
CHashGeneric *FramePtrAdd(U8 *name,I64 val=0,CTask *task=NULL)
{//Add named value to task->hash_table.
return HashGenericAdd(name,HTT_FRAME_PTR,val,0,0,task);
}
I64 FramePtrSet(U8 *name,I64 val,CTask *task=NULL)
{//Find hash entry in task->hash_table. Change user_data0.
CHashGeneric *tmph;
if (!task) task=Fs;
if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR))
return LXchgI64(&tmph->user_data0,val);
else
return 0;
}
I64 FramePtrDel(U8 *name,CTask *task=NULL)
{//Remove entry and delete.
CHashGeneric *tmph;
I64 res=0;
if (!task) task=Fs;
if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR)) {
res=tmph->user_data0;
HashRemDel(tmph,task->hash_table);
}
return res;
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\KHashB-Kernel.html\n// Date: unknown-date\n// Language: HolyC\n\nI64 HashTypeNum(CHash *tmph)\n{//Return bit num of hash type, limited to just types.\n if (tmph)\n return Bsf(tmph->type&HTG_TYPE_MASK);\n else\n return -1;\n}\n\nI64 HashVal(CHash *tmph)\n{//Returns most likely desired value.\n switch [HashTypeNum(tmph)] {\n case HTt_EXPORT_SYS_SYM:\n return tmph(CHashExport *)->val;\n case HTt_IMPORT_SYS_SYM:\n return tmph(CHashImport *)->module_base;\n case HTt_DEFINE_STR:\n case HTt_CLASS:\n case HTt_INTERNAL_TYPE:\n case HTt_WORD:\n case HTt_DICT_WORD:\n case HTt_OPCODE:\n case HTt_HELP_FILE:\n return tmph;\n case HTt_GLBL_VAR:\n if (tmph(CHashGlblVar *)->flags&GVF_EXTERN)\n return &tmph(CHashGlblVar *)->data_addr;\n else\n return tmph(CHashGlblVar *)->data_addr;\n case HTt_FUN:\n if (Bt(&tmph(CHashFun *)->flags,Cf_EXTERN))\n return tmph;\n else\n return tmph(CHashFun *)->exe_addr;\n case HTt_REG:\n return tmph(CHashReg *)->reg_num|tmph(CHashReg *)->reg_type<<8;\n case HTt_KEYWORD:\n case HTt_ASM_KEYWORD:\n case HTt_MODULE:\n case HTt_FILE:\n case HTt_FRAME_PTR:\n return tmph(CHashGeneric *)->user_data0;\n\n case -1: //nobound switch\n case HTt_TYPES_NUM: //nobound switch\n default:\n return 0;\n }\n}\n\nCHashTable *HashTableNew(I64 size,CTask *mem_task=NULL)\n{//New hash table, power-of-two in size.\n CHashTable *table;\n table=CAlloc(sizeof(CHashTable),mem_task);\n table->body=CAlloc(size<<3,mem_task);\n table->mask=size-1;\n return table;\n}\n\nU0 HashDel(CHashSrcSym *tmph)\n{//Free a std TempleOS system hash entry.\n if (!tmph) return;\n if (!(tmph->type&HTT_DICT_WORD))\n Free(tmph->str);\n if (tmph->type & HTG_SRC_SYM) {\n Free(tmph->src_link);\n Free(tmph->idx);\n Free(tmph->import_name);\n LinkedLstDel(tmph->ie_lst);\n if (tmph->type & (HTT_FUN | HTT_EXPORT_SYS_SYM))\n Free(tmph->dbg_info);\n if (tmph->type & (HTT_FUN | HTT_CLASS))\n//Assumes code not on heap, so doesn't Free.\n //ClassMemberLstDel() is an import to the Kernel module\n ClassMemberLstDel(tmph);\n else if (tmph->type&HTT_DEFINE_STR)\n Free(tmph(CHashDefineStr *)->data);\n else if (tmph->type & HTT_GLBL_VAR) {\n if (!(tmph(CHashGlblVar *)->flags&GVF_ALIAS))\n Free(tmph(CHashGlblVar *)->data_addr);\n LinkedLstDel(tmph(CHashGlblVar *)->dim.next);\n if (tmph(CHashGlblVar *)->fun_ptr)\n HashDel(tmph(CHashGlblVar *)->fun_ptr\n -tmph(CHashGlblVar *)->fun_ptr->ptr_stars_cnt);\n }\n } else if (tmph->type & HTT_FILE)\n Free(tmph(CHashGeneric *)->user_data0);\n Free(tmph);\n}\n\nU0 HashTableDel(CHashTable *table)\n{//Free std system hash table, calling HashDel() on entries.\n I64 i;\n CHashSrcSym *tmph,*tmph1;\n if (!table) return;\n for (i=0;i<=table->mask;i++) {\n tmph=table->body[i];\n while (tmph) {\n tmph1=tmph->next;\n HashDel(tmph);\n tmph=tmph1;\n }\n }\n Free(table->body);\n Free(table);\n}\n\nI64 HashTablePurge(CHashTable *table)\n{//Eliminate ExportSysSyms that have been usurped.\n I64 i,res=0;\n CHashSrcSym *tmph,*tmph1,*tmph2;\n if (!table) return 0;\n PUSHFD\n CLI //Precaution\n for (i=0;i<=table->mask;i++) {\n tmph=table->body[i];\n while (tmph) {\n tmph1=tmph->next; //We delete only older ones\n if (tmph->type&(HTT_FUN|HTT_GLBL_VAR)) {\n tmph2=tmph->next; //Older always later in chain\n while (tmph2) {\n if ((tmph2->type&HTT_EXPORT_SYS_SYM ||\n tmph2->type&HTG_TYPE_MASK==HTT_INVALID) &&\n !StrCmp(tmph2->str,tmph->str)) {\n if (tmph2->type&HTG_TYPE_MASK==HTT_INVALID)\n tmph2->type=HTT_KEYWORD;//Won't delete HTT_INVALID\n HashRemDel(tmph2,table);\n res++;\n break;\n }\n tmph2=tmph2->next;\n }\n }\n tmph=tmph1;\n }\n }\n POPFD\n return res;\n}\n\nCHashGeneric *HashGenericAdd(U8 *name,I64 type,\n I64 u0=0,I64 u1=0,I64 u2=0,CTask *task=NULL)\n{//Add any type to task hash_table, 3 user_data values.\n if (!task) task=Fs;\n CHashGeneric *res=CAlloc(sizeof(CHashGeneric),task);\n res->type=type;\n res->user_data0=u0;\n res->user_data1=u1;\n res->user_data2=u2;\n res->str=StrNew(name,task);\n HashAdd(res,task->hash_table);\n return res;\n}\n\nU0 HashSrcFileSet(CCmpCtrl *cc,CHashSrcSym *h,I64 line_num_offset=0)\n{//Set CHashSrcSym link and help_index by cur cc pos.\n CLexFile *tmpf=cc->lex_include_stk;\n I64 line_num=tmpf->line_num+line_num_offset;\n if (line_num<1) line_num=1;\n Free(h->src_link);\n h->src_link=MStrPrint(\"FL:%s,%d\",tmpf->full_name,line_num);\n if (Bt(&cc->opts,OPTf_KEEP_PRIVATE))\n h->type|=HTF_PRIVATE;\n Free(h->idx);\n if (cc->cur_help_idx && *cc->cur_help_idx)\n h->idx=StrNew(cc->cur_help_idx);\n else\n h->idx=NULL;\n}\n\nCHashGeneric *HashPublic(U8 *st,I64 mask,Bool val=TRUE)\n{//Mark a hash entry as public and HashSrcFileSet().\n CHashGeneric *res;\n if (res=HashFind(st,Fs->hash_table,mask)) {\n if (val)\n res->type|=HTF_PUBLIC;\n else\n res->type&=~HTF_PUBLIC;\n if (res->type&HTG_SRC_SYM)\n HashSrcFileSet(Fs->last_cc,res);\n return res;\n } else\n return NULL;\n}\n\nI64 HashLstAdd(U8 *lst,I64 type,CHashTable *table)\n{//Add a list to a hash table.\n I64 i=0;\n CHashGeneric *tmph;\n if (lst) {\n while (*lst) {\n if (*lst=='@')\n lst++;\n else\n i++;\n tmph=CAlloc(sizeof(CHashGeneric));\n tmph->user_data0=i-1;\n tmph->str=StrNew(lst);\n tmph->type=type;\n HashAdd(tmph,table);\n while (*lst++);\n }\n }\n return i;\n}\n\nI64 HashDefineLstAdd(U8 *dname,I64 type,CHashTable *table)\n{//Add define list to a hash table. See ::/Adam/DolDoc/DocInit.HC.\n CHashDefineStr *tmph;\n if (tmph=HashFind(dname,Fs->hash_table,HTT_DEFINE_STR))\n return HashLstAdd(tmph->data,type,table);\n else\n return 0;\n}\n\nI64 FramePtr(U8 *name,CTask *task=NULL)\n{//Find entry in task->hash_table, Return user_data.\n CHashGeneric *tmph;\n if (!task) task=Fs;\n if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR))\n return tmph->user_data0;\n else\n return 0;\n}\n\nCHashGeneric *FramePtrAdd(U8 *name,I64 val=0,CTask *task=NULL)\n{//Add named value to task->hash_table.\n return HashGenericAdd(name,HTT_FRAME_PTR,val,0,0,task);\n}\n\nI64 FramePtrSet(U8 *name,I64 val,CTask *task=NULL)\n{//Find hash entry in task->hash_table. Change user_data0.\n CHashGeneric *tmph;\n if (!task) task=Fs;\n if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR))\n return LXchgI64(&tmph->user_data0,val);\n else\n return 0;\n}\n\nI64 FramePtrDel(U8 *name,CTask *task=NULL)\n{//Remove entry and delete.\n CHashGeneric *tmph;\n I64 res=0;\n if (!task) task=Fs;\n if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR)) {\n res=tmph->user_data0;\n HashRemDel(tmph,task->hash_table);\n }\n return res;\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\ExtChars-Demo.html
// Date: unknown-date
// Language: HolyC
U8 face[8]={
0b00111100,
0b01000010,
0b10100101,
0b10000001,
0b11000011,
0b10111101,
0b01000010,
0b00111100,
};
text.font[255]=face[0](U64);
"Face:.\n";
//Chars 128-255 are treated as letters
//by the compiler and everything else.
//Enter them by holding ALT and
//pressing a 3 digit decimal number or
//press <CTRL-ALT-a>.
U0 SrcExample()
{
I64 f..=12345;
"f..=%d\n",f..;
}
SrcExample;
//See ::/Demo/ScrnCodes.HC, ::/Demo/Graphics/CharAnimation.HC,
//::/Demo/Games/CharDemo.HC and ::/Demo/Graphics/FontEd.HC.
//See char_bmp_alpha and char_bmp_alpha_numeric.
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\ExtChars-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\nU8 face[8]={\n\n0b00111100,\n0b01000010,\n0b10100101,\n0b10000001,\n0b11000011,\n0b10111101,\n0b01000010,\n0b00111100,\n\n};\n\n\ntext.font[255]=face[0](U64);\n\n\"Face:.\\n\";\n\n//Chars 128-255 are treated as letters\n//by the compiler and everything else.\n//Enter them by holding ALT and\n//pressing a 3 digit decimal number or\n//press <CTRL-ALT-a>.\n\nU0 SrcExample()\n{\n I64 f..=12345;\n \"f..=%d\\n\",f..;\n}\n\nSrcExample;\n//See ::/Demo/ScrnCodes.HC, ::/Demo/Graphics/CharAnimation.HC,\n//::/Demo/Games/CharDemo.HC and ::/Demo/Graphics/FontEd.HC.\n\n//See char_bmp_alpha and char_bmp_alpha_numeric."
}
]
}
|
// Source: D:\TempleOS-Projects\html\TOSToHtml-AcctExample-TOS-Demo.html
// Date: unknown-date
// Language: HolyC
//This is a customized version of ::/Demo/ToHtmlToTXTDemo/ToHtml.HC.
//Diff
#help_index "DolDoc/Conversion"
//See ::/Doc/Credits.DD.
#define DOCET_UNDEF_COLOR 0x100000000
#define DOCET_LINK_UNDERLINE 0x200000000
U0 HtmlPutS(CDoc *doc,I64 u32_attr,I64 *_old_u32_attr,Bool underline_update,
U8 *st,I64 *_col,U8 *style_bitmap=NULL)
{
U8 *ch,*ptr;
u32_attr&=0xFFFFFF00;
if (u32_attr&DOCET_INVERT)
u32_attr.u8[1]=(u32_attr.u8[1]&15)<<4|u32_attr.u8[1]>>4;
if (underline_update &&
!(u32_attr&DOCET_UNDERLINE) && *_old_u32_attr&DOCET_UNDERLINE) {
if (!(*_old_u32_attr&DOCET_LINK_UNDERLINE))
DocPrint(doc,"</u>");
*_old_u32_attr&=~DOCET_LINK_UNDERLINE;
}
if (!(u32_attr&DOCET_BLINK) && *_old_u32_attr&DOCET_BLINK)
DocPrint(doc,"</blink>");
if (u32_attr&0xFF00!=*_old_u32_attr&0xFF00) {
if (!(*_old_u32_attr&DOCET_UNDEF_COLOR))
DocPrint(doc,"</span>");
DocPrint(doc,"<span class=c%02X>",u32_attr.u8[1]);
if (style_bitmap)
LBts(style_bitmap,u32_attr.u8[1]);
}
if (u32_attr&DOCET_BLINK && !(*_old_u32_attr&DOCET_BLINK))
DocPrint(doc,"<blink>");
if (underline_update) {
if (u32_attr&DOCET_UNDERLINE && !(*_old_u32_attr&DOCET_UNDERLINE))
DocPrint(doc,"<u>");
} else //Keep same underline status.
u32_attr=u32_attr&~DOCET_UNDERLINE | *_old_u32_attr&DOCET_UNDERLINE;
*_old_u32_attr=u32_attr | *_old_u32_attr&DOCET_LINK_UNDERLINE;
while (ch=*st++) {
switch (ch) {
case '\t':
do {
DocPutKey(doc,CH_SPACE,0);
*_col=*_col+1;
} while (*_col&7);
break;
start:
case 'pi': ptr="pi"; break;
case 'theta': ptr="theta"; break;
case 'phi': ptr="phi"; break;
case 'omega': ptr="omega"; break;
case 'inf': ptr="inf"; break;
case 'u': ptr="u"; break;
end:
DocPrint(doc,ptr);
*_col=*_col+StrLen(ptr);
break;
start:
case CH_SHIFT_SPACE: ptr=" "; break;
case '&': ptr="&"; break;
case '<': ptr="<"; break;
case '>': ptr=">"; break;
case '"': ptr="""; break;
end:
DocPrint(doc,ptr);
*_col=*_col+1;
break;
default:
if (CH_SPACE<=ch<0x7F || ch=='\n')
DocPutKey(doc,ch,0);
else
DocPrint(doc,".");
*_col=*_col+1;
}
}
}
U8 *TOSLinkCvt2(U8 *filename,I64 line_num)
{// ::/ --> /Wb/
//Make your own LinkCvt routine
U8 *res=NULL,*st,*st2;
if (filename) {
st2=TOSBlogAbs(filename);
st=ExtChg(st2,"html");
Free(st2);
if (st && StrLen(st)>3 && !StrNCmp(st+1,":/",2))
res=MStrPrint(PERSONAL_WEB "/%s#l%d",st+3,line_num);
Free(st);
}
return res;
}
U8 *URLBibleGateway(U8 *src)
{
U8 buf[STR_LEN],*dst=buf;
if (!MemCmp(src,"BF:",3))
src+=3;
while (*src) {
if (*src==CH_SPACE || *src==',')
*dst++='+';
else
*dst++=*src;
src++;
}
*dst=0;
if (StrOcc(buf,'-'))
return MStrPrint(
"http://www.biblegateway.com/passage/?search=%s&version=NIV",buf);
else
return MStrPrint(
"http://www.biblegateway.com/verse/en/%s",buf);
}
U8 *TOSLinkCvt1(U8 *link_st)
{
static CDoc *bible=NULL;
static I64 locks=0;
U8 *res=NULL,*filename,*needle;
I64 i,num;
if (link_st) {
switch (i=EdLinkCvt(link_st,&filename,&needle,&num)) {
case LK_FILE_LINE:
case LK_PLAIN_LINE:
case LK_FILE:
res=TOSLinkCvt2(filename,num);
break;
case -1:
case LK_DEF:
case LK_HELP_INDEX:
case LK_DOC:
case LK_DOC_ANCHOR:
case LK_DOC_FIND:
case LK_DOC_LINE:
break;
case LK_BIBLE_FIND:
while (LBts(&locks,0))
Yield;
if (!bible)
bible=Adam("DocRead(\"%s\");",filename);
if (DocFind(bible,num,needle))
res=URLBibleGateway(link_st);
LBtr(&locks,0);
break;
default:
if (DocFileEd(i,filename,needle,&num,EDF_UNCOLLAPSE|EDF_BAIL))
res=TOSLinkCvt2(filename,num);
}
Free(filename);
Free(needle);
}
return res;
}
public CDoc *Doc2Html(CDoc *doc_in,U8 *html_header=NULL,U8 *body_header=NULL,
U8 *body_footer=NULL,U8 *html_footer=NULL,Bool line_anchors=TRUE,
U8 (*link_cvt)(U8 *link_st)=&TOSLinkCvt1,Bool line_nums=FALSE)
{//Cvt DolDocdoc to HTML file.
CDocEntry *doc_e,*style,*doc_e2;
I64 i,y,old_y=I64_MIN,col,old_u32_attr=DOCET_UNDEF_COLOR,old_attr,digits;
U32 *hl,*src;
U8 *st,st_2[2],*link_st,*style_bitmap=CAlloc(256/8);
CBGR48 p[COLORS_NUM];
GrPaletteGet(p);
CDoc *doc_out=DocNew;
Bool unlock_doc_in=DocLock(doc_in),no_bwd;
old_attr=doc_in->win_task->text_attr;
doc_in->win_task->text_attr=DOC_ATTR_DFT_TEXT;
for (i=0xF0;i<=0xFF;i++)
LBts(style_bitmap,i);
DocRecalc(doc_in,RECALCt_NORMAL|RECALCF_TO_HTML);
digits=Log10(doc_in->head.last->y+1)+1;
st_2[0]=0; st_2[1]=0;
doc_out->flags|=DOCF_PLAIN_TEXT|DOCF_NO_CURSOR;
if (!html_header) html_header=
"<!DOCTYPE HTML>\n"
"<html>\n"
"<head>\n"
"<meta http-equiv=\"Content-Type\" "
"content=\"text/html;charset=US-ASCII\">\n"
"<meta name=\"generator\" content=\"TempleOS V5.03\">\n";
if (!body_header) body_header=
"<body>\n"
"<pre style=\"font-family:courier;font-size:10pt\">\n";
if (!body_footer) body_footer=
"</pre></body>\n</html>\n";
if (!html_footer) html_footer=
"</html>\n";
DocPrint(doc_out,"%s",html_header);
DocPrint(doc_out,"<style type=\"text/css\">\n");
style=doc_out->cur_entry->last;
DocPrint(doc_out,
"</style>\n"
"</head>\n");
DocPrint(doc_out,"%s",body_header);
doc_e=doc_in->head.next;
col=doc_e->x;
y=doc_e->y;
while (doc_e!=doc_in) {
if (!(doc_e->de_flags&DOCEF_SKIP)) {
if (y!=old_y) {
if (line_anchors)
DocPrint(do
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\TOSToHtml-AcctExample-TOS-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\n//This is a customized version of ::/Demo/ToHtmlToTXTDemo/ToHtml.HC.\n//Diff\n\n#help_index \"DolDoc/Conversion\"\n//See ::/Doc/Credits.DD.\n\n#define DOCET_UNDEF_COLOR 0x100000000\n#define DOCET_LINK_UNDERLINE 0x200000000\nU0 HtmlPutS(CDoc *doc,I64 u32_attr,I64 *_old_u32_attr,Bool underline_update,\n U8 *st,I64 *_col,U8 *style_bitmap=NULL)\n{\n U8 *ch,*ptr;\n\n u32_attr&=0xFFFFFF00;\n if (u32_attr&DOCET_INVERT)\n u32_attr.u8[1]=(u32_attr.u8[1]&15)<<4|u32_attr.u8[1]>>4;\n\n if (underline_update &&\n !(u32_attr&DOCET_UNDERLINE) && *_old_u32_attr&DOCET_UNDERLINE) {\n if (!(*_old_u32_attr&DOCET_LINK_UNDERLINE))\n DocPrint(doc,\"</u>\");\n *_old_u32_attr&=~DOCET_LINK_UNDERLINE;\n }\n if (!(u32_attr&DOCET_BLINK) && *_old_u32_attr&DOCET_BLINK)\n DocPrint(doc,\"</blink>\");\n\n if (u32_attr&0xFF00!=*_old_u32_attr&0xFF00) {\n if (!(*_old_u32_attr&DOCET_UNDEF_COLOR))\n DocPrint(doc,\"</span>\");\n DocPrint(doc,\"<span class=c%02X>\",u32_attr.u8[1]);\n if (style_bitmap)\n LBts(style_bitmap,u32_attr.u8[1]);\n }\n if (u32_attr&DOCET_BLINK && !(*_old_u32_attr&DOCET_BLINK))\n DocPrint(doc,\"<blink>\");\n if (underline_update) {\n if (u32_attr&DOCET_UNDERLINE && !(*_old_u32_attr&DOCET_UNDERLINE))\n DocPrint(doc,\"<u>\");\n } else //Keep same underline status.\n u32_attr=u32_attr&~DOCET_UNDERLINE | *_old_u32_attr&DOCET_UNDERLINE;\n\n *_old_u32_attr=u32_attr | *_old_u32_attr&DOCET_LINK_UNDERLINE;\n\n while (ch=*st++) {\n switch (ch) {\n case '\\t':\n do {\n DocPutKey(doc,CH_SPACE,0);\n *_col=*_col+1;\n } while (*_col&7);\n break;\n\n start:\n case 'pi': ptr=\"pi\"; break;\n case 'theta': ptr=\"theta\"; break;\n case 'phi': ptr=\"phi\"; break;\n case 'omega': ptr=\"omega\"; break;\n case 'inf': ptr=\"inf\"; break;\n case 'u': ptr=\"u\"; break;\n end:\n DocPrint(doc,ptr);\n *_col=*_col+StrLen(ptr);\n break;\n\n start:\n case CH_SHIFT_SPACE: ptr=\" \"; break;\n case '&': ptr=\"&\"; break;\n case '<': ptr=\"<\"; break;\n case '>': ptr=\">\"; break;\n case '\"': ptr=\""\"; break;\n end:\n DocPrint(doc,ptr);\n *_col=*_col+1;\n break;\n\n default:\n if (CH_SPACE<=ch<0x7F || ch=='\\n')\n DocPutKey(doc,ch,0);\n else\n DocPrint(doc,\".\");\n *_col=*_col+1;\n }\n }\n}\n\nU8 *TOSLinkCvt2(U8 *filename,I64 line_num)\n{// ::/ --> /Wb/\n//Make your own LinkCvt routine\n U8 *res=NULL,*st,*st2;\n if (filename) {\n st2=TOSBlogAbs(filename);\n st=ExtChg(st2,\"html\");\n Free(st2);\n if (st && StrLen(st)>3 && !StrNCmp(st+1,\":/\",2))\n res=MStrPrint(PERSONAL_WEB \"/%s#l%d\",st+3,line_num);\n Free(st);\n }\n return res;\n}\n\nU8 *URLBibleGateway(U8 *src)\n{\n U8 buf[STR_LEN],*dst=buf;\n if (!MemCmp(src,\"BF:\",3))\n src+=3;\n while (*src) {\n if (*src==CH_SPACE || *src==',')\n *dst++='+';\n else\n *dst++=*src;\n src++;\n }\n *dst=0;\n if (StrOcc(buf,'-'))\n return MStrPrint(\n \"http://www.biblegateway.com/passage/?search=%s&version=NIV\",buf);\n else\n return MStrPrint(\n \"http://www.biblegateway.com/verse/en/%s\",buf);\n}\n\nU8 *TOSLinkCvt1(U8 *link_st)\n{\n static CDoc *bible=NULL;\n static I64 locks=0;\n U8 *res=NULL,*filename,*needle;\n I64 i,num;\n if (link_st) {\n switch (i=EdLinkCvt(link_st,&filename,&needle,&num)) {\n case LK_FILE_LINE:\n case LK_PLAIN_LINE:\n case LK_FILE:\n res=TOSLinkCvt2(filename,num);\n break;\n case -1:\n case LK_DEF:\n case LK_HELP_INDEX:\n case LK_DOC:\n case LK_DOC_ANCHOR:\n case LK_DOC_FIND:\n case LK_DOC_LINE:\n break;\n case LK_BIBLE_FIND:\n while (LBts(&locks,0))\n Yield;\n if (!bible)\n bible=Adam(\"DocRead(\\\"%s\\\");\",filename);\n if (DocFind(bible,num,needle))\n res=URLBibleGateway(link_st);\n LBtr(&locks,0);\n break;\n default:\n if (DocFileEd(i,filename,needle,&num,EDF_UNCOLLAPSE|EDF_BAIL))\n res=TOSLinkCvt2(filename,num);\n }\n Free(filename);\n Free(needle);\n }\n return res;\n}\n\n\npublic CDoc *Doc2Html(CDoc *doc_in,U8 *html_header=NULL,U8 *body_header=NULL,\n U8 *body_footer=NULL,U8 *html_footer=NULL,Bool line_anchors=TRUE,\n U8 (*link_cvt)(U8 *link_st)=&TOSLinkCvt1,Bool line_nums=FALSE)\n{//Cvt DolDocdoc to HTML file.\n CDocEntry *doc_e,*style,*doc_e2;\n I64 i,y,old_y=I64_MIN,col,old_u32_attr=DOCET_UNDEF_COLOR,old_attr,digits;\n U32 *hl,*src;\n U8 *st,st_2[2],*link_st,*style_bitmap=CAlloc(256/8);\n CBGR48 p[COLORS_NUM];\n GrPaletteGet(p);\n CDoc *doc_out=DocNew;\n Bool unlock_doc_in=DocLock(doc_in),no_bwd;\n\n old_attr=doc_in->win_task->text_attr;\n doc_in->win_task->text_attr=DOC_ATTR_DFT_TEXT;\n\n for (i=0xF0;i<=0xFF;i++)\n LBts(style_bitmap,i);\n\n DocRecalc(doc_in,RECALCt_NORMAL|RECALCF_TO_HTML);\n digits=Log10(doc_in->head.last->y+1)+1;\n\n st_2[0]=0; st_2[1]=0;\n doc_out->flags|=DOCF_PLAIN_TEXT|DOCF_NO_CURSOR;\n\n if (!html_header) html_header=\n \"<!DOCTYPE HTML>\\n\"\n \"<html>\\n\"\n \"<head>\\n\"\n \"<meta http-equiv=\\\"Content-Type\\\" \"\n \"content=\\\"text/html;charset=US-ASCII\\\">\\n\"\n \"<meta name=\\\"generator\\\" content=\\\"TempleOS V5.03\\\">\\n\";\n if (!body_header) body_header=\n \"<body>\\n\"\n \"<pre style=\\\"font-family:courier;font-size:10pt\\\">\\n\";\n if (!body_footer) body_footer=\n \"</pre></body>\\n</html>\\n\";\n if (!html_footer) html_footer=\n \"</html>\\n\";\n\n DocPrint(doc_out,\"%s\",html_header);\n\n DocPrint(doc_out,\"<style type=\\\"text/css\\\">\\n\");\n style=doc_out->cur_entry->last;\n DocPrint(doc_out,\n \"</style>\\n\"\n \"</head>\\n\");\n DocPrint(doc_out,\"%s\",body_header);\n\n doc_e=doc_in->head.next;\n col=doc_e->x;\n y=doc_e->y;\n while (doc_e!=doc_in) {\n if (!(doc_e->de_flags&DOCEF_SKIP)) {\n if (y!=old_y) {\n if (line_anchors)\n DocPrint(do"
}
]
}
|
// Source: D:\TempleOS-Projects\html\verses-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 special
U0 Song()
{
CTask *task;
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo=2.5;
try {
task=PopUpViewPrint(
"$WW,1$This shows a random passage based on "
"the time at the moment this song was run. "
"Talk to God as an offering, then run press <F7> if you "
"want God to talk some more. The Holy Spirit can "
"puppet you.\n");
TaskWait(task);
WinHorz(Fs->win_left,TEXT_COLS-10,task);
WinVert(Fs->win_bottom+3,Fs->win_bottom+15,task);
"$WW+H,1$";
DocRecalc(DocPut(task)); //Reformat word-wrap with new window size.
while (!ScanKey) {
FifoU8Flush(god.fifo);
GodBitsIns(GOD_GOOD_BITS,KbdMsEvtTime>>GOD_BAD_BITS);
GodBiblePassage(5);
Play("4qAeAB5C4B5qC4etABB5qC4etAA5REE4G");
Play("4qAeAB5C4B5qC4etABB5qC4etAA5REE4G");
Play("5eDRRRqGReRRGGGGqE");
Play("5eDRRRqGReRRGGGGqE");
}
} catch
PutExcept;
Snd;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\verses-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 special\nU0 Song()\n{\n CTask *task;\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo=2.5;\n try {\n task=PopUpViewPrint(\n \"$WW,1$This shows a random passage based on \"\n \"the time at the moment this song was run. \"\n \"Talk to God as an offering, then run press <F7> if you \"\n \"want God to talk some more. The Holy Spirit can \"\n \"puppet you.\\n\");\n TaskWait(task);\n WinHorz(Fs->win_left,TEXT_COLS-10,task);\n WinVert(Fs->win_bottom+3,Fs->win_bottom+15,task);\n \"$WW+H,1$\";\n DocRecalc(DocPut(task)); //Reformat word-wrap with new window size.\n while (!ScanKey) {\n FifoU8Flush(god.fifo);\n GodBitsIns(GOD_GOOD_BITS,KbdMsEvtTime>>GOD_BAD_BITS);\n GodBiblePassage(5);\n Play(\"4qAeAB5C4B5qC4etABB5qC4etAA5REE4G\");\n Play(\"4qAeAB5C4B5qC4etABB5qC4etAA5REE4G\");\n Play(\"5eDRRRqGReRRGGGGqE\");\n Play(\"5eDRRRqGReRRGGGGqE\");\n }\n } catch\n PutExcept;\n Snd;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\Load-Logic-Apps.html
// Date: unknown-date
// Language: HolyC
#help_index "Misc"
Cd(__DIR__);;
#include "Logic"
#help_index ""
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Load-Logic-Apps.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"Misc\"\n\nCd(__DIR__);;\n#include \"Logic\"\n\n#help_index \"\""
}
]
}
|
// Source: D:\TempleOS-Projects\html\Tour2-Tour-Misc.html
// Date: unknown-date
// Language: HolyC
//Puts the cursor at the bottom.
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);
"\n";
TourPut(
"You are now at the command line.\n"
"\n"
"The syntax is like $GREEN$C/C++$FG$ except you don't need $GREEN$()$FG$ "
"if there are no args.\n"
"\n"
"Type \"$GREEN$Dir;$FG$\" and press $GREEN$<ENTER>$FG$.\n\n"
"You must remember the semicolon.\n");
InGetStr("Dir;\n");
TourPut(
"Press $GREEN$<CTRL-m>$FG$.\n\n"
"This will access your PersonalMenu. You can customize it. "
"It's like your START menu and desktop.\n");
InGetChar(CH_CTRLM);
TourPut(
"You can also get to your PersonalMenu by clicking on the word "
"\"$GREEN$MENU$FG$\" in the title bar.\n",TRUE);
TourPut("Press $GREEN$<CURSOR-DOWN>$FG$ nine times.\n");
//Puts the cursor at the top
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
I64 i;
for (i=0;i<9;i++)
InGetKey(SC_CURSOR_DOWN);
TourPut(
"Keyboard commands are:\n\n"
"$GREEN$<SPACE>$FG$\t\tLeft-action\n"
"$GREEN$<ENTER>$FG$\t\tRight-action\n"
"$GREEN$<ESC>$FG$\t\tSave and exit\n"
"$GREEN$<SHIFT-ESC>$FG$\tAbort and exit\n",TRUE);
TourPut(
"The cursor is now on top of a macro we wish to run.\n"
"\n"
"Press $GREEN$<SPACE>$FG$.\n");
InGetStr(" ");
TourPut(
"The macro changed directories and did a $GREEN$Dir;$FG$ command. "
"The $RED$RED$FG$ filenames listed are file links. Left-clicking will "
"edit/view them. Right-clicking or pressing $GREEN$<ENTER>$FG$ when the "
"cursor is on top will bring-up a menu of options.\n\n"
"The $LTBLUE$BLUE$FG$ underline entries \"$LTBLUE$.$FG$\" "
"and \"$LTBLUE$..$FG$\""
"are macros and will change directories.\n",TRUE);
TourPut(
"Press $GREEN$<CTRL-t>$FG$ to toggle to plain text mode.\n\n"
"These are \"DolDoc\" commands.");
InGetChar(CH_CTRLT);
TourPut(
"The DolDoc widgets are bracketed with dollar sign characters.\n\n"
"\"LK\" stands \"link\".\n"
"\"MA\" stands for \"macro\".\n\n"
"Now, $GREEN$<CTRL-t>$FG$ to toggle back to regular mode.\n");
InGetChar(CH_CTRLT);
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Tour2-Tour-Misc.html\n// Date: unknown-date\n// Language: HolyC\n\n//Puts the cursor at the bottom.\nMsg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);\n\"\\n\";\n\nTourPut(\n\"You are now at the command line.\\n\"\n\"\\n\"\n\"The syntax is like $GREEN$C/C++$FG$ except you don't need $GREEN$()$FG$ \"\n\"if there are no args.\\n\"\n\"\\n\"\n\"Type \\\"$GREEN$Dir;$FG$\\\" and press $GREEN$<ENTER>$FG$.\\n\\n\"\n\"You must remember the semicolon.\\n\");\nInGetStr(\"Dir;\\n\");\n\nTourPut(\n\"Press $GREEN$<CTRL-m>$FG$.\\n\\n\"\n\"This will access your PersonalMenu. You can customize it. \"\n\"It's like your START menu and desktop.\\n\");\n\nInGetChar(CH_CTRLM);\nTourPut(\n\"You can also get to your PersonalMenu by clicking on the word \"\n\"\\\"$GREEN$MENU$FG$\\\" in the title bar.\\n\",TRUE);\n\nTourPut(\"Press $GREEN$<CURSOR-DOWN>$FG$ nine times.\\n\");\n\n//Puts the cursor at the top\nMsg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);\n\nI64 i;\nfor (i=0;i<9;i++)\n InGetKey(SC_CURSOR_DOWN);\n\nTourPut(\n\"Keyboard commands are:\\n\\n\"\n\"$GREEN$<SPACE>$FG$\\t\\tLeft-action\\n\"\n\"$GREEN$<ENTER>$FG$\\t\\tRight-action\\n\"\n\"$GREEN$<ESC>$FG$\\t\\tSave and exit\\n\"\n\"$GREEN$<SHIFT-ESC>$FG$\\tAbort and exit\\n\",TRUE);\n\nTourPut(\n\"The cursor is now on top of a macro we wish to run.\\n\"\n\"\\n\"\n\"Press $GREEN$<SPACE>$FG$.\\n\");\nInGetStr(\" \");\n\nTourPut(\n\"The macro changed directories and did a $GREEN$Dir;$FG$ command. \"\n\"The $RED$RED$FG$ filenames listed are file links. Left-clicking will \"\n\"edit/view them. Right-clicking or pressing $GREEN$<ENTER>$FG$ when the \"\n\"cursor is on top will bring-up a menu of options.\\n\\n\"\n\"The $LTBLUE$BLUE$FG$ underline entries \\\"$LTBLUE$.$FG$\\\" \"\n\"and \\\"$LTBLUE$..$FG$\\\"\"\n\"are macros and will change directories.\\n\",TRUE);\n\nTourPut(\n\"Press $GREEN$<CTRL-t>$FG$ to toggle to plain text mode.\\n\\n\"\n\"These are \\\"DolDoc\\\" commands.\");\nInGetChar(CH_CTRLT);\n\nTourPut(\n\"The DolDoc widgets are bracketed with dollar sign characters.\\n\\n\"\n\"\\\"LK\\\" stands \\\"link\\\".\\n\"\n\"\\\"MA\\\" stands for \\\"macro\\\".\\n\\n\"\n\"Now, $GREEN$<CTRL-t>$FG$ to toggle back to regular mode.\\n\");\nInGetChar(CH_CTRLT);\nMsg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);"
}
]
}
|
// Source: D:\TempleOS-Projects\html\AMouse-Adam.html
// Date: unknown-date
// Language: HolyC
#help_index "Graphics/Misc;Mouse/Ptr"
<1>/* Graphics Not Rendered in HTML */
gr.empty_sprite=<1>;
<2>/* Graphics Not Rendered in HTML */
<3>/* Graphics Not Rendered in HTML */
public U0 DrawGrabMs(CDC *dc,I64 x,I64 y,Bool closed)
{//This is a callback. See ::/Demo/Graphics/Grid.HC.
dc->flags&=~(DCF_TRANSFORMATION|DCF_SYMMETRY);
dc->color=ROP_EQU;
if (closed)
Sprite3(dc,x,y,0,<2>);
else
Sprite3(dc,x,y,0,<3>);
}
gr.fp_draw_grab_ms=&DrawGrabMs;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\AMouse-Adam.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"Graphics/Misc;Mouse/Ptr\"\n\n<1>/* Graphics Not Rendered in HTML */\n\ngr.empty_sprite=<1>;\n\n<2>/* Graphics Not Rendered in HTML */\n\n<3>/* Graphics Not Rendered in HTML */\n\npublic U0 DrawGrabMs(CDC *dc,I64 x,I64 y,Bool closed)\n{//This is a callback. See ::/Demo/Graphics/Grid.HC.\n dc->flags&=~(DCF_TRANSFORMATION|DCF_SYMMETRY);\n dc->color=ROP_EQU;\n if (closed)\n Sprite3(dc,x,y,0,<2>);\n else\n Sprite3(dc,x,y,0,<3>);\n}\ngr.fp_draw_grab_ms=&DrawGrabMs;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\BootHD-Opt-Boot-Adam.html
// Date: unknown-date
// Language: HolyC
#define MODULE_SIZE 1*BLK_SIZE
#define BOOT_HIGH_LOC_HD ((BOOT_RAM_LIMIT-\
(BOOT_STK_SIZE+MODULE_SIZE))>>4)
DefinePrint(
"DD_BOOT_HIGH_LOC_HD","%08X",BOOT_HIGH_LOC_HD<<4);
asm {
USE16
BHD_CODE::
#define BHD_START (BHD_CODE-offset(CFAT32Boot.code))
CLD
MOV AX,BOOT_HIGH_LOC_HD
MOV ES,AX
CLI
MOV SS,AX
MOV SP,BOOT_STK_SIZE+MODULE_SIZE
STI
CALL BHD_GET_RIP
BHD_GET_RIP:
POP BX
SUB BX,BHD_GET_RIP-BHD_START
SHR BX,4
//This copies this bootloader's code to 0x00096C00
MOV AX,CS
ADD AX,BX
MOV DS,AX
MOV CX,MODULE_SIZE
XOR SI,SI
XOR DI,DI
REP_MOVSB
MOV AX,BOOT_HIGH_LOC_HD
MOV DS,AX
//My assembler doesn't support 16-bit very well.
DU8 0xEA; //JMP BOOT_HIGH_LOC_HD:BHD_HISTART
DU16 BHD_HISTART-BHD_START,BOOT_HIGH_LOC_HD;
BHD_BIOS_DRV_NUM: DU8 0;
//Gets patched by BootHDIns().
BHD_BLK_CNT:: DU16 0;
BHD_DAP: DU8 16,0,1,0; //One blk at a time
BHD_DAP_BUF: DU16 0,0;
//Gets patched by BootHDIns().
BHD_DAP_BLK:: //64-bit
BHD_DAP_BLK_LO: DU32 0;
BHD_DAP_BLK_HI: DU32 0;
BHD_HISTART:
MOV U8 [BHD_BIOS_DRV_NUM-BHD_START],DL //Passed in by BIOS
MOV AX,BOOT_RAM_BASE/16
MOV ES,AX
XOR ECX,ECX
MOV CX,U16 [BHD_BLK_CNT-BHD_START]
@@05: PUSH CX //Blk cnt
//READ BLK
PUSH ES //Buf seg
MOV AX,ES
MOV U16 [BHD_DAP_BUF+2-BHD_START],AX //ES:0000
MOV SI,BHD_DAP-BHD_START //DS:SI=DAP
MOV AH,0x42
MOV DL,U8 [BHD_BIOS_DRV_NUM-BHD_START]
INT 0x13
POP AX //ES
ADD AX,BLK_SIZE/16
MOV ES,AX
INC U32 [BHD_DAP_BLK_LO-BHD_START]
JNZ @@10
INC U32 [BHD_DAP_BLK_HI-BHD_START]
@@10: POP CX
LOOP @@05
XOR EBX,EBX
MOV EAX,BOOT_SRC_HARDDRV //See sys_boot_src
//My assembler doesn't support 16-bit very well.
DU8 0xEA; //JMP BOOT_RAM_BASE:0000
DU16 0,BOOT_RAM_BASE/16;
//Continues here ::/Kernel/KStart16.HC
BHD_END::
#assert BHD_END-BHD_START<MODULE_SIZE-2
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\BootHD-Opt-Boot-Adam.html\n// Date: unknown-date\n// Language: HolyC\n\n#define MODULE_SIZE 1*BLK_SIZE\n#define BOOT_HIGH_LOC_HD ((BOOT_RAM_LIMIT-\\\n (BOOT_STK_SIZE+MODULE_SIZE))>>4)\n\nDefinePrint(\n \"DD_BOOT_HIGH_LOC_HD\",\"%08X\",BOOT_HIGH_LOC_HD<<4);\n\nasm {\nUSE16\nBHD_CODE::\n\n#define BHD_START (BHD_CODE-offset(CFAT32Boot.code))\n\n CLD\n\n MOV AX,BOOT_HIGH_LOC_HD\n MOV ES,AX\n\n CLI\n MOV SS,AX\n MOV SP,BOOT_STK_SIZE+MODULE_SIZE\n STI\n\n CALL BHD_GET_RIP\nBHD_GET_RIP:\n POP BX\n SUB BX,BHD_GET_RIP-BHD_START\n SHR BX,4\n//This copies this bootloader's code to 0x00096C00\n MOV AX,CS\n ADD AX,BX\n MOV DS,AX\n MOV CX,MODULE_SIZE\n XOR SI,SI\n XOR DI,DI\n REP_MOVSB\n\n MOV AX,BOOT_HIGH_LOC_HD\n MOV DS,AX\n\n//My assembler doesn't support 16-bit very well.\n DU8 0xEA; //JMP BOOT_HIGH_LOC_HD:BHD_HISTART\n DU16 BHD_HISTART-BHD_START,BOOT_HIGH_LOC_HD;\n\nBHD_BIOS_DRV_NUM: DU8 0;\n\n//Gets patched by BootHDIns().\nBHD_BLK_CNT:: DU16 0;\n\nBHD_DAP: DU8 16,0,1,0; //One blk at a time\nBHD_DAP_BUF: DU16 0,0;\n//Gets patched by BootHDIns().\nBHD_DAP_BLK:: //64-bit\nBHD_DAP_BLK_LO: DU32 0;\nBHD_DAP_BLK_HI: DU32 0;\n\nBHD_HISTART:\n MOV U8 [BHD_BIOS_DRV_NUM-BHD_START],DL //Passed in by BIOS\n MOV AX,BOOT_RAM_BASE/16\n MOV ES,AX\n XOR ECX,ECX\n MOV CX,U16 [BHD_BLK_CNT-BHD_START]\n\n@@05: PUSH CX //Blk cnt\n\n//READ BLK\n PUSH ES //Buf seg\n MOV AX,ES\n MOV U16 [BHD_DAP_BUF+2-BHD_START],AX //ES:0000\n MOV SI,BHD_DAP-BHD_START //DS:SI=DAP\n MOV AH,0x42\n MOV DL,U8 [BHD_BIOS_DRV_NUM-BHD_START]\n INT 0x13\n\n POP AX //ES\n ADD AX,BLK_SIZE/16\n MOV ES,AX\n INC U32 [BHD_DAP_BLK_LO-BHD_START]\n JNZ @@10\n INC U32 [BHD_DAP_BLK_HI-BHD_START]\n\n@@10: POP CX\n LOOP @@05\n\n XOR EBX,EBX\n MOV EAX,BOOT_SRC_HARDDRV //See sys_boot_src\n//My assembler doesn't support 16-bit very well.\n DU8 0xEA; //JMP BOOT_RAM_BASE:0000\n DU16 0,BOOT_RAM_BASE/16;\n//Continues here ::/Kernel/KStart16.HC\nBHD_END::\n#assert BHD_END-BHD_START<MODULE_SIZE-2\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\SpanBridge-Span-Apps.html
// Date: unknown-date
// Language: HolyC
#define STRENGTH_SCALE 1.5e7
#define SPRING_SCALE 6.0e6
#define COST_SCALE 375.0
#define MASS_RADIUS 3.0
#define MASS_MASS 10.0
#define WIRE_PERCENT 0.99
#define RIVER_BANK_COLS 5
#define SKY_LINES 40
#define FIXED_X1 ((RIVER_BANK_COLS-1)*FONT_WIDTH)
#define FIXED_X2 ((RIVER_BANK_COLS-4)*FONT_WIDTH)
#define FIXED_X3 (TEXT_COLS*FONT_WIDTH>>1)
#define FIXED_Y1 ((SKY_LINES+1)*FONT_HEIGHT)
#define FIXED_Y2 ((SKY_LINES+5)*FONT_HEIGHT)
#define FIXED_Y3 ((TEXT_ROWS-8)*FONT_HEIGHT)
#define LOAD_WEIGHTS 8
U0 SpanBridge1Init(CMathODE *)
{
I64 i;
MyMass *tmpm;
tmpm=PlaceMass(GR_WIDTH-FIXED_X1,FIXED_Y1);
tmpm->flags|=MSF_FIXED;
tmpm=PlaceMass(GR_WIDTH-FIXED_X2,FIXED_Y1);
tmpm->flags|=MSF_FIXED;
tmpm=PlaceMass(GR_WIDTH-FIXED_X1,FIXED_Y2);
tmpm->flags|=MSF_FIXED;
tmpm=PlaceMass(FIXED_X1,FIXED_Y1);
tmpm->flags|=MSF_FIXED;
tmpm=PlaceMass(FIXED_X2,FIXED_Y1);
tmpm->flags|=MSF_FIXED;
tmpm=PlaceMass(FIXED_X1,FIXED_Y2);
tmpm->flags|=MSF_FIXED;
tmpm=PlaceMass(FIXED_X3,FIXED_Y3);
tmpm->flags|=MSF_FIXED;
for (i=0;i<LOAD_WEIGHTS;i++) {
tmpm=PlaceMass(FIXED_X1+(i+1)*(GR_WIDTH-2*FIXED_X1)/(LOAD_WEIGHTS+1),
FIXED_Y1);
tmpm->load_t=(i+1.0)/LOAD_WEIGHTS;
tmpm->color=RED;
}
DocClear;
"$BG,LTCYAN$%h*c",SKY_LINES,'\n';
for (i=0;i<10;i++) {
"$BG,BROWN$%h*c",RIVER_BANK_COLS,CH_SPACE;
"$BG,LTCYAN$%h*c",TEXT_COLS-2*RIVER_BANK_COLS,CH_SPACE;
"$BG,BROWN$%h*c\n",RIVER_BANK_COLS,CH_SPACE;
}
for (i=0;i<5;i++) {
"$BG,BROWN$%h*c",RIVER_BANK_COLS+i,CH_SPACE;
"$BG,BLUE$%h*c",TEXT_COLS/2-RIVER_BANK_COLS-2*i,CH_SPACE;
"$BG,BROWN$%h*c",2*i,CH_SPACE;
"$BG,BLUE$%h*c",TEXT_COLS/2-RIVER_BANK_COLS-2*i,CH_SPACE;
"$BG,BROWN$%h*c\n",RIVER_BANK_COLS+i,CH_SPACE;
}
}
U0 AdjustLoads(CMathODE *ode)
{
MyMass *tmpm=ode->next_mass;
F64 d,tt=SpanTime/10.0;
while (tmpm!=&ode->next_mass) {
if (tmpm->load_t) {
if (tt) {
d=Abs(Sin(tmpm->load_t*pi+tt)); //0.0<=d<=1.0
tmpm->mass=100.0*Sqr(Sqr(d+1.0));
tmpm->radius=7.0*d+2.0;
} else {
tmpm->mass=MASS_MASS;
tmpm->radius=MASS_RADIUS;
}
}
tmpm=tmpm->next;
}
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\SpanBridge-Span-Apps.html\n// Date: unknown-date\n// Language: HolyC\n\n#define STRENGTH_SCALE 1.5e7\n#define SPRING_SCALE 6.0e6\n#define COST_SCALE 375.0\n#define MASS_RADIUS 3.0\n#define MASS_MASS 10.0\n#define WIRE_PERCENT 0.99\n\n#define RIVER_BANK_COLS 5\n#define SKY_LINES 40\n\n#define FIXED_X1 ((RIVER_BANK_COLS-1)*FONT_WIDTH)\n#define FIXED_X2 ((RIVER_BANK_COLS-4)*FONT_WIDTH)\n#define FIXED_X3 (TEXT_COLS*FONT_WIDTH>>1)\n#define FIXED_Y1 ((SKY_LINES+1)*FONT_HEIGHT)\n#define FIXED_Y2 ((SKY_LINES+5)*FONT_HEIGHT)\n#define FIXED_Y3 ((TEXT_ROWS-8)*FONT_HEIGHT)\n\n#define LOAD_WEIGHTS 8\n\nU0 SpanBridge1Init(CMathODE *)\n{\n I64 i;\n\n MyMass *tmpm;\n tmpm=PlaceMass(GR_WIDTH-FIXED_X1,FIXED_Y1);\n tmpm->flags|=MSF_FIXED;\n tmpm=PlaceMass(GR_WIDTH-FIXED_X2,FIXED_Y1);\n tmpm->flags|=MSF_FIXED;\n tmpm=PlaceMass(GR_WIDTH-FIXED_X1,FIXED_Y2);\n tmpm->flags|=MSF_FIXED;\n tmpm=PlaceMass(FIXED_X1,FIXED_Y1);\n tmpm->flags|=MSF_FIXED;\n tmpm=PlaceMass(FIXED_X2,FIXED_Y1);\n tmpm->flags|=MSF_FIXED;\n tmpm=PlaceMass(FIXED_X1,FIXED_Y2);\n tmpm->flags|=MSF_FIXED;\n tmpm=PlaceMass(FIXED_X3,FIXED_Y3);\n tmpm->flags|=MSF_FIXED;\n\n for (i=0;i<LOAD_WEIGHTS;i++) {\n tmpm=PlaceMass(FIXED_X1+(i+1)*(GR_WIDTH-2*FIXED_X1)/(LOAD_WEIGHTS+1),\n FIXED_Y1);\n tmpm->load_t=(i+1.0)/LOAD_WEIGHTS;\n tmpm->color=RED;\n }\n\n DocClear;\n \"$BG,LTCYAN$%h*c\",SKY_LINES,'\\n';\n for (i=0;i<10;i++) {\n \"$BG,BROWN$%h*c\",RIVER_BANK_COLS,CH_SPACE;\n \"$BG,LTCYAN$%h*c\",TEXT_COLS-2*RIVER_BANK_COLS,CH_SPACE;\n \"$BG,BROWN$%h*c\\n\",RIVER_BANK_COLS,CH_SPACE;\n }\n for (i=0;i<5;i++) {\n \"$BG,BROWN$%h*c\",RIVER_BANK_COLS+i,CH_SPACE;\n \"$BG,BLUE$%h*c\",TEXT_COLS/2-RIVER_BANK_COLS-2*i,CH_SPACE;\n \"$BG,BROWN$%h*c\",2*i,CH_SPACE;\n \"$BG,BLUE$%h*c\",TEXT_COLS/2-RIVER_BANK_COLS-2*i,CH_SPACE;\n \"$BG,BROWN$%h*c\\n\",RIVER_BANK_COLS+i,CH_SPACE;\n }\n}\n\nU0 AdjustLoads(CMathODE *ode)\n{\n MyMass *tmpm=ode->next_mass;\n F64 d,tt=SpanTime/10.0;\n while (tmpm!=&ode->next_mass) {\n if (tmpm->load_t) {\n if (tt) {\n d=Abs(Sin(tmpm->load_t*pi+tt)); //0.0<=d<=1.0\n tmpm->mass=100.0*Sqr(Sqr(d+1.0));\n tmpm->radius=7.0*d+2.0;\n } else {\n tmpm->mass=MASS_MASS;\n tmpm->radius=MASS_RADIUS;\n }\n }\n tmpm=tmpm->next;\n }\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\Sup1Bin-Sup1-Home.html
// Date: unknown-date
// Language: HolyC
../
GodPassage 319
GodWords 132
GodWords100 139
QEMU/
VMware/
VirtualBox/
make_tosz 134
mix_SND 196
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Sup1Bin-Sup1-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n../\nGodPassage 319\nGodWords 132\nGodWords100 139\nQEMU/\nVMware/\nVirtualBox/\nmake_tosz 134\nmix_SND 196"
}
]
}
|
// Source: D:\TempleOS-Projects\html\Shadow-Graphics-Demo.html
// Date: unknown-date
// Language: HolyC
F64 theta,phi,omega,s;
CDC *dc0,*dc1;
<1>/* Graphics Not Rendered in HTML */
U0 GrBlackLighting(CDC *dc,CD3I32 *,CD3I32 *,CD3I32 *,CColorROPU32)
{
dc->color=0;
}
U0 DrawShadow(CTask *task)
{
I64 r[4][4],*r2;
Mat4x4IdentEqu(dc1->r);
Mat4x4RotZ(dc1->r,theta);
Mat4x4RotX(dc1->r,phi);
Mat4x4RotZ(dc1->r,omega);
Mat4x4Scale(dc1->r,s);
Mat4x4TranslationEqu(dc1->r,200,200,5000);
dc1->flags|=DCF_TRANSFORMATION;
DCMat4x4Set(dc1,dc1->r);
MemSet(r,0,sizeof(r));
r[0][0]=GR_SCALE;
r[1][1]=GR_SCALE/2; //Pick a plane for the shadow, to suit your taste.
r[1][2]=GR_SCALE/2; //It doesn't have to have a norm of 1.0.
r[2][2]=GR_SCALE;
r[3][3]=GR_SCALE;
Mat4x4TranslationEqu(r,0,-2200,1000);
r2=Mat4x4MulMat4x4New(r,dc1->r,task);
Free(dc1->r);
DCMat4x4Set(dc1,r2);
dc1->lighting=&GrBlackLighting;
Sprite3(dc1,0,0,0,<1>);
}
U0 DrawIt(CTask *task,CDC *)
{
DCDepthBufRst(dc0);
Mat4x4IdentEqu(dc0->r);
Mat4x4RotZ(dc0->r,theta);
Mat4x4RotX(dc0->r,phi);
Mat4x4RotZ(dc0->r,omega);
Mat4x4Scale(dc0->r,s);
Mat4x4TranslationEqu(dc0->r,200,200,5000);
dc0->flags|=DCF_TRANSFORMATION;
DCMat4x4Set(dc0,dc0->r);
if (mp_cnt>1)
JobQue(&DrawShadow,task,1);
else
DrawShadow(task);
Sprite3(dc0,0,0,0,<1>);
}
U0 Shadow()
{//The shadow image b.s. Any is plausible.
dc0=DCAlias(gr.dc2,Fs);
dc1=DCAlias(gr.dc2,Fs);
DCDepthBufAlloc(dc0);
dc1->depth_buf=dc0->depth_buf;
theta=0;
phi=0;
omega=0;
s=1.5;
SettingsPush; //See SettingsPush
WinMax;
Fs->draw_it=&DrawIt;
while (!ScanChar) {
theta+=2*pi/70;
phi+=2*pi/90;
omega+=2*pi/110;
Sleep(20);
}
SettingsPop;
DCDel(dc0);
dc1->depth_buf=NULL;
DCDel(dc1);
}
Shadow;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Shadow-Graphics-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\nF64 theta,phi,omega,s;\nCDC *dc0,*dc1;\n\n\n\n\n\n\n\n\n <1>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n\n\n\n\nU0 GrBlackLighting(CDC *dc,CD3I32 *,CD3I32 *,CD3I32 *,CColorROPU32)\n{\n dc->color=0;\n}\n\nU0 DrawShadow(CTask *task)\n{\n I64 r[4][4],*r2;\n\n Mat4x4IdentEqu(dc1->r);\n Mat4x4RotZ(dc1->r,theta);\n Mat4x4RotX(dc1->r,phi);\n Mat4x4RotZ(dc1->r,omega);\n Mat4x4Scale(dc1->r,s);\n Mat4x4TranslationEqu(dc1->r,200,200,5000);\n dc1->flags|=DCF_TRANSFORMATION;\n DCMat4x4Set(dc1,dc1->r);\n\n MemSet(r,0,sizeof(r));\n\n r[0][0]=GR_SCALE;\n r[1][1]=GR_SCALE/2; //Pick a plane for the shadow, to suit your taste.\n r[1][2]=GR_SCALE/2; //It doesn't have to have a norm of 1.0.\n r[2][2]=GR_SCALE;\n r[3][3]=GR_SCALE;\n\n Mat4x4TranslationEqu(r,0,-2200,1000);\n r2=Mat4x4MulMat4x4New(r,dc1->r,task);\n Free(dc1->r);\n DCMat4x4Set(dc1,r2);\n\n dc1->lighting=&GrBlackLighting;\n Sprite3(dc1,0,0,0,<1>);\n}\n\nU0 DrawIt(CTask *task,CDC *)\n{\n DCDepthBufRst(dc0);\n Mat4x4IdentEqu(dc0->r);\n Mat4x4RotZ(dc0->r,theta);\n Mat4x4RotX(dc0->r,phi);\n Mat4x4RotZ(dc0->r,omega);\n Mat4x4Scale(dc0->r,s);\n Mat4x4TranslationEqu(dc0->r,200,200,5000);\n dc0->flags|=DCF_TRANSFORMATION;\n DCMat4x4Set(dc0,dc0->r);\n if (mp_cnt>1)\n JobQue(&DrawShadow,task,1);\n else\n DrawShadow(task);\n Sprite3(dc0,0,0,0,<1>);\n}\n\nU0 Shadow()\n{//The shadow image b.s. Any is plausible.\n dc0=DCAlias(gr.dc2,Fs);\n dc1=DCAlias(gr.dc2,Fs);\n DCDepthBufAlloc(dc0);\n dc1->depth_buf=dc0->depth_buf;\n\n theta=0;\n phi=0;\n omega=0;\n s=1.5;\n\n SettingsPush; //See SettingsPush\n WinMax;\n Fs->draw_it=&DrawIt;\n\n while (!ScanChar) {\n theta+=2*pi/70;\n phi+=2*pi/90;\n omega+=2*pi/110;\n Sleep(20);\n }\n SettingsPop;\n DCDel(dc0);\n dc1->depth_buf=NULL;\n DCDel(dc1);\n}\n\nShadow;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\TOSHolySpirit-TOS-Home.html
// Date: unknown-date
// Language: HolyC
#help_index "Misc/TOS/God;God/TOS"
U8 *URLPercentSpaces(U8 *src)
{
U8 buf[2048],*dst=buf;
while (*src) {
if (*src==CH_SPACE) {
*dst++='%';
*dst++='2';
*dst++='0';
src++;
} else
*dst++=*src++;
}
*dst=0;
return StrNew(buf);
}
U8 *URLPlusSpaces(U8 *src)
{
U8 buf[2048],*dst=buf;
while (*src) {
if (*src==CH_SPACE) {
*dst++='+';
src++;
} else
*dst++=*src++;
}
*dst=0;
return StrNew(buf);
}
I64 ExtDecFromHex(U8 *st,I64 digits)
{
I64 res=0,ch;
while (digits) {
if (!(ch=*st++))
break;
if ('0'<=ch<='9') {
res=10*res+ch-'0';
digits--;
}
}
return res;
}
U0 TOSBookLines(U8 *book_filename,I64 book_lines,U8 *st,I64 num_lines,
I64 radix,Bool modulo,Bool plus_one)
{//Radix<0 means extract N dec digits from hex.
CDoc *doc_out,*doc_in;
CDocEntry *doc_e;
I64 i,start;
U8 *verse;
if (*st && (doc_out=DocPut)) {
if (radix<0)
i=ExtDecFromHex(st,-radix);
else
i=Str2I64(st,radix);
if (radix<0)
DocPrint(doc_out,"'%s'-->(Taking first %d decimal digits)",st,-radix);
else if (radix==16)
DocPrint(doc_out,"0x%s-->",st);
if (modulo) {
DocPrint(doc_out,"(%d remainder when divided by %d)",
i,book_lines-(num_lines-1));
start=i%(book_lines-(num_lines-1));
} else {
if (radix>=0 || plus_one)
DocPrint(doc_out,"%d",i);
start=i;
}
if (plus_one) {
start++;
DocPrint(doc_out,"+1");
}
DocPrint(doc_out,"-->Line:%d\n",start);
if (StrMatch("NumBible",book_filename)) {
verse=BibleLine2Verse(start);
DocPrint(doc_out,"KingJamesBible (%s)\n\nGod says...\n$RED$",verse);
Free(verse);
}
doc_in=DocNew;
BookLines(doc_in,start,num_lines,book_filename);
while (TRUE) {//Del leading blanks
doc_e=doc_in->head.next;
if (doc_e==doc_in)
break;
else {
if (doc_e->type_u8==DOCT_NEW_LINE)
DocEntryDel(doc_in,doc_e);
else
break;
}
}
while (TRUE) {//Del trailing blanks
doc_e=doc_in->cur_entry->last;
if (doc_e==doc_in)
break;
else {
if (doc_e->type_u8==DOCT_NEW_LINE)
DocEntryDel(doc_in,doc_e);
else
break;
}
}
DocPrint(doc_in,"$FG$\n");
DocInsDoc(doc_out,doc_in);
DocDel(doc_in);
}
}
public U0 GodBooksPassageU32(U32 rand_u32,U8 *files_find_mask,
U8 *file_mask="*",I64 len=512,I64 verbosity=GBP_MEDIUM)
{//Make God pick a book passage. Holy Spirit Instructions
CDirEntry *tmpde=FilesFind(files_find_mask,
FUF_RECURSE|FUF_JUST_FILES|FUF_JUST_TXT),
*tmpde1,*tmpde2,**tmpde3;
I64 i=0;
U8 *st,*st2=NULL;
tmpde3=&tmpde2;
tmpde2=NULL;
while (tmpde) {
tmpde1=tmpde->next;
if (WildMatch(tmpde->full_name,file_mask)) {
*tmpde3=tmpde;
tmpde3=&tmpde->next;
} else
DirEntryDel(tmpde);
tmpde=tmpde1;
}
*tmpde3=NULL;
if (tmpde=tmpde2) {
while (tmpde) {
st=FileRead(tmpde->full_name);
tmpde->user_data=StrLen(st);
if (verbosity==GBP_LONG)
"%08X-",i;
if (tmpde->user_data>=len)
i+=tmpde->user_data+1-len;
if (verbosity==GBP_LONG)
"%08X:$LK,\"%s\",A=\"FI:%s\"$\n",
i-1,tmpde->full_name+2,tmpde->full_name;
Free(st);
tmpde=tmpde->next;
}
if (verbosity==GBP_LONG)
'\n';
if (verbosity>=GBP_MEDIUM)
"%08X*%08X",rand_u32,i;
i*=rand_u32;
if (verbosity>=GBP_MEDIUM)
"=%08X.%08X\n",i.u32[1],i.u32[0];
i=i.u32[1];
tmpde=tmpde2;
while (tmpde) {
if (!st2 && tmpde->user_data>=len) {
i-=tmpde->user_data+1-len;
if (i<0) {
st=FileRead(tmpde->full_name);
st2=st+(tmpde->user_data+1-len)+i;
st2[len]=0;
"%s\nGod says...\n$RED$%s$FG$\n",tmpde->full_name,st2;
Free(st);
}
}
tmpde=tmpde->next;
}
DirTreeDel(tmpde2);
}
}
U0 GodVideoDigits(U8 *title,U8 *webpage,U8 *rnd,I64 digits,U8 *filename)
{
U8 *st,*st2;
CGodVideoForm *gvf=CAlloc(sizeof(CGodVideoForm));
I64 i=ExtDecFromHex(rnd,digits);
if (!i) i=Round(10`digits);
if (st=DocLineRead(filename,i*2+1)) {
StrCpy(gvf->title,st);
Free(st);
if (!(st=DocLineRead(filename,i*2+2))||!*st) {
Free(st);
if (DocForm(gvf) && *gvf->serial) {
if (gvf->min || gvf->sec)
st=MStrPrint("%s&hl=enUS&start=%d",
gvf->serial,gvf->min*60+gvf->sec);
else
st=StrNew(gvf->serial);
DocLineWrite(filename,i*2+2,st);
} else
st=NULL;
}
"'%s'-->(Taking first %d decimal digits) #%02d\n",rnd,digits,i;
if (StrIMatch("Metallica",filename)) {
st2=URLPlusSpaces(gvf->title+3);
"God's response:\n"
"$TX,\"%s\",HTML=\"%s\"$\n"
"$TX,\"%s (Lyrics)\","
"HTML=\"http://lmgtfy.com/?q=Metallica+lyrics+%s\"$\n",
title,webpage,gvf->title,st2;
Free(st2);
} else
"God's response:\n"
"$TX,\"%s\",HTML=\"%s\"$\n"
"#%s\n",title,webpage,gvf->title;
if (st) {
"$HC,\"<object width=\\\"640\\\" height=\\\"520\\\">"
"<param name=\\\"movie\\\" "
"value=\\\"http://www.youtube.com/v/%s\\\"></param><param "
"name=\\\"allowscriptaccess\\\" "
"value=\\\"always\\\"></param><embed "
"src=\\\"http://www.youtube.com/v/%s\\\" "
"type=\\\"application/x-shockwave-flash\\\" "
"allowscriptaccess=\\\"always\\\" "
"width=\\\"640\\\" height=\\\"520\\\">"
"</embed></object>\"$\n",st,st;
Free(st);
}
}
Free(gvf);
}
U0 GodVideoU32(U32 rand_u32,U8 *filename)
{
U8 *st,*st2;
I64 i,num;
Bool old_silent=Silent;
num=LineRep(filename,"-S")/2;
Silent(old_silent);
if (num) {
i=rand_u32%num;
if (st=DocLineRead(filename,i*2+1)) {
st2=DocLineRead(filename,i*2+2);
PutF
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\TOSHolySpirit-TOS-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"Misc/TOS/God;God/TOS\"\n\nU8 *URLPercentSpaces(U8 *src)\n{\n U8 buf[2048],*dst=buf;\n while (*src) {\n if (*src==CH_SPACE) {\n *dst++='%';\n *dst++='2';\n *dst++='0';\n src++;\n } else\n *dst++=*src++;\n }\n *dst=0;\n return StrNew(buf);\n}\n\nU8 *URLPlusSpaces(U8 *src)\n{\n U8 buf[2048],*dst=buf;\n while (*src) {\n if (*src==CH_SPACE) {\n *dst++='+';\n src++;\n } else\n *dst++=*src++;\n }\n *dst=0;\n return StrNew(buf);\n}\n\nI64 ExtDecFromHex(U8 *st,I64 digits)\n{\n I64 res=0,ch;\n while (digits) {\n if (!(ch=*st++))\n break;\n if ('0'<=ch<='9') {\n res=10*res+ch-'0';\n digits--;\n }\n }\n return res;\n}\n\nU0 TOSBookLines(U8 *book_filename,I64 book_lines,U8 *st,I64 num_lines,\n I64 radix,Bool modulo,Bool plus_one)\n{//Radix<0 means extract N dec digits from hex.\n CDoc *doc_out,*doc_in;\n CDocEntry *doc_e;\n I64 i,start;\n U8 *verse;\n if (*st && (doc_out=DocPut)) {\n if (radix<0)\n i=ExtDecFromHex(st,-radix);\n else\n i=Str2I64(st,radix);\n if (radix<0)\n DocPrint(doc_out,\"'%s'-->(Taking first %d decimal digits)\",st,-radix);\n else if (radix==16)\n DocPrint(doc_out,\"0x%s-->\",st);\n if (modulo) {\n DocPrint(doc_out,\"(%d remainder when divided by %d)\",\n i,book_lines-(num_lines-1));\n start=i%(book_lines-(num_lines-1));\n } else {\n if (radix>=0 || plus_one)\n DocPrint(doc_out,\"%d\",i);\n start=i;\n }\n if (plus_one) {\n start++;\n DocPrint(doc_out,\"+1\");\n }\n DocPrint(doc_out,\"-->Line:%d\\n\",start);\n\n if (StrMatch(\"NumBible\",book_filename)) {\n verse=BibleLine2Verse(start);\n DocPrint(doc_out,\"KingJamesBible (%s)\\n\\nGod says...\\n$RED$\",verse);\n Free(verse);\n }\n\n doc_in=DocNew;\n BookLines(doc_in,start,num_lines,book_filename);\n while (TRUE) {//Del leading blanks\n doc_e=doc_in->head.next;\n if (doc_e==doc_in)\n break;\n else {\n if (doc_e->type_u8==DOCT_NEW_LINE)\n DocEntryDel(doc_in,doc_e);\n else\n break;\n }\n }\n while (TRUE) {//Del trailing blanks\n doc_e=doc_in->cur_entry->last;\n if (doc_e==doc_in)\n break;\n else {\n if (doc_e->type_u8==DOCT_NEW_LINE)\n DocEntryDel(doc_in,doc_e);\n else\n break;\n }\n }\n DocPrint(doc_in,\"$FG$\\n\");\n DocInsDoc(doc_out,doc_in);\n DocDel(doc_in);\n }\n}\n\npublic U0 GodBooksPassageU32(U32 rand_u32,U8 *files_find_mask,\n U8 *file_mask=\"*\",I64 len=512,I64 verbosity=GBP_MEDIUM)\n{//Make God pick a book passage. Holy Spirit Instructions\n CDirEntry *tmpde=FilesFind(files_find_mask,\n FUF_RECURSE|FUF_JUST_FILES|FUF_JUST_TXT),\n *tmpde1,*tmpde2,**tmpde3;\n I64 i=0;\n U8 *st,*st2=NULL;\n\n tmpde3=&tmpde2;\n tmpde2=NULL;\n while (tmpde) {\n tmpde1=tmpde->next;\n if (WildMatch(tmpde->full_name,file_mask)) {\n *tmpde3=tmpde;\n tmpde3=&tmpde->next;\n } else\n DirEntryDel(tmpde);\n tmpde=tmpde1;\n }\n *tmpde3=NULL;\n\n if (tmpde=tmpde2) {\n while (tmpde) {\n st=FileRead(tmpde->full_name);\n tmpde->user_data=StrLen(st);\n if (verbosity==GBP_LONG)\n \"%08X-\",i;\n if (tmpde->user_data>=len)\n i+=tmpde->user_data+1-len;\n if (verbosity==GBP_LONG)\n \"%08X:$LK,\\\"%s\\\",A=\\\"FI:%s\\\"$\\n\",\n i-1,tmpde->full_name+2,tmpde->full_name;\n Free(st);\n tmpde=tmpde->next;\n }\n if (verbosity==GBP_LONG)\n '\\n';\n if (verbosity>=GBP_MEDIUM)\n \"%08X*%08X\",rand_u32,i;\n i*=rand_u32;\n if (verbosity>=GBP_MEDIUM)\n \"=%08X.%08X\\n\",i.u32[1],i.u32[0];\n i=i.u32[1];\n\n tmpde=tmpde2;\n while (tmpde) {\n if (!st2 && tmpde->user_data>=len) {\n i-=tmpde->user_data+1-len;\n if (i<0) {\n st=FileRead(tmpde->full_name);\n st2=st+(tmpde->user_data+1-len)+i;\n st2[len]=0;\n \"%s\\nGod says...\\n$RED$%s$FG$\\n\",tmpde->full_name,st2;\n Free(st);\n }\n }\n tmpde=tmpde->next;\n }\n DirTreeDel(tmpde2);\n }\n}\n\nU0 GodVideoDigits(U8 *title,U8 *webpage,U8 *rnd,I64 digits,U8 *filename)\n{\n U8 *st,*st2;\n CGodVideoForm *gvf=CAlloc(sizeof(CGodVideoForm));\n I64 i=ExtDecFromHex(rnd,digits);\n if (!i) i=Round(10`digits);\n if (st=DocLineRead(filename,i*2+1)) {\n StrCpy(gvf->title,st);\n Free(st);\n if (!(st=DocLineRead(filename,i*2+2))||!*st) {\n Free(st);\n if (DocForm(gvf) && *gvf->serial) {\n if (gvf->min || gvf->sec)\n st=MStrPrint(\"%s&hl=enUS&start=%d\",\n gvf->serial,gvf->min*60+gvf->sec);\n else\n st=StrNew(gvf->serial);\n DocLineWrite(filename,i*2+2,st);\n } else\n st=NULL;\n }\n \"'%s'-->(Taking first %d decimal digits) #%02d\\n\",rnd,digits,i;\n if (StrIMatch(\"Metallica\",filename)) {\n st2=URLPlusSpaces(gvf->title+3);\n \"God's response:\\n\"\n \"$TX,\\\"%s\\\",HTML=\\\"%s\\\"$\\n\"\n \"$TX,\\\"%s (Lyrics)\\\",\"\n \"HTML=\\\"http://lmgtfy.com/?q=Metallica+lyrics+%s\\\"$\\n\",\n title,webpage,gvf->title,st2;\n Free(st2);\n } else\n \"God's response:\\n\"\n \"$TX,\\\"%s\\\",HTML=\\\"%s\\\"$\\n\"\n \"#%s\\n\",title,webpage,gvf->title;\n if (st) {\n \"$HC,\\\"<object width=\\\\\\\"640\\\\\\\" height=\\\\\\\"520\\\\\\\">\"\n \"<param name=\\\\\\\"movie\\\\\\\" \"\n \"value=\\\\\\\"http://www.youtube.com/v/%s\\\\\\\"></param><param \"\n \"name=\\\\\\\"allowscriptaccess\\\\\\\" \"\n \"value=\\\\\\\"always\\\\\\\"></param><embed \"\n \"src=\\\\\\\"http://www.youtube.com/v/%s\\\\\\\" \"\n \"type=\\\\\\\"application/x-shockwave-flash\\\\\\\" \"\n \"allowscriptaccess=\\\\\\\"always\\\\\\\" \"\n \"width=\\\\\\\"640\\\\\\\" height=\\\\\\\"520\\\\\\\">\"\n \"</embed></object>\\\"$\\n\",st,st;\n Free(st);\n }\n }\n Free(gvf);\n}\n\nU0 GodVideoU32(U32 rand_u32,U8 *filename)\n{\n U8 *st,*st2;\n I64 i,num;\n Bool old_silent=Silent;\n num=LineRep(filename,\"-S\")/2;\n Silent(old_silent);\n if (num) {\n i=rand_u32%num;\n if (st=DocLineRead(filename,i*2+1)) {\n st2=DocLineRead(filename,i*2+2);\n PutF"
}
]
}
|
// Source: D:\TempleOS-Projects\html\Luthur-Sup1-Sup1Blog-Home.html
// Date: unknown-date
// Language: HolyC
Martin Luthur
1. When our Lord and Master Jesus Christ said, "Repent" ( Matthew 4:17 ), he
willed the entire life of believers to be one of repentance.
2. This word cannot be understood as referring to the sacrament of penance, that
is, confession and satisfaction, as administered by the clergy.
3. Yet it does not mean solely inner repentance; such inner repentance is
worthless unless it produces various outward mortification of the flesh.
4. The penalty of sin remains as long as the hatred of self (that is, true inner
repentance), namely till our entrance into the kingdom of heaven.
5. The pope neither desires nor is able to remit any penalties except those
imposed by his own authority or that of the canons.
6. The pope cannot remit any guilt, except by declaring and showing that it has
been remitted by God; or, to be sure, by remitting guilt in cases reserved to
his judgment. If his right to grant remission in these cases were disregarded,
the guilt would certainly remain unforgiven.
7. God remits guilt to no one unless at the same time he humbles him in all
things and makes him submissive to the vicar, the priest.
8. The penitential canons are imposed only on the living, and, according to the
canons themselves, nothing should be imposed on the dying.
9. Therefore the Holy Spirit through the pope is kind to us insofar as the pope
in his decrees always makes exception of the article of death and of necessity.
10. Those priests act ignorantly and wickedly who, in the case of the dying,
reserve canonical penalties for purgatory.
11. Those tares of changing the canonical penalty to the penalty of purgatory
were evidently sown while the bishops slept ( Matthew 13:25 ).
12. In former times canonical penalties were imposed, not after, but before
absolution, as tests of true contrition.
13. The dying are freed by death from all penalties, are already dead as far as
the canon laws are concerned, and have a right to be released from them.
14. Imperfect piety or love on the part of the dying person necessarily brings
with it great fear; and the smaller the love, the greater the fear.
15. This fear or horror is sufficient in itself, to say nothing of other things,
to constitute the penalty of purgatory, since it is very near to the horror of
despair.
16. Hell, purgatory, and heaven seem to differ the same as despair, fear, and
assurance of salvation.
17. It seems as though for the souls in purgatory fear should necessarily
decrease and love increase.
18. Furthermore, it does not seem proved, either by reason or by Scripture, that
souls in purgatory are outside the state of merit, that is, unable to grow in
love.
19. Nor does it seem proved that souls in purgatory, at least not all of them,
are certain and assured of their own salvation, even if we ourselves may be
entirely certain of it.
20. Therefore the pope, when he uses the words "plenary remission of all
penalties," does not actually mean "all penalties," but only those imposed by
himself.
21. Thus those indulgence preachers are in error who say that a man is absolved
from every penalty and saved by papal indulgences.
22. As a matter of fact, the pope remits to souls in purgatory no penalty which,
according to canon law, they should have paid in this life.
23. If remission of all penalties whatsoever could be granted to anyone at all,
certainly it would be granted only to the most perfect, that is, to very few.
24. For this reason most people are necessarily deceived by that indiscriminate
and high-sounding promise of release from penalty.
25. That power which the pope has in general over purgatory corresponds to the
power which any bishop or curate has in a particular way in his own diocese and
parish.
26. The pope does very well when he grants remission to souls in purgatory, not
by the power of the keys, which he does not have, but by way of intercession for
them.
27. They preach only human doctrines who say that as soon as the money clinks
into the money chest, the soul flies out of purgatory.
28. It is certain that when money clinks in the money chest, greed and avarice
can be increased; but when the church intercedes, the result is in the hands of
God alone.
29. Who knows whether all souls in purgatory wish to be redeemed, since we have
exceptions in St. Severinus and St. Paschal, as related in a legend.
30. No one is sure of the integrity of his own contrition, much less of having
received plenary remission.
31. The man who actually buys indulgences is as rare as he who is really
penitent; indeed, he is exceedingly rare.
32. Those who believe that they can be certain of their salvation because they
have indulgence letters will be eternally damned, together with their teachers.
33. Men must especially be on guard against those who say that the pope's
pardons are that inestimable gift of God by which man is reconciled to him.
34. For the graces of indulgences are concerned only with the penalties of
sacramental satisfaction established by man.
35. They who teach that contrition is not necessary on the part of those who
intend to buy souls out of purgatory or to buy confessional privileges preach
unchristian doctrine.
36. Any truly repentant Christian has a right to full remission of penalty and
guilt, even without indulgence letters.
37. Any true Christian, whether living or dead, participates in all the
blessings of Christ and the church; and this is granted him by God, even without
indulgence letters.
38. Nevertheless, papal remission and blessing are by no means to be
disregarded, for they are, as I have said (Thesis 6), the proclamation of the
divine remission.
39. It is very difficult, even for the most learned theologians, at one and the
same time to commend to the people the bounty of indulgences and the need of
true contrition.
40. A Christian who is truly contrite seeks and loves to pay penalties for his
sins; the bounty of indulgences, however, relaxes penalties and cau
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Luthur-Sup1-Sup1Blog-Home.html\n// Date: unknown-date\n// Language: HolyC\n\nMartin Luthur\n\n1. When our Lord and Master Jesus Christ said, \"Repent\" ( Matthew 4:17 ), he \nwilled the entire life of believers to be one of repentance.\n\n2. This word cannot be understood as referring to the sacrament of penance, that \nis, confession and satisfaction, as administered by the clergy.\n\n3. Yet it does not mean solely inner repentance; such inner repentance is \nworthless unless it produces various outward mortification of the flesh.\n\n4. The penalty of sin remains as long as the hatred of self (that is, true inner \nrepentance), namely till our entrance into the kingdom of heaven.\n\n5. The pope neither desires nor is able to remit any penalties except those \nimposed by his own authority or that of the canons.\n\n6. The pope cannot remit any guilt, except by declaring and showing that it has \nbeen remitted by God; or, to be sure, by remitting guilt in cases reserved to \nhis judgment. If his right to grant remission in these cases were disregarded, \nthe guilt would certainly remain unforgiven.\n\n7. God remits guilt to no one unless at the same time he humbles him in all \nthings and makes him submissive to the vicar, the priest.\n\n8. The penitential canons are imposed only on the living, and, according to the \ncanons themselves, nothing should be imposed on the dying.\n\n9. Therefore the Holy Spirit through the pope is kind to us insofar as the pope \nin his decrees always makes exception of the article of death and of necessity.\n\n10. Those priests act ignorantly and wickedly who, in the case of the dying, \nreserve canonical penalties for purgatory.\n\n11. Those tares of changing the canonical penalty to the penalty of purgatory \nwere evidently sown while the bishops slept ( Matthew 13:25 ).\n\n12. In former times canonical penalties were imposed, not after, but before \nabsolution, as tests of true contrition.\n\n13. The dying are freed by death from all penalties, are already dead as far as \nthe canon laws are concerned, and have a right to be released from them.\n\n14. Imperfect piety or love on the part of the dying person necessarily brings \nwith it great fear; and the smaller the love, the greater the fear.\n\n15. This fear or horror is sufficient in itself, to say nothing of other things, \nto constitute the penalty of purgatory, since it is very near to the horror of \ndespair.\n\n16. Hell, purgatory, and heaven seem to differ the same as despair, fear, and \nassurance of salvation.\n\n17. It seems as though for the souls in purgatory fear should necessarily \ndecrease and love increase.\n\n18. Furthermore, it does not seem proved, either by reason or by Scripture, that \nsouls in purgatory are outside the state of merit, that is, unable to grow in \nlove.\n\n19. Nor does it seem proved that souls in purgatory, at least not all of them, \nare certain and assured of their own salvation, even if we ourselves may be \nentirely certain of it.\n\n20. Therefore the pope, when he uses the words \"plenary remission of all \npenalties,\" does not actually mean \"all penalties,\" but only those imposed by \nhimself.\n\n21. Thus those indulgence preachers are in error who say that a man is absolved \nfrom every penalty and saved by papal indulgences.\n\n22. As a matter of fact, the pope remits to souls in purgatory no penalty which, \naccording to canon law, they should have paid in this life.\n\n23. If remission of all penalties whatsoever could be granted to anyone at all, \ncertainly it would be granted only to the most perfect, that is, to very few.\n\n24. For this reason most people are necessarily deceived by that indiscriminate \nand high-sounding promise of release from penalty.\n\n25. That power which the pope has in general over purgatory corresponds to the \npower which any bishop or curate has in a particular way in his own diocese and \nparish.\n\n26. The pope does very well when he grants remission to souls in purgatory, not \nby the power of the keys, which he does not have, but by way of intercession for \nthem.\n\n27. They preach only human doctrines who say that as soon as the money clinks \ninto the money chest, the soul flies out of purgatory.\n\n28. It is certain that when money clinks in the money chest, greed and avarice \ncan be increased; but when the church intercedes, the result is in the hands of \nGod alone.\n\n29. Who knows whether all souls in purgatory wish to be redeemed, since we have \nexceptions in St. Severinus and St. Paschal, as related in a legend.\n\n30. No one is sure of the integrity of his own contrition, much less of having \nreceived plenary remission.\n\n31. The man who actually buys indulgences is as rare as he who is really \npenitent; indeed, he is exceedingly rare.\n\n32. Those who believe that they can be certain of their salvation because they \nhave indulgence letters will be eternally damned, together with their teachers.\n\n33. Men must especially be on guard against those who say that the pope's \npardons are that inestimable gift of God by which man is reconciled to him.\n\n34. For the graces of indulgences are concerned only with the penalties of \nsacramental satisfaction established by man.\n\n35. They who teach that contrition is not necessary on the part of those who \nintend to buy souls out of purgatory or to buy confessional privileges preach \nunchristian doctrine.\n\n36. Any truly repentant Christian has a right to full remission of penalty and \nguilt, even without indulgence letters.\n\n37. Any true Christian, whether living or dead, participates in all the \nblessings of Christ and the church; and this is granted him by God, even without \nindulgence letters.\n\n38. Nevertheless, papal remission and blessing are by no means to be \ndisregarded, for they are, as I have said (Thesis 6), the proclamation of the \ndivine remission.\n\n39. It is very difficult, even for the most learned theologians, at one and the \nsame time to commend to the people the bounty of indulgences and the need of \ntrue contrition.\n\n40. A Christian who is truly contrite seeks and loves to pay penalties for his \nsins; the bounty of indulgences, however, relaxes penalties and cau"
}
]
}
|
// Source: D:\TempleOS-Projects\html\KDate-Kernel.html
// Date: unknown-date
// Language: HolyC
//See ::/Doc/TimeDate.DD
U16 mon_start_days1[12]={
0,31,59,90,120,151,181,212,243,273,304,334};
U16 mon_start_days2[12]={
0,31,60,91,121,152,182,213,244,274,305,335};
I64 YearStartDate(I64 year)
{//32-bit day since AD 0, given year number.
I64 y1=year-1,yd4000=y1/4000,yd400=y1/400,yd100=y1/100,yd4=y1/4;
return year*365+yd4-yd100+yd400-yd4000;
}
CDate Struct2Date(CDateStruct *_ds)
{//Cvt CDateStruct to CDate.
CDate cdt;
I64 i1,i2;
i1=YearStartDate(_ds->year);
i2=YearStartDate(_ds->year+1);
if (i2-i1==365)
i1+=mon_start_days1[_ds->mon-1];
else
i1+=mon_start_days2[_ds->mon-1];
cdt.date=i1+_ds->day_of_mon-1;
cdt.time=(_ds->sec10000+100*(_ds->sec100+100*(_ds->sec
+60*(_ds->min+60*_ds->hour))))<<21/(15*15*3*625);
return cdt;
}
I64 DayOfWeek(I64 i)
{//Day of week, given 32-bit day since AD 0.
i+=CDATE_BASE_DAY_OF_WEEK;
if (i>=0)
return i % 7;
else
return 6-(6-i)%7;
}
U0 Date2Struct(CDateStruct *_ds,CDate cdt)
{//Cvt CDate to CDateStruct.
I64 i,k,date=cdt.date;
_ds->day_of_week=DayOfWeek(date);
_ds->year=(date+1)*100000/CDATE_YEAR_DAYS_INT;
i=YearStartDate(_ds->year);
while (i>date) {
_ds->year--;
i=YearStartDate(_ds->year);
}
date-=i;
if (YearStartDate(_ds->year+1)-i==365) {
k=0;
while (date>=mon_start_days1[k+1] && k<11)
k++;
date-=mon_start_days1[k];
} else {
k=0;
while (date>=mon_start_days2[k+1] && k<11)
k++;
date-=mon_start_days2[k];
}
_ds->mon=k+1;
_ds->day_of_mon=date+1;
k=(625*15*15*3*cdt.time)>>21+1;
_ds->sec10000=ModU64(&k,100);
_ds->sec100=ModU64(&k,100);
_ds->sec=ModU64(&k,60);
_ds->min=ModU64(&k,60);
_ds->hour =k;
}
I64 FirstDayOfMon(I64 i)
{//First day of month, given 32-bit day since AD 0.
CDateStruct ds;
CDate cdt=0;
cdt.date=i;
Date2Struct(&ds,cdt);
ds.day_of_mon=1;
cdt=Struct2Date(&ds);
return cdt.date;
}
I64 LastDayOfMon(I64 i)
{//Last day of month, given 32-bit day since AD 0.
CDateStruct ds;
CDate cdt=0;
cdt.date=i;
Date2Struct(&ds,cdt);
ds.mon++;
if (ds.mon==13) {
ds.mon=0;
ds.year++;
}
ds.day_of_mon=1;
cdt=Struct2Date(&ds);
return cdt.date-1;
}
I64 FirstDayOfYear(I64 i)
{//First day of year, given 32-bit day since AD 0.
CDateStruct ds;
CDate cdt=0;
cdt.date=i;
Date2Struct(&ds,cdt);
ds.day_of_mon=1;
ds.mon=1;
cdt=Struct2Date(&ds);
return cdt.date;
}
I64 LastDayOfYear(I64 i)
{//Last day of year, given 32-bit day since AD 0.
CDateStruct ds;
CDate cdt=0;
cdt.date=i;
Date2Struct(&ds,cdt);
ds.day_of_mon=1;
ds.mon=1;
ds.year++;
cdt=Struct2Date(&ds);
return cdt.date-1;
}
I64 Bcd2Bin(U64 b)
{
I64 i,res=0;
for (i=0;i<16;i++) {
res=res*10+b>>60;
b<<=4;
}
return res;
}
U0 NowDateTimeStruct(CDateStruct *_ds)
{
I64 i;
U8 *b=_ds;
Bool is_bcd;
MemSet(_ds,0,sizeof(CDateStruct));
PUSHFD
CLI
while (LBts(&sys_semas[SEMA_SYS_DATE],0))
PAUSE
OutU8(0x70,0x0A);
do {
while (InU8(0x71) & 0x80)
PAUSE
OutU8(0x70,0);
b[2]=InU8(0x71);
OutU8(0x70,2);
b[3]=InU8(0x71);
OutU8(0x70,4);
b[4]=InU8(0x71);
OutU8(0x70,6);
b[5]=InU8(0x71);
OutU8(0x70,7);
b[6]=InU8(0x71);
OutU8(0x70,8);
b[7]=InU8(0x71);
OutU8(0x70,9);
b[8]=InU8(0x71);
OutU8(0x70,0x0A);
} while (InU8(0x71) & 0x80);
OutU8(0x70,0x0B);
if (InU8(0x71) & 4)
is_bcd=FALSE;
else
is_bcd=TRUE;
LBtr(&sys_semas[SEMA_SYS_DATE],0);
POPFD
if (is_bcd)
for (i=2;i<9;i++)
b[i]=Bcd2Bin(b[i]);
if (_ds->year>255) _ds->year=255;
_ds->year+=2000;
if (_ds->mon>12) _ds->mon=12;
if (_ds->day_of_mon>31) _ds->day_of_mon=31;
if (_ds->day_of_week>6) _ds->day_of_week=6;
if (_ds->hour>23) _ds->hour=23;
if (_ds->min>59) _ds->min=59;
if (_ds->sec>59) _ds->sec=59;
}
CDate Now()
{//Current datetime.
CDateStruct ds;
NowDateTimeStruct(&ds);
return Struct2Date(&ds)-local_time_offset;
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\KDate-Kernel.html\n// Date: unknown-date\n// Language: HolyC\n\n//See ::/Doc/TimeDate.DD\n\nU16 mon_start_days1[12]={\n0,31,59,90,120,151,181,212,243,273,304,334};\nU16 mon_start_days2[12]={\n0,31,60,91,121,152,182,213,244,274,305,335};\n\nI64 YearStartDate(I64 year)\n{//32-bit day since AD 0, given year number.\n I64 y1=year-1,yd4000=y1/4000,yd400=y1/400,yd100=y1/100,yd4=y1/4;\n return year*365+yd4-yd100+yd400-yd4000;\n}\n\nCDate Struct2Date(CDateStruct *_ds)\n{//Cvt CDateStruct to CDate.\n CDate cdt;\n I64 i1,i2;\n i1=YearStartDate(_ds->year);\n i2=YearStartDate(_ds->year+1);\n if (i2-i1==365)\n i1+=mon_start_days1[_ds->mon-1];\n else\n i1+=mon_start_days2[_ds->mon-1];\n cdt.date=i1+_ds->day_of_mon-1;\n cdt.time=(_ds->sec10000+100*(_ds->sec100+100*(_ds->sec\n +60*(_ds->min+60*_ds->hour))))<<21/(15*15*3*625);\n return cdt;\n}\n\nI64 DayOfWeek(I64 i)\n{//Day of week, given 32-bit day since AD 0.\n i+=CDATE_BASE_DAY_OF_WEEK;\n if (i>=0)\n return i % 7;\n else\n return 6-(6-i)%7;\n}\n\nU0 Date2Struct(CDateStruct *_ds,CDate cdt)\n{//Cvt CDate to CDateStruct.\n I64 i,k,date=cdt.date;\n _ds->day_of_week=DayOfWeek(date);\n _ds->year=(date+1)*100000/CDATE_YEAR_DAYS_INT;\n i=YearStartDate(_ds->year);\n while (i>date) {\n _ds->year--;\n i=YearStartDate(_ds->year);\n }\n date-=i;\n if (YearStartDate(_ds->year+1)-i==365) {\n k=0;\n while (date>=mon_start_days1[k+1] && k<11)\n k++;\n date-=mon_start_days1[k];\n } else {\n k=0;\n while (date>=mon_start_days2[k+1] && k<11)\n k++;\n date-=mon_start_days2[k];\n }\n _ds->mon=k+1;\n _ds->day_of_mon=date+1;\n k=(625*15*15*3*cdt.time)>>21+1;\n _ds->sec10000=ModU64(&k,100);\n _ds->sec100=ModU64(&k,100);\n _ds->sec=ModU64(&k,60);\n _ds->min=ModU64(&k,60);\n _ds->hour =k;\n}\n\nI64 FirstDayOfMon(I64 i)\n{//First day of month, given 32-bit day since AD 0.\n CDateStruct ds;\n CDate cdt=0;\n cdt.date=i;\n Date2Struct(&ds,cdt);\n ds.day_of_mon=1;\n cdt=Struct2Date(&ds);\n return cdt.date;\n}\n\nI64 LastDayOfMon(I64 i)\n{//Last day of month, given 32-bit day since AD 0.\n CDateStruct ds;\n CDate cdt=0;\n cdt.date=i;\n Date2Struct(&ds,cdt);\n ds.mon++;\n if (ds.mon==13) {\n ds.mon=0;\n ds.year++;\n }\n ds.day_of_mon=1;\n cdt=Struct2Date(&ds);\n return cdt.date-1;\n}\n\nI64 FirstDayOfYear(I64 i)\n{//First day of year, given 32-bit day since AD 0.\n CDateStruct ds;\n CDate cdt=0;\n cdt.date=i;\n Date2Struct(&ds,cdt);\n ds.day_of_mon=1;\n ds.mon=1;\n cdt=Struct2Date(&ds);\n return cdt.date;\n}\n\nI64 LastDayOfYear(I64 i)\n{//Last day of year, given 32-bit day since AD 0.\n CDateStruct ds;\n CDate cdt=0;\n cdt.date=i;\n Date2Struct(&ds,cdt);\n ds.day_of_mon=1;\n ds.mon=1;\n ds.year++;\n cdt=Struct2Date(&ds);\n return cdt.date-1;\n}\n\nI64 Bcd2Bin(U64 b)\n{\n I64 i,res=0;\n for (i=0;i<16;i++) {\n res=res*10+b>>60;\n b<<=4;\n }\n return res;\n}\n\nU0 NowDateTimeStruct(CDateStruct *_ds)\n{\n I64 i;\n U8 *b=_ds;\n Bool is_bcd;\n\n MemSet(_ds,0,sizeof(CDateStruct));\n PUSHFD\n CLI\n while (LBts(&sys_semas[SEMA_SYS_DATE],0))\n PAUSE\n\n OutU8(0x70,0x0A);\n do {\n while (InU8(0x71) & 0x80)\n PAUSE\n\n OutU8(0x70,0);\n b[2]=InU8(0x71);\n OutU8(0x70,2);\n b[3]=InU8(0x71);\n OutU8(0x70,4);\n b[4]=InU8(0x71);\n\n OutU8(0x70,6);\n b[5]=InU8(0x71);\n OutU8(0x70,7);\n b[6]=InU8(0x71);\n OutU8(0x70,8);\n b[7]=InU8(0x71);\n OutU8(0x70,9);\n b[8]=InU8(0x71);\n\n OutU8(0x70,0x0A);\n } while (InU8(0x71) & 0x80);\n\n OutU8(0x70,0x0B);\n if (InU8(0x71) & 4)\n is_bcd=FALSE;\n else\n is_bcd=TRUE;\n\n LBtr(&sys_semas[SEMA_SYS_DATE],0);\n POPFD\n if (is_bcd)\n for (i=2;i<9;i++)\n b[i]=Bcd2Bin(b[i]);\n\n if (_ds->year>255) _ds->year=255;\n _ds->year+=2000;\n if (_ds->mon>12) _ds->mon=12;\n if (_ds->day_of_mon>31) _ds->day_of_mon=31;\n if (_ds->day_of_week>6) _ds->day_of_week=6;\n if (_ds->hour>23) _ds->hour=23;\n if (_ds->min>59) _ds->min=59;\n if (_ds->sec>59) _ds->sec=59;\n}\n\nCDate Now()\n{//Current datetime.\n CDateStruct ds;\n NowDateTimeStruct(&ds);\n return Struct2Date(&ds)-local_time_offset;\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\KMisc-Kernel.html
// Date: unknown-date
// Language: HolyC
U0 PortNop()
{//Innoculous (reads IRQ Mask) which should take fixed time
//because it's an ISA-bus standard. It takes 1.0uS-2.0uS.
InU8(0x21);
}
U16 EndianU16(U16 d)
{//Swap big<-->little endian.
I64 res=0;
res.u8[1]=d.u8[0];
res.u8[0]=d.u8[1];
return res;
}
U32 EndianU32(U32 d)
{//Swap big<-->little endian.
I64 res=0;
res.u8[3]=d.u8[0];
res.u8[2]=d.u8[1];
res.u8[1]=d.u8[2];
res.u8[0]=d.u8[3];
return res;
}
I64 EndianI64(I64 d)
{//Swap big<-->little endian.
U64 res;
res.u8[7]=d.u8[0];
res.u8[6]=d.u8[1];
res.u8[5]=d.u8[2];
res.u8[4]=d.u8[3];
res.u8[3]=d.u8[4];
res.u8[2]=d.u8[5];
res.u8[1]=d.u8[6];
res.u8[0]=d.u8[7];
return res;
}
I64 BCnt(I64 d)
{//Count set bits in I64.
I64 res=0,i;
for (i=0;i<8;i++)
res+=set_bits_table[d.u8[i]];
return res;
}
U0 IntCore0TimerHndlr(CTask *)
{//Called from IntCore0TimerHndlr
I64 i;
if (mp_cnt>1)
while (LBts(&sys_semas[SEMA_SYS_TIMER],0))
PAUSE
lock cnts.jiffies++;
cnts.timer+=SYS_TIMER0_PERIOD+1;
LBtr(&sys_semas[SEMA_SYS_TIMER],0);
for (i=1;i<mp_cnt;i++)
MPInt(I_TIMER,i);
OutU8(0x20,0x20); //Acknowledge PIC Interrupt
}
I64 SysTimerRead()
{//System timer count with overflow already handled.
I64 i,res;
PUSHFD
CLI
if (mp_cnt>1)
while (LBts(&sys_semas[SEMA_SYS_TIMER],0))
PAUSE
OutU8(0x43,0); //Latch Timer0
if ((i=InU8(0x40)+InU8(0x40)<<8)==SYS_TIMER0_PERIOD) {
if (InU8(0x20) & 1)
i=-1;
}
res=cnts.timer+SYS_TIMER0_PERIOD-i;
LBtr(&sys_semas[SEMA_SYS_TIMER],0);
POPFD
return res;
}
I64 HPET()
{ //Get high precision event timer.
return *(dev.uncached_alias+HPET_MAIN_CNT)(I64 *);
}
I64 TimeStampFreqCal()
{
static I64 time_stamp_start=0,timer_start=0,HPET_start=0;
I64 i;
if (time_stamp_start) {
PUSHFD
CLI
if (HPET_start) {
cnts.time_stamp_freq=cnts.HPET_freq*(GetTSC-time_stamp_start);
i=HPET-HPET_start;
} else {
cnts.time_stamp_freq=SYS_TIMER_FREQ*(GetTSC-time_stamp_start);
i=SysTimerRead-timer_start;
}
if (!i)
AdamErr("Timer Cal Error");
else {
cnts.time_stamp_freq/=i;
cnts.time_stamp_kHz_freq=cnts.time_stamp_freq/1000;
cnts.time_stamp_calibrated=TRUE;
}
POPFD
}
PUSHFD
CLI
if (cnts.HPET_freq) {
timer_start=0;
HPET_start=HPET;
} else {
timer_start=SysTimerRead;
HPET_start=0;
}
time_stamp_start=GetTSC;
POPFD
return cnts.time_stamp_freq;
}
F64 tS()
{//Time since boot in seconds as a float.
if (cnts.HPET_freq)
return ToF64(HPET-cnts.HPET_initial)/cnts.HPET_freq;
else
return SysTimerRead/ToF64(SYS_TIMER_FREQ);
}
Bool Blink(F64 Hz=2.5)
{//Return TRUE, then FALSE, then TRUE at given frequency.
if (!Hz) return 0;
return ToI64(cnts.jiffies*2*Hz/JIFFY_FREQ)&1;
}
U0 Busy(I64 uS)
{//Loosely timed.
I64 i;
if (cnts.HPET_freq) {
i=HPET+cnts.HPET_freq*uS/1000000;
while (HPET<i);
} else
for (i=0;i<uS;i++)
PortNop;
}
U0 SleepUntil(I64 wake_jiffy)
{//Not for power-saving. It is to make a program pause without hogging the CPU.
Bool old_idle=LBts(&Fs->task_flags,TASKf_IDLE);
Fs->wake_jiffy=wake_jiffy;
Yield;
LBEqu(&Fs->task_flags,TASKf_IDLE,old_idle);
}
U0 Sleep(I64 mS)
{//Not for power-saving. It is to make a program pause without hogging the CPU.
if (!mS)
Yield;
else
SleepUntil(cnts.jiffies+mS*JIFFY_FREQ/1000);
}
F64 Ona2Freq(I8 ona)
{//Ona to freq. Ona=60 is 440.0Hz.
if (ona==ONA_REST)
return 0;
else
return 440.0/32*2.0`(ona/12.0);
}
I8 Freq2Ona(F64 freq)
{//Freq to Ona. 440.0Hz is Ona=60.
if (freq>0)
return ClampI64(12*Log2(32.0/440.0*freq),ONA_REST+1,I8_MAX);
else
return ONA_REST;
}
U0 Snd(I8 ona=ONA_REST)
{//Play ona, a piano key num. -128 means rest.
I64 period;
CSndData *d;
if (!Bt(&sys_semas[SEMA_MUTE],0) &&
!LBts(&sys_semas[SEMA_SND],0)) { //Mutex. Just throw-out if in use
if (ona<=ONA_REST) {
snd.ona=ona;
OutU8(0x61,InU8(0x61)&~3);
} else if (ona!=snd.ona) {
snd.ona=ona;
period=ClampI64(SYS_TIMER_FREQ/Ona2Freq(ona),1,U16_MAX);
OutU8(0x43,0xB6);
OutU8(0x42,period);
OutU8(0x42,period.u8[1]);
OutU8(0x61,3|InU8(0x61));
}
if (!IsDbgMode && snd.record) {
d=ACAlloc(sizeof(CSndData));
d->ona=ona;
d->time=tS;
QueIns(d,snd.record_head.last);
}
LBtr(&sys_semas[SEMA_SND],0);
}
}
U0 SndRst()
{//Fix stuck sound.
if (Bt(&sys_semas[SEMA_SND],0)) {
Sleep(1);
if (Bt(&sys_semas[SEMA_SND],0)) {
Sleep(1);
LBtr(&sys_semas[SEMA_SND],0);
}
}
Snd;
}
U0 Beep(I8 ona=62,Bool busy=FALSE)
{//Make beep at given ona freq.
Snd(ona);
if (busy)
Busy(500000);
else
Sleep(500);
Snd;
if (busy)
Busy(200000);
else
Sleep(200);
}
Bool Mute(Bool val)
{//Turn-off sound.
Bool res;
if (val) {
PUSHFD
CLI
Snd;
res=LBts(&sys_semas[SEMA_MUTE],0);
POPFD
} else
res=LBtr(&sys_semas[SEMA_MUTE],0);
return res;
}
Bool IsMute()
{//Return is-mute flag.
return Bt(&sys_semas[SEMA_MUTE],0);
}
Bool Silent(Bool val=ON)
{//Turn-off StdOut console text. (Not sound.)
return LBEqu(&Fs->display_flags,DISPLAYf_SILENT,val);
}
Bool IsSilent()
{//Return StdOut turned-off?
return Bt(&Fs->display_flags,DISPLAYf_SILENT);
}
Bool SysDbg(Bool val)
{//Set SysDbg bit you can use while debugging.
return LBEqu(&sys_semas[SEMA_DEBUG],0,val);
}
Bool IsSysDbg()
{//Return SysDbg bit.
return Bt(&sys_semas[SEMA_DEBUG],0);
}
Bool Raw(Bool val)
{//Set to direct scrn, BLACK & WHITE, non-windowed output mode.
if (!val)
VGAFlush;
return !LBEqu(&Fs->display_flags,DISPLAYf_NOT_RAW,!val);
}
Bool IsRaw()
{//Are we in BLACK & WHITE raw scrn mode?
return !Bt(&Fs->display_flags,DISPLAYf_NOT_RAW);
}
Bool SingleUser(Bool val)
{//Set single-user mode.
return LBEqu(&sys_semas[SEMA_SINGLE_USER],0,val);
}
Bool IsSingleUser()
{//Return single-user mode.
return Bt(&sys_semas[SEMA_SINGLE_USER],0);
}
Bool DbgMode(Bool val)
{//Set dbg-mode.
return LBEqu(&sys_semas[SEMA_DBG_MODE],0,val);
}
Bool IsDbgMode()
{//Return dbg-mode.
return Bt(&sys_semas[SEMA_DBG_MODE],0);
}
U0 ProgressBarsRst(U8 *path=NULL)
{//Reset all progress bars to zero.
CallExtStr("ProgressBarsRegTf",path);
MemSet(sys_progresses,0,sizeof(sys_progresses));
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\KMisc-Kernel.html\n// Date: unknown-date\n// Language: HolyC\n\nU0 PortNop()\n{//Innoculous (reads IRQ Mask) which should take fixed time\n//because it's an ISA-bus standard. It takes 1.0uS-2.0uS.\n InU8(0x21);\n}\n\nU16 EndianU16(U16 d)\n{//Swap big<-->little endian.\n I64 res=0;\n res.u8[1]=d.u8[0];\n res.u8[0]=d.u8[1];\n return res;\n}\n\nU32 EndianU32(U32 d)\n{//Swap big<-->little endian.\n I64 res=0;\n res.u8[3]=d.u8[0];\n res.u8[2]=d.u8[1];\n res.u8[1]=d.u8[2];\n res.u8[0]=d.u8[3];\n return res;\n}\n\nI64 EndianI64(I64 d)\n{//Swap big<-->little endian.\n U64 res;\n res.u8[7]=d.u8[0];\n res.u8[6]=d.u8[1];\n res.u8[5]=d.u8[2];\n res.u8[4]=d.u8[3];\n res.u8[3]=d.u8[4];\n res.u8[2]=d.u8[5];\n res.u8[1]=d.u8[6];\n res.u8[0]=d.u8[7];\n return res;\n}\n\nI64 BCnt(I64 d)\n{//Count set bits in I64.\n I64 res=0,i;\n for (i=0;i<8;i++)\n res+=set_bits_table[d.u8[i]];\n return res;\n}\n\nU0 IntCore0TimerHndlr(CTask *)\n{//Called from IntCore0TimerHndlr\n I64 i;\n if (mp_cnt>1)\n while (LBts(&sys_semas[SEMA_SYS_TIMER],0))\n PAUSE\n lock cnts.jiffies++;\n cnts.timer+=SYS_TIMER0_PERIOD+1;\n LBtr(&sys_semas[SEMA_SYS_TIMER],0);\n for (i=1;i<mp_cnt;i++)\n MPInt(I_TIMER,i);\n OutU8(0x20,0x20); //Acknowledge PIC Interrupt\n}\n\nI64 SysTimerRead()\n{//System timer count with overflow already handled.\n I64 i,res;\n PUSHFD\n CLI\n if (mp_cnt>1)\n while (LBts(&sys_semas[SEMA_SYS_TIMER],0))\n PAUSE\n OutU8(0x43,0); //Latch Timer0\n if ((i=InU8(0x40)+InU8(0x40)<<8)==SYS_TIMER0_PERIOD) {\n if (InU8(0x20) & 1)\n i=-1;\n }\n res=cnts.timer+SYS_TIMER0_PERIOD-i;\n LBtr(&sys_semas[SEMA_SYS_TIMER],0);\n POPFD\n return res;\n}\n\nI64 HPET()\n{ //Get high precision event timer.\n return *(dev.uncached_alias+HPET_MAIN_CNT)(I64 *);\n}\n\nI64 TimeStampFreqCal()\n{\n static I64 time_stamp_start=0,timer_start=0,HPET_start=0;\n I64 i;\n if (time_stamp_start) {\n PUSHFD\n CLI\n if (HPET_start) {\n cnts.time_stamp_freq=cnts.HPET_freq*(GetTSC-time_stamp_start);\n i=HPET-HPET_start;\n } else {\n cnts.time_stamp_freq=SYS_TIMER_FREQ*(GetTSC-time_stamp_start);\n i=SysTimerRead-timer_start;\n }\n if (!i)\n AdamErr(\"Timer Cal Error\");\n else {\n cnts.time_stamp_freq/=i;\n cnts.time_stamp_kHz_freq=cnts.time_stamp_freq/1000;\n cnts.time_stamp_calibrated=TRUE;\n }\n POPFD\n }\n PUSHFD\n CLI\n if (cnts.HPET_freq) {\n timer_start=0;\n HPET_start=HPET;\n } else {\n timer_start=SysTimerRead;\n HPET_start=0;\n }\n time_stamp_start=GetTSC;\n POPFD\n return cnts.time_stamp_freq;\n}\n\nF64 tS()\n{//Time since boot in seconds as a float.\n if (cnts.HPET_freq)\n return ToF64(HPET-cnts.HPET_initial)/cnts.HPET_freq;\n else\n return SysTimerRead/ToF64(SYS_TIMER_FREQ);\n}\n\nBool Blink(F64 Hz=2.5)\n{//Return TRUE, then FALSE, then TRUE at given frequency.\n if (!Hz) return 0;\n return ToI64(cnts.jiffies*2*Hz/JIFFY_FREQ)&1;\n}\n\nU0 Busy(I64 uS)\n{//Loosely timed.\n I64 i;\n if (cnts.HPET_freq) {\n i=HPET+cnts.HPET_freq*uS/1000000;\n while (HPET<i);\n } else\n for (i=0;i<uS;i++)\n PortNop;\n}\n\nU0 SleepUntil(I64 wake_jiffy)\n{//Not for power-saving. It is to make a program pause without hogging the CPU.\n Bool old_idle=LBts(&Fs->task_flags,TASKf_IDLE);\n Fs->wake_jiffy=wake_jiffy;\n Yield;\n LBEqu(&Fs->task_flags,TASKf_IDLE,old_idle);\n}\n\nU0 Sleep(I64 mS)\n{//Not for power-saving. It is to make a program pause without hogging the CPU.\n if (!mS)\n Yield;\n else\n SleepUntil(cnts.jiffies+mS*JIFFY_FREQ/1000);\n}\n\nF64 Ona2Freq(I8 ona)\n{//Ona to freq. Ona=60 is 440.0Hz.\n if (ona==ONA_REST)\n return 0;\n else\n return 440.0/32*2.0`(ona/12.0);\n}\n\nI8 Freq2Ona(F64 freq)\n{//Freq to Ona. 440.0Hz is Ona=60.\n if (freq>0)\n return ClampI64(12*Log2(32.0/440.0*freq),ONA_REST+1,I8_MAX);\n else\n return ONA_REST;\n}\n\nU0 Snd(I8 ona=ONA_REST)\n{//Play ona, a piano key num. -128 means rest.\n I64 period;\n CSndData *d;\n if (!Bt(&sys_semas[SEMA_MUTE],0) &&\n !LBts(&sys_semas[SEMA_SND],0)) { //Mutex. Just throw-out if in use\n if (ona<=ONA_REST) {\n snd.ona=ona;\n OutU8(0x61,InU8(0x61)&~3);\n } else if (ona!=snd.ona) {\n snd.ona=ona;\n period=ClampI64(SYS_TIMER_FREQ/Ona2Freq(ona),1,U16_MAX);\n OutU8(0x43,0xB6);\n OutU8(0x42,period);\n OutU8(0x42,period.u8[1]);\n OutU8(0x61,3|InU8(0x61));\n }\n if (!IsDbgMode && snd.record) {\n d=ACAlloc(sizeof(CSndData));\n d->ona=ona;\n d->time=tS;\n QueIns(d,snd.record_head.last);\n }\n LBtr(&sys_semas[SEMA_SND],0);\n }\n}\n\nU0 SndRst()\n{//Fix stuck sound.\n if (Bt(&sys_semas[SEMA_SND],0)) {\n Sleep(1);\n if (Bt(&sys_semas[SEMA_SND],0)) {\n Sleep(1);\n LBtr(&sys_semas[SEMA_SND],0);\n }\n }\n Snd;\n}\n\nU0 Beep(I8 ona=62,Bool busy=FALSE)\n{//Make beep at given ona freq.\n Snd(ona);\n if (busy)\n Busy(500000);\n else\n Sleep(500);\n Snd;\n if (busy)\n Busy(200000);\n else\n Sleep(200);\n}\n\nBool Mute(Bool val)\n{//Turn-off sound.\n Bool res;\n if (val) {\n PUSHFD\n CLI\n Snd;\n res=LBts(&sys_semas[SEMA_MUTE],0);\n POPFD\n } else\n res=LBtr(&sys_semas[SEMA_MUTE],0);\n return res;\n}\n\nBool IsMute()\n{//Return is-mute flag.\n return Bt(&sys_semas[SEMA_MUTE],0);\n}\n\nBool Silent(Bool val=ON)\n{//Turn-off StdOut console text. (Not sound.)\n return LBEqu(&Fs->display_flags,DISPLAYf_SILENT,val);\n}\n\nBool IsSilent()\n{//Return StdOut turned-off?\n return Bt(&Fs->display_flags,DISPLAYf_SILENT);\n}\n\nBool SysDbg(Bool val)\n{//Set SysDbg bit you can use while debugging.\n return LBEqu(&sys_semas[SEMA_DEBUG],0,val);\n}\n\nBool IsSysDbg()\n{//Return SysDbg bit.\n return Bt(&sys_semas[SEMA_DEBUG],0);\n}\n\nBool Raw(Bool val)\n{//Set to direct scrn, BLACK & WHITE, non-windowed output mode.\n if (!val)\n VGAFlush;\n return !LBEqu(&Fs->display_flags,DISPLAYf_NOT_RAW,!val);\n}\n\nBool IsRaw()\n{//Are we in BLACK & WHITE raw scrn mode?\n return !Bt(&Fs->display_flags,DISPLAYf_NOT_RAW);\n}\n\nBool SingleUser(Bool val)\n{//Set single-user mode.\n return LBEqu(&sys_semas[SEMA_SINGLE_USER],0,val);\n}\n\nBool IsSingleUser()\n{//Return single-user mode.\n return Bt(&sys_semas[SEMA_SINGLE_USER],0);\n}\n\nBool DbgMode(Bool val)\n{//Set dbg-mode.\n return LBEqu(&sys_semas[SEMA_DBG_MODE],0,val);\n}\n\nBool IsDbgMode()\n{//Return dbg-mode.\n return Bt(&sys_semas[SEMA_DBG_MODE],0);\n}\n\nU0 ProgressBarsRst(U8 *path=NULL)\n{//Reset all progress bars to zero.\n CallExtStr(\"ProgressBarsRegTf\",path);\n MemSet(sys_progresses,0,sizeof(sys_progresses));\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\villa-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has words
-] Reward1
CallExtStr("JukeReward",""
-] Reward2
"bookmaker in addressees anointment "
"complaint dictations snippiest puller "
"pot's Kampala's bleached stealth's "
"anticked carpel's Uranus's Olive's "
"countersinks sheikh stripes fidgety "
);
U0 Song()
{
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.480;
music.stacatto_factor= 0.902;
try {
while (!ScanKey) {
Play("6etEEE5qB6etDDqtD5qB6etCCqtC5qBhB",
"Go \0to \0the \0well.\n\0This \0is \0a \0hell.\n\0"
"Shad\0ow \0of \0bell.\n\0 \0");
Play("6etEEE5qB6etDDqtD5qB6etCCqtC5qBhB",
"I \0know \0it \0well.\n\0I \0can \0do, \0fell.\n\0"
"Al\0read\0y \0tell.\n\0 \0");
Play("etAB6CqD5etB6CCqDetDC5BqAhA",
"On \0the \0way \0up\n\0to \0fill \0my \0cup\n\0"
"and \0go\0ing \0down.\n\0 \0");
Play("etAB6CqD5etB6CCqDetDC5BqAhA",
"Here \0comes \0a \0pup\n\0I \0give \0a \0hup\n\0"
"and \0get \0a \0crown.\n\0 \0");
Play("qA6etC5A6EsGCGC5etB6C5GA6D5AqA6GetD5A6D",
"Who's \0going \0 \0to \0sing?\n\0"
" \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0");
Play("5qA6etC5A6EsGCGC5etB6C5GA6D5AqA6GetD5A6D",
"Who's \0going \0 \0to \0swing?\n\0"
" \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0");
}
} catch
PutExcept;
Snd;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\villa-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has words\n\n-] Reward1\n CallExtStr(\"JukeReward\",\"\"\n -] Reward2\n \n \"bookmaker in addressees anointment \"\n \"complaint dictations snippiest puller \"\n \"pot's Kampala's bleached stealth's \"\n \"anticked carpel's Uranus's Olive's \"\n \"countersinks sheikh stripes fidgety \"\n \n );\n\nU0 Song()\n{\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 2.480;\n music.stacatto_factor= 0.902;\n try {\n while (!ScanKey) {\n Play(\"6etEEE5qB6etDDqtD5qB6etCCqtC5qBhB\",\n \"Go \\0to \\0the \\0well.\\n\\0This \\0is \\0a \\0hell.\\n\\0\"\n \"Shad\\0ow \\0of \\0bell.\\n\\0 \\0\");\n Play(\"6etEEE5qB6etDDqtD5qB6etCCqtC5qBhB\",\n \"I \\0know \\0it \\0well.\\n\\0I \\0can \\0do, \\0fell.\\n\\0\"\n \"Al\\0read\\0y \\0tell.\\n\\0 \\0\");\n Play(\"etAB6CqD5etB6CCqDetDC5BqAhA\",\n \"On \\0the \\0way \\0up\\n\\0to \\0fill \\0my \\0cup\\n\\0\"\n \"and \\0go\\0ing \\0down.\\n\\0 \\0\");\n Play(\"etAB6CqD5etB6CCqDetDC5BqAhA\",\n \"Here \\0comes \\0a \\0pup\\n\\0I \\0give \\0a \\0hup\\n\\0\"\n \"and \\0get \\0a \\0crown.\\n\\0 \\0\");\n Play(\"qA6etC5A6EsGCGC5etB6C5GA6D5AqA6GetD5A6D\",\n \"Who's \\0going \\0 \\0to \\0sing?\\n\\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5qA6etC5A6EsGCGC5etB6C5GA6D5AqA6GetD5A6D\",\n \"Who's \\0going \\0 \\0to \\0swing?\\n\\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n }\n } catch\n PutExcept;\n Snd;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\Temple-Sup1-Sup1Blog-Home.html
// Date: unknown-date
// Language: HolyC
Original Jewish Temple
The Jewish Temples:
The First Temple - Solomon's Temple
Jewish Temple: Table of Contents | Second Temple | Jerusalem During First Temple
Print Friendly and PDF
The crowning achievement of King Solomon's reign was the erection of the
magnificent Temple (Hebrew- Beit haMikdash) in the capital city of ancient
Israel - Jerusalem. His father, King David, had wanted to build the great Temple
a generation earlier, as a permanent resting place for the Ark of the Covenant
which contained the Ten Commandments. A divine edict, however, had forbidden him
from doing so: "You will not build a house for My name," God said to David, "for
you are a man of battles and have shed blood" (I Chronicles 28:3).
Artists rendering of Solomon's Temple
The Bible's description of Solomon's Temple (also called The First Temple)
suggests that the inside ceiling was was 180 feet long, 90 feet wide, and 50
feet high. The highest point on the Temple that King Solomon built was actually
120 cubits tall (about 20 stories or about 207 feet).
According to the Tanach (II Chronicles):
3:3- "The length by cubits after the ancient measure was threescore
cubits, and the breadth twenty cubits".
3:4- "And the porch that was before the house, the length of it,
according to the breadth of the house, was twenty cubits, and the height a
hundred and twenty; and he overlaid it within with pure gold."
Solomon spared no expense for the building's creation. He ordered vast
quantities of cedar wood from King Hiram of Tyre (I Kings 5:20..25), had huge
blocks of the choicest stone quarried, and commanded that the building's
foundation be laid with hewn stone. To complete the massive project, he imposed
forced labor on all his subjects, drafting people for work shifts that sometimes
lasted a month at a time. Some 3,300 officials were appointed to oversee the
Temple's erection (5:27..30). Solomon assumed such heavy debts in building the
Temple that he is forced to pay off King Hiram by handing over twenty towns in
the Galilee (I Kings 9:11).
When the Temple was completed, Solomon inaugurated it with prayer and
sacrifice, and even invited non..Jews to come and pray there. He urged God to
pay particular heed to their prayers: "Thus all the peoples of the earth will
know Your name and revere You, as does Your people Israel; and they will
recognize that Your name is attached to this House that I have built" (I Kings
8:43).
Sacrifice was the predominant mode of divine service in the Temple until it
was destroyed by the Babylonians some four hundred years later, in 586 BCE.
Seventy years later, after the story of Purim, a number of Jews returned to
Israel - led by the prophets Ezra and Nehemiah - and the Second Temple was built
on the same site. Sacrifices to God were once again resumed. During the first
century B.C.E., Herod, the Roman appointed head of Judea, made substantial
modifications to the Temple and the surrounding mountain, enlargening and
expanding the Temple. The Second Temple, however, met the same fate as the first
and was destroyed by the Romans in 70 C.E., following the failure of the Great
Revolt.
As glorious and elaborate as the Temple was, its most important room
contained almost no furniture at all. Known as the Holy of Holies (Kodesh
Kodashim), it housed the two tablets of the Ten Commandments inside the Ark of
Covenant. Unfortunately, the tablets disappeared when the Babylonians destroyed
the Temple and, therefore, during the Second Temple era the Holy of Holies was
reduced to small, entirely bare room. Only once a year, on Yom Kippur, the High
Priest would enter this room and pray to God on behalf of the Israelite nation.
A remarkable monologue by a Hasidic rabbi in the Yiddish play The Dybbuk conveys
a sense of what the Jewish throngs worshiping at the Temple must have
experienced during this ceremony:
God's world is great and holy. The holiest land in the world is the
land of Israel. In the land of Israel the holiest city is Jerusalem. In
Jerusalem the holiest place was the Temple, and in the Temple the holiest spot
was the Holy of Holies.... There are seventy peoples in the world. The holiest
among these is the people of Israel. The holiest of the people of Israel is the
tribe of Levi. In the tribe of Levi the holiest are the priests. Among the
priests, the holiest was the High Priest.... There are 354 days in the [lunar]
year. Among these, the holidays are holy. Higher than these is the holiness of
the Sabbath. Among Sabbaths, the holiest is the Day of Atonement, the Sabbath of
Sabbaths.... There are seventy languages in the world. The holiest is Hebrew.
Holier than all else in this language is the holy Torah, and in the Torah the
holiest part is the Ten Commandments. In the Ten Commandments the holiest of all
words is the name of God.... And once during the year, at a certain hour, these
four supreme sanctities of the world were joined with one another. That was on
the Day of Atonement, when the High Priest would enter the Holy of Holies and
there utter the name of God. And because this hour was beyond measure holy and
awesome, it was the time of utmost peril not only for the High Priest but for
the whole of Israel. For if in this hour there had, God forbid, entered the mind
of the High Priest a false or sinful thought, the entire world would have been
destroyed.
To this day, traditional Jews pray three times a day for the Temple's
restoration.
Over the centuries, the Muslims who eventually took control of Jerusalem
built two mosques on the Temple Mount, the site of the two Jewish Temples. (This
was no coincidence; it is a common Islamic custom to build mosques on the sites
of other people's holy places.) Since any attempt to level these mosques would
lead to an international Muslim holy war (jihad) against Israel, the Temple
cannot be rebuilt in the foreseeable future.
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Temple-Sup1-Sup1Blog-Home.html\n// Date: unknown-date\n// Language: HolyC\n\nOriginal Jewish Temple\n\nThe Jewish Temples:\nThe First Temple - Solomon's Temple\nJewish Temple: Table of Contents | Second Temple | Jerusalem During First Temple\nPrint Friendly and PDF\n \n \n\n The crowning achievement of King Solomon's reign was the erection of the \nmagnificent Temple (Hebrew- Beit haMikdash) in the capital city of ancient \nIsrael - Jerusalem. His father, King David, had wanted to build the great Temple \na generation earlier, as a permanent resting place for the Ark of the Covenant \nwhich contained the Ten Commandments. A divine edict, however, had forbidden him \nfrom doing so: \"You will not build a house for My name,\" God said to David, \"for \nyou are a man of battles and have shed blood\" (I Chronicles 28:3).\n\n\nArtists rendering of Solomon's Temple\n\n The Bible's description of Solomon's Temple (also called The First Temple) \nsuggests that the inside ceiling was was 180 feet long, 90 feet wide, and 50 \nfeet high. The highest point on the Temple that King Solomon built was actually \n120 cubits tall (about 20 stories or about 207 feet).\n\n According to the Tanach (II Chronicles):\n 3:3- \"The length by cubits after the ancient measure was threescore \ncubits, and the breadth twenty cubits\".\n 3:4- \"And the porch that was before the house, the length of it, \naccording to the breadth of the house, was twenty cubits, and the height a \nhundred and twenty; and he overlaid it within with pure gold.\"\n\n Solomon spared no expense for the building's creation. He ordered vast \nquantities of cedar wood from King Hiram of Tyre (I Kings 5:20..25), had huge \nblocks of the choicest stone quarried, and commanded that the building's \nfoundation be laid with hewn stone. To complete the massive project, he imposed \nforced labor on all his subjects, drafting people for work shifts that sometimes \nlasted a month at a time. Some 3,300 officials were appointed to oversee the \nTemple's erection (5:27..30). Solomon assumed such heavy debts in building the \nTemple that he is forced to pay off King Hiram by handing over twenty towns in \nthe Galilee (I Kings 9:11).\n\n When the Temple was completed, Solomon inaugurated it with prayer and \nsacrifice, and even invited non..Jews to come and pray there. He urged God to \npay particular heed to their prayers: \"Thus all the peoples of the earth will \nknow Your name and revere You, as does Your people Israel; and they will \nrecognize that Your name is attached to this House that I have built\" (I Kings \n8:43).\n\n\n Sacrifice was the predominant mode of divine service in the Temple until it \nwas destroyed by the Babylonians some four hundred years later, in 586 BCE. \nSeventy years later, after the story of Purim, a number of Jews returned to \nIsrael - led by the prophets Ezra and Nehemiah - and the Second Temple was built \non the same site. Sacrifices to God were once again resumed. During the first \ncentury B.C.E., Herod, the Roman appointed head of Judea, made substantial \nmodifications to the Temple and the surrounding mountain, enlargening and \nexpanding the Temple. The Second Temple, however, met the same fate as the first \nand was destroyed by the Romans in 70 C.E., following the failure of the Great \nRevolt.\n\n As glorious and elaborate as the Temple was, its most important room \ncontained almost no furniture at all. Known as the Holy of Holies (Kodesh \nKodashim), it housed the two tablets of the Ten Commandments inside the Ark of \nCovenant. Unfortunately, the tablets disappeared when the Babylonians destroyed \nthe Temple and, therefore, during the Second Temple era the Holy of Holies was \nreduced to small, entirely bare room. Only once a year, on Yom Kippur, the High \nPriest would enter this room and pray to God on behalf of the Israelite nation. \nA remarkable monologue by a Hasidic rabbi in the Yiddish play The Dybbuk conveys \na sense of what the Jewish throngs worshiping at the Temple must have \nexperienced during this ceremony:\n\n God's world is great and holy. The holiest land in the world is the \nland of Israel. In the land of Israel the holiest city is Jerusalem. In \nJerusalem the holiest place was the Temple, and in the Temple the holiest spot \nwas the Holy of Holies.... There are seventy peoples in the world. The holiest \namong these is the people of Israel. The holiest of the people of Israel is the \ntribe of Levi. In the tribe of Levi the holiest are the priests. Among the \npriests, the holiest was the High Priest.... There are 354 days in the [lunar] \nyear. Among these, the holidays are holy. Higher than these is the holiness of \nthe Sabbath. Among Sabbaths, the holiest is the Day of Atonement, the Sabbath of \nSabbaths.... There are seventy languages in the world. The holiest is Hebrew. \nHolier than all else in this language is the holy Torah, and in the Torah the \nholiest part is the Ten Commandments. In the Ten Commandments the holiest of all \nwords is the name of God.... And once during the year, at a certain hour, these \nfour supreme sanctities of the world were joined with one another. That was on \nthe Day of Atonement, when the High Priest would enter the Holy of Holies and \nthere utter the name of God. And because this hour was beyond measure holy and \nawesome, it was the time of utmost peril not only for the High Priest but for \nthe whole of Israel. For if in this hour there had, God forbid, entered the mind \nof the High Priest a false or sinful thought, the entire world would have been \ndestroyed.\n\n To this day, traditional Jews pray three times a day for the Temple's \nrestoration.\n\n Over the centuries, the Muslims who eventually took control of Jerusalem \nbuilt two mosques on the Temple Mount, the site of the two Jewish Temples. (This \nwas no coincidence; it is a common Islamic custom to build mosques on the sites \nof other people's holy places.) Since any attempt to level these mosques would \nlead to an international Muslim holy war (jihad) against Israel, the Temple \ncannot be rebuilt in the foreseeable future."
}
]
}
|
// Source: D:\TempleOS-Projects\html\Talons-Games-Demo.html
// Date: unknown-date
// Language: HolyC
//Uses fixed-point.
RegDft("TempleOS/Talons","F64 best_score=9999;\n");
RegExe("TempleOS/Talons");
//Keep these power of two so shift is used instead of multiply
//to index arrays.
#define MAP_WIDTH 1024
#define MAP_HEIGHT 1024
#define MAP_SCALE 150
#define DISPLAY_SCALE 100
#define CTRLS_SCALE 0.05
//I think I did these so the heads-up showed intelligable numbers.
//Scaling is a mess.
#define COORDINATE_SCALE 256
#define COORDINATE_BITS 8
#define WATER_ELEVATION 15
#define BIRD_ELEVATION 10
#define ROCK_ELEVATION 45
#define SNOW_ELEVATION 55
//Too big makes off-scrn draws take place.
#define PANEL_SIZE_MAX 16
<1>/* Graphics Not Rendered in HTML */
<2>/* Graphics Not Rendered in HTML */
<3>/* Graphics Not Rendered in HTML */
<4>/* Graphics Not Rendered in HTML */
<5>/* Graphics Not Rendered in HTML */
<6>/* Graphics Not Rendered in HTML */
#define LS_TYPES 3
U8 *landscape_small_imgs[LS_TYPES]={<4>,<5>,<6>},
*landscape_large_imgs[LS_TYPES];
#define B_NUM 256
class Bird
{
Bird *next,*last;
CD3I64 p;
F64 theta;
} b_head[mp_cnt];
class Obj
{
Obj *next,*last;
CD3I64 p;
U8 *img;
Bool fish;
};
class Panel
{//Polygon or Obj
Panel *next;
CD3I32 *pts;
I64 cnt;
U16 update,num_sides;
CColorROPU32 color;
Obj *next_obj,*last_obj;
} *panel_head,*panels[MAP_HEIGHT][MAP_WIDTH];
I64 critical_section_flag;
I16 elevations[MAP_HEIGHT][MAP_WIDTH];
CD3 normals[MAP_HEIGHT][MAP_WIDTH];
class MPCtrl {
I64 init_not_done_flags,update_not_done_flags,app_not_done_flags;
I64 strip_width[MP_PROCESSORS_NUM];
Bool app_done;
} mp;
F64 game_t0,game_tf,pitch,roll,heading,phi,speed;
Bool invert_pitch,rolled_over;
I64 strip_height,x,y,z,fish_left;
CD3 v;
U0 WrapAngles()
{
I64 r[4][4],x,y,z;
phi=Wrap(phi);
pitch=Wrap(-phi-pi/2);
if (Abs(pitch)>pi/2) {
invert_pitch=TRUE;
pitch=Wrap(pi-pitch);
} else
invert_pitch=FALSE;
roll=Wrap(roll);
if (invert_pitch ^^ -pi/2<=roll<pi/2)
rolled_over=FALSE;
else
rolled_over=TRUE;
heading=Wrap(heading,0);
//World to scrn coordinates
Mat4x4IdentEqu(r);
Mat4x4RotZ(r,heading);
Mat4x4RotX(r,phi);
Mat4x4RotZ(r,roll);
//We use velocity vector for dog-fighting.
x=0x100000000*speed; y=0; z=0;
Mat4x4MulXYZ(r,&x,&y,&z);
v.x=x/ToF64(0x100000000); v.y=y/ToF64(0x100000000); v.z=z/ToF64(0x100000000);
}
U0 EDTransform(CDC *dc,I64 *x,I64 *y,I64 *z)
{
I64 zz;
Mat4x4MulXYZ(dc->r,x,y,z);
*z=zz=-*z;
if (zz>0) {
*x = dc->x + *x * DISPLAY_SCALE/zz; //Foreshortening
*y = dc->y - *y * DISPLAY_SCALE/zz;
} else {
*x = dc->x + *x;
*y = dc->y - *y;
}
}
U0 CalcNormals()
{/*Find the normal vect with a curl.
i,j and k are the axis unit vectors,
not to be confused with my local index variables.
i j k
0 1 dz2
1 0 dz1
Normal: dz1*i + dz2*j - k
*/
I64 i,j;
for (j=0;j<MAP_HEIGHT-1;j++) {
for (i=0;i<MAP_WIDTH-1;i++) {
normals[j][i].x=elevations[j][i+1]-elevations[j][i];
normals[j][i].y=elevations[j+1][i]-elevations[j][i];
normals[j][i].z=-1;
D3Unit(&normals[j][i]);
}
MemSet(&normals[j][i],0,sizeof(CD3));
}
for (i=0;i<MAP_WIDTH-1;i++)
MemSet(&normals[j][i],0,sizeof(CD3));
}
Bool TestSameSlope(I64 x,I64 y,I64 w,I64 h)
{
CD3 p,*s;
I64 k1,k2;
if (!(0<=x && x+w<MAP_WIDTH && 0<=y && y+h<MAP_HEIGHT))
return FALSE;
s=&normals[y][x];
for (k2=0;k2<h;k2++)
for (k1=0;k1<w;k1++)
if (D3NormSqr(D3Sub(&p,&normals[y+k2][x+k1],s))>.10)
return FALSE;
return TRUE;
}
U0 MPDoPanels(CTask *task)
{
I64 i,j,l,k1,k2,w,h,threshold,lo,hi;
Bool cont;
Panel *tmpp,*start_ptr=NULL,*end_ptr=NULL;
CD3I32 *poly;
Obj *tmpo;
lo=Gs->num*(MAP_HEIGHT-1)/mp_cnt;
hi=(Gs->num+1)*(MAP_HEIGHT-1)/mp_cnt;
for (threshold=8;threshold>=1;threshold--)
for (j=lo;j<hi;j++) {
for (i=0;i<MAP_WIDTH-1;i++) {
if (!panels[j][i]) {
w=1;
h=1;
do {
cont=FALSE;
if (w<PANEL_SIZE_MAX && TestSameSlope(i,j,w+1,h)) {
w++;
cont=TRUE;
}
if (h<PANEL_SIZE_MAX && TestSameSlope(i,j,w,h+1)) {
h++;
cont=TRUE;
}
} while (cont);
if (w>=threshold || h>=threshold) {
tmpp=CAlloc(sizeof(Panel),task);
QueInit(&tmpp->next_obj);
l=elevations[j][i];
if (l<=WATER_ELEVATION*MAP_SCALE &&
elevations[j][i+w-1]<=WATER_ELEVATION*MAP_SCALE &&
elevations[j+h-1][i]<=WATER_ELEVATION*MAP_SCALE &&
elevations[j+h-1][i+w-1]<=WATER_ELEVATION*MAP_SCALE) {
tmpp->color=BLUE;
if (Rand<0.05) {
tmpo=MAlloc(sizeof(Obj),task);
tmpo->p.x=(i+w/2)*MAP_SCALE;
tmpo->p.y=(j+h/2)*MAP_SCALE;
if (Rand<0.1) {
tmpo->fish=FALSE;
if (RandI16&1)
tmpo->img=landscape_large_imgs[0]; //Boat
else
tmpo->img=landscape_large_imgs[1]; //Boat
tmpo->p.z=(WATER_ELEVATION+2)*MAP_SCALE;
} else {
tmpo->fish=TRUE;
tmpo->img=<1>; //Fish
tmpo->p.z=WATER_ELEVATION*MAP_SCALE;
}
QueIns(tmpo,tmpp->last_obj);
}
} else {
if (l<ROCK_ELEVATION*MAP_SCALE) {
if (RandI16&1)
tmpp->color=LTGREEN;
else
tmpp->color=GREEN+LTGREEN<<16+ROPF_DITHER;
if (Rand<0.03) {
tmpo=MAlloc(size
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\Talons-Games-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\n//Uses fixed-point.\n\nRegDft(\"TempleOS/Talons\",\"F64 best_score=9999;\\n\");\nRegExe(\"TempleOS/Talons\");\n\n//Keep these power of two so shift is used instead of multiply\n//to index arrays.\n#define MAP_WIDTH 1024\n#define MAP_HEIGHT 1024\n\n#define MAP_SCALE 150\n#define DISPLAY_SCALE 100\n#define CTRLS_SCALE 0.05\n\n//I think I did these so the heads-up showed intelligable numbers.\n//Scaling is a mess.\n#define COORDINATE_SCALE 256\n#define COORDINATE_BITS 8\n\n#define WATER_ELEVATION 15\n#define BIRD_ELEVATION 10\n#define ROCK_ELEVATION 45\n#define SNOW_ELEVATION 55\n\n//Too big makes off-scrn draws take place.\n#define PANEL_SIZE_MAX 16\n\n\n\n\n\n <1>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n <2>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n <3>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n <4>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n <5>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n <6>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n\n\n\n#define LS_TYPES 3\nU8 *landscape_small_imgs[LS_TYPES]={<4>,<5>,<6>},\n *landscape_large_imgs[LS_TYPES];\n\n#define B_NUM 256\nclass Bird\n{\n Bird *next,*last;\n CD3I64 p;\n F64 theta;\n} b_head[mp_cnt];\n\nclass Obj\n{\n Obj *next,*last;\n CD3I64 p;\n U8 *img;\n Bool fish;\n};\n\nclass Panel\n{//Polygon or Obj\n Panel *next;\n CD3I32 *pts;\n I64 cnt;\n U16 update,num_sides;\n CColorROPU32 color;\n Obj *next_obj,*last_obj;\n} *panel_head,*panels[MAP_HEIGHT][MAP_WIDTH];\n\nI64 critical_section_flag;\nI16 elevations[MAP_HEIGHT][MAP_WIDTH];\nCD3 normals[MAP_HEIGHT][MAP_WIDTH];\n\nclass MPCtrl {\n I64 init_not_done_flags,update_not_done_flags,app_not_done_flags;\n I64 strip_width[MP_PROCESSORS_NUM];\n Bool app_done;\n} mp;\n\nF64 game_t0,game_tf,pitch,roll,heading,phi,speed;\nBool invert_pitch,rolled_over;\nI64 strip_height,x,y,z,fish_left;\nCD3 v;\n\nU0 WrapAngles()\n{\n I64 r[4][4],x,y,z;\n\n phi=Wrap(phi);\n pitch=Wrap(-phi-pi/2);\n if (Abs(pitch)>pi/2) {\n invert_pitch=TRUE;\n pitch=Wrap(pi-pitch);\n } else\n invert_pitch=FALSE;\n roll=Wrap(roll);\n if (invert_pitch ^^ -pi/2<=roll<pi/2)\n rolled_over=FALSE;\n else\n rolled_over=TRUE;\n heading=Wrap(heading,0);\n\n //World to scrn coordinates\n Mat4x4IdentEqu(r);\n Mat4x4RotZ(r,heading);\n Mat4x4RotX(r,phi);\n Mat4x4RotZ(r,roll);\n\n //We use velocity vector for dog-fighting.\n x=0x100000000*speed; y=0; z=0;\n Mat4x4MulXYZ(r,&x,&y,&z);\n v.x=x/ToF64(0x100000000); v.y=y/ToF64(0x100000000); v.z=z/ToF64(0x100000000);\n}\n\nU0 EDTransform(CDC *dc,I64 *x,I64 *y,I64 *z)\n{\n I64 zz;\n Mat4x4MulXYZ(dc->r,x,y,z);\n *z=zz=-*z;\n if (zz>0) {\n *x = dc->x + *x * DISPLAY_SCALE/zz; //Foreshortening\n *y = dc->y - *y * DISPLAY_SCALE/zz;\n } else {\n *x = dc->x + *x;\n *y = dc->y - *y;\n }\n}\n\nU0 CalcNormals()\n{/*Find the normal vect with a curl.\n\ni,j and k are the axis unit vectors,\nnot to be confused with my local index variables.\n\ni j k\n0 1 dz2\n1 0 dz1\n\nNormal: dz1*i + dz2*j - k\n*/\n I64 i,j;\n for (j=0;j<MAP_HEIGHT-1;j++) {\n for (i=0;i<MAP_WIDTH-1;i++) {\n normals[j][i].x=elevations[j][i+1]-elevations[j][i];\n normals[j][i].y=elevations[j+1][i]-elevations[j][i];\n normals[j][i].z=-1;\n D3Unit(&normals[j][i]);\n }\n MemSet(&normals[j][i],0,sizeof(CD3));\n }\n for (i=0;i<MAP_WIDTH-1;i++)\n MemSet(&normals[j][i],0,sizeof(CD3));\n}\n\nBool TestSameSlope(I64 x,I64 y,I64 w,I64 h)\n{\n CD3 p,*s;\n I64 k1,k2;\n if (!(0<=x && x+w<MAP_WIDTH && 0<=y && y+h<MAP_HEIGHT))\n return FALSE;\n s=&normals[y][x];\n for (k2=0;k2<h;k2++)\n for (k1=0;k1<w;k1++)\n if (D3NormSqr(D3Sub(&p,&normals[y+k2][x+k1],s))>.10)\n return FALSE;\n return TRUE;\n}\n\nU0 MPDoPanels(CTask *task)\n{\n I64 i,j,l,k1,k2,w,h,threshold,lo,hi;\n Bool cont;\n Panel *tmpp,*start_ptr=NULL,*end_ptr=NULL;\n CD3I32 *poly;\n Obj *tmpo;\n lo=Gs->num*(MAP_HEIGHT-1)/mp_cnt;\n hi=(Gs->num+1)*(MAP_HEIGHT-1)/mp_cnt;\n for (threshold=8;threshold>=1;threshold--)\n for (j=lo;j<hi;j++) {\n for (i=0;i<MAP_WIDTH-1;i++) {\n if (!panels[j][i]) {\n w=1;\n h=1;\n do {\n cont=FALSE;\n if (w<PANEL_SIZE_MAX && TestSameSlope(i,j,w+1,h)) {\n w++;\n cont=TRUE;\n }\n if (h<PANEL_SIZE_MAX && TestSameSlope(i,j,w,h+1)) {\n h++;\n cont=TRUE;\n }\n } while (cont);\n if (w>=threshold || h>=threshold) {\n tmpp=CAlloc(sizeof(Panel),task);\n QueInit(&tmpp->next_obj);\n l=elevations[j][i];\n if (l<=WATER_ELEVATION*MAP_SCALE &&\n elevations[j][i+w-1]<=WATER_ELEVATION*MAP_SCALE &&\n elevations[j+h-1][i]<=WATER_ELEVATION*MAP_SCALE &&\n elevations[j+h-1][i+w-1]<=WATER_ELEVATION*MAP_SCALE) {\n tmpp->color=BLUE;\n if (Rand<0.05) {\n tmpo=MAlloc(sizeof(Obj),task);\n tmpo->p.x=(i+w/2)*MAP_SCALE;\n tmpo->p.y=(j+h/2)*MAP_SCALE;\n if (Rand<0.1) {\n tmpo->fish=FALSE;\n if (RandI16&1)\n tmpo->img=landscape_large_imgs[0]; //Boat\n else\n tmpo->img=landscape_large_imgs[1]; //Boat\n tmpo->p.z=(WATER_ELEVATION+2)*MAP_SCALE;\n } else {\n tmpo->fish=TRUE;\n tmpo->img=<1>; //Fish\n tmpo->p.z=WATER_ELEVATION*MAP_SCALE;\n }\n QueIns(tmpo,tmpp->last_obj);\n }\n } else {\n if (l<ROCK_ELEVATION*MAP_SCALE) {\n if (RandI16&1)\n tmpp->color=LTGREEN;\n else\n tmpp->color=GREEN+LTGREEN<<16+ROPF_DITHER;\n if (Rand<0.03) {\n tmpo=MAlloc(size"
}
]
}
|
// Source: D:\TempleOS-Projects\html\HelloWorld-Doc.html
// Date: unknown-date
// Language: HolyC
//Press F5 in the editor to compile and run.
--------Hello.HC.Z---------
"Hello World\n";
--------Hello.HC.Z---------
U0 Main()
{
"Hello World\n";
}
Main;
--------Hello.HC.Z---------
U0 MyPrint(U8 *st)
{
"%s",st;
}
MyPrint("Hello World\n");
--------Hello.HC.Z---------
U0 MyPrint2(U8 *st1,U8 *st2) //Any number of args.
{
"%s %s\n",st1,st2; //Any number of args.
}
MyPrint2("Hello","World");
--------Hello.HC.Z---------
U0 MyPrint(U8 *st)
{
"" st; //Empty with no comma means first is fmt str.
}
MyPrint("Hello World\n");
--------Hello.HC.Z---------
asm {
MSG: DU8 "Hello World\n",0;
//The convention is underscore on C callable.
//Two colons means exported symbol.
_HELLO_WORLD::
//You can only clobber RAX,RBX,RCX,RDX
PUSH RSI
MOV RSI,MSG
CALL PUT_STR
POP RSI
RET
}
Call(_HELLO_WORLD);
--------Hello.HC.Z---------
asm {
_HELLO_WORLD::
//You can only clobber RAX,RBX,RCX,RDX
MOV RAX,'Hello '
CALL PUT_CHARS //Up to 8 chars packed into one 64-bit int.
MOV RAX,'World\n'
CALL PUT_CHARS
RET
}
Call(_HELLO_WORLD);
--------Hello.HC.Z---------
asm {
_MY_PRINT::
//You can only clobber RAX,RBX,RCX,RDX
PUSH RBP
MOV RBP,RSP
PUSH RSI
MOV RSI,U64 SF_ARG1[RBP]
CALL PUT_STR
POP RSI
POP RBP
RET1 8 //Callee pops the stack to clear args.
}
_extern _MY_PRINT U0 MyPrint(U8 *st);
MyPrint("Hello World\n");
--------Hello.HC.Z---------
asm {
_MY_PRINT::
//You can only clobber RAX,RBX,RCX,RDX
PUSH RBP
MOV RBP,RSP
PUSH U64 SF_ARG1[RBP]
CALL &PutS //Callee pops the stack to clear args.
POP RBP
RET1 8
}
_extern _MY_PRINT U0 MyPrint(U8 *st);
MyPrint("Hello World\n");
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\HelloWorld-Doc.html\n// Date: unknown-date\n// Language: HolyC\n\n//Press F5 in the editor to compile and run.\n\n--------Hello.HC.Z---------\n\"Hello World\\n\";\n\n\n--------Hello.HC.Z---------\nU0 Main()\n{\n \"Hello World\\n\";\n}\nMain;\n\n\n--------Hello.HC.Z---------\nU0 MyPrint(U8 *st)\n{\n \"%s\",st;\n}\nMyPrint(\"Hello World\\n\");\n\n\n--------Hello.HC.Z---------\nU0 MyPrint2(U8 *st1,U8 *st2) //Any number of args.\n{\n \"%s %s\\n\",st1,st2; //Any number of args.\n}\nMyPrint2(\"Hello\",\"World\");\n\n\n--------Hello.HC.Z---------\nU0 MyPrint(U8 *st)\n{\n \"\" st; //Empty with no comma means first is fmt str.\n}\nMyPrint(\"Hello World\\n\");\n\n\n--------Hello.HC.Z---------\nasm {\nMSG: DU8 \"Hello World\\n\",0;\n\n//The convention is underscore on C callable.\n//Two colons means exported symbol.\n_HELLO_WORLD::\n//You can only clobber RAX,RBX,RCX,RDX\n PUSH RSI\n MOV RSI,MSG\n CALL PUT_STR\n POP RSI\n RET\n}\nCall(_HELLO_WORLD);\n\n\n--------Hello.HC.Z---------\nasm {\n_HELLO_WORLD::\n//You can only clobber RAX,RBX,RCX,RDX\n MOV RAX,'Hello '\n CALL PUT_CHARS //Up to 8 chars packed into one 64-bit int.\n MOV RAX,'World\\n'\n CALL PUT_CHARS\n RET\n}\nCall(_HELLO_WORLD);\n\n\n--------Hello.HC.Z---------\nasm {\n_MY_PRINT::\n//You can only clobber RAX,RBX,RCX,RDX\n PUSH RBP\n MOV RBP,RSP\n PUSH RSI\n MOV RSI,U64 SF_ARG1[RBP]\n CALL PUT_STR\n POP RSI\n POP RBP\n RET1 8 //Callee pops the stack to clear args.\n}\n_extern _MY_PRINT U0 MyPrint(U8 *st);\nMyPrint(\"Hello World\\n\");\n\n\n--------Hello.HC.Z---------\nasm {\n_MY_PRINT::\n//You can only clobber RAX,RBX,RCX,RDX\n PUSH RBP\n MOV RBP,RSP\n PUSH U64 SF_ARG1[RBP]\n CALL &PutS //Callee pops the stack to clear args.\n POP RBP\n RET1 8\n}\n_extern _MY_PRINT U0 MyPrint(U8 *st);\nMyPrint(\"Hello World\\n\");"
}
]
}
|
// Source: D:\TempleOS-Projects\html\DocRecalcLib-DolDoc-Adam.html
// Date: unknown-date
// Language: HolyC
#help_index "DolDoc"
I64 DocCharDist(CDoc *doc,I64 x,I64 y)
{
#assert FONT_WIDTH==FONT_HEIGHT
return (SqrI64(doc->x-x)+SqrI64(doc->y-y))*FONT_WIDTH*FONT_WIDTH;
}
U0 DocDelToNum(CDoc *doc,I64 num)
{
CDocEntry *doc_e=doc->head.next,*doc_e2;
while (num-->0 && doc_e!=doc) {
doc_e2=doc_e->next;
if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))) {
if (doc_e==doc->cur_entry) {
doc->cur_entry=doc_e2;
doc->cur_col=doc_e2->min_col;
}
DocEntryDel(doc,doc_e);
}
doc_e=doc_e2;
}
}
U0 DocDelToEntry(CDoc *doc,CDocEntry *clear_entry,Bool clear_holds)
{
CDocEntry *doc_e=doc->head.next,*doc_e2;
while (doc_e!=doc) {
doc_e2=doc_e->next;
if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))||clear_holds) {
if (doc_e==doc->cur_entry) {
doc->cur_entry=doc_e2;
doc->cur_col=doc_e2->min_col;
}
DocEntryDel(doc,doc_e);
}
if (doc_e==clear_entry)
break;
doc_e=doc_e2;
}
}
U0 DocBorderLstDraw(CDoc *doc)
{
CTask *win_task=doc->win_task;
I64 i,y=-1,attr=win_task->border_attr<<8;
U64 ch;
CDoc *tmpl=doc;
CD3I64 saved_scroll;
while (tmpl && tmpl->doc_signature==DOC_SIGNATURE_VAL) {
y+=(Bsr(tmpl->desc)+7)>>3+1; //StrLen+1
tmpl=tmpl->parent_doc;
}
tmpl=doc;
if (y>win_task->win_height)
y=win_task->win_height;
WinScrollNull(win_task,&saved_scroll);
while (tmpl && tmpl->doc_signature==DOC_SIGNATURE_VAL) {
ch=tmpl->desc;
i=(Bsr(ch)+7)>>3; //StrLen
ch=EndianI64(ch<<((8-i)<<3));
attr=win_task->border_attr<<8;
while (i-- && y>0) {
TextChar(win_task,TRUE,-1,--y,attr+ch&0xFF);
ch>>=8;
}
y--;
tmpl=tmpl->parent_doc;
}
WinScrollRestore(win_task,&saved_scroll);
}
public U0 DocTop(CDoc *doc=NULL)
{//Move cursor, cur_entry, to top.
Bool unlock;
if (!doc && !(doc=DocPut))
return;
unlock=DocLock(doc);
doc->cur_entry=doc->head.next;
doc->cur_col=doc->cur_entry->min_col;
doc->x=0;
doc->y=0;
doc->line_start_col=0;
doc->top_line_num=0;
DocFormFwd(doc);
DocRecalc(doc);
if (unlock)
DocUnlock(doc);
}
public U0 DocCenter(CDoc *doc=NULL,I64 recalc_flags=RECALCt_NORMAL)
{//Center win on doc cursor, cur_entry.
Bool unlock;
CTask *task;
if (!doc && !(doc=DocPut))
return;
unlock=DocLock(doc);
task=doc->win_task;
DocRecalc(doc,recalc_flags);
if (!(doc->flags&DOCF_BORDER_DOC))
doc->top_line_num=doc->y-(task->win_height+1)>>1;
if (unlock)
DocUnlock(doc);
}
public U0 DocBottom(CDoc *doc=NULL)
{//Move cursor, cur_entry, to bottom.
Bool unlock;
if (!doc && !(doc=DocPut))
return;
unlock=DocLock(doc);
doc->cur_entry=doc;
doc->cur_col=0;
DocRecalc(doc);
if (unlock)
DocUnlock(doc);
}
public U0 DocClear(CDoc *doc=NULL,Bool clear_holds=FALSE)
{//Clear all doc entries, except +H, hold entries.
Bool unlock;
if (!doc && !(doc=DocPut))
return;
unlock=DocLock(doc);
DocBottom(doc);
if (clear_holds)
DocPrint(doc,"$CL+H$");
else
DocPrint(doc,"$CL$");
DocRecalc(doc);
if (unlock)
DocUnlock(doc);
}
public Bool DocCursor(Bool show=OFF,CDoc *doc=NULL)
{//Show or hide cursor.
if (!doc && !(doc=DocPut))
return FALSE;
return !LBEqu(&doc->flags,DOCf_HIDE_CURSOR,!show);
}
public Bool DocHighlightCursor(Bool show=OFF,CDoc *doc=NULL)
{//Highlight or Don't highlight cursor.
if (!doc && !(doc=DocPut))
return FALSE;
return !LBEqu(&doc->flags,DOCf_DONT_HIGHLIGHT_CURSOR,!show);
}
public Bool DocScroll(Bool val=OFF,CDoc *doc=NULL)
{//Turn scroll bars OFF/ON.
if (!doc && !(doc=DocPut))
return FALSE;
return !LBEqu(&doc->flags,DOCf_NO_SCROLL_BARS,!val);
}
public U0 DocCollapse(Bool collapse=TRUE,CDoc *doc=NULL)
{//Collapse or uncollapse all tree widgets.
CDocEntry *doc_e;
Bool unlock;
if (!doc && !(doc=DocPut))
return;
unlock=DocLock(doc);
doc_e=doc->head.next;
while (doc_e!=doc) {
if (doc_e->de_flags&DOCEF_TREE)
BEqu(&doc_e->de_flags,DOCEf_CHECKED_COLLAPSED,collapse);
doc_e=doc_e->next;
}
DocRecalc(doc);
if (unlock)
DocUnlock(doc);
}
#help_index "DolDoc/Cmd Line (Typically);Cmd Line (Typically)"
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
//when more are added and the old scroll up.
//See max_entries.
I64 res;
CDoc *doc;
if (doc=DocPut) {
res=doc->max_entries;
doc->max_entries=i;
return res;
} else
return 0;
}
#help_index "DolDoc/Task;StdOut/Task"
U0 DocUpdateTaskDocs(CTask *task)
{//This is called from GrUpdateTaskWin() by the winmgr at 30fps.
CDoc *doc;
CD3I64 saved_scroll;
if (task->border_src==BDS_CUR_DRV && task->cur_dv)
task->border_attr=DrvTextAttrGet(Drv2Let(task->cur_dv));
if (task->title_src==TTS_TASK_NAME)
StrCpy(task->task_title,task->task_name);
if ((doc=DocDisplay(task)) && !(doc->flags&DOCF_DONT_SHOW)) {
if (task->border_src==BDS_ED_FILENAME_DRV)
task->border_attr=DrvTextAttrGet(*doc->filename.name);
if (task->title_src==TTS_ED_FILENAME)
MemCpy(task->task_title,doc->filename.name,STR_LEN-1);
DocRecalc(doc,RECALCt_TO_SCRN|RECALCF_HAS_CURSOR);
}
if ((doc=DocBorder(task)) && !(doc->flags&DOCF_DONT_SHOW)) {
WinScrollNull(task,&saved_scroll);
DocRecalc(doc,RECALCt_TO_SCRN);
WinScrollRestore(task,&saved_scroll);
}
}
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\DocRecalcLib-DolDoc-Adam.html\n// Date: unknown-date\n// Language: HolyC\n\n#help_index \"DolDoc\"\n\nI64 DocCharDist(CDoc *doc,I64 x,I64 y)\n{\n#assert FONT_WIDTH==FONT_HEIGHT\n return (SqrI64(doc->x-x)+SqrI64(doc->y-y))*FONT_WIDTH*FONT_WIDTH;\n}\n\nU0 DocDelToNum(CDoc *doc,I64 num)\n{\n CDocEntry *doc_e=doc->head.next,*doc_e2;\n while (num-->0 && doc_e!=doc) {\n doc_e2=doc_e->next;\n if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))) {\n if (doc_e==doc->cur_entry) {\n doc->cur_entry=doc_e2;\n doc->cur_col=doc_e2->min_col;\n }\n DocEntryDel(doc,doc_e);\n }\n doc_e=doc_e2;\n }\n}\n\nU0 DocDelToEntry(CDoc *doc,CDocEntry *clear_entry,Bool clear_holds)\n{\n CDocEntry *doc_e=doc->head.next,*doc_e2;\n while (doc_e!=doc) {\n doc_e2=doc_e->next;\n if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))||clear_holds) {\n if (doc_e==doc->cur_entry) {\n doc->cur_entry=doc_e2;\n doc->cur_col=doc_e2->min_col;\n }\n DocEntryDel(doc,doc_e);\n }\n if (doc_e==clear_entry)\n break;\n doc_e=doc_e2;\n }\n}\n\nU0 DocBorderLstDraw(CDoc *doc)\n{\n CTask *win_task=doc->win_task;\n I64 i,y=-1,attr=win_task->border_attr<<8;\n U64 ch;\n CDoc *tmpl=doc;\n CD3I64 saved_scroll;\n while (tmpl && tmpl->doc_signature==DOC_SIGNATURE_VAL) {\n y+=(Bsr(tmpl->desc)+7)>>3+1; //StrLen+1\n tmpl=tmpl->parent_doc;\n }\n tmpl=doc;\n if (y>win_task->win_height)\n y=win_task->win_height;\n WinScrollNull(win_task,&saved_scroll);\n while (tmpl && tmpl->doc_signature==DOC_SIGNATURE_VAL) {\n ch=tmpl->desc;\n i=(Bsr(ch)+7)>>3; //StrLen\n ch=EndianI64(ch<<((8-i)<<3));\n attr=win_task->border_attr<<8;\n while (i-- && y>0) {\n TextChar(win_task,TRUE,-1,--y,attr+ch&0xFF);\n ch>>=8;\n }\n y--;\n tmpl=tmpl->parent_doc;\n }\n WinScrollRestore(win_task,&saved_scroll);\n}\n\npublic U0 DocTop(CDoc *doc=NULL)\n{//Move cursor, cur_entry, to top.\n Bool unlock;\n if (!doc && !(doc=DocPut))\n return;\n unlock=DocLock(doc);\n doc->cur_entry=doc->head.next;\n doc->cur_col=doc->cur_entry->min_col;\n doc->x=0;\n doc->y=0;\n doc->line_start_col=0;\n doc->top_line_num=0;\n\n DocFormFwd(doc);\n DocRecalc(doc);\n if (unlock)\n DocUnlock(doc);\n}\n\npublic U0 DocCenter(CDoc *doc=NULL,I64 recalc_flags=RECALCt_NORMAL)\n{//Center win on doc cursor, cur_entry.\n Bool unlock;\n CTask *task;\n if (!doc && !(doc=DocPut))\n return;\n unlock=DocLock(doc);\n task=doc->win_task;\n DocRecalc(doc,recalc_flags);\n if (!(doc->flags&DOCF_BORDER_DOC))\n doc->top_line_num=doc->y-(task->win_height+1)>>1;\n if (unlock)\n DocUnlock(doc);\n}\n\npublic U0 DocBottom(CDoc *doc=NULL)\n{//Move cursor, cur_entry, to bottom.\n Bool unlock;\n if (!doc && !(doc=DocPut))\n return;\n unlock=DocLock(doc);\n doc->cur_entry=doc;\n doc->cur_col=0;\n DocRecalc(doc);\n if (unlock)\n DocUnlock(doc);\n}\n\npublic U0 DocClear(CDoc *doc=NULL,Bool clear_holds=FALSE)\n{//Clear all doc entries, except +H, hold entries.\n Bool unlock;\n if (!doc && !(doc=DocPut))\n return;\n unlock=DocLock(doc);\n DocBottom(doc);\n if (clear_holds)\n DocPrint(doc,\"$CL+H$\");\n else\n DocPrint(doc,\"$CL$\");\n DocRecalc(doc);\n if (unlock)\n DocUnlock(doc);\n}\n\npublic Bool DocCursor(Bool show=OFF,CDoc *doc=NULL)\n{//Show or hide cursor.\n if (!doc && !(doc=DocPut))\n return FALSE;\n return !LBEqu(&doc->flags,DOCf_HIDE_CURSOR,!show);\n}\n\npublic Bool DocHighlightCursor(Bool show=OFF,CDoc *doc=NULL)\n{//Highlight or Don't highlight cursor.\n if (!doc && !(doc=DocPut))\n return FALSE;\n return !LBEqu(&doc->flags,DOCf_DONT_HIGHLIGHT_CURSOR,!show);\n}\n\npublic Bool DocScroll(Bool val=OFF,CDoc *doc=NULL)\n{//Turn scroll bars OFF/ON.\n if (!doc && !(doc=DocPut))\n return FALSE;\n return !LBEqu(&doc->flags,DOCf_NO_SCROLL_BARS,!val);\n}\n\npublic U0 DocCollapse(Bool collapse=TRUE,CDoc *doc=NULL)\n{//Collapse or uncollapse all tree widgets.\n CDocEntry *doc_e;\n Bool unlock;\n if (!doc && !(doc=DocPut))\n return;\n unlock=DocLock(doc);\n doc_e=doc->head.next;\n while (doc_e!=doc) {\n if (doc_e->de_flags&DOCEF_TREE)\n BEqu(&doc_e->de_flags,DOCEf_CHECKED_COLLAPSED,collapse);\n doc_e=doc_e->next;\n }\n DocRecalc(doc);\n if (unlock)\n DocUnlock(doc);\n}\n\n#help_index \"DolDoc/Cmd Line (Typically);Cmd Line (Typically)\"\npublic I64 DocMax(I64 i=I64_MAX)\n{//Set max document entries. (Cmd line buffer size.)\n//Adjusts the size of the cmd line buf.\n //Normally, the cmd line deletes entries\n //when more are added and the old scroll up.\n //See max_entries.\n I64 res;\n CDoc *doc;\n if (doc=DocPut) {\n res=doc->max_entries;\n doc->max_entries=i;\n return res;\n } else\n return 0;\n}\n\n#help_index \"DolDoc/Task;StdOut/Task\"\nU0 DocUpdateTaskDocs(CTask *task)\n{//This is called from GrUpdateTaskWin() by the winmgr at 30fps.\n CDoc *doc;\n CD3I64 saved_scroll;\n if (task->border_src==BDS_CUR_DRV && task->cur_dv)\n task->border_attr=DrvTextAttrGet(Drv2Let(task->cur_dv));\n if (task->title_src==TTS_TASK_NAME)\n StrCpy(task->task_title,task->task_name);\n if ((doc=DocDisplay(task)) && !(doc->flags&DOCF_DONT_SHOW)) {\n if (task->border_src==BDS_ED_FILENAME_DRV)\n task->border_attr=DrvTextAttrGet(*doc->filename.name);\n if (task->title_src==TTS_ED_FILENAME)\n MemCpy(task->task_title,doc->filename.name,STR_LEN-1);\n DocRecalc(doc,RECALCt_TO_SCRN|RECALCF_HAS_CURSOR);\n }\n if ((doc=DocBorder(task)) && !(doc->flags&DOCF_DONT_SHOW)) {\n WinScrollNull(task,&saved_scroll);\n DocRecalc(doc,RECALCt_TO_SCRN);\n WinScrollRestore(task,&saved_scroll);\n }\n}"
}
]
}
|
// Source: D:\TempleOS-Projects\html\beseech-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has words
-] Reward1
CallExtStr("JukeReward",""
-] Reward2
"Guy's uncommunicative Texan's artless "
"egg's dung breeding's humblings "
"oncology's wretchedness's forecastles decor's "
"referenced coauthor twists desegregates "
"sublimate quilt spermicide's Uruguayan "
);
U0 Song()
{
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.480;
music.stacatto_factor= 0.549;
try {
while (!ScanKey) {
Play("5e.DsCeE4B5D4BqB5eFFe.EFeFqD",
"Jade \0 \0 \0 \0mon\0key \0 \0laugh\0ing \0"
" \0at \0the \0beach.\n\0");
Play("e.DsCeE4B5D4BqB5sFFFFe.EFeFqD",
"Wade \0 \0dunk\0ey, \0 \0 \0 \0$RED$\"Fer\0 \0al \0"
" \0 \0I \0can't \0teach.\"$FG$\n\0");
Play("F4B5sFe.G4eA5C4qA5F4GeGG",
"I \0got \0mo\0jo!\n\0 \0 \0 \0 \0 \0 \0 \0");
Play("5qF4B5e.FsG4eA5C4qA5F4Ge.GsG",
"You \0an \0ass\0 \0hole.\n\0 \0 \0 \0 \0 \0 \0");
}
} catch
PutExcept;
Snd;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\beseech-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has words\n\n-] Reward1\n CallExtStr(\"JukeReward\",\"\"\n -] Reward2\n \n \"Guy's uncommunicative Texan's artless \"\n \"egg's dung breeding's humblings \"\n \"oncology's wretchedness's forecastles decor's \"\n \"referenced coauthor twists desegregates \"\n \"sublimate quilt spermicide's Uruguayan \"\n \n );\n\nU0 Song()\n{\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 2.480;\n music.stacatto_factor= 0.549;\n try {\n while (!ScanKey) {\n Play(\"5e.DsCeE4B5D4BqB5eFFe.EFeFqD\",\n \"Jade \\0 \\0 \\0 \\0mon\\0key \\0 \\0laugh\\0ing \\0\"\n \" \\0at \\0the \\0beach.\\n\\0\");\n Play(\"e.DsCeE4B5D4BqB5sFFFFe.EFeFqD\",\n \"Wade \\0 \\0dunk\\0ey, \\0 \\0 \\0 \\0$RED$\\\"Fer\\0 \\0al \\0\"\n \" \\0 \\0I \\0can't \\0teach.\\\"$FG$\\n\\0\");\n Play(\"F4B5sFe.G4eA5C4qA5F4GeGG\",\n \"I \\0got \\0mo\\0jo!\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5qF4B5e.FsG4eA5C4qA5F4Ge.GsG\",\n \"You \\0an \\0ass\\0 \\0hole.\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n }\n } catch\n PutExcept;\n Snd;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\ZoneOut-Games-Demo.html
// Date: unknown-date
// Language: HolyC
RegDft("TempleOS/ZoneOut","F64 best_score=9999;\n");
RegExe("TempleOS/ZoneOut");
<1>/* Graphics Not Rendered in HTML */
<2>/* Graphics Not Rendered in HTML */
<3>/* Graphics Not Rendered in HTML */
/* Graphics Not Rendered in HTML */
#define THEM_NUM 10
class Obj
{
Obj *next,*last;
F64 t0,theta;
I64 x,y,z;
Bool hit,pad[7];
} us,them[THEM_NUM],shots;
I64 num_them;
F64 t0,tf;
#define SCRN_SCALE 512
#define TANK_HEIGHT 32
U0 ZOTransform(CDC *dc,I64 *x,I64 *y,I64 *z)
{
I64 zz;
Mat4x4MulXYZ(dc->r,x,y,z);
zz=*z;
if (zz<1) zz=1;
*x=SCRN_SCALE/2* *x/zz;
*y=SCRN_SCALE/2* (*y+TANK_HEIGHT)/zz;
*x+=dc->x;
*y+=dc->y;
*z+=dc->z;
}
U0 DrawIt(CTask *task,CDC *dc)
{
Obj *tmpo;
I64 i,dd,y,w=task->pix_width,h=task->pix_height,cx=w>>1,cy=h>>1;
U8 *img;
F64 tt,theta;
theta=640*Wrap(2*us.theta)/pi;
Sprite3(dc,theta-1280,90,0,<4>);
Sprite3(dc,theta ,90,0,<4>);
Sprite3(dc,theta+1280,90,0,<4>);
DCDepthBufAlloc(dc);
dc->transform=&ZOTransform;
dc->x=cx;
dc->y=cy;
Mat4x4TranslationEqu(dc->r,-us.x,-us.y,-us.z);
Mat4x4RotY(dc->r,us.theta-pi/2);
Mat4x4RotX(dc->r,pi/16);
dc->flags|=DCF_TRANSFORMATION;
for (i=0;i<THEM_NUM;i++) {
y=them[i].y;
tmpo=shots.next;
while (tmpo!=&shots) {
dd=SqrI64(them[i].x-tmpo->x)+SqrI64(them[i].z-tmpo->z);
if (dd<SCRN_SCALE/2*SCRN_SCALE/2) {
y-=Sqrt(dd);
if (!them[i].hit) {
them[i].hit=TRUE;
if (!--num_them) {
tf=tS;
if (tf-t0<best_score)
best_score=tf-t0;
}
}
}
tmpo=tmpo->next;
}
if (them[i].hit)
img=<2>;
else
img=<1>;
Sprite3YB(dc,them[i].x,y,them[i].z,img,-them[i].theta);
}
tmpo=shots.next;
while (tmpo!=&shots) {
Sprite3YB(dc,tmpo->x,tmpo->y,tmpo->z,<3>,-tmpo->theta);
tmpo=tmpo->next;
}
dc->flags&=~DCF_TRANSFORMATION;
dc->color=LTGREEN;
GrLine(dc,cx-5,cy,cx+5,cy);
GrLine(dc,cx,cy-5,cx,cy+5);
if (tf) {
dc->color=RED;
if (Blink)
GrPrint(dc,cx-(FONT_WIDTH*14)/2,cy-FONT_HEIGHT/2,"Game Completed");
tt=tf;
} else {
dc->color=BLACK;
GrLine(dc,cx-5,cy,cx+5,cy);
GrLine(dc,cx,cy-5,cx,cy+5);
tt=tS;
}
dc->color=BLACK;
GrPrint(dc,0,0,"Enemy:%d Time:%3.2f Best:%3.2f",num_them,tt-t0,best_score);
}
U0 Fire()
{
Obj *tmpo=MAlloc(sizeof(Obj));
tmpo->x=us.x;
tmpo->y=TANK_HEIGHT;
tmpo->z=us.z;
tmpo->theta=us.theta;
tmpo->t0=tS;
QueIns(tmpo,shots.last);
}
U0 MoveUs(F64 theta)
{
us.x+=0.1*SCRN_SCALE*Cos(theta);
us.z+=0.1*SCRN_SCALE*Sin(theta);
}
U0 AnimateTask(I64)
{
I64 i;
Obj *tmpo,*tmpo1;
while (TRUE) {
for (i=0;i<THEM_NUM;i++) {
them[i].x+=SCRN_SCALE/32*Cos(them[i].theta);
them[i].z+=SCRN_SCALE/32*Sin(them[i].theta);
them[i].theta+=Rand/100.0;
}
tmpo=shots.next;
while (tmpo!=&shots) {
tmpo1=tmpo->next;
if (tS-tmpo->t0>1.0) {
QueRem(tmpo);
Free(tmpo);
} else {
tmpo->x+=0.25*SCRN_SCALE*Cos(tmpo->theta);
tmpo->z+=0.25*SCRN_SCALE*Sin(tmpo->theta);
}
tmpo=tmpo1;
}
Sleep(20);
}
}
U0 Init()
{
I64 i;
DocClear;
"$BG,LTCYAN$%h12c",'\n';
QueInit(&shots);
MemSet(&us,0,sizeof(us));
MemSet(them,0,sizeof(them));
num_them=THEM_NUM;
for (i=0;i<THEM_NUM;i++) {
them[i].x=10000*Rand-5000;
them[i].z=10000*Rand-5000;
them[i].theta=2*pi*Rand;
them[i].hit=FALSE;
}
tf=0;
t0=tS;
}
U0 CleanUp()
{
QueDel(&shots,TRUE);
}
U0 SongTask(I64)
{//Randomly generate (by God :-)
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
while (TRUE) {
Play("5sD4B5D4B5qEsG4B5G4B5eD4GsB5F4B5FeD4A5qFG");
Play("5sD4B5D4B5qEsG4B5G4B5eD4GsB5F4B5FeD4A5qFG");
Play("5eGDsFGFGqDE4eB5E4sG5D4G5DqF4sGAGA");
Play("5eGDsFGFGqDE4eB5E4sG5D4G5DqF4sGAGA");
}
}
U0 ZoneOut()
{
I64 sc;
PopUpOk(
"I refuse to rip-off the original\n"
"so this is intentionally crappy\n"
"and included for demonstration\n"
"purposes.\n\n"
"Write games, don't play them.\n");
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
" Exit(,CH_ESC);"
"}"
"Play {"
" Restart(,'\n');"
" Fwd(,,SC_CURSOR_UP);"
" Bwd(,,SC_CURSOR_DOWN);"
" Left(,,SC_CURSOR_LEFT);"
" Right(,,SC_CURSOR_RIGHT);"
" Fire(,CH_SPACE);"
"}"
);
SettingsPush; //See SettingsPush
Fs->text_attr=YELLOW<<4+WHITE;
AutoComplete;
WinBorder;
WinMax;
DocCursor;
Init;
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
Fs->draw_it=&DrawIt;
try {
while (TRUE) {
switch (GetKey(&sc)) {
case CH_SPACE:
Fire;
break;
case '\n':
CleanUp;
Init;
break;
case CH_ESC:
case CH_SHIFT_ESC:
goto zo_done;
case 0:
switch (sc.u8[0]) {
case SC_CURSOR_RIGHT:
us.theta-=pi/256;
break;
case SC_CURSOR_LEFT:
us.theta+=pi/256;
break;
case SC_CURSOR_UP:
MoveUs(us.theta);
break;
case SC_CURSOR_DOWN:
MoveUs(us.theta+pi);
break;
}
break;
}
}
zo_done:
} catch
PutExcept;
CleanUp;
DocClear;
SettingsPop;
MenuPop;
RegWrite("TempleOS/ZoneOut","F64 best_score=%5.4f;\n",best_score);
}
ZoneOut;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\ZoneOut-Games-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\nRegDft(\"TempleOS/ZoneOut\",\"F64 best_score=9999;\\n\");\nRegExe(\"TempleOS/ZoneOut\");\n\n\n\n\n\n\n\n\n\n\n <1>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n <2>/* Graphics Not Rendered in HTML */\n\n\n\n\n\n\n\n\n\n\n\n\n\n <3>/* Graphics Not Rendered in HTML */\n\n/* Graphics Not Rendered in HTML */\n\n\n\n\n\n\n\n\n\n\n#define THEM_NUM 10\n\nclass Obj\n{\n Obj *next,*last;\n F64 t0,theta;\n I64 x,y,z;\n Bool hit,pad[7];\n} us,them[THEM_NUM],shots;\nI64 num_them;\nF64 t0,tf;\n\n#define SCRN_SCALE 512\n#define TANK_HEIGHT 32\n\nU0 ZOTransform(CDC *dc,I64 *x,I64 *y,I64 *z)\n{\n I64 zz;\n Mat4x4MulXYZ(dc->r,x,y,z);\n zz=*z;\n if (zz<1) zz=1;\n *x=SCRN_SCALE/2* *x/zz;\n *y=SCRN_SCALE/2* (*y+TANK_HEIGHT)/zz;\n *x+=dc->x;\n *y+=dc->y;\n *z+=dc->z;\n}\n\nU0 DrawIt(CTask *task,CDC *dc)\n{\n Obj *tmpo;\n I64 i,dd,y,w=task->pix_width,h=task->pix_height,cx=w>>1,cy=h>>1;\n U8 *img;\n F64 tt,theta;\n\n theta=640*Wrap(2*us.theta)/pi;\n Sprite3(dc,theta-1280,90,0,<4>);\n Sprite3(dc,theta ,90,0,<4>);\n Sprite3(dc,theta+1280,90,0,<4>);\n\n DCDepthBufAlloc(dc);\n dc->transform=&ZOTransform;\n dc->x=cx;\n dc->y=cy;\n Mat4x4TranslationEqu(dc->r,-us.x,-us.y,-us.z);\n Mat4x4RotY(dc->r,us.theta-pi/2);\n Mat4x4RotX(dc->r,pi/16);\n\n dc->flags|=DCF_TRANSFORMATION;\n for (i=0;i<THEM_NUM;i++) {\n y=them[i].y;\n tmpo=shots.next;\n while (tmpo!=&shots) {\n dd=SqrI64(them[i].x-tmpo->x)+SqrI64(them[i].z-tmpo->z);\n if (dd<SCRN_SCALE/2*SCRN_SCALE/2) {\n y-=Sqrt(dd);\n if (!them[i].hit) {\n them[i].hit=TRUE;\n if (!--num_them) {\n tf=tS;\n if (tf-t0<best_score)\n best_score=tf-t0;\n }\n }\n }\n tmpo=tmpo->next;\n }\n if (them[i].hit)\n img=<2>;\n else\n img=<1>;\n Sprite3YB(dc,them[i].x,y,them[i].z,img,-them[i].theta);\n }\n tmpo=shots.next;\n while (tmpo!=&shots) {\n Sprite3YB(dc,tmpo->x,tmpo->y,tmpo->z,<3>,-tmpo->theta);\n tmpo=tmpo->next;\n }\n dc->flags&=~DCF_TRANSFORMATION;\n dc->color=LTGREEN;\n GrLine(dc,cx-5,cy,cx+5,cy);\n GrLine(dc,cx,cy-5,cx,cy+5);\n if (tf) {\n dc->color=RED;\n if (Blink)\n GrPrint(dc,cx-(FONT_WIDTH*14)/2,cy-FONT_HEIGHT/2,\"Game Completed\");\n tt=tf;\n } else {\n dc->color=BLACK;\n GrLine(dc,cx-5,cy,cx+5,cy);\n GrLine(dc,cx,cy-5,cx,cy+5);\n tt=tS;\n }\n dc->color=BLACK;\n GrPrint(dc,0,0,\"Enemy:%d Time:%3.2f Best:%3.2f\",num_them,tt-t0,best_score);\n}\n\nU0 Fire()\n{\n Obj *tmpo=MAlloc(sizeof(Obj));\n tmpo->x=us.x;\n tmpo->y=TANK_HEIGHT;\n tmpo->z=us.z;\n tmpo->theta=us.theta;\n tmpo->t0=tS;\n QueIns(tmpo,shots.last);\n}\n\nU0 MoveUs(F64 theta)\n{\n us.x+=0.1*SCRN_SCALE*Cos(theta);\n us.z+=0.1*SCRN_SCALE*Sin(theta);\n}\n\nU0 AnimateTask(I64)\n{\n I64 i;\n Obj *tmpo,*tmpo1;\n while (TRUE) {\n for (i=0;i<THEM_NUM;i++) {\n them[i].x+=SCRN_SCALE/32*Cos(them[i].theta);\n them[i].z+=SCRN_SCALE/32*Sin(them[i].theta);\n them[i].theta+=Rand/100.0;\n }\n tmpo=shots.next;\n while (tmpo!=&shots) {\n tmpo1=tmpo->next;\n if (tS-tmpo->t0>1.0) {\n QueRem(tmpo);\n Free(tmpo);\n } else {\n tmpo->x+=0.25*SCRN_SCALE*Cos(tmpo->theta);\n tmpo->z+=0.25*SCRN_SCALE*Sin(tmpo->theta);\n }\n tmpo=tmpo1;\n }\n Sleep(20);\n }\n}\n\nU0 Init()\n{\n I64 i;\n DocClear;\n \"$BG,LTCYAN$%h12c\",'\\n';\n QueInit(&shots);\n MemSet(&us,0,sizeof(us));\n MemSet(them,0,sizeof(them));\n num_them=THEM_NUM;\n for (i=0;i<THEM_NUM;i++) {\n them[i].x=10000*Rand-5000;\n them[i].z=10000*Rand-5000;\n them[i].theta=2*pi*Rand;\n them[i].hit=FALSE;\n }\n tf=0;\n t0=tS;\n}\n\nU0 CleanUp()\n{\n QueDel(&shots,TRUE);\n}\n\nU0 SongTask(I64)\n{//Randomly generate (by God :-)\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n while (TRUE) {\n Play(\"5sD4B5D4B5qEsG4B5G4B5eD4GsB5F4B5FeD4A5qFG\");\n Play(\"5sD4B5D4B5qEsG4B5G4B5eD4GsB5F4B5FeD4A5qFG\");\n Play(\"5eGDsFGFGqDE4eB5E4sG5D4G5DqF4sGAGA\");\n Play(\"5eGDsFGFGqDE4eB5E4sG5D4G5DqF4sGAGA\");\n }\n}\n\nU0 ZoneOut()\n{\n I64 sc;\n\n PopUpOk(\n \"I refuse to rip-off the original\\n\"\n \"so this is intentionally crappy\\n\"\n \"and included for demonstration\\n\"\n \"purposes.\\n\\n\"\n \"Write games, don't play them.\\n\");\n\n MenuPush(\n \"File {\"\n \" Abort(,CH_SHIFT_ESC);\"\n \" Exit(,CH_ESC);\"\n \"}\"\n \"Play {\"\n \" Restart(,'\\n');\"\n \" Fwd(,,SC_CURSOR_UP);\"\n \" Bwd(,,SC_CURSOR_DOWN);\"\n \" Left(,,SC_CURSOR_LEFT);\"\n \" Right(,,SC_CURSOR_RIGHT);\"\n \" Fire(,CH_SPACE);\"\n \"}\"\n );\n\n SettingsPush; //See SettingsPush\n Fs->text_attr=YELLOW<<4+WHITE;\n AutoComplete;\n WinBorder;\n WinMax;\n DocCursor;\n Init;\n Fs->animate_task=Spawn(&AnimateTask,NULL,\"Animate\",,Fs);\n Fs->song_task=Spawn(&SongTask,NULL,\"Song\",,Fs);\n Fs->draw_it=&DrawIt;\n try {\n while (TRUE) {\n switch (GetKey(&sc)) {\n case CH_SPACE:\n Fire;\n break;\n case '\\n':\n CleanUp;\n Init;\n break;\n case CH_ESC:\n case CH_SHIFT_ESC:\n goto zo_done;\n case 0:\n switch (sc.u8[0]) {\n case SC_CURSOR_RIGHT:\n us.theta-=pi/256;\n break;\n case SC_CURSOR_LEFT:\n us.theta+=pi/256;\n break;\n case SC_CURSOR_UP:\n MoveUs(us.theta);\n break;\n case SC_CURSOR_DOWN:\n MoveUs(us.theta+pi);\n break;\n }\n break;\n }\n }\nzo_done:\n } catch\n PutExcept;\n CleanUp;\n DocClear;\n SettingsPop;\n MenuPop;\n RegWrite(\"TempleOS/ZoneOut\",\"F64 best_score=%5.4f;\\n\",best_score);\n}\n\nZoneOut;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\StdOutTask-Doc.html
// Date: unknown-date
// Language: HolyC
There is one CDoc for the task's border: Fs->border_doc. There is a pair for
the task's client area: Fs->put_doc and Fs->display_doc. You can, optionally,
do double buffering, otherwise Fs->put_doc is the same as Fs->display_doc. See
::/Demo/Spy.HC.
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\StdOutTask-Doc.html\n// Date: unknown-date\n// Language: HolyC\n\nThere is one CDoc for the task's border: Fs->border_doc. There is a pair for \nthe task's client area: Fs->put_doc and Fs->display_doc. You can, optionally, \ndo double buffering, otherwise Fs->put_doc is the same as Fs->display_doc. See \n::/Demo/Spy.HC."
}
]
}
|
// Source: D:\TempleOS-Projects\html\passions-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has words
U0 Song()
{
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.480;
music.stacatto_factor= 0.902;
try {
while (!ScanKey) {
Play("5sDCDC4qA5DetDGFeDAqtEetF4eA5sC4A5e.GsE",
"Ad\0am \0 \0Eve?\n\0 \0 \0 \0 \0 \0 \0 \0 \0 \0"
" \0 \0 \0 \0 \0");
Play("5DCDC4qA5DetDGFeDAqtEetF4eA5sC4A5e.GsE",
"No \0 \0re\0prieve.\n\0 \0 \0 \0 \0 \0 \0 \0 \0"
" \0 \0 \0 \0 \0 \0");
Play("5e.C4sGe.B5sC4eA5sFC4FG5eCqE4eB5D4B5sC4B5eEE",
"Mon\0 \0key \0 \0 \0 \0 \0want \0some \0fruit?\n\0"
" \0 \0 \0 \0 \0 \0 \0 \0");
Play("5e.C4sGe.B5sC4eA5sFC4FG5eCqE4eB5D4B5sC4B5eEE",
"Thou \0 \0shalt \0 \0 \0 \0 \0wear \0a \0suit.\n\0"
" \0 \0 \0 \0 \0 \0 \0 \0");
}
} catch
PutExcept;
Snd;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\passions-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has words\nU0 Song()\n{\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 2.480;\n music.stacatto_factor= 0.902;\n try {\n while (!ScanKey) {\n Play(\"5sDCDC4qA5DetDGFeDAqtEetF4eA5sC4A5e.GsE\",\n \"Ad\\0am \\0 \\0Eve?\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\"\n \" \\0 \\0 \\0 \\0 \\0\");\n Play(\"5DCDC4qA5DetDGFeDAqtEetF4eA5sC4A5e.GsE\",\n \"No \\0 \\0re\\0prieve.\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5e.C4sGe.B5sC4eA5sFC4FG5eCqE4eB5D4B5sC4B5eEE\",\n \"Mon\\0 \\0key \\0 \\0 \\0 \\0 \\0want \\0some \\0fruit?\\n\\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"5e.C4sGe.B5sC4eA5sFC4FG5eCqE4eB5D4B5sC4B5eEE\",\n \"Thou \\0 \\0shalt \\0 \\0 \\0 \\0 \\0wear \\0a \\0suit.\\n\\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n }\n } catch\n PutExcept;\n Snd;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\fishermen-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has graphics
<1>/* Graphics Not Rendered in HTML */
U0 DrawIt(CTask *task,CDC *dc)
{
I64 i,w=task->pix_width,h=task->pix_height;
dc->color=BROWN;
for (i=60*Saw(Beat,20);i<w;i+=20)
GrLine(dc,i,h,w,h-i/4);
dc->color=BLACK;
GrLine(dc,0,h-1,w,h-1);
GrLine(dc,w-1,0,w-1,h);
}
U0 Song()
{
CTask *task;
SettingsPush; //See SettingsPush
Fs->text_attr=LTCYAN<<4+BLACK;
Fs->draw_it=&DrawIt;
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo=2.5;
try {
task=PopUpViewPrint(
"BF:Matthew,4:19\n"
"BF:Luke,5:4\n");
TaskWait(task);
WinHorz(Fs->win_left,TEXT_COLS-10,task);
WinVert(Fs->win_bottom+3,Fs->win_bottom+15,task);
while (!ScanKey) {
"$CL$$BG,LTCYAN$";
Play("5qEsGEGEeF4GB5CqCeDE4qB5sERER",
"$FG$Lord, \0I \0 \0am \0 \0feel\0ing \0"
"just \0a \0bit \0un\0in\0spired.\n\0With \0 \0 \0 \0");
Play("5qEsGEGEeF4GB5CqCeDE4qB5sERER",
"net \0or \0 \0with \0 \0reel\0ing \0 \0"
"I \0keep \0get\0ting \0mired.\n\0 \0 \0 \0 \0");
Play("5qD4etRA5FqDGetFC4GsB5C4B5CqDF",
"$RED$Throw \0 \0out \0your \0net.\n\0 \0 \0"
" \0 \0 \0 \0 \0 \0 \0 \0");
Sprite(<1>);
Play("5D4etRA5FqDGetFC4GsB5C4B5CqDF",
"Make \0 \0you \0a \0bet.\n\0 \0 \0 \0 \0 \0"
" \0 \0 \0 \0 \0");
'\n\n\n\n\n';
}
} catch
PutExcept;
SettingsPop;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\fishermen-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has graphics\n<1>/* Graphics Not Rendered in HTML */\n\n\n\n\nU0 DrawIt(CTask *task,CDC *dc)\n{\n I64 i,w=task->pix_width,h=task->pix_height;\n dc->color=BROWN;\n for (i=60*Saw(Beat,20);i<w;i+=20)\n GrLine(dc,i,h,w,h-i/4);\n dc->color=BLACK;\n GrLine(dc,0,h-1,w,h-1);\n GrLine(dc,w-1,0,w-1,h);\n}\n\nU0 Song()\n{\n CTask *task;\n SettingsPush; //See SettingsPush\n Fs->text_attr=LTCYAN<<4+BLACK;\n Fs->draw_it=&DrawIt;\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo=2.5;\n try {\n task=PopUpViewPrint(\n \"BF:Matthew,4:19\\n\"\n \"BF:Luke,5:4\\n\");\n TaskWait(task);\n WinHorz(Fs->win_left,TEXT_COLS-10,task);\n WinVert(Fs->win_bottom+3,Fs->win_bottom+15,task);\n while (!ScanKey) {\n \"$CL$$BG,LTCYAN$\";\n Play(\"5qEsGEGEeF4GB5CqCeDE4qB5sERER\",\n \"$FG$Lord, \\0I \\0 \\0am \\0 \\0feel\\0ing \\0\"\n \"just \\0a \\0bit \\0un\\0in\\0spired.\\n\\0With \\0 \\0 \\0 \\0\");\n Play(\"5qEsGEGEeF4GB5CqCeDE4qB5sERER\",\n \"net \\0or \\0 \\0with \\0 \\0reel\\0ing \\0 \\0\"\n \"I \\0keep \\0get\\0ting \\0mired.\\n\\0 \\0 \\0 \\0 \\0\");\n Play(\"5qD4etRA5FqDGetFC4GsB5C4B5CqDF\",\n \"$RED$Throw \\0 \\0out \\0your \\0net.\\n\\0 \\0 \\0\"\n \" \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Sprite(<1>);\n Play(\"5D4etRA5FqDGetFC4GsB5C4B5CqDF\",\n \"Make \\0 \\0you \\0a \\0bet.\\n\\0 \\0 \\0 \\0 \\0 \\0\"\n \" \\0 \\0 \\0 \\0 \\0\");\n '\\n\\n\\n\\n\\n';\n }\n } catch\n PutExcept;\n SettingsPop;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\WaterFowl-Snd-Demo.html
// Date: unknown-date
// Language: HolyC
/* Graphics Not Rendered in HTML */
U8 *poem=
"To a Waterfowl
by William Cullen Bryant
Whither, 'midst falling dew,
While glow the heavens with the last steps of day,
Far, through their rosy depths, dost thou pursue
Thy solitary way?
Vainly the fowler's eye
Might mark thy distant flight to do thee wrong,
As, darkly painted on the crimson sky,
Thy figure floats along.
Seek'st thou the plashy brink
Of weedy lake, or marge of river wide,
Or where the rocking billows rise and sink
On the chafed ocean side?
There is a Power whose care
Teaches thy way along that pathless coast,--
The desert and illimitable air,--
Lone wandering, but not lost.
All day thy wings have fann'd
At that far height, the cold thin atmosphere:
Yet stoop not, weary, to the welcome land,
Though the dark night is near.
And soon that toil shall end,
Soon shalt thou find a summer home, and rest,
And scream among thy fellows; reed shall bend
Soon o'er thy sheltered nest.
Thou'rt gone, the abyss of heaven
Hath swallowed up thy form; yet, on my heart
Deeply hath sunk the lesson thou hast given,
And shall not soon depart.
He, who, from zone to zone,
Guides through the boundless sky thy certain flight,
In the long way that I must tread alone,
Will lead my steps aright.
";
#define POEM_COLS 53
#define POEM_TIME 65.0
F64 t0;
U0 DrawIt(CTask *task,CDC *dc)
{
I64 w=task->pix_width,h=task->pix_height;
F64 t=1.04-(0.35+0.65*Caw(tS-t0,20))`3,s=1.0-0.5*t,
x=w*t,y=h*(0.35-.1*t);
dc->color=WHITE;
GrPrint(dc,w>>1-(POEM_COLS*FONT_WIDTH)>>1,
Caw(tS-t0,POEM_TIME)*(h-3*FONT_HEIGHT),poem);
dc->color=BLACK;
GrLine(dc,x,y,x-8*s,y+6*s*FullTri(tS,0.4));
GrLine(dc,x,y,x+8*s,y+6*s*FullTri(tS,0.4));
}
U0 SongTask(I64)
{//Song by Terry A. Davis
//This specifies a callback routine
//to be called when the task dies.
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
while (TRUE) {
Play("5eEDC4B5C4B5C4BA5qReEDC4B5C");
Play("4B5C4BA5qReFEDEDEDC4qB");
Play("5ReFEDEDEDC4BqR");
}
}
U0 WaterFowl()
{
SettingsPush; //See SettingsPush
Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
AutoComplete;
WinBorder;
WinMax;
DocClear;
t0=tS;
Fs->draw_it=&DrawIt;
Sprite(<1>);
"%h*c",TEXT_ROWS-2,'\n';
GetChar;
DocClear;
SettingsPop;
}
WaterFowl;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\WaterFowl-Snd-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\n/* Graphics Not Rendered in HTML */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nU8 *poem=\n\"To a Waterfowl\nby William Cullen Bryant\n\nWhither, 'midst falling dew,\nWhile glow the heavens with the last steps of day,\nFar, through their rosy depths, dost thou pursue\nThy solitary way?\n\nVainly the fowler's eye\nMight mark thy distant flight to do thee wrong,\nAs, darkly painted on the crimson sky,\nThy figure floats along.\n\nSeek'st thou the plashy brink\nOf weedy lake, or marge of river wide,\nOr where the rocking billows rise and sink\nOn the chafed ocean side?\n\nThere is a Power whose care\nTeaches thy way along that pathless coast,--\nThe desert and illimitable air,--\nLone wandering, but not lost.\n\nAll day thy wings have fann'd\nAt that far height, the cold thin atmosphere:\nYet stoop not, weary, to the welcome land,\nThough the dark night is near.\n\nAnd soon that toil shall end,\nSoon shalt thou find a summer home, and rest,\nAnd scream among thy fellows; reed shall bend\nSoon o'er thy sheltered nest.\n\nThou'rt gone, the abyss of heaven\nHath swallowed up thy form; yet, on my heart\nDeeply hath sunk the lesson thou hast given,\nAnd shall not soon depart.\n\nHe, who, from zone to zone,\nGuides through the boundless sky thy certain flight,\nIn the long way that I must tread alone,\nWill lead my steps aright.\n\";\n\n#define POEM_COLS 53\n#define POEM_TIME 65.0\n\nF64 t0;\n\nU0 DrawIt(CTask *task,CDC *dc)\n{\n I64 w=task->pix_width,h=task->pix_height;\n F64 t=1.04-(0.35+0.65*Caw(tS-t0,20))`3,s=1.0-0.5*t,\n x=w*t,y=h*(0.35-.1*t);\n dc->color=WHITE;\n GrPrint(dc,w>>1-(POEM_COLS*FONT_WIDTH)>>1,\n Caw(tS-t0,POEM_TIME)*(h-3*FONT_HEIGHT),poem);\n dc->color=BLACK;\n GrLine(dc,x,y,x-8*s,y+6*s*FullTri(tS,0.4));\n GrLine(dc,x,y,x+8*s,y+6*s*FullTri(tS,0.4));\n}\n\nU0 SongTask(I64)\n{//Song by Terry A. Davis\n//This specifies a callback routine\n //to be called when the task dies.\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n while (TRUE) {\n Play(\"5eEDC4B5C4B5C4BA5qReEDC4B5C\");\n Play(\"4B5C4BA5qReFEDEDEDC4qB\");\n Play(\"5ReFEDEDEDC4BqR\");\n }\n}\n\nU0 WaterFowl()\n{\n SettingsPush; //See SettingsPush\n Fs->song_task=Spawn(&SongTask,NULL,\"Song\",,Fs);\n AutoComplete;\n WinBorder;\n WinMax;\n DocClear;\n t0=tS;\n Fs->draw_it=&DrawIt;\n Sprite(<1>);\n \"%h*c\",TEXT_ROWS-2,'\\n';\n GetChar;\n DocClear;\n SettingsPop;\n}\n\nWaterFowl;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\codes-Sup1-Sup1Hymns-Home.html
// Date: unknown-date
// Language: HolyC
//5 has words
-] Reward1
CallExtStr("JukeReward",""
-] Reward2
"anyhow agility Spenser's Nannie's "
"lettering's educational Leticia's gobbler "
"impales Susana incubators Julliard's "
"Yahoo's Spirograph's joblessness fastenings "
"prosecutor's quells collage's bluefish "
);
U0 Song()
{
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.480;
music.stacatto_factor= 0.902;
try {
while (!ScanKey) {
Play("5eEEE4B5DDD4A5CCCDEC4qA",
"Spring\0ing \0down\n\0the \0bun\0ny \0trail.\n\0"
" \0Hap\0py \0rush.\n\0There's \0hay \0to \0bail.\n\0");
Play("5eCEE4A5FEDEEDCDECqE",
"Ada \0wise?\n\0 \0 \0Thun\0der \0sighs.\n\0"
" \0 \0 \0 \0 \0Great \0big \0fail.\n\0");
Play("eG4AqA5Ge.CsCqF4eABAGB5sFG",
"Bob\0-n-\0 \0weave?\n\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0");
Play("eG4AqA5Ge.CsCqF4eABA5C4B5sFG",
"Heft\0y \0 \0heave.\n\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0");
}
} catch
PutExcept;
Snd;
}
Song;
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\codes-Sup1-Sup1Hymns-Home.html\n// Date: unknown-date\n// Language: HolyC\n\n//5 has words\n\n-] Reward1\n CallExtStr(\"JukeReward\",\"\"\n -] Reward2\n \n \"anyhow agility Spenser's Nannie's \"\n \"lettering's educational Leticia's gobbler \"\n \"impales Susana incubators Julliard's \"\n \"Yahoo's Spirograph's joblessness fastenings \"\n \"prosecutor's quells collage's bluefish \"\n \n );\n\nU0 Song()\n{\n Fs->task_end_cb=&SndTaskEndCB;\n MusicSettingsRst;\n music.tempo= 2.480;\n music.stacatto_factor= 0.902;\n try {\n while (!ScanKey) {\n Play(\"5eEEE4B5DDD4A5CCCDEC4qA\",\n \"Spring\\0ing \\0down\\n\\0the \\0bun\\0ny \\0trail.\\n\\0\"\n \" \\0Hap\\0py \\0rush.\\n\\0There's \\0hay \\0to \\0bail.\\n\\0\");\n Play(\"5eCEE4A5FEDEEDCDECqE\",\n \"Ada \\0wise?\\n\\0 \\0 \\0Thun\\0der \\0sighs.\\n\\0\"\n \" \\0 \\0 \\0 \\0 \\0Great \\0big \\0fail.\\n\\0\");\n Play(\"eG4AqA5Ge.CsCqF4eABAGB5sFG\",\n \"Bob\\0-n-\\0 \\0weave?\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n Play(\"eG4AqA5Ge.CsCqF4eABA5C4B5sFG\",\n \"Heft\\0y \\0 \\0heave.\\n\\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0\");\n }\n } catch\n PutExcept;\n Snd;\n}\n\nSong;"
}
]
}
|
// Source: D:\TempleOS-Projects\html\HtmlGen-ToHtmlToTXTDemo-Demo.html
// Date: unknown-date
// Language: HolyC
/* This converts ::/Demo/ToHtmlToTXTDemo/DemoInPage.DD to
an html document named "OutPage.html".
Notice that an entry like $TX,"GOOGLE",HTML="http://www.google.com"$
will be converted to text in the html with an html link.
I cheated by hardcoding www.templeos.org as the website
for TempleOS Links. Why don't you copy
::/Demo/ToHtmlToTXTDemo/ToHtml.HC to your /Home directory
and modify it? You are welcome to link to
http://www.templeos.org if you want file that come on the
TempleOS distribution.
You can pass html meta data as args to ToHtml().
If you want to blog like I do, see these files...
::/Demo/AcctExample/TOS/TOSToHtml.HC
::/Demo/AcctExample/HomeKeyPlugIns.HC
::/Demo/AcctExample/TOS/TOSHolySpirit.HC
*/
Cd(__DIR__);;
#include "ToHtml"
ToHtml("DemoInPage.DD.Z","~/DemoOutPage");
|
{
"messages": [
{
"role": "system",
"content": "You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style."
},
{
"role": "user",
"content": "Please write some HolyC code."
},
{
"role": "assistant",
"content": "// Source: D:\\TempleOS-Projects\\html\\HtmlGen-ToHtmlToTXTDemo-Demo.html\n// Date: unknown-date\n// Language: HolyC\n\n/* This converts ::/Demo/ToHtmlToTXTDemo/DemoInPage.DD to\nan html document named \"OutPage.html\".\n\nNotice that an entry like $TX,\"GOOGLE\",HTML=\"http://www.google.com\"$\nwill be converted to text in the html with an html link.\n\nI cheated by hardcoding www.templeos.org as the website\nfor TempleOS Links. Why don't you copy\n::/Demo/ToHtmlToTXTDemo/ToHtml.HC to your /Home directory\nand modify it? You are welcome to link to\nhttp://www.templeos.org if you want file that come on the\nTempleOS distribution.\n\nYou can pass html meta data as args to ToHtml().\n\nIf you want to blog like I do, see these files...\n::/Demo/AcctExample/TOS/TOSToHtml.HC\n::/Demo/AcctExample/HomeKeyPlugIns.HC\n::/Demo/AcctExample/TOS/TOSHolySpirit.HC\n*/\n\nCd(__DIR__);;\n#include \"ToHtml\"\n\nToHtml(\"DemoInPage.DD.Z\",\"~/DemoOutPage\");"
}
]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.