mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2025-03-28 19:05:10 +00:00
Restore Bible, GodWord, GodBiblePassage, BF: links
This commit is contained in:
parent
733feab1f5
commit
cce6b73cf3
29 changed files with 100747 additions and 119 deletions
Zenith-latest-2021-06-28-07_02_56.iso
src
Apps/Psalmody
Demo/MultiCore
Doc
ChangeLog.DDCredits.DDDolDocOverview.DDEdPullDown.DDFeatures.DDHelpIndex.DDStandBy.DDStdZenithOSPC.DDWelcome.DD
Home
HomeKeyPlugIns.CCHomeSys.CCMisc
Zenith
BIN
Zenith-latest-2021-06-27-02_52_32.iso → Zenith-latest-2021-06-28-07_02_56.iso
Executable file → Normal file
BIN
Zenith-latest-2021-06-27-02_52_32.iso → Zenith-latest-2021-06-28-07_02_56.iso
Executable file → Normal file
Binary file not shown.
|
@ -101,7 +101,7 @@ Bool JBPutKey(CDoc *doc, U8 *, I64 ch, I64 sc)
|
|||
{
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
st = MStrPrint("%s %s %s %s ", DivineWordStr, DivineWordStr, DivineWordStr, DivineWordStr);
|
||||
st = MStrPrint("%s %s %s %s ", GodWordStr, GodWordStr, GodWordStr, GodWordStr);
|
||||
DocTreeFAppend(tmpde->full_name, "Reward1/Reward2", "\"%s\"\n", st);
|
||||
Free(st);
|
||||
}
|
||||
|
|
|
@ -97,4 +97,4 @@ U0 Palindrome(U8 *filename)
|
|||
"Time:%9.5f\n", tS - t0;
|
||||
}
|
||||
|
||||
Palindrome("/Misc/Vocab.DD");
|
||||
Palindrome(BIBLE_FILENAME);
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
$WW,1$$FG,5$$TX+CX,"ChangeLog"$$FG$
|
||||
$IV,1$----06/28/21 06:20:21----$IV,0$
|
||||
* Restored /Zenith/God directory, the $LK,"Bible",A="FI:::/Misc/Bible.TXT"$, $LK,"Bible Links",A="BF:Exodus,20:1"$, and $MA-X+PU,"GodBiblePassage",LM="GodBiblePassage;View;\n"$ with SHIFT-F7.
|
||||
|
||||
$IV,1$----06/24/21 01:01:06----$IV,0$
|
||||
* Implemented PCI fall-back functions for when PCIBIOS is unsupported, to improve bare-metal support.
|
||||
* Abstracted $LK+PU,"PCI functions",A="FI:::/Kernel/PCI.CC"$ out from $LK+PU,"PCIBIOS",A="FI:::/Kernel/PCIBIOS.CC"$ file.
|
||||
|
@ -158,7 +161,7 @@ $IV,1$----02/23/20 02:36:28----$IV,0$
|
|||
$IV,1$----02/22/20 20:04:00----$IV,0$
|
||||
* Reduced $LK,"MEM_MIN_MEG",A="MN:MEM_MIN_MEG"$ to 256 MiB (VMWare users have to do less work).
|
||||
* Added $FG,2$<CTRL-ALT-X>$FG$ to AC $LK,"standby",A="FI:::/Doc/StandBy.DD"$ doc.
|
||||
* Removed the /Zenith/God directory. Bible.TXT has been removed. The functionality of HolySpirit.CC has been moved into $LK,"::/Zenith/Divination.CC",A="FI:::/Zenith/Divination.CC"$. Functions renamed from God*() to $LK,"Divine*",A="MN:DivineWord"$(). Psalmody GodSong feature $LK,"disabled",A="FF:::/Apps/Psalmody/PsalmodyMain.CC,GodSongStr"$. DolDoc "BF:" links removed. CtrlAltB() is free to be used for other things.
|
||||
* Removed the /Zenith/God directory. Bible.TXT has been removed. The functionality of HolySpirit.CC has been moved into $LK,"::/Zenith/Divination.CC",A="FI:::/Zenith/Divination.CC"$. Functions renamed from God*() to $LK,"Divine*",A="MN:GodWord"$(). Psalmody GodSong feature $LK,"disabled",A="FF:::/Apps/Psalmody/PsalmodyMain.CC,GodSongStr"$. DolDoc "BF:" links removed. CtrlAltB() is free to be used for other things.
|
||||
* Updated the $LK,"Charter",A="FI:::/Doc/Charter.DD"$.
|
||||
|
||||
$IV,1$----02/21/20 17:30:17----$IV,0$
|
||||
|
|
|
@ -30,7 +30,7 @@ I, $FG,2$Terry A. Davis$FG$, wrote all of TempleOS over the past 15.4 years (ful
|
|||
|
||||
*) God told me to stick with 640x480 16 color and single-voice 8-bit signed MIDI-like sample for sound. He kept me from zombie-walking into making child windows like $FG,2$Windows$FG$. Instead, I made one window per task with no child windows. He also guided my progress, very obviously.
|
||||
|
||||
*) I got $FG,4$$TX,"Webster's Dictionary",HTML="http://www.templeos.org/files/DICTIONARY.DD"$$FG$ from $FG,4$$TX,"Project Gutenberg",HTML="http://web.archive.org/web/20110730111436/http://promo.net/pg/"$$FG$.
|
||||
*) I got $FG,4$$TX,"Webster's Dictionary",HTML="http://www.templeos.org/files/DICTIONARY.DD"$$FG$ and $LK,"The King James Bible",A="FI:::/Misc/Bible.TXT"$ from $FG,4$$TX,"Project Gutenberg",HTML="http://web.archive.org/web/20110730111436/http://promo.net/pg/"$$FG$.
|
||||
|
||||
*) John Carmack inspired me to use "$LK,"Clamp",A="MN:Clamp"$" as a name instead of "Limit". He inspired me to use "needle" and "haystack" as names. He inspired me to simplify my Frames-Per-Second code.
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ See $LK,"::/Demo/DolDoc/CursorMove.CC"$.
|
|||
|
||||
$ID,-2$$TR,"AN Anchor"$
|
||||
$ID,2$The $LK,"CDocEntry",A="MN:CDocEntry"$.aux_str arg $FG,2$A=""$FG$ is used for the anchor. I don't use these very often, but they're good sometimes.
|
||||
$ID,-2$$TR,"LK Link"$
|
||||
$ID,-2$$TR-C,"LK Link"$
|
||||
$ID,2$The $LK,"CDocEntry",A="MN:CDocEntry"$.aux_str arg $FG,2$A=""$FG$ is used for the link text. With no aux the tag becomes the link text, as in example 3.
|
||||
|
||||
See $LK,"Link Types",A="MN:LK_FILE"$.
|
||||
|
@ -114,9 +114,10 @@ Examples: <CTRL-t> to see
|
|||
6)$LK,"Manual page link",A="MN:Print"$
|
||||
7)$LK,"File line num link",A="FL:::/Kernel/KernelA.HH,200"$
|
||||
8)$LK,"File anchor link -- <CTRL-t> to see anchor after you click",A="FA:::/Demo/DolDoc/DemoDoc.DD,MyLittleAnchor"$
|
||||
9) $LK,"Help Index Link",A="HI:DolDoc"$.
|
||||
10) $LK,"Address Link",A="AD:0x11000"$.
|
||||
11) For in-memory document address links, see $LK,"SpriteEdText",A="MN:SpriteEdText"$().
|
||||
9)$LK,"Bible link",A="BF:Acts,2:3"$ The chapter:verse actually just does a text search.
|
||||
10) $LK,"Help Index Link",A="HI:DolDoc"$.
|
||||
11) $LK,"Address Link",A="AD:0x11000"$.
|
||||
12) For in-memory document address links, see $LK,"SpriteEdText",A="MN:SpriteEdText"$().
|
||||
|
||||
$ID,-2$$TR,"BT Bttn"$
|
||||
$ID,2$See $LK,"::/Demo/DolDoc/MenuBttn.CC"$.
|
||||
|
|
|
@ -34,7 +34,8 @@ Insert
|
|||
GraphicResource(,CH_CTRLR,0x41300000413);
|
||||
FileName(,,0x3E0000003E);
|
||||
DirName(,,0x23E0000023E);
|
||||
DivineWord(,,0x4100000041);
|
||||
GodWord(,,0x4100000041);
|
||||
GodBiblePassage(,,0x24100000241);
|
||||
IndentIn(,CH_CTRLI,0x41700000417);
|
||||
IndentOut(,CH_CTRLI,0x61700000617);
|
||||
WordWrapOn(,CH_CTRLW,0x41100000411);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
$WW,1$$FG,5$$TX+CX,"ZenithOS' Features"$$FG$
|
||||
|
||||
* Oracle with $FG,2$<F7>$FG$ for words or $FG,2$<SHIFT-F7>$FG$ for passages.
|
||||
|
||||
* $FG,4$$TX,"x86_64",HTML="http://en.wikipedia.org/wiki/Amd64#AMD64"$$FG$, ring-0-only, single-address-map (identity), multitasking kernel with multicore support.
|
||||
|
||||
* Master/Slave MultiCore
|
||||
|
@ -42,12 +44,10 @@
|
|||
|
||||
* Code $LK,"profiler",A="MN:Prof"$, $LK,"merge",A="MN:Merge"$, $LK,"diff",A="MN:Diff"$ utils.
|
||||
|
||||
* $FG,2$PC Speaker$FG$ support with many songs.
|
||||
* $FG,2$PC Speaker$FG$ support with many hymns.
|
||||
|
||||
* Music composing tool.
|
||||
|
||||
* Word divination with $FG,2$<F7>$FG$.
|
||||
|
||||
* Many games, $LK,"demos",A="FI:::/Doc/DemoIndex.DD"$ and $LK,"documentation",A="FI:::/Doc/HelpIndex.DD"$.
|
||||
|
||||
* $FG,2$All source code$FG$ included. Only compiles with the included ZenithOS compiler and assembler.
|
||||
|
|
Binary file not shown.
|
@ -2,19 +2,21 @@ $FG,5$$TX+CX,"AutoComplete is in StandBy"$$FG$
|
|||
|
||||
$FG,4$$TX+CX+L+PU+UL,"System Keys Quick Guide",A="::/Doc/HelpIndex.DD"$$FG$
|
||||
$FG,4$$TX+CX,"(Works Everywhere)"$$FG$
|
||||
$FG,2$<SPACE> $FG$ Left-Click
|
||||
$FG,2$ <ENTER> $FG$ Right-Click
|
||||
$FG,2$ <F1> $FG$ Help
|
||||
$FG,2$ <CTRL-m> $FG$ Personal Menu
|
||||
$FG,2$ <ESC> $FG$ Save & Exit
|
||||
$FG,2$ <SPACE> $FG$ Left-Click
|
||||
$FG,2$ <ENTER> $FG$ Right-Click
|
||||
$FG,2$ <F1> $FG$ Help
|
||||
$FG,2$ <CTRL-m> $FG$ Personal Menu
|
||||
$FG,2$ <ESC> $FG$ Save & Exit
|
||||
$FG,2$ <SHIFT-ESC> $FG$ Abort & Exit
|
||||
$FG,2$<CTRL-ALT-X> $FG$Kill Window
|
||||
$FG,2$<CTRL-ALT-N> $FG$Focus Next Win
|
||||
$FG,2$ <CTRL-ALT-X> $FG$Kill Window
|
||||
$FG,2$ <CTRL-ALT-N> $FG$Focus Next Win
|
||||
$FG,2$ <WINDOWS> $FG$ Pull-Down Menu
|
||||
$FG,2$ <CTRL-D>$FG$ File Manager
|
||||
$FG,2$<CTRL-F>$FG$ Find
|
||||
$FG,2$<ALT-M>$FG$ Max Window
|
||||
$FG,2$<ALT-H>$FG$ Horz Tile
|
||||
$FG,2$<ALT-V>$FG$ Vert Tile
|
||||
$FG,2$ <ALT-M>$FG$ Max Window
|
||||
$FG,2$ <ALT-H>$FG$ Horz Tile
|
||||
$FG,2$ <ALT-V>$FG$ Vert Tile
|
||||
$FG,2$<CTRL-L>$FG$ Text Menu
|
||||
$FG,2$<ALT-SHIFT-A>$FG$ Close AC
|
||||
$FG,2$ <F7>$FG$ God Word
|
||||
$FG,2$ <SHIFT-F7>$FG$ God Passage
|
||||
$FG,2$<ALT-SHIFT-A>$FG$ Close AC
|
|
@ -58,7 +58,7 @@ $FG,5$$TX+CX,"Version 1.0"$$FG$
|
|||
|
||||
We will make a spec for a $$8,000, perfectly standardized, cryogenically-cooled, monster desktop PC. It will have 16 cores, integrated 4K graphics, and, hopefully, 6 Ghz continuous operation. Perhaps, 64 Gig of RAM will be standard? God said to help to poor buy them. It is pointless to have a high powered machine if other people have wimpy machines and cannot run programs you write. Therefore, everybody in the developed world will buy a Standard ZenithOS IBM PC over the next ten years, so that will be a quantity of 400 million, perhaps. God said to pay the US national debt with the revenue. We will standardize everything, not just the ZenithOS related items. The display will be 4K (and of course 640x480 16 color) and no others. Everybody gets just one monitor, unless you buy special PCI cards. Everybody gets two speakers, a headphone, a mic, a webcam and touch screen. We make the audio one sample rate and one sample size, but ZenithOS still gets just a square wave. (HD Audio is really screwed-up and requires complicated artificial intelligence, just to route output to speakers.)
|
||||
|
||||
The Standard Temple IBM PC will be a full-sized tower. Perhaps, stain-glass will decorate the case because God is sentimentally attached to stained-glass. We should set the size at exactly 2.5 feet by 1.5 feet by 1.5 feet as in the Exodus,25:10-10 for all time. If there is extra room, make a storage shelf for DVDs. We do not want a race-to-the-bottom, shrinking the size. Instead of making it smaller, make it more powerful. We want to remove all cost pressure from making things small. It must have a CD/DVD/Blu-ray drive. The vision is CD/DVDs used for a library of games, not installed on the hard-drive. We need a network connection, possibly implemented as a super-simple high speed serial device. What about standard monitor and speakers? The C64's success was partially due to wide spread, completely standard, hardware. I think ZenithOS will not do bad block devices, so we need a hard drive, not just NV-memory or SSD.
|
||||
The Standard Temple IBM PC will be a full-sized tower. Perhaps, stain-glass will decorate the case because God is sentimentally attached to stained-glass. We should set the size at exactly 2.5 feet by 1.5 feet by 1.5 feet as in $LK,"Exodus 25:10",A="BF:Exodus,25:10"$ for all time. If there is extra room, make a storage shelf for DVDs. We do not want a race-to-the-bottom, shrinking the size. Instead of making it smaller, make it more powerful. We want to remove all cost pressure from making things small. It must have a CD/DVD/Blu-ray drive. The vision is CD/DVDs used for a library of games, not installed on the hard-drive. We need a network connection, possibly implemented as a super-simple high speed serial device. What about standard monitor and speakers? The C64's success was partially due to wide spread, completely standard, hardware. I think ZenithOS will not do bad block devices, so we need a hard drive, not just NV-memory or SSD.
|
||||
|
||||
ZenithOS will have the priority over Windows or Linux on hardware decisions. We could make it heterogenious multicore. I think we want 16 non-hyperthreaded cores. Core#0 is the only full-featured core needed. The other cores will have long mode, but not some of these: real mode, protected mode, ring-3, paging, interrupts, in/out port instructions, SSE instructions, MMX instructions.
|
||||
|
||||
|
@ -77,7 +77,7 @@ The standard set-up will be a C primary drive and a D back-up drive. Keep the si
|
|||
|
||||
Having all your 3rd party software on separate DVDs or ISO files and ZenithOS running from a ROM, keeps it delightfully simple so you have complete understanding of what is going on. You will have complete confidence and it will be a joy to use. 3rd party applications can store saved data files into your /Home hard drive directory.
|
||||
|
||||
The Temple PC will stay unchanged for seven years at a time. The Bible speaks of a seven year release in Deuteronomy,15:1. The Commodore stayed unchanged for many years and people became intimately familiar with every aspect.
|
||||
The Temple PC will stay unchanged for seven years at a time. The Bible speaks of a seven year release in $LK,"Deuteronomy 15:1",A="BF:Deuteronomy,15:1"$. The Commodore stayed unchanged for many years and people became intimately familiar with every aspect.
|
||||
|
||||
$HC,"<object width=\"640\" height=\"520\"><param name=\"movie\" value=\"http://www.youtube.com/v/bs_jcTuwPKo\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/bs_jcTuwPKo\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" width=\"640\" height=\"520\"></embed></object>"$
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ $FG$I didn't like that, so I made parentheses optional on calls with no args and
|
|||
|
||||
The syntax change created an ambiguity when specifying function addresses, like for calling $LK,"QuickSort",A="MN:QuickSort"$(). To resolve it, I made a '$FG,2$&$FG$' required in front of function names when specifying an address of a function, which is better anyway.
|
||||
|
||||
Once I was no longer using standard C/C++ syntax, I decided to change everything I didn't like and call it $LK,"CosmiC",A="FI:::/Doc/CosmiC.DD"$. Here are the new $LK,"operator precedence",A="FF:::/Doc/CosmiC.DD,operator precedence"$ rules.
|
||||
Once I was no longer using standard C/C++ syntax, I decided to change everything I didn't like and call it $LK,"CosmiC",A="FI:::/Doc/CosmiC.DD"$. Here are the new $LK,"operator precedence",A="FF:::/Doc/CosmiC.DD,operator precedence"$ rules. It's Biblical! See $LK,"Luke 5:37",A="BF:Luke,5:37"$.
|
||||
|
||||
There are no object files in ZenithOS and, normally, you don't make executable files either, but you can. That's known as $LK,"Ahead-of-Time",A="FF:::/Doc/Glossary.DD,AOT Compile Mode"$ compilation. Instead, you $LK,"Just in Time",A="FF:::/Doc/Glossary.DD,JIT Compile Mode"$ compile.
|
||||
|
||||
|
|
|
@ -20,19 +20,21 @@ for (i = 0; i < AHCI_MAX_PORTS; i++)
|
|||
if (ata_drive < 0)
|
||||
throw('No ATA');
|
||||
|
||||
In("CC\n%d\n\n1024\n768\n\n\n", ata_drive);
|
||||
In("CC\n%d\n\n5\n\n\n", ata_drive);
|
||||
BootHDIns;
|
||||
|
||||
"\n\nSuccessful? ";
|
||||
if (YorN)
|
||||
{
|
||||
Once( "CursorRemove(\"/*\");;;"
|
||||
"#include \"DoDistro\";;"
|
||||
"if (DriveIsWritable)"
|
||||
"{"
|
||||
"Del(\"~/Registry.CC\");"
|
||||
"OutU16(0x4004, 0x3400);"
|
||||
"}");
|
||||
// Once( "CursorRemove(\"/*\");;;"
|
||||
// "#include \"DoDistro\";;"
|
||||
// "if (DriveIsWritable)"
|
||||
// "{"
|
||||
// "Del(\"~/Registry.CC\");"
|
||||
// "OutU16(0x4004, 0x3400);"
|
||||
// "}");
|
||||
|
||||
// Once(
|
||||
// "#include \"DoDistro\";;");
|
||||
BootRAM;
|
||||
}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
Cd(__DIR__);;
|
||||
|
||||
//If these are not present in /Home, it uses the version in the root dir. You
|
||||
//can make your own, modified, version of these files in your /Home directory.
|
||||
#include "~/HomeLocalize"
|
||||
#include "/Zenith/Boot/MakeBoot"
|
||||
#include "/Zenith/Utils/MakeUtils"
|
||||
#include "~/HomeWrappers"
|
||||
MapFileLoad("::/Kernel/Kernel");
|
||||
MapFileLoad("::/Compiler/Compiler");
|
||||
#include "~/HomeKeyPlugIns"
|
||||
#include "~/HomeSys"
|
||||
Cd("..");;
|
|
@ -23,7 +23,7 @@ Bool MyPutKey(I64 ch, I64 sc)
|
|||
//Return TRUE if you completely
|
||||
//handled the key.
|
||||
I64 i;
|
||||
U8 *st;
|
||||
U8 *st1, *st2;
|
||||
|
||||
if (sc & SCF_ALT && !(sc & SCF_CTRL))
|
||||
{
|
||||
|
@ -165,9 +165,18 @@ Bool MyPutKey(I64 ch, I64 sc)
|
|||
else
|
||||
{
|
||||
ClipDel;
|
||||
st = FileNameAbs(DocPut->filename.name);
|
||||
DocPrint(sys_clip_doc, "$$LK,\"FL:%s,%d\"$$", st, DocPut->cur_entry->y + 1);
|
||||
Free(st);
|
||||
st1 = FileNameAbs(BIBLE_FILENAME);
|
||||
st2 = FileNameAbs(DocPut->filename.name);
|
||||
if (!StrCompare(st1, st2))
|
||||
{
|
||||
Free(st1);
|
||||
st1 = BibleLine2Verse(DocPut->cur_entry->y + 1, ',');
|
||||
DocPrint(sys_clip_doc, "$$LK,\"BF:%s\"$$", st1);
|
||||
}
|
||||
else
|
||||
DocPrint(sys_clip_doc, "$$LK,\"FL:%s,%d\"$$", st2, DocPut->cur_entry->y + 1);
|
||||
Free(st1);
|
||||
Free(st2);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ U0 StartUpTasks()
|
|||
"Boot Time:%7.3fs\n", tS;
|
||||
XTalk(user, "Cd;#include \"Once\";\n");
|
||||
Silent; //no output to screen
|
||||
ACInit("/*");
|
||||
ACInit("/*;!*/Bible.TXT");
|
||||
Silent(OFF); //no output to screen
|
||||
|
||||
if (sys_boot_src.u16[0] != BOOT_SRC_RAM)
|
||||
|
|
100117
src/Misc/Bible.TXT
Normal file
100117
src/Misc/Bible.TXT
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1478,6 +1478,14 @@ U0 DoPrompt()
|
|||
DeathWait(&task, TRUE);
|
||||
}
|
||||
|
||||
U0 DoNumBible()
|
||||
{
|
||||
CTask *task = User;
|
||||
XTalkWait(task, "#include \"::/Demo/DolDoc/NumBible\";\n");
|
||||
Del("~/DemoNumBible.DD");
|
||||
DeathWait(&task, TRUE);
|
||||
}
|
||||
|
||||
U0 DoForm()
|
||||
{
|
||||
CTask *task = User;
|
||||
|
@ -1656,7 +1664,7 @@ U0 OSTestSuite()
|
|||
TS("RadixDort"); TSFile("::/Demo/RadixSort");
|
||||
TS("MPAdd"); DoMPAdd;
|
||||
TS("Primes"); TSFile("::/Demo/MultiCore/Primes");
|
||||
TS("Palindrome"); TSFile("::/Demo/MultiCore/Palindrome");
|
||||
TS("Palindrome"); if (FileFind(BIBLE_FILENAME)) TSFile("::/Demo/MultiCore/Palindrome");
|
||||
TS("MPRadix"); if (mp_count > 1) TSFile("::/Demo/MultiCore/MPRadix");
|
||||
TS("LoadTest"); if (mp_count > 1 && DriveIsWritable(':')) TSFileChar("::/Demo/MultiCore/LoadTest");
|
||||
TS("MPPrint"); if (mp_count > 1) TSFile("::/Demo/MultiCore/MPPrint");
|
||||
|
@ -1764,6 +1772,7 @@ U0 OSTestSuite()
|
|||
TS("Data"); TSFile("::/Demo/DolDoc/Data");
|
||||
TS("CallBack"); TSFile("::/Demo/DolDoc/CallBack");
|
||||
TS("ClassMeta"); TSFile("::/Demo/ClassMeta");
|
||||
TS("NumBible"); if (DriveIsWritable('~')) DoNumBible;
|
||||
TS("Form"); DoForm;
|
||||
TS("ClickCallBack"); DoClickCallBack;
|
||||
TS("MenuBttn"); DoMenuBttn;
|
||||
|
|
|
@ -19,7 +19,7 @@ U0 DocInit()
|
|||
|
||||
DefineListLoad("ST_LINK_TYPES",
|
||||
|
||||
"FI\0FA\0FF\0FL\0MN\0PI\0PF\0PL\0DN\0HI\0AD\0AI\0AA\0AF\0AL\0");
|
||||
"FI\0FA\0FF\0FL\0MN\0PI\0PF\0PL\0BF\0DN\0HI\0AD\0AI\0AA\0AF\0AL\0");
|
||||
|
||||
doldoc.hash = HashTableNew(512);
|
||||
HashDefineListAdd("ST_DOC_CMDS", DHT_DOC_CMD, doldoc.hash);
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
"PF:haystack_filename,needle_str"
|
||||
"PF:haystack_filename,needle_str:occurnum"
|
||||
"PL:filename,linenum"
|
||||
"BF:haystack_bible_book,needle_str"
|
||||
"DN:word"
|
||||
"DN:word,defnum"
|
||||
"HI:index"
|
||||
|
@ -33,14 +34,15 @@ To edit a doc structure already in memory. See $LK,"SpriteEdText",A="MN:SpriteEd
|
|||
#define LK_PLAIN 5
|
||||
#define LK_PLAIN_FIND 6
|
||||
#define LK_PLAIN_LINE 7
|
||||
#define LK_DEF 8
|
||||
#define LK_HELP_INDEX 9
|
||||
#define LK_ADDR 10
|
||||
#define LK_DOC 11 //See $LK,"SpriteEdText",A="MN:SpriteEdText"$()
|
||||
#define LK_DOC_ANCHOR 12
|
||||
#define LK_DOC_FIND 13
|
||||
#define LK_DOC_LINE 14
|
||||
#define LK_PLACE_ANCHOR 15
|
||||
#define LK_BIBLE_FIND 8
|
||||
#define LK_DEF 9
|
||||
#define LK_HELP_INDEX 10
|
||||
#define LK_ADDR 11
|
||||
#define LK_DOC 12 //See $LK,"SpriteEdText",A="MN:SpriteEdText"$()
|
||||
#define LK_DOC_ANCHOR 13
|
||||
#define LK_DOC_FIND 14
|
||||
#define LK_DOC_LINE 15
|
||||
#define LK_PLACE_ANCHOR 16
|
||||
|
||||
public U8 *DocEntryLink(CDoc *doc, CDocEntry *doc_e)
|
||||
{//MAlloc new str, either tag or aux_str if link.
|
||||
|
@ -88,6 +90,9 @@ Bool DocFileEd(I64 _type, U8 *filename, U8 *needle_str, I64 *_num, I64 edf_dof_f
|
|||
case LK_DOC_LINE:
|
||||
type = LK_FILE_LINE;
|
||||
break;
|
||||
case LK_BIBLE_FIND:
|
||||
flags = DOCF_PLAIN_TEXT | DOCF_NO_CURSOR;
|
||||
break;
|
||||
}
|
||||
|
||||
flags |= DOCF_ALLOW_UNDO;
|
||||
|
@ -142,6 +147,9 @@ Bool DocFileEd(I64 _type, U8 *filename, U8 *needle_str, I64 *_num, I64 edf_dof_f
|
|||
case LK_FILE_FIND:
|
||||
res = DocFind(doc,, needle_str, *_num);
|
||||
break;
|
||||
case LK_BIBLE_FIND:
|
||||
res = DocFind(doc, *_num, needle_str);
|
||||
break;
|
||||
|
||||
default:
|
||||
DocCenter(doc);
|
||||
|
@ -190,7 +198,7 @@ Bool DocFileEd(I64 _type, U8 *filename, U8 *needle_str, I64 *_num, I64 edf_dof_f
|
|||
|
||||
public I64 EdLinkConvert(U8 *link_st, U8 **_filename=NULL, U8 **_needle_str=NULL, I64 *_num=NULL, I64 edf_dof_flags=0)
|
||||
{//$LK,"Editor Link",A="MN:LK_FILE"$--> filename, needle_str and line number.
|
||||
U8 *st, *ptr, *filename = NULL, *needle_str = NULL, *filename2;
|
||||
U8 *st, *ptr, *src, *filename = NULL, *needle_str = NULL, *filename2;
|
||||
I64 res, i, num = 1;
|
||||
CHashSrcSym *tmph;
|
||||
|
||||
|
@ -248,6 +256,29 @@ public I64 EdLinkConvert(U8 *link_st, U8 **_filename=NULL, U8 **_needle_str=NULL
|
|||
filename = StrNew(filename2);
|
||||
goto lc_done;
|
||||
|
||||
case LK_BIBLE_FIND:
|
||||
if (ptr = StrLastOcc(filename2, ","))
|
||||
{
|
||||
*ptr = 0;
|
||||
src = ptr + 1;
|
||||
while (*src)
|
||||
{//We do not allow ending verse
|
||||
if (*src == '-')
|
||||
*src = 0;
|
||||
src++;
|
||||
}
|
||||
needle_str = StrNew(ptr + 1);
|
||||
}
|
||||
i = DefineMatch(filename2, "ST_BIBLE_BOOKS", LMF_IGNORE_CASE);
|
||||
if (i < 0)
|
||||
res = -1;
|
||||
else
|
||||
{
|
||||
num = Str2I64(DefineSub(i, "ST_BIBLE_BOOK_LINES"));
|
||||
filename2 = BIBLE_FILENAME;
|
||||
}
|
||||
break;
|
||||
|
||||
case LK_FILE_LINE:
|
||||
case LK_PLAIN_LINE:
|
||||
case LK_DOC_LINE:
|
||||
|
@ -331,6 +362,15 @@ public Bool DocLinkCheck(CDoc *doc, U8 *link_st)
|
|||
res = FileFind(filename,, FUF_JUST_FILES | FUF_SCAN_PARENTS);
|
||||
break;
|
||||
|
||||
case LK_BIBLE_FIND:
|
||||
st = StrNew(link_st + 3);
|
||||
if (StrOcc(st, ','))
|
||||
StrLastRemove(st, ",");
|
||||
if (DefineMatch(st, "ST_BIBLE_BOOKS", LMF_IGNORE_CASE) >= 0)
|
||||
res = TRUE;
|
||||
Free(st);
|
||||
break;
|
||||
|
||||
default://TODO: Need to validate HI: and DN:
|
||||
if (Ed(link_st, EDF_BAIL))
|
||||
res = TRUE;
|
||||
|
@ -342,7 +382,7 @@ public Bool DocLinkCheck(CDoc *doc, U8 *link_st)
|
|||
return res;
|
||||
}
|
||||
|
||||
public U8 *DocLinkFile(U8 *link_st)
|
||||
public U8 *DocLinkFile(U8 *link_st, CTask *mem_task=NULL)
|
||||
{//Return the file for an $LK,"Editor Link Types",A="MN:LK_FILE"$.
|
||||
U8 *filename = NULL, *st, *res = NULL;
|
||||
|
||||
|
@ -361,6 +401,9 @@ public U8 *DocLinkFile(U8 *link_st)
|
|||
res = StrNew(st);
|
||||
Free(st);
|
||||
break;
|
||||
case LK_BIBLE_FIND:
|
||||
res = StrNew(BIBLE_FILENAME, mem_task);
|
||||
break;
|
||||
}
|
||||
Free(filename);
|
||||
}
|
||||
|
|
|
@ -440,13 +440,19 @@ public U0 DocPutKey(CDoc *doc, I64 ch=0, I64 sc=0)
|
|||
case SC_F7:
|
||||
if (sc & SCF_KEY_DESC)
|
||||
{
|
||||
KeyDescSet("Cmd /God Word");
|
||||
if (sc & SCF_SHIFT)
|
||||
KeyDescSet("Cmd /God Passage");
|
||||
else
|
||||
KeyDescSet("Cmd /God Word");
|
||||
}
|
||||
else
|
||||
{
|
||||
FifoU8Flush(divine.fifo);
|
||||
DivineBitsInsert(DIVN_GOOD_BITS, KbdMouseEventTime >> DIVN_BAD_BITS);
|
||||
DivineWord;
|
||||
FifoU8Flush(god.fifo);
|
||||
GodBitsInsert(GOD_GOOD_BITS, KbdMouseEventTime >> GOD_BAD_BITS);
|
||||
if (sc & SCF_SHIFT)
|
||||
GodBiblePassage;
|
||||
else
|
||||
GodWord;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ I64 PopUpLinkType(Bool include_anchor)
|
|||
"$$MU,\"To line in file\",LE=LK_FILE_LINE$$\n"
|
||||
"$$MU,\"To man page\",LE=LK_MAN_PAGE$$\n"
|
||||
"$$MU,\"To plain-text file\",LE=LK_PLAIN$$\n"
|
||||
"$$MU,\"To Bible chapter line and verse\",LE=LK_BIBLE_FIND$$\n"
|
||||
"$$MU,\"To str in plain-text file\",LE=LK_PLAIN_FIND$$\n"
|
||||
"$$MU,\"To line in plain-text file\",LE=LK_PLAIN_LINE$$\n"
|
||||
"$$MU,\"To Dictionary Definition\",LE=LK_DEF$$\n"
|
||||
|
@ -123,6 +124,19 @@ class CEdPlaceAnchor
|
|||
hide format "$$CB,\"Hide\"$$\n";
|
||||
};
|
||||
|
||||
class CEdBibleLink
|
||||
{
|
||||
U8 tag[512] format "$$DA-P,A=\"Tag Text :%s\"$$\n",
|
||||
file[512];
|
||||
I64 book format "$$LS,D=\"ST_BIBLE_BOOKS\"$$\n";
|
||||
U8 aux[512] format "$$DA-P,A=\"Chapter Verse :%s\"$$\n";
|
||||
I64 num;
|
||||
U8 html_link[512] format "$$DA-P,A=\"Html Link :%s\"$$\n";
|
||||
Bool pop_up format "$$CB,\"PopUp\"$$\n",
|
||||
quote format "$$CB,\"Quote\"$$\n",
|
||||
hide;
|
||||
};
|
||||
|
||||
class CEdDefLink
|
||||
{
|
||||
U8 tag[512] format "$$DA-P,A=\"Tag Text :%s\"$$\n",
|
||||
|
@ -294,6 +308,18 @@ Bool GetLink(I64 type, U8 **_tag, U8 **_link, Bool *_pop_up, Bool *_quote, U8 **
|
|||
}
|
||||
break;
|
||||
|
||||
case LK_BIBLE_FIND:
|
||||
if (DocForm(e, "CEdBibleLink",,, ctrl_L_footer))
|
||||
{
|
||||
res = TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag = MStrPrint("%Z,%s", e->book, "ST_BIBLE_BOOKS", e->aux);
|
||||
else
|
||||
*_tag = StrNew(e->tag);
|
||||
*_link = MStrPrint("BF:%Z,%s", e->book, "ST_BIBLE_BOOKS", e->aux);
|
||||
}
|
||||
break;
|
||||
|
||||
case LK_DEF:
|
||||
e->num = -1;
|
||||
if (DocForm(e, "CEdDefLink",,, ctrl_L_footer))
|
||||
|
|
|
@ -31,6 +31,9 @@ public class CDolDocGlobals
|
|||
} doldoc;
|
||||
MemSet(&doldoc, 0, sizeof(CDolDocGlobals));
|
||||
|
||||
#help_index "God"
|
||||
#define BIBLE_FILENAME "::/Misc/Bible.TXT"
|
||||
|
||||
#include "DocExterns"
|
||||
#include "DocBin"
|
||||
#include "DocNew"
|
||||
|
|
387
src/Zenith/God/GodBible.CC
Normal file
387
src/Zenith/God/GodBible.CC
Normal file
|
@ -0,0 +1,387 @@
|
|||
#help_index "God"
|
||||
|
||||
U0 BibleInit()
|
||||
{
|
||||
DefineListLoad("ST_BIBLE_BOOKS",
|
||||
"Genesis\0"
|
||||
"Exodus\0"
|
||||
"Leviticus\0"
|
||||
"Numbers\0"
|
||||
"Deuteronomy\0"
|
||||
"Joshua\0"
|
||||
"Judges\0"
|
||||
"Ruth\0"
|
||||
"1 Samuel\0"
|
||||
"2 Samuel\0"
|
||||
"1 Kings\0"
|
||||
"2 Kings\0"
|
||||
"1 Chronicles\0"
|
||||
"2 Chronicles\0"
|
||||
"Ezra\0"
|
||||
"Nehemiah\0"
|
||||
"Esther\0"
|
||||
"Job\0"
|
||||
"Psalms\0"
|
||||
"Proverbs\0"
|
||||
"Ecclesiastes\0"
|
||||
"Song of Songs\0"
|
||||
"Isaiah\0"
|
||||
"Jeremiah\0"
|
||||
"Lamentations\0"
|
||||
"Ezekiel\0"
|
||||
"Daniel\0"
|
||||
"Hosea\0"
|
||||
"Joel\0"
|
||||
"Amos\0"
|
||||
"Obadiah\0"
|
||||
"Jonah\0"
|
||||
"Micah\0"
|
||||
"Nahum\0"
|
||||
"Habakkuk\0"
|
||||
"Zephaniah\0"
|
||||
"Haggai\0"
|
||||
"Zechariah\0"
|
||||
"Malachi\0"
|
||||
"Matthew\0"
|
||||
"Mark\0"
|
||||
"Luke\0"
|
||||
"John\0"
|
||||
"Acts\0"
|
||||
"Romans\0"
|
||||
"1 Corinthians\0"
|
||||
"2 Corinthians\0"
|
||||
"Galatians\0"
|
||||
"Ephesians\0"
|
||||
"Philippians\0"
|
||||
"Colossians\0"
|
||||
"1 Thessalonians\0"
|
||||
"2 Thessalonians\0"
|
||||
"1 Timothy\0"
|
||||
"2 Timothy\0"
|
||||
"Titus\0"
|
||||
"Philemon\0"
|
||||
"Hebrews\0"
|
||||
"James\0"
|
||||
"1 Peter\0"
|
||||
"2 Peter\0"
|
||||
"1 John\0"
|
||||
"2 John\0"
|
||||
"3 John\0"
|
||||
"Jude\0"
|
||||
"Revelation\0");
|
||||
DefineListLoad("ST_BIBLE_BOOK_LINES",
|
||||
"297\0"
|
||||
"5068\0"
|
||||
"9123\0"
|
||||
"12005\0"
|
||||
"15977\0"
|
||||
"19168\0"
|
||||
"21329\0"
|
||||
"23598\0"
|
||||
"23902\0"
|
||||
"26892\0"
|
||||
"29345\0"
|
||||
"32241\0"
|
||||
"34961\0"
|
||||
"37633\0"
|
||||
"40756\0"
|
||||
"41671\0"
|
||||
"42963\0"
|
||||
"43605\0"
|
||||
"46190\0"
|
||||
"53793\0"
|
||||
"56267\0"
|
||||
"56966\0"
|
||||
"57332\0"
|
||||
"61806\0"
|
||||
"66736\0"
|
||||
"67217\0"
|
||||
"71804\0"
|
||||
"73189\0"
|
||||
"73876\0"
|
||||
"74130\0"
|
||||
"74615\0"
|
||||
"74697\0"
|
||||
"74860\0"
|
||||
"75241\0"
|
||||
"75416\0"
|
||||
"75604\0"
|
||||
"75806\0"
|
||||
"75932\0"
|
||||
"76684\0"
|
||||
"76908\0"
|
||||
"79970\0"
|
||||
"81941\0"
|
||||
"85266\0"
|
||||
"87803\0"
|
||||
"90914\0"
|
||||
"92110\0"
|
||||
"93323\0"
|
||||
"94088\0"
|
||||
"94514\0"
|
||||
"94869\0"
|
||||
"95153\0"
|
||||
"95402\0"
|
||||
"95647\0"
|
||||
"95772\0"
|
||||
"96090\0"
|
||||
"96320\0"
|
||||
"96440\0"
|
||||
"96500\0"
|
||||
"97370\0"
|
||||
"97687\0"
|
||||
"97976\0"
|
||||
"98163\0"
|
||||
"98506\0"
|
||||
"98552\0"
|
||||
"98597\0"
|
||||
"98684\0"
|
||||
"100111\0");
|
||||
DefinePrint("ST_BIBLE_LINES","%d",
|
||||
Str2I64(DefineSub(DefineCount("ST_BIBLE_BOOK_LINES") - 1, "ST_BIBLE_BOOK_LINES")) - 1);
|
||||
} BibleInit;
|
||||
|
||||
public U8 *BibleLine2Verse(I64 line, I64 separate_ch=CH_SPACE)
|
||||
{//Line number to verse str, Malloc()ed.
|
||||
//Separate with <SPACE> or ','. If you pass '%', it uses "%20".
|
||||
CDoc *doc;
|
||||
CDocEntry *doc_e;
|
||||
I64 i = 0,
|
||||
count = DefineCount("ST_BIBLE_BOOKS"),
|
||||
start = 0,
|
||||
last_start = 0;
|
||||
U8 *ptr = DefineSub(0, "ST_BIBLE_BOOK_LINES"),
|
||||
*ptr2;
|
||||
|
||||
while (i <= count)
|
||||
{
|
||||
last_start = start;
|
||||
start = Str2I64(ptr);
|
||||
if (line < start)
|
||||
break;
|
||||
i++;
|
||||
ptr += StrLen(ptr) + 1;
|
||||
}
|
||||
|
||||
if (0 <= --i < count)
|
||||
{
|
||||
doc = DocRead(BIBLE_FILENAME, DOCF_PLAIN_TEXT | DOCF_NO_CURSOR);
|
||||
DocGoToLine(doc, line); //one based
|
||||
doc_e = doc->cur_entry;
|
||||
while (doc_e != doc && (doc_e->type_u8 != DOCT_TEXT || !*doc_e->tag))
|
||||
doc_e = doc_e->next;
|
||||
if (doc_e->type_u8 == DOCT_TEXT && '0' <= *doc_e->tag <= '9')
|
||||
{
|
||||
ptr = ptr2=doc_e->tag;
|
||||
while ('0' <= *ptr2 <= '9' || *ptr2 == ':')
|
||||
ptr2++;
|
||||
*ptr2 = 0;
|
||||
if (separate_ch == '%')
|
||||
ptr = MStrPrint("%Z%%20%s", i, "ST_BIBLE_BOOKS", ptr);
|
||||
else
|
||||
ptr = MStrPrint("%Z%c%s", i, "ST_BIBLE_BOOKS", separate_ch, ptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (TRUE)
|
||||
{
|
||||
doc_e = doc_e->last;
|
||||
if (doc_e == doc)
|
||||
{
|
||||
ptr = NULL;
|
||||
break;
|
||||
}
|
||||
if (doc_e->y + 1 < last_start)
|
||||
{
|
||||
ptr = MStrPrint("%Z", i, "ST_BIBLE_BOOKS");
|
||||
break;
|
||||
}
|
||||
if (doc_e->type_u8 == DOCT_TEXT && StrLen(doc_e->tag) >= 3)
|
||||
{
|
||||
ptr = doc_e->tag + StrLen(doc_e->tag) - 1;
|
||||
while (ptr > doc_e->tag && (!('0' <= *(ptr - 1) <= '9') || *ptr != ':' || !('0' <= *(ptr + 1) <= '9')))
|
||||
ptr--;
|
||||
ptr--;
|
||||
while (ptr >= doc_e->tag && '0' <= *ptr <= '9')
|
||||
ptr--;
|
||||
ptr2 = ++ptr;
|
||||
if ('0' <= *ptr2++ <= '9')
|
||||
{
|
||||
while ('0' <= *ptr2 <= '9')
|
||||
ptr2++;
|
||||
if (*ptr2++ == ':' && '0' <= *ptr2++ <= '9')
|
||||
{
|
||||
while ('0' <= *ptr2 <= '9')
|
||||
ptr2++;
|
||||
*ptr2 = 0;
|
||||
if (separate_ch == '%')
|
||||
ptr = MStrPrint("%Z%%20%s", i, "ST_BIBLE_BOOKS", ptr);
|
||||
else
|
||||
ptr = MStrPrint("%Z%c%s", i, "ST_BIBLE_BOOKS", separate_ch, ptr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DocDel(doc);
|
||||
return ptr;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public U0 BookLines(CDoc *doc_out=NULL, I64 start, I64 lines, U8 *book_filename=BIBLE_FILENAME)
|
||||
{//Put N line starting at line M into doc.
|
||||
CDoc *doc_in;
|
||||
CDocEntry *doc_e;
|
||||
|
||||
if (!doc_out) doc_out = DocPut;
|
||||
if (doc_out && FileFind(book_filename))
|
||||
{
|
||||
doc_in = DocRead(book_filename, DOCF_PLAIN_TEXT | DOCF_NO_CURSOR);
|
||||
DocGoToLine(doc_in, start); //one based
|
||||
doc_e = doc_in->cur_entry;
|
||||
while (lines > 0 && doc_e != doc_in)
|
||||
{
|
||||
if (doc_e->type_u8 == DOCT_TEXT)
|
||||
DocPrint(doc_out, "%s", doc_e->tag);
|
||||
else if (doc_e->type_u8 == DOCT_NEW_LINE)
|
||||
{
|
||||
DocPutKey(doc_out, '\n');
|
||||
lines--;
|
||||
}
|
||||
doc_e = doc_e->next;
|
||||
}
|
||||
DocDel(doc_in);
|
||||
}
|
||||
}
|
||||
|
||||
public U0 BibleVerse(CDoc *doc_out=NULL, U8 *verse, I64 lines)
|
||||
{//Put N lines starting at verse str into doc.
|
||||
I64 i;
|
||||
CDoc *doc_in;
|
||||
CDocEntry *doc_e;
|
||||
U8 *st, *st2;
|
||||
|
||||
if (!doc_out) doc_out = DocPut;
|
||||
if (doc_out && FileFind(BIBLE_FILENAME))
|
||||
{
|
||||
st = StrNew(verse);
|
||||
st2 = StrNew(verse);
|
||||
if (StrOcc(st, ','))
|
||||
StrLastRemove(st, ",", st2);
|
||||
else
|
||||
*st2 = 0;
|
||||
|
||||
i = DefineMatch(st, "ST_BIBLE_BOOKS", LMF_IGNORE_CASE);
|
||||
if (i >= 0)
|
||||
{
|
||||
i = Str2I64(DefineSub(i, "ST_BIBLE_BOOK_LINES"));
|
||||
doc_in = DocRead(BIBLE_FILENAME, DOCF_PLAIN_TEXT | DOCF_NO_CURSOR);
|
||||
DocGoToLine(doc_in, i); //one based
|
||||
if (*st2)
|
||||
{
|
||||
StrCopy(doc_in->find_replace->find_text, st2);
|
||||
EdFindNext(doc_in);
|
||||
}
|
||||
doc_e = doc_in->cur_entry;
|
||||
while (lines > 0 && doc_e != doc_in)
|
||||
{
|
||||
if (doc_e->type_u8 == DOCT_TEXT)
|
||||
DocPrint(doc_out, "%s", doc_e->tag);
|
||||
else if (doc_e->type_u8 == DOCT_NEW_LINE)
|
||||
{
|
||||
DocPutKey(doc_out, '\n');
|
||||
lines--;
|
||||
}
|
||||
doc_e = doc_e->next;
|
||||
}
|
||||
DocDel(doc_in);
|
||||
}
|
||||
Free(st);
|
||||
Free(st2);
|
||||
}
|
||||
}
|
||||
|
||||
public CDoc *BibleDoc()
|
||||
{//Return Bible as DolDoc with trees.
|
||||
CDoc *res = DocRead(BIBLE_FILENAME);
|
||||
CDocEntry *doc_e = res->head.next,*doc_e1;
|
||||
Bool open_chapter = FALSE;
|
||||
U8 *ptr = Define("ST_BIBLE_BOOK_LINES");
|
||||
I64 book,
|
||||
book_count = DefineCount("ST_BIBLE_BOOK_LINES") - 1,
|
||||
chapter,
|
||||
line = Str2I64(ptr,, &ptr);
|
||||
|
||||
ptr++;
|
||||
for (book = 0; book < book_count; book++)
|
||||
{
|
||||
while (doc_e->y + 1 < line)
|
||||
{
|
||||
doc_e1 = doc_e->next;
|
||||
DocEntryDel(res, doc_e);
|
||||
doc_e = doc_e1;
|
||||
}
|
||||
res->cur_entry = doc_e;
|
||||
res->cur_col = 0;
|
||||
DocPrint(res, "$$TR,\"%Z\"$$\n$$ID,2$$", book, "ST_BIBLE_BOOKS");
|
||||
line = Str2I64(ptr,, &ptr);
|
||||
ptr++;
|
||||
chapter = 1;
|
||||
while (doc_e->y + 1 < line)
|
||||
{
|
||||
doc_e1 = doc_e->next;
|
||||
if (doc_e->type_u8 == DOCT_TEXT && StrMatch(":1 ", doc_e->tag))
|
||||
{
|
||||
res->cur_entry = doc_e;
|
||||
res->cur_col = 0;
|
||||
if (open_chapter)
|
||||
{
|
||||
DocPrint(res, "$$ID,-2$$");
|
||||
open_chapter = FALSE;
|
||||
}
|
||||
DocPrint(res, "$$TR,\"%d\"$$\n$$ID,2$$", chapter++);
|
||||
open_chapter = TRUE;
|
||||
}
|
||||
else if (chapter == 1)
|
||||
{
|
||||
doc_e1 = doc_e->next;
|
||||
DocEntryDel(res, doc_e);
|
||||
doc_e = doc_e1;
|
||||
}
|
||||
doc_e = doc_e1;
|
||||
}
|
||||
res->cur_entry = doc_e;
|
||||
res->cur_col = 0;
|
||||
if (open_chapter)
|
||||
{
|
||||
DocPrint(res, "$$ID,-2$$");
|
||||
open_chapter = FALSE;
|
||||
}
|
||||
DocPrint(res, "$$ID,-2$$");
|
||||
}
|
||||
while (doc_e != res)
|
||||
{
|
||||
doc_e1 = doc_e->next;
|
||||
DocEntryDel(res, doc_e);
|
||||
doc_e = doc_e1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public U0 BibleView()
|
||||
{//View Bible as DolDoc with trees.
|
||||
U8 buf[STR_LEN];
|
||||
CDoc *doc = BibleDoc;
|
||||
|
||||
StrPrint(buf, "AL:%d,1", doc);
|
||||
Ed(buf);
|
||||
DocDel(doc);
|
||||
}
|
||||
U0 CtrlAltB(I64)
|
||||
{
|
||||
PopUp("BibleView;");
|
||||
}
|
||||
CtrlAltCBSet('B', &CtrlAltB, "Cmd /Bible");
|
21
src/Zenith/God/GodExterns.CC
Normal file
21
src/Zenith/God/GodExterns.CC
Normal file
|
@ -0,0 +1,21 @@
|
|||
#help_index "God"
|
||||
|
||||
#define GOD_BAD_BITS 4
|
||||
#define GOD_GOOD_BITS 24
|
||||
|
||||
public class CGodGlobals
|
||||
{
|
||||
U8 **words,
|
||||
*word_file_mask;
|
||||
|
||||
I64 word_fuf_flags,
|
||||
word_count;
|
||||
CFifoU8 *fifo;
|
||||
} god;
|
||||
|
||||
MemSet(&god, 0, sizeof(CGodGlobals));
|
||||
god.fifo = FifoU8New(2048 * 8);
|
||||
|
||||
extern U0 GodBiblePassage(I64 num_lines=20);
|
||||
extern U0 GodBitsInsert(I64 num_bits, I64 bitfield);
|
||||
extern U0 GodWord(I64 bits=17);
|
103
src/Zenith/Divination.CC → src/Zenith/God/HolySpirit.CC
Executable file → Normal file
103
src/Zenith/Divination.CC → src/Zenith/God/HolySpirit.CC
Executable file → Normal file
|
@ -1,34 +1,16 @@
|
|||
#define DIVN_GOOD_BITS 24
|
||||
#define DIVN_BAD_BITS 4
|
||||
|
||||
class CDivinationGlobals
|
||||
{
|
||||
U8 **words,
|
||||
*word_file_mask;
|
||||
|
||||
I64 word_fuf_flags,
|
||||
word_count;
|
||||
CFifoU8 *fifo;
|
||||
} divine;
|
||||
|
||||
MemSet(&divine, 0, sizeof(CDivinationGlobals));
|
||||
divine.fifo = FifoU8New(2048 * 8);
|
||||
#help_index "God"
|
||||
|
||||
U8 *TimeStampCB(CDoc *, CDocEntry *, CTask *mem_task)
|
||||
{
|
||||
U8 *st = MAlloc(64, mem_task);
|
||||
|
||||
StrPrint(st, "%X", TSCGet >> DIVN_BAD_BITS);
|
||||
|
||||
StrPrint(st, "%X", TSCGet >> GOD_BAD_BITS);
|
||||
return st;
|
||||
}
|
||||
|
||||
U8 *KbdMouseTimeCB(CDoc *, CDocEntry *, CTask *mem_task)
|
||||
{
|
||||
U8 *st = MAlloc(64, mem_task);
|
||||
|
||||
StrPrint(st, "%X", KbdMouseEventTime >> DIVN_BAD_BITS);
|
||||
|
||||
StrPrint(st, "%X", KbdMouseEventTime >> GOD_BAD_BITS);
|
||||
return st;
|
||||
}
|
||||
|
||||
|
@ -54,59 +36,72 @@ I64 PopUpTimerOk(U8 *msg=NULL)
|
|||
return i;
|
||||
}
|
||||
|
||||
I64 DivinePick(U8 *msg=NULL)
|
||||
I64 GodPick(U8 *message=NULL)
|
||||
{
|
||||
U8 *st = MStrPrint("%s\n\nPress $$GREEN$$OKAY$$FG$$ to generate a random number from the timer.\n"
|
||||
"The latch is the last timestamp from the keyboard.\n"
|
||||
"When you press $$GREEN$$OKAY$$FG$$, a new timestamp will be used.\n", msg);
|
||||
"When you press $$GREEN$$OKAY$$FG$$, a new timestamp will be used.\n", message);
|
||||
PopUpTimerOk(st);
|
||||
Free(st);
|
||||
return KbdMouseEventTime >> DIVN_BAD_BITS;
|
||||
return KbdMouseEventTime >> GOD_BAD_BITS;
|
||||
}
|
||||
|
||||
public U0 DivineBitsInsert(I64 num_bits, I64 bitfield)
|
||||
{//Insert bits info divination bit fifo.
|
||||
public U0 GodBitsInsert(I64 num_bits, I64 bitfield)
|
||||
{//Insert bits into God bit FIFO.
|
||||
I64 i;
|
||||
|
||||
for (i = 0; i < num_bits; i++)
|
||||
{
|
||||
FifoU8Insert(divine.fifo, bitfield & 1);
|
||||
FifoU8Insert(god.fifo, bitfield & 1);
|
||||
bitfield >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
public I64 DivineBitsRemove(I64 num_bits, U8 *msg=NULL)
|
||||
public U0 GodHexInsert(U8 *st)
|
||||
{//Insert hex record into God bit FIFO.
|
||||
U8 buf[2];
|
||||
if (st)
|
||||
{
|
||||
buf[1] = 0;
|
||||
while (*buf = *st++)
|
||||
if (Bt(char_bmp_hex_numeric, *buf))
|
||||
GodBitsInsert(4, rev_bits_table[Str2I64(buf, 16)] >> 4);
|
||||
}
|
||||
}
|
||||
|
||||
public I64 GodBitsRemove(I64 num_bits, U8 *message=NULL)
|
||||
{//Return N bits. If low on entropy pop-up okay.
|
||||
U8 b;
|
||||
I64 res = 0;
|
||||
|
||||
while (num_bits)
|
||||
{
|
||||
if (FifoU8Remove(divine.fifo, &b))
|
||||
if (FifoU8Remove(god.fifo, &b))
|
||||
{
|
||||
res = res << 1 + b;
|
||||
num_bits--;
|
||||
}
|
||||
else
|
||||
DivineBitsInsert(DIVN_GOOD_BITS, DivinePick(msg));
|
||||
GodBitsInsert(GOD_GOOD_BITS, GodPick(message));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 DivineInit(U8 *files_find_mask="/Misc/Vocab.DD")
|
||||
{
|
||||
I64 GodInit(U8 *files_find_mask="/Zenith/God/Vocab.DD", U8 *fu_flags=NONE)
|
||||
{//Read God's vocab file for picking words.
|
||||
I64 i, ch, fuf_flags = 0;;
|
||||
U8 *buf, *ptr, *ptr2;
|
||||
CDirEntry *tmpde, *tmpde1;
|
||||
|
||||
FlagsScan(&fuf_flags, Define("ST_FILE_UTIL_FLAGS"), "+r+f+F+T+O");
|
||||
FlagsScan(&fuf_flags, Define("ST_FILE_UTIL_FLAGS"), fu_flags);
|
||||
if (fuf_flags & ~FUG_FILES_FIND)
|
||||
throw('FUF');
|
||||
|
||||
//Free(divine.word_file_mask);
|
||||
divine.word_file_mask = StrNew(files_find_mask);
|
||||
divine.word_fuf_flags = fuf_flags;
|
||||
Free(god.word_file_mask);
|
||||
god.word_file_mask = StrNew(files_find_mask);
|
||||
god.word_fuf_flags = fuf_flags;
|
||||
|
||||
tmpde = tmpde1 = FilesFind(files_find_mask, fuf_flags);
|
||||
|
||||
|
@ -132,9 +127,9 @@ I64 DivineInit(U8 *files_find_mask="/Misc/Vocab.DD")
|
|||
tmpde = tmpde->next;
|
||||
}
|
||||
|
||||
Free(divine.words);
|
||||
divine.word_count = i;
|
||||
divine.words = MAlloc(sizeof(U8 *) * i);
|
||||
Free(god.words);
|
||||
god.word_count = i;
|
||||
god.words = MAlloc(sizeof(U8 *) * i);
|
||||
|
||||
tmpde = tmpde1;
|
||||
i = 0;
|
||||
|
@ -153,7 +148,7 @@ I64 DivineInit(U8 *files_find_mask="/Misc/Vocab.DD")
|
|||
ptr++;
|
||||
ch = *ptr;
|
||||
*ptr = '\0';
|
||||
divine.words[i++] = StrNew(ptr2);
|
||||
god.words[i++] = StrNew(ptr2);
|
||||
*ptr = ch;
|
||||
}
|
||||
}
|
||||
|
@ -163,21 +158,29 @@ I64 DivineInit(U8 *files_find_mask="/Misc/Vocab.DD")
|
|||
}
|
||||
DirTreeDel(tmpde1);
|
||||
|
||||
return divine.word_count;
|
||||
return god.word_count;
|
||||
}
|
||||
GodInit;
|
||||
|
||||
DivineInit;
|
||||
|
||||
public U8 *DivineWordStr(I64 bits=17)
|
||||
{//Divine a word.
|
||||
if (divine.word_count)
|
||||
return divine.words[DivineBitsRemove(bits) % divine.word_count];
|
||||
public U8 *GodWordStr(I64 bits=17)
|
||||
{//Make God pick a word.
|
||||
if (god.word_count)
|
||||
return god.words[GodBitsRemove(bits) % god.word_count];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public U0 DivineWord(I64 bits=17)
|
||||
{//Divine a word.
|
||||
if (divine.word_count)
|
||||
"%s ", divine.words[DivineBitsRemove(bits) % divine.word_count];
|
||||
public U0 GodWord(I64 bits=17)
|
||||
{//Make God pick a word.
|
||||
if (god.word_count)
|
||||
"%s ", god.words[GodBitsRemove(bits) % god.word_count];
|
||||
}
|
||||
|
||||
public U0 GodBiblePassage(I64 num_lines=20)
|
||||
{//Make God pick a Bible passage.
|
||||
I64 start = GodBitsRemove(21) % (ST_BIBLE_LINES - (num_lines - 1)) + 1;
|
||||
U8 *verse = BibleLine2Verse(start);
|
||||
"%s\n\n", verse;
|
||||
Free(verse);
|
||||
BookLines(, start, num_lines);
|
||||
}
|
7
src/Zenith/God/MakeGod.CC
Normal file
7
src/Zenith/God/MakeGod.CC
Normal file
|
@ -0,0 +1,7 @@
|
|||
Cd(__DIR__);;
|
||||
|
||||
#help_index "God"
|
||||
|
||||
#include "GodBible"
|
||||
#include "HolySpirit"
|
||||
Cd("..");;
|
0
src/Misc/Vocab.DD → src/Zenith/God/Vocab.DD
Executable file → Normal file
0
src/Misc/Vocab.DD → src/Zenith/God/Vocab.DD
Executable file → Normal file
|
@ -11,13 +11,14 @@ Cd(__DIR__);;
|
|||
#include "Win"
|
||||
#include "WinMgr"
|
||||
#include "ZDebug"
|
||||
#include "Divination"
|
||||
#include "::/Zenith/God/GodExterns"
|
||||
#include "DolDoc/MakeDoc"
|
||||
LBts(&sys_run_level, RLf_DOC);
|
||||
#include "Ctrls/MakeCtrls"
|
||||
#include "InFile"
|
||||
#include "ZRegistry"
|
||||
#include "AutoComplete/MakeAC"
|
||||
#include "God/MakeGod"
|
||||
#include "ZHash"
|
||||
#include "TaskSettings"
|
||||
#include "DevInfo"
|
||||
|
|
Loading…
Reference in a new issue