TempleOSCDV4.06.ISO
This commit is contained in:
1 parent
6fe38d2d9d
commit
b632ab9a4f
261 files changed
+6282
-5801
No files matched your search
@@ -0,0 +1,90 @@
|
||||
U0 DrawIt(CTask *task,CDC *dc)
|
||||
{
|
||||
}
|
||||
|
||||
U0 AnimateTask(I64)
|
||||
{
|
||||
while (TRUE) {
|
||||
Sleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
U0 Init()
|
||||
{
|
||||
}
|
||||
|
||||
U0 CleanUp()
|
||||
{
|
||||
}
|
||||
|
||||
U0 SongTask(I64)
|
||||
{
|
||||
Fs->task_end_cb=&SndTaskEndCB;
|
||||
MusicSettingsRst;
|
||||
while (TRUE) {
|
||||
Play("ABC");
|
||||
}
|
||||
}
|
||||
|
||||
U0 MyGame()
|
||||
{
|
||||
I64 sc;
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Fs->text_attr=YELLOW<<4+BLUE;
|
||||
Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
|
||||
AutoComplete;
|
||||
WinBorder;
|
||||
WinMax;
|
||||
DocCursor;
|
||||
DocClear;
|
||||
|
||||
MenuPush(
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}"
|
||||
"Play {"
|
||||
" Restart(,'\n');"
|
||||
" Up(,,SC_CURSOR_UP);"
|
||||
" Down(,,SC_CURSOR_DOWN);"
|
||||
" Left(,,SC_CURSOR_LEFT);"
|
||||
" Right(,,SC_CURSOR_RIGHT);"
|
||||
"}"
|
||||
);
|
||||
|
||||
Init;
|
||||
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
|
||||
Fs->draw_it=&DrawIt;
|
||||
|
||||
try {
|
||||
while (TRUE)
|
||||
switch (GetKey(&sc)) {
|
||||
case 0:
|
||||
switch (sc.u8[0]) {
|
||||
case SC_CURSOR_LEFT:
|
||||
break;
|
||||
case SC_CURSOR_RIGHT:
|
||||
break;
|
||||
case SC_CURSOR_UP:
|
||||
break;
|
||||
case SC_CURSOR_DOWN:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case '\n':
|
||||
CleanUp;
|
||||
Init;
|
||||
break;
|
||||
case CH_SHIFT_ESC:
|
||||
case CH_ESC:
|
||||
goto mg_done;
|
||||
}
|
||||
mg_done: //Don't goto out of try
|
||||
} catch
|
||||
PutExcept;
|
||||
SettingsPop;
|
||||
CleanUp;
|
||||
MenuPop;
|
||||
}
|
||||
|
||||
MyGame;
|
||||
@@ -0,0 +1,16 @@
|
||||
U0 MyRead(U8 *filename)
|
||||
{
|
||||
CCmpCtrl *cc=CmpCtrlNew(MStrPrint("#include \"%s\"",filename));
|
||||
while (Lex(cc)) {
|
||||
"%03d:",cc->token;
|
||||
switch (cc->token) {
|
||||
case TK_IDENT: "IDENT:%s",cc->cur_str; break;
|
||||
case TK_STR: "STR:%s",cc->cur_str; break;
|
||||
case TK_CHAR_CONST: "CHAR:%d",cc->cur_i64; break;
|
||||
case TK_I64: "I64:%d",cc->cur_i64; break;
|
||||
case TK_F64: "F64:%d",cc->cur_f64; break;
|
||||
}
|
||||
'\n';
|
||||
}
|
||||
CmpCtrlDel(cc);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
I64 mp_not_done_flags;
|
||||
|
||||
U0 MPRoutine(CDoc *doc)
|
||||
{
|
||||
DocPrint(doc,"Core:%d\n",Gs->num);
|
||||
LBtr(&mp_not_done_flags,Gs->num);
|
||||
}
|
||||
|
||||
U0 Main()
|
||||
{
|
||||
I64 i;
|
||||
mp_not_done_flags=1<<mp_cnt-1;
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
Spawn(&MPRoutine,DocPut,NULL,i);
|
||||
while (mp_not_done_flags)
|
||||
Yield;
|
||||
}
|
||||
|
||||
Main;
|
||||
@@ -0,0 +1,43 @@
|
||||
class MyMass:CMass
|
||||
{
|
||||
F64 radius;
|
||||
};
|
||||
|
||||
class MySpring:CSpring
|
||||
{
|
||||
};
|
||||
|
||||
CMathODE *ode=NULL;
|
||||
|
||||
U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||
{
|
||||
MyMass *tempm1,*tempm2;
|
||||
|
||||
tempm1=ode->next_mass;
|
||||
while (tempm1!=&ode->next_mass) {
|
||||
tempm2=tempm1->next;
|
||||
while (tempm2!=&ode->next_mass) {
|
||||
tempm2=tempm2->next;
|
||||
}
|
||||
tempm1=tempm1->next;
|
||||
}
|
||||
}
|
||||
|
||||
U0 Init()
|
||||
{
|
||||
ode=ODENew(0,1e-4,ODEF_HAS_MASSES);
|
||||
ode->derivative=&MyDerivative;
|
||||
ode->drag_v2=0.002;
|
||||
ode->drag_v3=0.00001;
|
||||
ode->acceleration_limit=5e3;
|
||||
|
||||
QueIns(ode,Fs->last_ode);
|
||||
}
|
||||
|
||||
U0 CleanUp()
|
||||
{
|
||||
QueRem(ode);
|
||||
QueDel(&ode->next_mass,TRUE);
|
||||
QueDel(&ode->next_spring,TRUE);
|
||||
ODEDel(ode);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
RegSetDftEntry("MyCompany/MyApp","F64 best_score=9999;\n");
|
||||
RegExeBranch("MyCompany/MyApp");
|
||||
|
||||
U0 Main()
|
||||
{
|
||||
GetChar;
|
||||
RegWriteBranch("MyCompany/MyApp","F64 best_score=%5.4f;\n",best_score);
|
||||
}
|
||||
|
||||
Main;
|
||||
@@ -0,0 +1,14 @@
|
||||
U0 MyUtil(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||
{
|
||||
I64 fuf_flags=0;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde) {
|
||||
PutFileLink(tempde->full_name);
|
||||
'\n';
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
I64 MyUtilDoc(CDoc *doc,I64 fuf_flags)
|
||||
{
|
||||
Bool unlock=DocLock(doc);
|
||||
I64 res=0;
|
||||
CDocEntry *doc_e;
|
||||
DocRecalc(doc);
|
||||
doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
res++;
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
DocRecalc(doc);
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 MyUtilFile(U8 *filename,I64 fuf_flags)
|
||||
{//Optimize File.
|
||||
I64 res;
|
||||
CDoc *doc=DocRead(filename);
|
||||
if (res=MyUtilDoc(doc,fuf_flags)) {
|
||||
"%8d:%s\n",res,doc->filename.name;
|
||||
DocWrite(doc);
|
||||
}
|
||||
DocDel(doc);
|
||||
return res;
|
||||
}
|
||||
I64 MyUtilLst(CDirEntry *tempde,I64 fuf_flags)
|
||||
{
|
||||
I64 res=0;
|
||||
CDirEntry *tempde1;
|
||||
while (tempde) {
|
||||
tempde1=tempde->next;
|
||||
if (tempde->attr & RS_ATTR_DIR) {
|
||||
if (tempde->sub) {
|
||||
"Processing Directory: %s\n",tempde->full_name;
|
||||
res+=MyUtilLst(tempde->sub,fuf_flags);
|
||||
}
|
||||
} else
|
||||
res+=MyUtilFile(tempde->full_name,fuf_flags);
|
||||
DirEntryDel(tempde);
|
||||
tempde=tempde1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
I64 MyUtil(U8 *files_find_mask="*",U8 *fu_flags=NULL)
|
||||
{
|
||||
I64 fuf_flags=0;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+T");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
return MyUtilLst(FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND),
|
||||
fuf_flags&~FUG_FILES_FIND);
|
||||
}
|
||||
Reference in new issue
Block a user