0001                                   Aiwnios.com
0002 
0003   Welcome to Aiwnios.com,the best server on earth. I will show you how  to do 
0004 cool stuff like write compilers and make games. I will write articles time to 
0005 time,but first let me tell you about myself.
0006 
0007   My name is Clayton and I like compilers alot.I wrote Aiwnios which is a  HolyC 
0008 compiler that runs on 64,bit arm and X86_64 and it's Travis Scott lit.I will 
0009 explain it in detail how it works,the first part is the lexer. I'm not a unix 
0010 pro but here are my notes Unix Notes or my Jain Notes.
0011 
0012   Here is a link to the User Guide if you want to know how to use aiwnios. Or 
0013 maybe you are here for the blog
0014 
0015   Checkout My FlashCards app and flash cards for the latest in nroots Greek 
0016 Quest(download the ISO and MountFile it in Aiwnios to use it).
0017 
0018   Irc Server
0019 
0020 aiwnios.com 6667
0021 Turn off SSL before connecting in your client
0022 Dont send anything important over the IRC server
0023 
0024 
0025                            Kralech Compiler Tutorial
0026 
0027   I dont know where my life will end up but I have a compiler. This is certian. 
0028 I did it. I will show others how to do it. This is a good way when you are 
0029 right. A compiler turns source code into action that your computer understands. 
0030 Knowing how to compile is a good way to milk a computer to the max
0031 
0032 
0033 <1>
0034 0035 0036 0037 0038 0039 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 0050 0051 0052 0053 0054 0055 0056 0057 0058 Lesson 1: The Lexer 0059 Lexers turn raw data (such as source code ) into tokens a motherfucking 0060 compiler can use. Dont make a compiler without a lexer or you will have to 0061 juggle lots of meaningless symbols 0062 0063 Lesson 2: The Parser 0064 A compiler must turn tokens into meaningful constructs that the compiler will 0065 use. Representing the reality of the source data is key (representation) when 0066 generating machine code. 0067 0068 0069 Lesson 3: Register Allocation Pt.1 0070 Registers are values that live in your computer. Values in in registers,and 0071 sometimes they die. Here we see which values are living and dead at what points 0072 in time 0073 0074 0075 Lesson 4: Reg Allocation Pt.2: Graph Coloring 0076 0077 Compilers have a finite number of registers. We must use the registers in a good 0078 fashion to generate good machine code. 0079 -] Registers Poem 0080 0081 I hate the scare-registered program 0082 For it lacks a wham. 0083 As the heated graph... 0084 One cant help but laugh, 0085 For one is too poor,the other too dumb 0086 0087 0088 Lesson 5: Reg Allocation Pt.3: Using Less Registers 0089 Registers are finite,forms are not. A value may be in register R10 at one 0090 point,RDI at another 0091 0092 Lesson 6: Reg Allocation Pt.4: Assigning temporary registers 0093 0094 Lesson 7: Reg GENERATING MOTHERFUCKIN MACHINE CODE 0095 0096 Shitpit Pt.3 0097 0098 6-23-24 Pt.1 0099 0100 I am feignin for food. Also I apt upgraded my RISC-V machine that was running 0101 debian SID it messed things up. SID is the offical debian for RISC-V machines. 0102 Looks like a sad time for RISC-V machines around the world. 0103 0104 Who the fuck even uses RISC-V except for big-techies and me? 0105 0106 I worked on SmallTalk-Serialization. It isnt there yet but I sent it to aiwnio 0107 s.com today so you can see it do next to nothing. 0108 0109 I have decided that the frogs will not talk in the game for now. 0110 0111 6-22-24 Pt.2 0112 0113 Being dis-illusioned with living is a virtue when you make others happy. Die 0114 to make someone else's dream come true. I will ask about volenteering more to 0115 make someone else's dream come true. If I make the pain of others a pleasuree to 0116 me then that will be problematic when I face retaliation. If I make others' 0117 pleasure a pleasure to me then it will be better. 0118 0119 If living is a pleasure then suicide isnt a good option. I should seek neither 0120 death or living so I am pleasured by existence. My life shouldnt belong to me 0121 anymore. Let me be a public fuck toy for others to play with who feels nothing. 0122 0123 Can you win? Either you incur someone's disrepect or you fight them for 0124 respect. Either way you will feel pain. It seems to win at life you just give up 0125 fighting to win. The only thing better than winning is not having a battle in 0126 the first place. 0127 0128 0129 6-22-24 Pt.1 Serialization 0130 0131 I worked on some lit serialization code for SmallTalk(Save.HC). 0132 0133 0134 6-19-24 Pt.2 Tadpole Emergency 0135 0136 I accidently poured flavored water into my tadpole bowl. I saved 1 but there 0137 is another lurking in the bowl I think. I was drinking flavored water and I had 0138 another water for the tadpoles but I made a mistake and put the wrong water in. 0139 I hope sink water doesnt kill him. I put him in a pitcher full of sink water 0140 0141 I accidently killed assloads of tadpoles the other day because it was hot 0142 outside and they died. 0143 0144 6-19-24 Pt.1 0145 0146 I went to burger king and i bought a vegan burger. It was good. I bought new 0147 shoes today too. I was asked about primordial things. I cannot answer such 0148 questions. What is the purpose of eating,for fun. People learn things to 0149 construct reality 0150 0151 6-18-24 Pt.3 0152 0153 A king can give away his kingdom at death time. This is good. What if the king 0154 becomes alive again and sees how silly the new ruler is. Would he do it again. 0155 Ceasing to exist would be a blessing in this case. The pain comes not from his 0156 good(giving away the kingdom)but because of his attachment to his kingdom. I 0157 will give up the TOOM 2 port just as the King renounces his attachment to the 0158 world. I will try to make the networking code decent. I love my work but I will 0159 give it up when it is ready. 0160 0161 6-18-24 Pt.2 0162 0163 Good people arent just remembered for the things they accomplished but for 0164 what good they brought to others. It is important to remember how people 0165 impacted the world around them before we can analyze themself 0166 0167 6-18-24 Pt.1 0168 0169 Its so hot outside so I cant get tea so my productivity will plumet. I cannot 0170 operate while being hot without tea. I was debugging the networked multiplayer. 0171 I was sending the client hashes and using that size for the final number of 0172 things to be sent from the server. This lead to "vanishing" things. 0173 0174 The multiplayer code will suck ass but will be fun. People play games is for 0175 fun. I really really hope latency is not going to be an issue 0176 0177 6-17-24 Pt.4 Bool-3 0178 -] Birth bodies 0179 0180 -] (Inside) Earth 0181 0182 Natural things like rocks 0183 0184 -] From Water 0185 0186 Tadpoles 0187 0188 -] From Fire 0189 0190 Fire bodies 0191 0192 -] From Air 0193 0194 Bacteria 0195 0196 -] From Plants 0197 0198 Plants 0199 0200 -] Moving 0201 0202 Humans/animals 0203 0204 0205 0206 0207 6-17-24 Pt.3 Bool-2 0208 0209 -] Cha Jiva Nikayah(Classes of living beings) 0210 0211 -] 1 Sense(Sense of touch/collision) 0212 0213 Earth,fire/water phenomon,Plants 0214 0215 -] 2 Sense creatures(Taste) 0216 0217 Worms 0218 0219 -] 3 Sense creatures(Smell) 0220 0221 Ants 0222 0223 -] 4 Sense creatures(Sight) 0224 0225 Flies 0226 0227 -] 5 Sense creatures(Hearing) 0228 0229 Humans 0230 0231 0232 0233 6-17-24 Pt.2 0234 0235 It is hard to find my Amazon books. I bought a book called 0236 The Mystery of Life: 25 Bol.Jainism Simplified in English. It was so hard to 0237 find in my amazon stuff. I have other books like OpenCL cookbook and 0238 Santa Conquers the Homophobes. I think in the eariler shitpits I would say 0239 whatever with no filter and it was true. I think that some people arent equiped 0240 to hear unpleasant truths so I will be more conversative in my ramblings. It is 0241 best to humble yourself. 0242 0243 I used to wonder why scripture makes reference to human desires while 0244 condemning human vices. It is because Truth is so hard to understand sometimes 0245 you have to be able to eat it in a way that tastes good. The same applies to the 0246 Shitpit. Expousing reality is benefical and it leaves little room for baises. 0247 The religion of the Tirhankaras is good at expousing reality. 0248 0249 6-17-24 Pt.1 Bool-1 0250 0251 -] States of Movement between Lives 0252 0253 -] Narak Gati 0254 0255 Hellish Poo Poo realm 0256 0257 -] Tiryach Gati 0258 0259 A abnormal confused reality comparable to human life 0260 0261 -] Manusha Gati 0262 0263 Transgere to a Human or Human-Like(Samaska) life,the only state that can 0264 obtain Moska 0265 0266 -] Deva Gati 0267 0268 A Godlike state of existence 0269 0270 0271 0272 6-16-24 Pt.2 0273 0274 Fuckin DolDoc fucked up my dollar signs and I lost some shitpit entries 0275 0276 0277 6-15-24 Pt.2 0278 0279 The only thing better than winning a fight is not having one. I am a big 0280 looser because I am not a winner. 0281 0282 6-15-24 Pt.1 0283 0284 Working on Doom is boring now. I have to implement the secret levels. Big 0285 boring. I cant wait to work on the frogs game again. 0286 0287 6-12-24 Pt.2 0288 0289 The Gihon server at aiwnios.com 6667 now uses CrossNetShims. You can probably 0290 run it on vinilla TempleOS. 0291 0292 6-12-24 Pt.1 0293 0294 Scientists use precise langauge,psychologists use abstract language. There is 0295 a clear disconnect. I have not seen psychologist so anything impressive. I have 0296 heard that bhuddists are a middle way. I dont know what this actually means. 0297 0298 People in distress hire lawyers to whine for them in precise langauge. In 0299 precise language I will say that "help" is in itself useless. Therapy only works 0300 becuase of the process of help and not the therapy itself. It you use magic to 0301 help you it is irrelevant if magic is acutally real because you are putting your 0302 faith in magic and that is what is causing you to change. 0303 0304 6-10-24 Pt.3 0305 0306 Enemies in TOOM can walk through each-other(it gets crowded). I will make them 0307 "bounce" off eachother in the future maybe 0308 0309 6-10-24 Pt.2 0310 TOTSE(Looks like a cool website). Its not goatse,its like an old text board that 0311 is pretty cool. 0312 0313 6-10-24 Pt.1 0314 0315 Kralech streamed porn during a twich stream. I laughed even though its bad. I 0316 optimized the TOOM collision code today. It's quite boring actually. I was 0317 iterating all of the things that needed colision. This is bad because if you 0318 have 100 things,that means you will do 100*100 things. I now ONLY use the thing 0319 grid(blockmap) when looking for things. It speeds things up alot. 0320 <2>
0321 0322 0323 0324 0325 0326 0327 0328 0329 0330 0331 0332 0333 0334 0335 0336 0337 0338 0339 Doom II has massive levels and its boring to play. I still have to balance the 0340 gameplay a bit. 0341 0342 0343 6-9-24 Pt.1 0344 0345 Billie Ellish is a depressed singer who says things that dperessed people want 0346 to hear with Good-Artistry. 0347 0348 My favorite singers are those who talk about poop/the n-word with good 0349 artistry. Not really good taste but idk. 0350 0351 -] Best signers 0352 0353 1 - London Yellow(Raps about poop) 0354 2 - Rucka Rucka Ali(Is a fan of racism but not a racist somehow) 0355 3 - Micheal Jackson(Good artistry) 0356 4 - Scarlxrd (Fuckin sick flows,but lacking in depth) 0357 0358 0359 Ill tell you a story though a comic 0360 Froggis
0361 0362 0363 0364 0365 0366 0367 0368 0369 0370 0371 0372 0373 0374 0375 0376 0377 0378 0379 0380 0381 0382 0383 0384 0385 0386 0387 0388 0389 0390 0391 0392 0393 0394 0395 0396 0397 0398 0399 0400 0401 0402 0403 0404 0405 0406 0407 0408 0409 0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 0450 0451 6-8-24 Pt.2 0452 0453 Wtf 0454 0455 6-8-24 Pt.1 0456 0457 I live in a good country where I can do barley anything and live likee a king. 0458 I dont know why it seems suicide is so common here,but this isnt the point. 0459 Monks dont really do too much so its good. I am blessed enough to have a job 0460 where I feed homeless people and can think 0461 0462 Monks limit their travel. When I was a kid there were plants that would get 0463 stuck to me. They would attach themselves to me. Much in the same way a plant 0464 attaches its seeds to an animal,morals attach themselves to animals from travel. 0465 0466 If I was to quit getting tea everyday this would be good. Sticking your head 0467 underwater for swimming sounds fun until you run out of breath. I will practice. 0468 0469 6-7-24 Pt.2 0470 0471 -] Ratnakarandaka Sravak-acara notes Pt.1 0472 0473 -] The path to Nirvana is defined by 0474 0475 1 - Right Faith 0476 2 - Right knowledge 0477 3 - Right conduct 0478 -] Right Faith 0479 0480 Belief in the true Devas who are free from vices of the flesh and who 0481 are onmipotetent and who have true dharma. 0482 Gods are true only when they say the right things in an unbaised nature 0483 with no evil motives. Truth is clouded by biases therefore true Gods have 0484 to have no biases 0485 0486 Right Faith is above knowledge and conduct. A seed is not above the tree 0487 0488 -] Limbs of faith 0489 0490 1 - Belief in realities substances 0491 2 - Rejection of sense gratifaction as they lead to bad karmas 0492 3 - Love for monks 0493 4 - Rejection of poo poo brain morality 0494 5 - Dont corrupt truth 0495 6 - ??? 0496 7 - Have respect for monks and householders 0497 8 - Establish the glory of the Jain religion by doing cool stuff. 0498 0499 0500 -] Right Knowledge 0501 0502 True Knowledge is neither ineffective of exagerated. 0503 0504 -] Right Conduct 0505 0506 Ridding yourself of likes and dislikes is peace 0507 -] Anuvratas (minor vows) 0508 0509 1 - Avoid destruction of >=2 sensed beigns(anything beyond vegetables) 0510 2 - Dont make falsehood or say harmful truths 0511 3 - No stealing 0512 4 - No adultery 0513 5 - No buying assloads of shit 0514 6 - No wine and honey 0515 0516 -] Moolgunas (fundamental virtues) 0517 0518 Digvrata - Limit travel distance 0519 Dont eat roots and flowers and butter 0520 0521 0522 0523 0524 0525 0526 6-7-24 Pt.1 0527 0528 Here is a secret formula for making a TempleOS ram disk: 0529 0530 CDrv *dv=DrvMakeFreeSlot(DrvNextFreeLet('A')); 0531 CBlkDev *bd=BlkDevNextFreeSlot(dv->drv_let,BDT_RAM); 0532 bd->max_blk=0x10000; 0533 BlkDevAdd(bd,,TRUE,TRUE); 0534 Fmt('A'); 0535 0536 I want to make Aiwnios's files be put in a RAM disk,user files will be put in 0537 hard-disk or whatever,that way you cannot mess up the KernelA.HH 0538 6-6-24 Pt.2 0539 0540 "Transiton" means seperation from the past and the future. Is is fundamentary a 0541 seperation. In this possibly transitory journey I am on in life I am seperated by 0542 nature. Transition ends when you reach your goal. It is fallacious thinking to 0543 think things are acquired except through the self. You dont get knowledge by 0544 appearing in class in the same way therapists dont cure you. It only works if you 0545 believe in it. 0546 0547 I said that hope is composed of abstraction and heuristics. It is fundamentally 0548 an abstraction of truth that looks closer to a desired result. You are forcing 0549 reality to look like a desired outcome via hope. If something doesnt look 0550 right,just abstract the ill feelings out of it and it will look better. This is 0551 how hope works. 0552 0553 I gave up a long time ago on hope. It is better to confront a cruel reality than 0554 to abstract the truth out of truth and become a poo poo brain. 0555 0556 6-6-24 Pt.1 0557 0558 I accidently deleted the shitpit entry for today 0559 0560 5-28-24 Pt.1 0561 0562 A fool seeks validation of others while a learned man knows himself. I am 0563 working on a Temple-Chat thing that is an AI. Self control is black and white. 0564 Either you control yourself or not. Reality is a good religion to study and you 0565 can find it's scripture everywhere you look. I suppose the Tirhankaras wouldnt 0566 mind me studing algorithms becasue theyt are real. 0567 0568 I cannot control myself to turn off my brain because i want to study Machine 0569 Learning. My mind is racing,the world could be burning and I wouldnt care. Man Im 0570 fuckin zooted. 0571 0572 0573 0574 5-27-24 Pt.1 0575 0576 Im Pushin' P putting Quake2 from steam on a flash drive to play on the RISC-V 0577 machine. I once said I am a living legend. This is simply not the case. A educated 0578 person in kindegarden looks like a genius(by comparasion). I need to find the rest 0579 of the compiler clan.Im not sure where they are 0580 0581 In my life I used to play with transitors as a kid. I wanted to build robots. I 0582 guess you could say I was a genius,but in reality I simply had access to more 0583 imformation than other kids. Its not that hard to build and AND gate,or a NOT 0584 gate. Alternating Current was secrectly above my head. I never understood 0585 inductors. 0586 0587 Math is the real star of the show. Do you ever wonder how people come up with 0588 operational amplifiers and filters; It's through math. Ill give an example of a 0589 simple amplifier and how math is responsible for it 0590 <4>
0591 0592 0593 0594 0595 0596 0597 0598 0599 0600 0601 0602 0603 0604 0605 0606 0607 0608 Edit: I have no idea how I worked the math of an operational amplififier at like 0609 12/13. I have become dumbers over the years. Time to stop pretending to be smart 0610 0611 5-26-24 Pt.2 0612 0613 Some people suffer for fame. I am not famous and even if I was I would not care. 0614 If you have seen the qualities of seeking attention you have seen whatever the 0615 fuck this is: 0616 <5>
0617 0618 0619 0620 0621 0622 0623 0624 0625 0626 0627 0628 0629 0630 0631 0632 0633 0634 0635 0636 0637 Detioration of the senses and substance will occur. You will no longer be able 0638 to drink the Gamer Girl piss and bathwater. Dont carelessly misuse yourself while 0639 you are sensible. God will misuse you once your senses start to disappear and you 0640 will be unable to construct reality. I dont know if the target demographic for 0641 retarded Gamer Girl piss is old men or young men. I really dont know. 0642 0643 5-26-24 Pt.1 0644 0645 I heard autistic people cannot think abstractly easier. If I look at my notes 0646 they are not glued togheter or make any sense when viewed as a whole. They are not 0647 concrete(abstract). I am diagnosed with autism but I dont have it too bad. 0648 0649 You may be wondering about socialization. I have wrote before that beings are 0650 capable of receiving and giving love. This could apply to humanity at large as 0651 opposed to a small group of individuals. I do not care about anyone enough to 0652 marry them. I don't even care about them enough to serious talk to them,but I care 0653 enough to offer tea to homeless people and volenteer/work at food pantry for 0654 homeless people. I dont do this for money because I only get paid half of what I 0655 "work"(I volenteer the rest of the days). 0656 0657 See this section for why I am not Schitzophrenic. 0658 0659 5-25-24 Pt.2 0660 0661 Have you seen internal conflict. No? I have(self control). There are few if any 0662 outside oppressors. A room with a sexy RISC-V machine or other programmable 0663 machine is sexy is the same as the world to me. I wonder about the mentality of 0664 insane people. I used to belive God wanted me to wash myself alot but I was not 0665 insane becuase the Quran said so,therefore my "insane" OCD was based in a sort of 0666 reality. I was operating on bad info. I am not actually insane because I was 0667 operating on bad information as opposed to pure insanity. 0668 0669 Actually insne people(I imagine) are unable to different reality from thoughts. 0670 Insane people and "insane" people only appear the same on the outside. Hueristics 0671 are illrevelant here. 0672 0673 0674 5-25-24 Pt.1 0675 0676 Biases obscure reality. Try looking in the mirror and seeing an evil person. 0677 Morality seems to be used to justify sins more than it is used to condemn them. 0678 People eat food then it comes back out. This is self morality. True morality is 0679 not a by-product. 0680 0681 A facts is different than the reason is it being presented to you 0682 0683 5-23-24 Pt.1 0684 0685 People going full smart mode must not eat beans. There was a crow 2(?) days ago 0686 that wanted to enter my workplace,he flew into the window multiple and squaked and 0687 left his claw-marks on the window. Mr Crow tried to enter again at the front door. 0688 0689 What belongs to humans is in my hands,and what is the crow's is in his(?) claws. 0690 It is improper to take what belongs to the crow,and improper for the bird to enter 0691 my workplace,even though he is cute. 0692 0693 5-22-24 Pt.1 0694 0695 Things not to think about: 0696 <6>
0697 0698 0699 0700 0701 0702 0703 0704 0705 0706 0707 0708 0709 0710 0711 0712 0713 0714 0715 0716 0717 0718 0719 0720 0721 Im not sure why this sounds like a good idea to me. They say sharing sins is a 0722 first step. Just as jucie has less taste when mixed with lots of water,sins become 0723 reduced when confessed. I asked StableDefusion to make a picture of a hedgehog 0724 made out of shit and cheetos but I didnt get a good result 0725 0726 5-21-24 Pt.4 0727 0728 I will reload the Smalltalk compiler. I wil use goto's instead of switch 0729 statements 0730 0731 5-21-24 Pt.3 0732 0733 We loose life when we loose senses(by death),to live we must remain sensible to 0734 live. I think of a severly retarded frog individual that has no snese of reality 0735 and does everthing that comes to mind. He looks like a meth addict. 0736 0737 I should make a archive of sexy content that demonstrates the in-sensibity of 0738 humans,like a "best of" list of crazyshit.com. I saw a guy smoking meth out of 0739 some fine plumbing dressed up like Super Mario. I swear the shit was fuckin lit. 0740 0741 5-21-24 Pt.2 0742 The Tirhankaras would not approve of deporting people but I cannot censor 0743 myself. The best person to deport to Africa is yourself sometimes. 0744 0745 5-21-24 Pt.1 0746 0747 Systematic deportation of mastrubators to Africa is a good way to solve the 0748 world's problems. Ill do research on how to run for President. I need to be 35 0749 years old. We need to assemble a Pornhub to Africa pipeline to fuel economic 0750 growth. Africa will benefit because they will have people to help fix poverty 0751 <7>
0752 0753 0754 0755 0756 0757 0758 0759 0760 0761 0762 0763 0764 0765 0766 0767 0768 0769 0770 0771 0772 0773 0774 0775 0776 0777 0778 0779 0780 0781 0782 0783 0784 0785 0786 0787 0788 0789 0790 0791 5-20-24 Pt.5 0792 0793 It is improper to romanicize anything out of reach. Security is a virtue. If I 0794 lost everythng and I accept the situation I will have security. Hypothetical gains 0795 from "just try it" are no match for security. A hyptohetical gain is lesser than 0796 the actuall loss in aquiring such a gain. Doing what suites you and makes you 0797 happy is perfecty fine and doesnt need to be fixed 0798 0799 5-20-24 Pt.4 0800 0801 Delusion could be defined as holding a gun to someone's head and claiming 0802 victimhood for the victim disobeying him. If the victim obeys it is still 0803 delusion. They say forced non-murder isnt true peace. This is the socitey 0804 delusion 0805 0806 Societies are defined by sets of morals. A Society without morals is an 0807 oxymoron. 0808 0809 Good people sell cures.Bad people create problems then sell cures. It is common 0810 for people to advocate freedom then condemn the liberties of others. Religious 0811 freedoom is no more of an oxymoron than society liberty. No values == no morals. 0812 The only super power you get from morality is self control 0813 0814 It seems to me that people dont have true morals and are just pretending. If I 0815 say the n word then everyone will condemn me but I am literally on a literal level 0816 harming no one. Sweet words("dont say the n word") can motivate people to do good. 0817 Does evil brew in silence or numbers. 0818 0819 Religion is good at reminding people to have morals. Home and security guards 0820 evils. Its like visiting house that you no longer live in. 0821 0822 5-20-24 Pt.3 0823 0824 If you have even seen words,you probably dont remember the paper they were 0825 written on. Thats becuase it is way too easy to read words. You could even 0826 transliterate greek if I told you what the letters sounded like. Reading isnt the 0827 true virtue,understanding is. Why am I writing the things I write 0828 0829 Compasion comes in 2 forms,Self-helping and Self-Obstructing. Somtimes helping 0830 others helps you or hurts you. Rejecting compassion is garenteed to deny the 0831 possibly of benefit but accepting compasion can give you either or 0832 0833 5-20-24 Pt.2 0834 0835 I am not a f*g,maybe I am a fig so I might be plantsexual but I dont know how 0836 sexy lettuce is. I dont know if it is possible that plants have genderes 0837 0838 5-20-24 Pt.1 0839 0840 Members of the Heavens Gate cult dressed up as star trek charactors before 0841 pwning themselves. Sometimes reality is strange we have to do strange things to 0842 express reality. It is less narcasistic to accept a loss than to deny it. I am 0843 reflecting on my reality.It is an serious act,the only people seeing 0844 trajedy/confusion are outsiders 0845 0846 5-19-24 Pt.2 0847 0848 Abstracting the dying out of death is bad. Everyone wants what they lust for 0849 until they have it. Vice versa. The problem with good people isnt good people 0850 dying,rather its when death becomes an abstract and trajedy becomes just. 0851 0852 5-19-24 Pt.1 0853 0854 I am a creatin with little sense of direction,but with a Compiler and loads of 0855 time. Despite being true I will refuse to hear it from other. Just in the same way 0856 it is useless to reason with a wall,it is useless to explain compilers with 0857 outsiders. Likewise it is useless to reason with me about direction; This is not a 0858 choise made in ignorance though 0859 0860 A Goldfish does what is best for him,witihin his capacity. Whatever hypothetical 0861 gain will go over it's goofy goldfish brain. He is soley concerned with reality. 0862 Anyone thinking of hyptheticals alone isnt thinking about reality. Goldfish poo 0863 poo brains are good at reality studies. 0864 0865 My misadventures are focosed with reality and not hyptoheticals. A hyptohetical 0866 evil is lesser than the actuall evil in combaring a hypothetical evil. 0867 0868 Morality is over my head. It is not for me to decide. 0869 0870 5-13-24 Pt.1 0871 0872 It is a strange occurance to read something to complex to understand,it is 0873 stranger to understand it. Aquisition and understanding is a 2 fold activity 0874 0875 5-10-24 Pt.2 0876 0877 Dillo 3.1 is out,grab your bros 0878 0879 5-10-24 Pt.1 0880 0881 I will say that humility is knowling your place as the asker of questions. Gods 0882 I think have a degree of humility in awnsering questions. The planter doesnt ask 0883 the Sun God for rain and the Althete doesnt ask the Rain God for sun. I suppose 0884 the Gods know their place and we ought to know our place too 0885 The 1 God cannot awnser the prayers of both the farmer and the athlete. 0886 0887 You see,knowledge is reduction ,and reality consitutes knowledge. You cannot 0888 attain liberation without reduction and restaint from evil 0889 0890 Clayton 0891 0892 <nrootconauto@gmail.com>
0893 0894 0895 0896 0897 0898 0899 0900 0901 0902 0903 0904 0905 0906 0907 0908 0909 0910 0911 0912 0913 0914 0915 0916 0917 0918 0919 0920 0921 0922 0923 0924 0925 0926 0927 0928 0929 0930 WIP DOOM port 0931 I am working on a port of Doom that runs on Aiwnios(TOOM). 0932
0933 0934 0935 0936 0937 0938 0939 0940 0941 0942 0943 0944 0945 0946 0947 0948 0949 0950 0951 0952 0953 0954 0955 0956 0957 0958 0959 0960 0961 0962 0963 0964 0965 0966 0967 0968 0969 0970 0971 0972 0973 0974 0975 0976 0977 0978 0979 0980 Compiler Part 1,The Lexer 0981 0982 The first part of the compiler is the lex. It turned the text from the source 0983 code into words(tokens) that the compiler understands. For example, 0984 "123" gets turned into a TK_I64. 0985 0986 In our lexer,we have CLexFile's which are blocks of text we read,this can we any 0987 piece of text,like a macro's definition or an #exe block or a file. We get the 0988 charactors out of the Lexer via LexGetChar,which will do things like free the old 0989 CLexFile if we reach the end of the stream. 0990 0991 Sometimes we want to put a charactor back into the stream. You can use CCF_USE_L 0992 AST_U16 to reuse the last charactor. For example,if we are looking for digits in 0993 the expression 123; and we hit the semicolon,we dont want to discard the semicolon 0994 that we just got,so we put it back into the lexer by setting CCF_USE_LAST_U16 0995 0996 0997 <10>
0998 0999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 Compiler Part 2,The Parser 1018 1019 The second part of the compiler is the the parser. At the heart of this parser 1020 (in AIWNIOS_PrsExp.HC) is the shunting yard algorithm. This uses Reverse Polish 1021 Notation. This is a form of stack notation that looks like this: 1022 1023 1024 1 2 + 3 4 + * 1025 1026 The operators come is the order that they are used,lets see again with some 1027 parenthesis 1028 1029 ((1 2 +) (3 4 +) *) 1030 1031 Pretty epic isn't it. 1032 1033 To generate this,I use a stack called CCmpCtrl->ps with a class of CPrsStk. 1034 There are 3 stacks in a CPrsStk. The first is the precedence stack,the second is 1035 pointers to the generated CRPN's. The final is tree nodes. 1036 1037 The algorithm works by immediately pushing numbers to the stack first. Operators 1038 are pushed to the Shunting yard stack. It looks like this 1039 1040 <11>
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 The first thing to do here is put the '+' operator on the stack. 1061 1062 <12>
1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 The next thing to do(after we push 2 to the output) is to check if + comes after 1083 *. + comes after the * so we push it to the output,then push * to the stack for 1084 later. We end up with something like this 1085 1086 <13>
1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 Once we are at the end of input(after we add 3). We add all the operators to the 1109 output 1110 1111 <14>
1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 Compiler Part 2,The Parser II 1132 1133 UNDER CONSTRUCTION 1134 1135 Compiler Part 3,The Code Generator 1136 1137 1138 The code generator in aiwnios is platform dependant and is written in C to make 1139 porting to new platforms easier(bootstrapping is done in C). There is an interface 1140 in AIWNIOS_CodeGen.HC to use the turn the Intermediate Codes from the HolyC parser 1141 into the C intermediate codes. 1142 1143 There are multiple phases to turning the intermeidate codes into machine code. 1144 The first phases are in optpass.c. This file is pretty simple and does things like 1145 constant folding(OptPassConstFold) and merging communitive operations(OptPassMerge 1146 Communitives). This is boring stuff ,but the epic part is in x86_64_backend.c(or a 1147 rm_backend.c for AARCH64). 1148 1149 The most important thing this file does is generate machine code,at the top of 1150 the file you will see functions that generate voluptuous X86 instructions for you. 1151 The second most important part is generating the temporary registers for the 1152 intermediate codes. 1153 1154 To do this,I imagine the CRPN's as a tree. Beacuse temporary registers are 1155 scare,we need to make good use of them. A good way to do this is to assign them to 1156 the leafs of the tree,and when we are done using them,we Pop them from our 1157 imaginary stack(computers loves stacks). 1158 1159 1160 <15>
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 The heavy lifting for this is done in PushTmpDepthFirst. This we recuse into the 1179 parse "Tree" and Push items once it's children are done. Items are popped when we 1180 are done with them. The PushTmp/PushTmpSpilled functions will automatically choose 1181 a temporary register based on how many temporary registers are used,or if none are 1182 availble a stack location will be choosed. 1183 1184 The fun part is at the __OptPassFinal function. This is basically a gaint switch 1185 statement that will generate the machine code from the intermediate codes. 1186 1187 This is done in 2 passes,the first pass is done to see how big the resulting 1188 source code is,and the second part is to actually generator the source code. In my 1189 code generator,I have code_misc's on some of the intermedaite codes like IC_GOTO. 1190 1191 Sometimes we want the address of a label,but we dont know it untill all the 1192 machine code is generated. You can have the compiler fill in the label at an 1193 offset in the machine code with CodeMiscAddRef(CCodeMisc*,I64 offset). At the end 1194 of our OptPassFinal function I fill in the holes with the label pointers. 1195 1196 1197 User-Guide 1198 1199 Runtime Part 1:Graphics I 1200 1201 Use the Fs->draw_it callback to draw something to the current window 1202 1203 1204 U0 DrawIt(CTask *,CDC *dc) { 1205 dc->color=BLUE; 1206 GrRect(dc,0,0,100,100); 1207 } 1208 Fs->draw_it=&DrawIt; 1209 1210 1211 1212 The first argument is a pointer to the CTask being drawn,and the second argument 1213 is a CDC drawing context,use some primitives to draw to the screen. 1214 1215 -] GrRect 1216 1217 GrRect(dc,200,200,100,100); 1218 1219 -] GrPlot(single pixel) 1220 1221 GrPlot(dc,200,200); 1222 1223 -] GrFillCircle 1224 1225 GrFillCircle(dc,100,100,50); 1226 1227 -] GrCircle 1228 1229 GrCircle(dc,100,100,50); 1230 1231 -] GrLine 1232 1233 GrLine(dc,100,100,0,0); 1234 1235 -] GrPrint 1236 1237 GrPrint(dc,100,100,"Hello World"); 1238 1239 -] GrBlot(copy dc to other dc) 1240 1241 GrBlot(dc,100,100,new); 1242 1243 -] DCClear 1244 1245 DCClear(dc); //Resets Z buffer 1246 1247 -] DCFill 1248 1249 DCFill(dc,COLOR); 1250 1251 1252 Runtime Part 1:Graphics Transformations and 3D graphics 1253 1254 TempleOS lets you do sexy stuff with the graphics like 3D graphics. At the heart 1255 of this is a transformation matrix. Im not a math genius but luckily for me there 1256 are functions for managing the math for me. Before we can use a transformation 1257 matrix,we need to set the DCF_TRANSFORMATION flag in CDC->flags. After wards you 1258 can use matrix functions to rotate your drawing things cordanates 1259 1260 1261 CDC *dc=DCNew(100,100); 1262 Mat4x4IdentEqu(dc->r); //Assign a identity matrix(No transformation) 1263 DCFill; 1264 dc->flags|=DCF_TRANSFORMATION; 1265 F64 rotx=0; 1266 for(;rotx<=2*pi;rotx+=(2*pi/100.)) { 1267 DCFill(dc); 1268 Mat4x4IdentEqu(dc->r); //Reset our transformation 1269 Mat4x4RotZ(dc->r,rotx); 1270 Mat4x4TranslationEqu(dc->r,50,50,0); 1271 dc->color=YELLOW; 1272 GrRect3(dc,0,0,0,50,50); 1273 DCFill; 1274 GrBlot(,100,100,dc); 1275 Sleep(33); 1276 } 1277 DCDel(dc); 1278 DCFill; 1279 1280 1281 Here are a list of (transformation) matrix goodies: 1282 -] Mat4x4RotX 1283 1284 //Rotates around the X axis,used for Y-flipping 1285 1286 -] Mat4x4RotY 1287 1288 //Rotates around the Y axis,used for X-flipping 1289 1290 -] Mat4x4RotZ 1291 1292 //Rotates around the Z axis,use general 2D rotations 1293 1294 -] Mat4x4Scale 1295 1296 //Zooms a matrix 1297 1298 -] Mat4x4TranslationEqu 1299 1300 Mat4x4TranslationEqu(mat,x,y,z); //Sets the cordantes of a matrix 1301 1302 -] Mat4x4TranslationAdd 1303 1304 Mat4x4TranslationAdd(mat,x,y,z); //Add to the cordantes of a matrix 1305 1306 -] Mat4x4MulXYZ 1307 1308 Mat4x4MulXYZ(mat,&x,&y,&z); //THIS WILL TRANSFORM THE CORDANTES BY THE MATRIX 1309 1310 1311 You may want to do general math on matricies too: 1312 -] Mat4x4IdentEqu 1313 1314 Mat4x4IdentEqu(mat); //This makes a normal matrix that doesnt do transofrmations 1315 1316 -] Mat4x4IdentNew 1317 1318 I64 *malloced=Mat4x4IdentNew; //This makes a normal matrix that doesnt do 1319 transofrmations 1320 1321 -] Mat4x4MulMat4x4Equ 1322 1323 Mat4x4MulMat4x4Equ(dst,a,b); //Multiplies a matrix to another matrix,ask a 1324 genius what this actually does 1325 1326 -] Mat4x4MulMat4x4New 1327 1328 I64 *malloced=Mat4x4MulMat4x4Nw(a,b); //Same as above but MAlloced 1329 1330 1331 Sometimes in your 3D adventures you may want to make sure you draw things in the 1332 distacne behind the things in the front. This is called Z-buffering. In TempleOS 1333 this is easy-peasy. Just call DCDepthBufAlloc(dc). This will handle your depths 1334 for you. 1335 1336 Here is a cube thing for you: 1337 1338 1339 CD3I32 poly[4]= {{-100,-100,-100},{100,-100,-100},{100,100,-100},{-100,100,-100}}; 1340 I64 colors[4]= {BLUE,YELLOW,GREEN,CYAN}; 1341 CDC *dc=DCNew(200,200); 1342 dc->r=Mat4x4IdentNew; 1343 DCDepthBufAlloc(dc); 1344 DCFill; 1345 dc->flags|=DCF_TRANSFORMATION; 1346 F64 rotx=0,roty; 1347 CD3I32 cube[6][6]; 1348 I64 i=0,i2=0; 1349 I64 *trans=Mat4x4IdentNew; 1350 for(rotx=0.; rotx<=(2.*pi)-1.; rotx+=2*pi/4.) { 1351 Mat4x4IdentEqu(trans); 1352 Mat4x4RotX(trans,rotx); 1353 Mat4x4RotY(trans,roty); 1354 for(i2=0; i2!=4; i2++) { 1355 MemCpy(&cube[i][i2],&poly[i2],sizeof(CD3I32)); 1356 Mat4x4MulXYZ(trans,&cube[i][i2].x,&cube[i][i2].y,&cube[i][i2].z); 1357 } 1358 i++; 1359 } 1360 for(rotx=0; rotx<=2*pi; rotx+=(2*pi/100.)) { 1361 DCFill(dc); 1362 DCDepthBufRst(dc); 1363 Mat4x4IdentEqu(dc->r); 1364 Mat4x4RotX(dc->r,rotx); 1365 Mat4x4RotY(dc->r,rotx); 1366 Mat4x4RotZ(dc->r,rotx); 1367 Mat4x4Scale(dc->r,.5); 1368 Mat4x4TranslationEqu(dc->r,0,0,3000); 1369 for(i2=0; i2!=6; i2++) { 1370 dc->color=colors[i2]; 1371 GrFillPoly3(dc,4,cube[i2]); 1372 } 1373 DCFill; 1374 GrBlot(,100,100,dc); 1375 Sleep(33); 1376 } 1377 DCDel(dc); 1378 DCFill; 1379 1380 1381 If you ran the above example,the cube looks flat,THIS IS BECUASE YOU NEED TO 1382 MAKE THINGS SHRINK IN THE DISTANCE 1383 1384 Let me introduce the CDC->transform callback: This callback will be called for 1385 every point that is rendered when DCF_TRANSFORMATION is enabled. To acheive the 1386 epic "shrinking effect",divide the X/Y coordinates by the Z coordanate times a 1387 scale distance Let's see an example: 1388 Heres an example: 1389 1390 1391 #define SCRN_SCALE 512 1392 U0 Transform(CDC *dc,I64 *x,I64 *y,I64 *z) 1393 { 1394 I64 zz; 1395 Mat4x4MulXYZ(dc->r,x,y,z); 1396 zz=SCRN_SCALE/3+*z; 1397 if (zz<1) zz=1; 1398 *x=SCRN_SCALE/2* *x/zz; 1399 *y=SCRN_SCALE/2* (*y)/zz; 1400 *x+=dc->x; 1401 *y+=dc->y; 1402 *z+=dc->z; 1403 } 1404 CDC *dc=DCAlias; 1405 dc->transform=&Transform; 1406 dc->flags|=DCF_TRANSFORMATION; 1407 I64 dist=0; 1408 dc->z=-60; 1409 for(dist=0;dist!=100;dist++) { 1410 Mat4x4TranslationEqu(dc->r,0,0,dist); 1411 dc->color=LTRED; 1412 GrRect3(dc,0,0,0,100,100); 1413 Refresh; 1414 DCFill; 1415 } 1416 1417 Runtime Part 1:Graphics Raster Operations 1418 1419 In TempleOS there are 16 colors,but you can mix them to make "new" colors. This 1420 is called dithering. To use dithering to use raster operations. This allows us to 1421 do things like make shading or invert the colors below what your drawing. Let's 1422 get started 1423 1424 1425 CDC *dc=DCAlias; 1426 I64 cnt; 1427 for(cnt=0;cnt!=100;cnt++) { 1428 dc->color=LTRED+YELLOW<<16+ROPF_DITHER; //Mix LTRED+YELLOW for Orange-ish color 1429 GrRect3(dc,0,0,0,100,100); 1430 Refresh; 1431 DCFill; 1432 } 1433 1434 1435 If you though that was cool,check out probability dithering. This will make a 1436 shading effect. You can change the percentage of what color gets used to make a 1437 shading of your choice.The CDC->dither_probability_u16 is a 16bit percentage of 1438 the the colors being used. If the dither_probability_u16 is 0,it will use 1439 dc->color,otherwise it will use dc->color.u8[2] if the probability is U16_MAX; 1440 1441 Let's rock(.u8[2] is 16 bits over): 1442 1443 CDC *dc=DCAlias; 1444 I64 cnt; 1445 for(cnt=0;cnt!=100;cnt++) { 1446 dc->color=BLACK; 1447 GrRect(dc,0,0,100,100); 1448 dc->color=LTRED+YELLOW<<16+ROPF_PROBABILITY_DITHER; 1449 dc->dither_probability_u16=U16_MAX*ToF64(cnt)/100.; 1450 GrFloodFill(dc,10,10); 1451 Refresh; 1452 DCFill; 1453 } 1454 DCDel(dc); 1455 1456 Runtime Part 2: Making Noises 1457 1458 TempleOS makes sounds that will bring you back to the days of Atari games. The 1459 simplest way to make a tone is Snd(23);(This higher the number the higher the 1460 pitch). Call "Snd;" to cancel the sound. 1461 1462 If you want to go the extra mile and make a bodacious explosioon sound,use Nois 1463 e(milliseconds,min_pitch,max_pitch);. Or if you want a jumping sound,use Sweep. 1464 1465 Runtime Part 3: Making Music 1466 1467 TempleOS let's you make some epic jams. To do this,we use the Music 1468 1469 A simple song looks like this: 1470 1471 Play("wChDqEeFwGwAwB"); 1472 1473 1474 There are special charactors that change the duration/properties of the notes,so 1475 without further ado,here is a list 1476 -] # 1477 1478 Make a note sharp(comes after the note) 1479 1480 -] w 1481 1482 When before a note,it makes it a whole note 1483 1484 -] h 1485 1486 Makes a half note 1487 1488 -] q 1489 1490 Makes a 1/4 note 1491 1492 -] e 1493 1494 Makes a tiny eigth note 1495 1496 1497 You can change the tempo of the music via the global vairable music.tempo(Be 1498 sure to reset the music's settings via MusicSettingsRst) 1499 1500 Try this: 1501 1502 1503 music.tempo=8; 1504 Play( 1505 "hEhEwEhChEwGqG" 1506 "wCqGqEqAqBqA#qAqGhEhGwAhFhGwEhChDqB" 1507 "wCqGqEqAqBqA#qAqGhEhGwAhFhGwEhChDqB" 1508 "hGhF#hFhD#wEqG#qAhCqAhChD" 1509 "hGhF#hFhD#wE.wC.wC.wC" 1510 "hGhF#hFhD#wEqG#qAhCqAhChDwD#wDwC" 1511 "hGhF#hFhD#wEqG#qAhCqAhChD" 1512 "hGhF#hFhD#wE.wC.wC.wC" 1513 "hGhF#hFhD#wEqG#qAhCqAhChDwD#wDwC" 1514 ); 1515 MusicSettingsRst; 1516 1517 Runtime Part 4: Meta-data and Reflection 1518 1519 HolyC is a mainly just in time language. This means when the code gets 1520 compiled,the information about the code is still in memory. This is great for 1521 having the code reflect on itself and saves a lot of time doing meanial things 1522 like serializing a class. The primary way to do this is via MetaData. This means 1523 data about the self. 1524 1525 To get the metadata of a class out of the compiler,we must use the CTask's hash 1526 table and do these steps 1527 1528 -] Step 1 1529 1530 Lookup the class by it's name CHashClass 1531 *findc=HashFind(cls,Fs->hash_table,HTT_CLASS); 1532 1533 -] Step 2 1534 1535 Lookup the class by it's name CMemberLst 1536 *member=MemberFind("member_name",findc); 1537 1538 -] Step 3 1539 1540 Lookup the meta data I64 meta_data=MemberMeta("META_DATA",member); 1541 1542 1543 1544 Perhaps an example will help: 1545 1546 class CMeta { 1547 I64 a fmt "A:%d\n"; 1548 I64 b fmt "B:%d\n"; 1549 F64 c fmt "C:%n\n"; 1550 }; 1551 CMeta abc={1,2,3}; 1552 U0 Main(U8 *ptr,U8 *cls=lastclass) { 1553 CHashClass *findc=HashFind(cls,Fs->hash_table,HTT_CLASS); 1554 CMemberLst *ml; 1555 U64 sf; 1556 if(!findc) return; 1557 ml=MemberFind("a",findc); 1558 sf=(ptr+ml->offset)[0](U64); 1559 if(MemberMetaFind("fmt",ml)) { 1560 Print(MemberMetaData("fmt",ml),sf); 1561 } 1562 } 1563 Main(&abc); //Here we use lastclass to get the class of abc 1564 1565 1566 If you want to make a form using meta data,you can use PopUpForm 1567 1568 1569 class CInput { 1570 //Be sure to use -P with strings 1571 U8 name[STR_LEN] format "\n"; 1572 I64 age format "\n"; 1573 Bool is_tall format "\n"; 1574 }; 1575 CInput inp; 1576 PopUpForm(&inp); 1577 "%s is %d years old\n",inp.name,inp.age; 1578 if(inp.is_tall) 1579 "Tall!\n"; 1580 1581 1582 Runtime Part 5: Filesystem 1583 1584 If you are used to using TempleOS,use the Cd("Folder"); to move into a folder. 1585 You can list the contents of the directory via Dir(".");("." is the current folder 1586 ). Sometimes you want your programs to be aware of the folders. Luckily for 1587 you,you have come to the right place 1588 1589 In TempleOS,each task has a current directory path in Fs->cur_dir(this doesnt 1590 include the drive letter). If you want the full path,use DirCur. 1591 1592 To make a file,use FileWrite("filename","text",4 /*text length*/);. When you 1593 want to read it use FilleRead("filename",&len); FileRead will always put a NULL 1594 terminator at the end of the file for your,so you can use it like a string. 1595 1596 Like C,in TempleOS you can read files in a stream,But in TempleOS,all file 1597 reads/writes act directly on the Hard-Disks sectors(Which are BLK_SIZE bytes big). 1598 You FOpen("filename","w") for writing FOpen("filename","r") for reading. To open a 1599 file for adding more data to it,use FOpen("filename","w+"). Lets see an example 1600 1601 1602 // 1603 // Files opened with FOpen MUST WRITE BLK_SIZE bytes at once 1604 // A BLK is the size of a hard-disk sector 1605 // 1606 CFile *file=FOpen("Database.BIN","w"); 1607 class CFileEnt { 1608 U8 name[STR_LEN]; 1609 U8 password[STR_LEN]; 1610 }; 1611 #assert sizeof(CFileEnt)<=BLK_SIZE 1612 CFileEnt clayton={"Clayton","123"}; 1613 CFileEnt root={"Root","toor"}; 1614 U8 buffer[BLK_SIZE]; 1615 MemCpy(buffer,&root,sizeof(CFileEnt)); 1616 FBlkWrite(file,buffer,0,1); //Write 1 blk at the first block(blk 0) 1617 MemCpy(buffer,&clayton,sizeof(CFileEnt)); 1618 FBlkWrite(file,buffer,1,1); //Write 1 blk at the second block(blk 1) 1619 FClose(file); 1620 // 1621 // Now we read 1622 // 1623 file=FOpen("Database.BIN","r"); 1624 CFileEnt user; 1625 while(FBlkRead(file,buffer,,1)) { 1626 MemCpy(&user,buffer,sizeof(CFileEnt)); 1627 "Got user \"%s\" with password \"%s\"\n",user.name,user.password; 1628 } 1629 FClose(file); 1630 1631 1632 Making and reading files is fun,but first you need to figure out where a file 1633 is. To do this use, . This will return a CDirEntry of the results(which may be 1634 multiple files). Assuming you are familiar with wildcards from Linux,DOS and CP/M. 1635 Look at this example 1636 1637 1638 FileWrite("abc.TXT","abc",3); 1639 FileWrite("def.TXT","def",3); 1640 FileWrite("ghi.TXT","ghi",3); 1641 CDirEntry *cur,*root=FilesFind("*.TXT",FUF_JUST_FILES); 1642 for(cur=root;cur!=NULL;cur=cur->next) { 1643 "I Found %s\n",cur->full_name; 1644 } 1645 DirEntryDel(root); 1646 1647 1648 A CDirEntry has much information about the directory structure. The most 1649 important is full_name which tells you the full name of the file as you may 1650 expect(name is the filename without the path). When you are done with a CDirEntry 1651 be sure to free the root data with . 1652 1653 To check if a file exists,you can use FileFind("file.HC") to check if a file 1654 exists. 1655 1656 Time to get to the nitty gritty. Has some epic flags you can use.Im not going to 1657 waste time with exposiiton,rather I will give you a table of flags 1658 1659 1660 -] FUF_RECURSE 1661 1662 This will search in the child folders for the pattern too 1663 1664 -] FUF_JUST_DIRS 1665 1666 Chooses only directories(folders) 1667 1668 -] FUF_JUST_FILES 1669 1670 Chooses only files 1671 1672 -] FUF_JUST_TXT 1673 1674 Chooses only text files 1675 1676 -] FUF_JUST_DD 1677 1678 Chooses only DolDoc files 1679 1680 -] FUF_JUST_SRC 1681 1682 Chooses only source files 1683 1684 -] FUF_Z_OR_NOT_Z 1685 1686 This will ignore Ziped named of files and just check as normal 1687 1688 -] FUF_FLATTEN_TREE 1689 1690 This will flatten a FUF_RECURSE tree for you conveince 1691 1692 1693 If you want to delete files,use DelTree("folder/files");,or if you just want to 1694 remove a fule use Del("file"); 1695 1696 There are 2 ways to make a folder,use Cd("a/b/c/d/e",TRUE); to make a path,or 1697 make a folder one at a time via DirMk("folder_name");. Copy your stuff via CopyTre 1698 e("old","new") or just a file via Copy("old","new"). 1699 1700 And by the way you can open a file chooser via PopUpPickFile("T:/"); 1701 1702 Runtime Part 6: Data structures(1 CQue) 1703 1704 TempleOS comes loaded with useful data structures but it may be confusing at 1705 first. The most important one is a CQue. This means a Circular Queue. It's likle a 1706 loop,ill draw a picture for you. 1707 1708 1709 1710 <16>
1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 As you can see(poorly drawn) is that each item has 2 pointers( the CQue->last 1721 and the CQue->next).The ->last pointer is the previous item in the chain,not the 1722 "last" one. 1723 1724 To make a new CQue,use QueInit on the item make both pointers point to the 1725 item,which means an empty CQue. You can insert items into the CQue via QueIns(to_i 1726 nsert,at). Perhaps an example will help you. 1727 1728 In our below example,I start at head and also end at head as the queue is 1729 ciruclar 1730 1731 1732 CQue *head=MAlloc(sizeof CQue),*one=MAlloc(sizeof CQue),*two=MAlloc(sizeof 1733 CQue),*cur; 1734 QueInit(head); 1735 QueIns(one,head); 1736 QueIns(two,one); 1737 for(cur=head->next;cur!=head;cur=cur->next) 1738 "Current element(excuding HEAD):%P\n",cur; 1739 QueDel(head); //Remove all items in the CQue 1740 Free(head); //QueDel doesnt Free the head 1741 1742 1743 To get the count of items in your queue use QueCnt(head). And to remove an item 1744 form the queue(not Free it),use QueRem which will detach the item from a queue 1745 1746 1747 CQue *head=MAlloc(sizeof CQue),*one=MAlloc(sizeof CQue),*two=MAlloc(sizeof 1748 CQue),*cur; 1749 QueInit(head); 1750 QueIns(one,head); 1751 QueIns(two,one); 1752 QueRem(one); //Detach one from the CQue 1753 Free(one); //Free it's data 1754 for(cur=head->next;cur!=head;cur=cur->next) 1755 "Current element(excuding HEAD):%P\n",cur; 1756 QueDel(head); //Remove all items in the CQue 1757 Free(head); //QueDel doesnt Free the head 1758 1759 1760 You can insert get the item count of the QueCnt(head) 1761 1762 Here is a reference section: 1763 -] QueInit(head) 1764 1765 Intialize the head of a queue 1766 1767 -] QueIns(to_ins,elem) 1768 1769 Insert an item after the elem 1770 1771 -] QueInsRev(to_ins,elem) 1772 1773 Insert an item before the elem 1774 1775 -] QueRem(elem) 1776 1777 Detach an item from the queue(doesnt free it) 1778 1779 -] QueDel(head) 1780 1781 Frees all items in the queue 1782 1783 -] QueCnt(head) 1784 1785 How many items in the queue(excluding the head) 1786 1787 1788 Runtime Part 7: Data structures 2(HashTable) 1789 1790 Hash tables are like dictionary data structures and each task has one in Fs->has 1791 h_table. Each CHash has a type and a str. 1792 1793 When you look up a hash from a hash-table you will need the type. For example,if 1794 we want to grab a define(HTT_DEFINE_STR) from our current task,we do: 1795 1796 #define FOO 123 1797 CHashDefineStr *def=HashFind("FOO",Fs->hash_table,HTT_DEFINE_STR); 1798 if(def) 1799 "%s\n",def->data; 1800 1801 We looked up foo with type HTT_DEFINE_STR. Sometimes we want to add things to a 1802 CHashTable. To do this we need to use HashAdd. 1803 1804 CHashDefineStr *d=CAlloc(sizeof(CHashDefineStr)); 1805 d->str=StrNew("Hello"); //Must allocate string on heap 1806 d->type=HTT_DEFINE_STR; 1807 d->data=StrNew("10"); 1808 HashAdd(d,Fs->hash_table); 1809 //We added the macro Hello into the hash table 1810 "%d\n",Hello; 1811 1812 1813 Sometimes you want to make your own hashtables. You can do this via HashTableNew 1814 (size). size MUST BE A POWER OF 2. 1815 1816 Any generic data in the hashtable should use type HTT_FRAME_PTR as HashTableDel 1817 doesnt try to make assuptions on how to free the data 1818 1819 Perhaps an example will help: 1820 1821 CHashTable *ht=HashTableNew(0x100); 1822 CHashGeneric *ent=CAlloc(sizeof CHashGeneric); 1823 ent->user_data0=1; 1824 ent->user_data1=2; 1825 ent->user_data2=3; 1826 ent->type=HTT_FRAME_PTR; 1827 ent->str=StrNew("look"); 1828 HashAdd(ent,ht); 1829 CHashGeneric *g=HashFind("look",ht,HTT_FRAME_PTR); 1830 "%d,%d,%d\n",g->user_data0,g->user_data1,g->user_data2; 1831 HashTableDel(ht); 1832 1833 1834 Here is a reference of hash table functions 1835 1836 -] HashAdd(item,table) 1837 1838 Adds an item to the hash table 1839 1840 -] HashRemDel(item,table) 1841 1842 Delete an item from the hash table 1843 1844 -] HashFind(str,table,type) 1845 1846 Find an item in the table 1847 1848 -] HashSingleTableFind(str,table) 1849 1850 Find an item in the table,but dont check parent task's thing 1851 1852 -] HashTableNew(sz) 1853 1854 Make new hashtable,sz must be a power of 2 1855 1856 1857 Runtime Part 8: Data structures 3(Fifo) 1858 1859 Fifo's mean "First In First Out" and do things like store key presses. The first 1860 key you press is the the first one you get out. They also have a maximum 1861 size,which means that if you get too many keys,the old ones will be discarded 1862 1863 It looks like this: 1864 <17>
1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 First create a FIFO with FifoI64New,Size must be a power of 2 1881 1882 CFifoI64 *fifoI64=FifoI64New(4); 1883 FifoI64Ins(fifoI64,1); 1884 FifoI64Ins(fifoI64,2); 1885 FifoI64Ins(fifoI64,3); 1886 1887 You can remove an item with FifoI64Rem. This takes a pointer and returns TRUE 1888 1889 CFifoI64 *fifoI64=FifoI64New(4); 1890 FifoI64Ins(fifoI64,1); 1891 FifoI64Ins(fifoI64,2); 1892 FifoI64Ins(fifoI64,3); 1893 I64 val; 1894 while(FifoI64Rem(fifoI64,&val)) 1895 "Got a %d\n",val; 1896 1897 1898 Here is a reference section 1899 1900 -] FifoI64New(sz) 1901 1902 Make a new fifo,sz must be a power of 2 1903 1904 -] FifoI64Flush(f) 1905 1906 Remove all the items from the fifo 1907 1908 -] FifoI64Cnt(f) 1909 1910 Get a count of all the items in the fifo 1911 1912 -] FifoI64Peek(f,&val) 1913 1914 Look at the next item in the fifo without removing it 1915 1916 -] FifoI64Del(f) 1917 1918 Free the fifo 1919 1920 -] FifoI64Rem(f,&val) 1921 1922 Remove an item from the fifo 1923 1924 -] FifoI64Ins(f,val) 1925 1926 Insert an item into the fifo 1927 1928 -] FifoU8Flush(f) 1929 1930 Remove all the items from the fifo 1931 1932 -] FifoU8Cnt(f) 1933 1934 Get a count of all the items in the fifo 1935 1936 -] FifoU8Peek(f,&val) 1937 1938 Look at the next item in the fifo without removing it 1939 1940 -] FifoU8Del(f) 1941 1942 Free the fifo 1943 1944 -] FifoU8Rem(f,&val) 1945 1946 Remove an item from the fifo 1947 1948 -] FifoU8Ins(f,val) 1949 1950 Insert an item into the fifo 1951 1952 -] FifoU8New(sz) 1953 1954 Make a new fifo,sz must be a power of 2 1955 1956 1957 Runtime Part 9: User Input 1958 1959 TempleOS lets you do lit stuff like click on things and use the keyboard. These 1960 events are passed through messages. We use GetMsg to get the messages,along with a 1961 message mask. 1962 1963 I64 x,y; 1964 U0 DrawIt(CTask *t,CDC *dc) { 1965 dc->color=RED; 1966 GrRect(dc,x,y,100,100); 1967 } 1968 U0 Run() { 1969 Fs->draw_it=&DrawIt; 1970 I64 m,x2,y2; 1971 while(TRUE) { 1972 m=GetMsg(&x2,&y2,1<<MSG_MS_MOVE+1<<MSG_MS_R_DOWN); 1973 if(m==MSG_MS_R_DOWN) 1974 break; 1975 x=x2; 1976 y=y2; 1977 Refresh; 1978 } 1979 } 1980 Run; 1981 1982 1983 Keyboard messages can be gotten via ScanKey(&ch,&sc). The first argument is the 1984 ASCII charactor,and the second one is the scancode. The scancode is the raw key 1985 being pressed and has flags in it. I'll give an example usage of the function 1986 first before I dive into details. 1987 1988 I64 x,y; 1989 U0 DrawIt(CTask*,CDC*dc) { 1990 dc->color=GREEN; 1991 GrRect(dc,x,y,100,100); 1992 } 1993 U0 Run() { 1994 Fs->draw_it=&DrawIt; 1995 I64 msg,sc,ch; 1996 for(;TRUE;) { 1997 if(ScanKey(&ch,&sc)) { 1998 if(sc&0xff==SC_ESC) break; 1999 if(sc&0xff==SC_CURSOR_UP) { 2000 y-=3; 2001 } else if(sc&0xff==SC_CURSOR_DOWN) { 2002 y+=3; 2003 } else if(sc&0xff==SC_CURSOR_LEFT) { 2004 x-=3; 2005 } else if(sc&0xff==SC_CURSOR_RIGHT) { 2006 x+=3; 2007 } 2008 } else { 2009 Refresh; 2010 } 2011 } 2012 } 2013 Run; 2014 2015 As you can see,I check the first 8 bits(0xff) of the scan code to test what key 2016 it is. There also flags on the scancode that tell you things like if the shift key 2017 is down etc. 2018 2019 The first byte of scancode is the key code,but the other bytes are flags which 2020 can be tested via the "&" operator 2021 2022 2023 I64 x,y; 2024 I64 color=GREEN; 2025 U0 DrawIt(CTask*,CDC*dc) { 2026 dc->color=color; 2027 GrRect(dc,x,y,100,100); 2028 dc->color=RED; 2029 } 2030 U0 Run() { 2031 Fs->draw_it=&DrawIt; 2032 I64 msg,sc,ch; 2033 for(;TRUE;) { 2034 if(ScanMsg(&ch,&sc,1<<MSG_KEY_UP|1<<MSG_KEY_DOWN)) { 2035 if(sc.u8[0]==SC_ESC) break; 2036 if(sc.u8[0]==SC_CURSOR_UP) { 2037 y-=3; 2038 } else if(sc.u8[0]==SC_CURSOR_DOWN) { 2039 y+=3; 2040 } else if(sc.u8[0]==SC_CURSOR_LEFT) { 2041 x-=3; 2042 } else if(sc.u8[0]==SC_CURSOR_RIGHT) { 2043 x+=3; 2044 } 2045 if(sc&SCF_CTRL) 2046 color=RED; 2047 else if(sc&SCF_SHIFT) 2048 color=YELLOW; 2049 else 2050 color=GREEN; 2051 } else { 2052 Refresh; 2053 } 2054 } 2055 } 2056 Run; 2057 2058 2059 Here's a list of scancode flags: 2060 2061 -] SCF_KEY_UP 2062 2063 The key was released 2064 2065 -] SCF_CTRL 2066 2067 The Ctrl key is down 2068 2069 -] SCF_SHIFT 2070 2071 The shift key is down 2072 2073 -] SCF_ALT 2074 2075 The alt key is down 2076 2077 -] SCF_CAPS 2078 2079 The Caps lock key is down 2080 2081 -] SCF_NUM 2082 2083 The NumLock key is kdown 2084 2085 -] SCF_SCROLL 2086 2087 Scroll Lock key is down 2088 2089 -] SCF_MS_L_DOWN 2090 2091 The left mouse is down 2092 2093 -] SCF_MS_R_DOWN 2094 2095 The right mouse is down 2096 2097 -] SCF_NO_SHIFT 2098 2099 There is no shift 2100 2101 2102 Here's a list of scancode keys: 2103 2104 -] SC_ESC 2105 2106 The escape key 2107 2108 -] SC_BACKSPACE 2109 2110 The backspace key 2111 2112 -] SC_TAB 2113 2114 The tab key 2115 2116 -] SC_ENTER 2117 2118 The enter key 2119 2120 -] SC_CTRL 2121 2122 The ctrl key 2123 2124 -] SC_ALT 2125 2126 The alt key 2127 2128 -] SC_CAPS 2129 2130 The caps lock key 2131 2132 -] SC_NUM 2133 2134 The num lock key 2135 2136 -] SC_SCROLL 2137 2138 The scroll lock key 2139 2140 -] SC_CURSOR_UP 2141 2142 The up key 2143 2144 -] SC_CURSOR_DOWN 2145 2146 The down key 2147 2148 -] SC_CURSOR_LEFT 2149 2150 The left key 2151 2152 -] SC_CURSOR_RIGHT 2153 2154 The right key 2155 2156 -] SC_PAGE_DOWN 2157 2158 The page down key 2159 2160 -] SC_PAGE_UP 2161 2162 The page up key 2163 2164 -] SC_HOME 2165 2166 The home key 2167 2168 -] SC_END 2169 2170 The end key 2171 2172 -] SC_INS 2173 2174 The insert key 2175 2176 -] SC_DELETE 2177 2178 The delete key 2179 2180 -] SC_F1-SC_F12 2181 2182 The Fxx keys 2183 2184 -] SC_PAUSE 2185 2186 The pause key 2187 2188 -] SC_GUI 2189 2190 The logo key 2191 2192 -] SC_PRTSCRN1 2193 2194 The print screen key 2195 2196 -] SC_PRTSCRN2 2197 2198 The print screen key 2199 2200 2201 I mentioned eariler about GetMsg,and I used ScanMsg. GetMsg waits for an 2202 event,but ScanMsg doesn't. There are also message codes 2203 2204 -] MSG_KEY_DOWN(ch,scancode) 2205 2206 A Key is put down 2207 2208 -] MSG_KEY_UP(ch,scancode) 2209 2210 A Key is release 2211 2212 -] MSG_MS_MOVE(x,y) 2213 2214 The mouse is moved 2215 2216 -] MSG_MS_L_DOWN(x,y) 2217 2218 The left button is down 2219 2220 -] MSG_MS_L_UP(x,y) 2221 2222 The left button is down 2223 2224 -] MSG_MS_R_DOWN(x,y) 2225 2226 The right button is down 2227 2228 -] MSG_MS_R_UP(x,y) 2229 2230 The right button is down 2231 2232 2233 Runtime Part 9: Multithreading 2234 2235 TempleOS is non-premptive. This means each Task has to manually tell the 2236 computer when to context swap. The way to do this and prevent freezing is to Yield 2237 2238 In TempleOS,spawning task's is easy,use the Spawn function 2239 2240 2241 U0 Foo(U8 *data) { 2242 Beep; 2243 } 2244 Spawn(&Foo,"Some_data","TaskName"); 2245 2246 2247 You can make a user terminal via User. You can talk to that task via XTalk 2248 2249 2250 CTask *u=User; 2251 XTalk(u,"\"Exiting in 5 seconds\\n\";\n"); //Be sure to put a semi-colon at the 2252 end as we are "the-user". 2253 Sleep(5000); 2254 XTalk(u,"Exit;\n"); 2255 2256 2257 Sometimes you want to wait for a task to die,to do this use DeathWait 2258 2259 2260 CTask *t=User; 2261 DeathWait(&t); //Note address of t 2262 Beep; //Will beep when you exit the User task 2263 2264 2265 There is also a BirthWait 2266 2267 2268 CTask *t=User; 2269 BirthWait(&t); //Note address of t 2270 Beep; //Will beep when you exit the User task 2271 2272 2273 To avoid race conditions we use locks. In TempleOS this is acheived through 2274 locked bit instructions with spinlocks. How it works is LBts will set the bit,and 2275 return the old value of the bit. We keep on setting the bit. If the old value is 2276 not set,it means we have access to the lock,otherwise we keep on looping. Be sure 2277 to reset the bit when you are done with LBtr. 2278 2279 2280 I64 beep_lock=0; 2281 U0 OneThread(I64 snd) { 2282 //This will spin until bit 0 is reset(look at the end of the function) 2283 while(LBts(&beep_lock,0)) //LBts has a side effect of setting the bit after it 2284 is checked 2285 Yield; //We are going to be beeping for awhile so Yield out control to other 2286 tasks 2287 Beep(snd); 2288 //We reset bit 0 of beep_lock to signify we are done with it. 2289 LBtr(&beep_lock,0); 2290 } 2291 I64 i; 2292 for(i;i!=10;i++) { 2293 Spawn(&OneThread,i*7+10); 2294 "Spawned a thread!!\n"; 2295 } 2296 2297 Runtime Part 10: Jobs 2298 2299 In TempleOS,each core has a seth_task. This task does lit stuff like run Jobs 2300 which can be created via TaskExe and you get the results via JobResGet 2301 2302 2303 CJob *job=TaskExe(Gs->seth_task,Fs,"1+1;;;",0); 2304 res=JobResGet(job); 2305 Kill(jobber); 2306 "I got %d\n",res; 2307 2308 With cpu_structs,you can spawn jobs on other cores 2309 2310 2311 CTask *parent_task=Fs; 2312 I64 core=0; 2313 //mp_cnt is the number of cpus 2314 CJob *jobs[mp_cnt]; 2315 for(core=0;core!=mp_cnt;core++) { 2316 jobs[core]=TaskExe(cpu_structs[core].seth_task,Fs, 2317 "Sleep(RandI64%1000);" 2318 "Gs->num;;", //Gs is the current CCPU for the core,->num is the cpu number 2319 0); 2320 } 2321 for(core=0;core!=mp_cnt;core++) { 2322 "Core %d return %d\n",core,JobResGet(jobs[core]); 2323 } 2324 2325 2326 If you want to have the parent task wait while a job runs,you can use the JOBf_W 2327 AKE_MASTER flag. 2328 2329 2330 CTask *parent_task=Fs; 2331 //Things ending in a lowecase f as bits(and need to be shifted to be flags) 2332 TaskExe(Gs->seth_task,parent_task,"Play(\"EGBDF\");",(1<<JOBf_WAKE_MASTER)); 2333 2334 Runtime Part 11: DolDoc 2335 2336 Most of the text you see on screen is from the DolDoc layout engine. It uses a 2337 series of dollar signs to set things like the text color and make elements. The 2338 are stored as a circular queue of CDocEntry's. The easyiest way to make a DolDoc 2339 element is to use DocPrint,use DocPut to get the current task's document. 2340 2341 2342 //BT is a button 2343 CDocEntry *de=DocPrint(DocPut,"\n\n$BT,\"Hello\"$\n\n"); 2344 2345 2346 As you can see,the DolDoc entries have a type and argument. They are surrounded 2347 by $'s. They can also have flags too. This let's you do things like center the 2348 text. Lets see an example: 2349 2350 2351 //TX is a text,+CX is the center flag 2352 CDocEntry *de=DocPrint(DocPut,"\n\n$TX+CX,\"Hello\"$\n\n"); 2353 2354 2355 DolDoc entries can also take an argument,Links use this to figure out where to 2356 go when you click them. Arguments for DolDoc entries come after the comma,some of 2357 the arguments are named and have the format "name=value" 2358 2359 2360 CDocEntry *de=DocPrint(DocPut,"\n\n$LK,\"Text\",A=\"FL:/PersonalMenu.DD\"$\n\n"); 2361 2362 2363 You can interact directly with the generated CDocEntrys. You can put things like 2364 callbacks into them. In our below example I set the left_cb function pointer to 2365 Beep2 and I tell the entry that it has a callback with DOCEF_LEFT_CB. 2366 2367 2368 I64 Beep2(CDoc *,CDocEntry *) { 2369 Beep; 2370 } 2371 CDocEntry *de=DocPrint(DocPut,"\n\n$BT+CX,\"Hello\"$\n\n"); 2372 de->de_flags|=DOCEF_LEFT_CB; 2373 de->left_cb=&Beep2; 2374 2375 2376 You can use the DocMenu function to get a value from your document. I use the LE 2377 for a left-click-expression. 2378 2379 2380 U0 CreateDialog() { 2381 CDocEntry *nums[3]; 2382 I64 i; 2383 DocClear(DocPut); 2384 "$TX+CX,\"Pick a number:\"$\n"; 2385 for(i=0;i!=3;i++) { 2386 nums[i]=DocPrint(DocPut,"\n\n$BT+CX,\"%d\",LE=%d$\n\n",i,i); 2387 } 2388 DocBottom(DocPut); 2389 switch(DocMenu(DocPut)) { 2390 start: 2391 DocClear(DocPut); 2392 case 0: 2393 "You picked nothing lol.\n"; 2394 break; 2395 case 1: 2396 "One is the one\n"; 2397 break; 2398 case 2: 2399 "Two is too good\n"; 2400 break; 2401 end: 2402 } 2403 } 2404 CreateDialog; 2405 2406 2407 You can use PopUpForm to use a class's meta data for making a menu. 2408 2409 2410 U0 CreateDialog() { 2411 class CInput { 2412 //Be sure to use -P with strings 2413 U8 name[STR_LEN] format "\n"; 2414 I64 age format "\n"; 2415 Bool is_tall format "\n"; //CB is a Check box 2416 }; 2417 CInput inp; 2418 PopUpForm(&inp); 2419 "%s is %d years old\n",inp.name,inp.age; 2420 if(inp.is_tall) 2421 "Tall!\n"; 2422 2423 2424 Yeah time for some reference section ehh: 2425 2426 -] TX 2427 2428 Text 2429 2430 -] CR 2431 2432 Newline 2433 2434 -] CU 2435 2436 Cursor pos,normally a ASCII #5 2437 2438 -] TB 2439 2440 Tab 2441 2442 -] CL 2443 2444 Clears all elements without the "+H" flag 2445 2446 -] PB 2447 2448 Page break 2449 2450 -] PL 2451 2452 Page length 2453 2454 -] LM 2455 2456 Left margin 2457 2458 -] RM 2459 2460 Right margin 2461 2462 -] HD 2463 2464 Header margin 2465 2466 -] FO 2467 2468 Footer margin 2469 2470 -] ID 2471 2472 Indent,use wit tree elements,and use with a negative number to un-indent 2473 2474 -] FD 2475 2476 Forground default color 2477 2478 -] BD 2479 2480 Background default color 2481 2482 -] PT 2483 2484 Command Line Prompt 2485 2486 -] WW 2487 2488 Use 1 to enable word wrap,use 0 to disable 2489 2490 -] UL 2491 2492 Use 1/0 to enable/disable underline 2493 2494 -] IV 2495 2496 Disable/enable Inverting of colors 2497 2498 -] BK 2499 2500 Burger Kind,just kidding,it's actually for blinking 2501 2502 -] SX 2503 2504 Shift the text by a amount of pixels 2505 2506 -] SY 2507 2508 Shift the text up/down by an amount of pixels 2509 2510 -] CB 2511 2512 Checkbox 2513 2514 -] LS 2515 2516 Major Lit Alert 2517 Use with the "D" argument to make a list(from a DefineListLoad),do this 2518 $LS,"potato",D="ST_BIBLE_BOOKS"$ 2519 Clicking on this will make a menu to pick an item from the list 2520 2521 -] MA 2522 2523 A macro,clicking on this will insert LM into the command line prompt 2524 2525 -] TR 2526 2527 A Tree wigdet,use this with ID to nest the tree's 2528 2529 -] HL 2530 2531 Turn HolyC syntax highting on/off 2532 2533 2534 Here is a reference section for the flags,they can be added/removed with +/-(For 2535 example you can do "$TX+CX+H,\"I have CX and H flags.\"$\n";) 2536 2537 -] H 2538 2539 Hold,this will prevent CL from deleting this element 2540 2541 -] L 2542 2543 This will make the element act as a link 2544 2545 -] TR 2546 2547 This will make the element act as a tree 2548 2549 -] LS 2550 2551 This will make the element act as a list 2552 2553 -] PU 2554 2555 This will make a macro run in a popup window 2556 2557 -] C 2558 2559 This will collapse a tree,use -C to uncollapse the tree 2560 2561 -] X 2562 2563 This will save and Exit after the macro is done 2564 2565 -] UD 2566 2567 Update data on typing 2568 2569 2570 Here is a reference section for the argument codes,use them like "$TX,T=\"123\"$" 2571 2572 -] T 2573 2574 Tag text,this is the text that gets displayed. 2575 2576 -] LEN 2577 2578 Sets the length of the DA element. 2579 2580 -] A 2581 2582 Sets the link location 2583 2584 -] LE 2585 2586 Left expression,runs an expression on left click 2587 2588 -] RE 2589 2590 Right expression,runs an expression on right click 2591 2592 -] LM 2593 2594 Left macro,runs text on left click 2595 2596 -] RM 2597 2598 Right macro,runs text on right click 2599 2600 -] RT 2601 2602 Raw type of DA 2603 2604 -] U 2605 2606 User data 2607 2608 -] SCX 2609 2610 Scroll x columns Makes a amazing scrolling effect 2611 2612 -] SX 2613 2614 Scroll x pixels 2615 2616 -] SY 2617 2618 Scroll y pixels 2619 2620 2621 Making links is easy,to do this we use "$LK,\"text\",A=\"BF:Acts,2:3\"$"; Here 2622 is a reference for the link codes: 2623 2624 -] FI 2625 2626 File index,FI="file" or FI="file,line" 2627 2628 -] FF 2629 2630 File Find,FF="file,text" 2631 2632 -] BF 2633 2634 Bible Find,BF="book,text". "text" can be a chapter/verse 2635 2636 -] HI 2637 2638 Help Index,HI="Help Index". Make help indexes via #help_index 2639 2640 -] A 2641 2642 Symbol address, takes a pointer A="0x11223344" 2643 2644 2645 Now a function reference: 2646 2647 -] DocBottom 2648 2649 Move to the bottom of the document 2650 2651 -] DocCenter 2652 2653 Make ->cur_entry be in the viewport 2654 2655 -] DocClear 2656 2657 Clear all elements except those with the +H flag 2658 2659 -] DocCollapse(collapsed,doc) 2660 2661 Collapse or un-collapse all trees in the document 2662 2663 -] DocDel 2664 2665 Delete a documents memory 2666 2667 -] DocEntryDel(doc,elem) 2668 2669 Deletes a document entry 2670 2671 -] DocEntryCopy(doc,elem) 2672 2673 Copy an element 2674 2675 -] DocInsDoc(to,from) 2676 2677 Insert a document into an other document 2678 2679 -] DocLock 2680 2681 Lock a document 2682 2683 -] DocUnlock 2684 2685 Unlock a document 2686 2687 -] DocRst 2688 2689 Reset the document 2690 2691 -] DocTop 2692 2693 Go to the top of the document 2694 2695 -] DocLineRead(filename,line) 2696 2697 Read a line from a file 2698 2699 -] DocLineWrite(filename,line,text) 2700 2701 Write a line into a file 2702 2703 -] DocRead(filename) 2704 2705 Read a document from a file 2706 2707 -] DocLoad(into_doc,ptr,len) 2708 2709 Read a document from memory into a docuemnt 2710 2711 -] DocSave(doc,len_ptr) 2712 2713 Save a document into memory 2714 2715 -] DocWrite(doc) 2716 2717 Save a document to disk. Filename is detirmnined by DocNew("filename"); 2718 2719 -] DocMenu 2720 2721 Interact with a document until a value is found 2722 2723 -] DocForm 2724 2725 Use a class's meta-data to make a form for you to fill out 2726 2727 -] DocNew(filename) 2728 2729 Make a new document that will be saved to filename 2730 2731 -] DocGR(doc,filename.GR) 2732 2733 Insert a .GR file into a document 2734 2735 -] DocPrint 2736 2737 Print text into a document 2738 2739 -] DocPut 2740 2741 Get the current document for a task 2742 2743 -] DocType(doc,filename) 2744 2745 Type a file into a document