more doc update

This commit is contained in:
minjaesong
2022-09-06 16:52:59 +09:00
parent 15d3aeaeea
commit 26a5d4af5d
8 changed files with 126 additions and 68 deletions

View File

@@ -661,7 +661,7 @@ shell.execute = function(line) {
shell.pipes = {} // syntax: _G.shell.pipes[name] = contents; all pipes are named pipes just like in Windows shell.pipes = {} // syntax: _G.shell.pipes[name] = contents; all pipes are named pipes just like in Windows
shell.currentlyActivePipes = [] // Queue of pipe's names. Use shell.removePipe() to dequeue and shell.pushPipe() to enqueue. shell.currentlyActivePipes = [] // Queue of pipe's names. Use shell.removePipe() to dequeue and shell.pushPipe() to enqueue.
shell._rndstr = '0123456789+qwfpgjluyarstdhneiozxcvbkm/QWFPGJLUYARSTDHNEIOZXCVBKM' shell._rndstr = '0123456789+qwfpgjluyarstdhneiozxcvbkm/QWFPGJLUYARSTDHNEIOZXCVBKM'
shell.generateRandomName = function() { shell.generateAnonPipeName = function() {
let name = '' let name = ''
while (true) { while (true) {
name = "anonpipe_" name = "anonpipe_"
@@ -682,7 +682,7 @@ shell.appendToCurrentPipe = function(s) {
shell.pipes[n] = content += s shell.pipes[n] = content += s
} }
shell.pushAnonPipe = function(contents) { shell.pushAnonPipe = function(contents) {
let name = shell.generateRandomName() let name = shell.generateAnonPipeName()
shell.pushPipe(name, contents) shell.pushPipe(name, contents)
} }
shell.pushPipe = function(name, contents) { shell.pushPipe = function(name, contents) {

View File

@@ -1,3 +1,5 @@
\begin{itemlist} \begin{itemlist}
\item Song, Minjae. 2021. ``Terran BASIC Reference Manual for Language Version 1.2, Third Edition''. \item Song, Minjae. 2021. ``Terran BASIC Reference Manual for Language Version 1.2, Third Edition''.
\item Wikipedia. ``List of DOS commands.'' Updated 2022-08-29 15:00. \url{https://en.wikipedia.org/wiki/List_of_DOS_commands}.
\item Wikipedia. ``Pipeline (software).'' Updated 2022-07-17 06:21. \url{https://en.wikipedia.org/wiki/Pipeline_(software)}.
\end{itemlist} \end{itemlist}

View File

@@ -1,4 +1,4 @@
\chapter{Virtual Machine} \chapter{\thismachine}
\section{Specs} \section{Specs}
@@ -14,9 +14,7 @@ There are three memories on the system: Hardware Memory (8 MB), Scratchpad Memor
Your Javascript program is stored into the Program Memory, and since its capacity is limitless, you can put a large graphics directly into your Javascript source code, but the Program Memory is the slowest of all three memories. For faster graphics, you need to store them onto the Scratchpad Memory then DMA-Copy them to the graphics adapter. Your Javascript program is stored into the Program Memory, and since its capacity is limitless, you can put a large graphics directly into your Javascript source code, but the Program Memory is the slowest of all three memories. For faster graphics, you need to store them onto the Scratchpad Memory then DMA-Copy them to the graphics adapter.
\section{Built-in Commands} \section{Javascript Extensions}
\subsection{Javascript Extensions}
\index{js extensions}\thismachine\ provides the extra functions for your convenience. \index{js extensions}\thismachine\ provides the extra functions for your convenience.
@@ -29,7 +27,13 @@ Your Javascript program is stored into the Program Memory, and since its capacit
\1\inlinesynopsis[Array]{max}{selector}{returns the maximum among the elements of the array. Selector is optionally defined to indicate how the value must be transformed to obtain the max.} \1\inlinesynopsis[Array]{max}{selector}{returns the maximum among the elements of the array. Selector is optionally defined to indicate how the value must be transformed to obtain the max.}
\end{outline} \end{outline}
\subsection{Standard Input and Output}
\chapter{Libraries}
\section{Standard Input and Output}
\index{stdio (library)}These are standard input/output functions: \index{stdio (library)}These are standard input/output functions:
@@ -41,9 +45,7 @@ Your Javascript program is stored into the Program Memory, and since its capacit
\1\inlinesynopsis{read}{}{reads a string from the keyboard. Hit the Return to finish reading.} \1\inlinesynopsis{read}{}{reads a string from the keyboard. Hit the Return to finish reading.}
\end{outline} \end{outline}
\section{Console}
\subsection{Console}
\index{console (library)}Console library contains the functions for screen text manipulation. \index{console (library)}Console library contains the functions for screen text manipulation.
@@ -93,7 +95,7 @@ Functions:
\subsection{Gzip} \section{Gzip}
\index{gzip (library)}Gzip allows texts and bytes and compressed and decompressed using the gzip format. \index{gzip (library)}Gzip allows texts and bytes and compressed and decompressed using the gzip format.
@@ -114,7 +116,7 @@ Functions:
\subsection{Base64} \section{Base64}
\index{base64 (library)}Base64 allows encoding of the binary data into the ASCII-strings and vice-versa. \index{base64 (library)}Base64 allows encoding of the binary data into the ASCII-strings and vice-versa.
@@ -128,7 +130,7 @@ Functions:
\subsection{Sys} \section{Sys}
Sys library allows programmers to manipulate the system in low-level. Sys library allows programmers to manipulate the system in low-level.
@@ -775,7 +777,12 @@ TODO
\section{The Graphics Library} \section{The Graphics Library}
\index{graphics (library)}Graphics library provides basic functions to communicate and manipulate the graphics adapter.
\namespaceis{Graphics}{graphics}
\begin{outline}
\end{outline}
\section{Graphics MMIO} \section{Graphics MMIO}

View File

@@ -1,25 +1,28 @@
\indexentry{js extensions|hyperpage}{7} \indexentry{js extensions|hyperpage}{7}
\indexentry{stdio (library)|hyperpage}{8} \indexentry{stdio (library)|hyperpage}{9}
\indexentry{console (library)|hyperpage}{8} \indexentry{console (library)|hyperpage}{9}
\indexentry{con (library)|hyperpage}{8} \indexentry{con (library)|hyperpage}{9}
\indexentry{gzip (library)|hyperpage}{10} \indexentry{gzip (library)|hyperpage}{11}
\indexentry{gzip (library)|hyperpage}{10} \indexentry{gzip (library)|hyperpage}{11}
\indexentry{base64 (library)|hyperpage}{11} \indexentry{base64 (library)|hyperpage}{12}
\indexentry{base64 (library)|hyperpage}{11} \indexentry{base64 (library)|hyperpage}{12}
\indexentry{sys (library)|hyperpage}{12} \indexentry{sys (library)|hyperpage}{13}
\indexentry{block communication|hyperpage}{15} \indexentry{block communication|hyperpage}{16}
\indexentry{com (library)|hyperpage}{15} \indexentry{com (library)|hyperpage}{16}
\indexentry{com (library)|hyperpage}{15} \indexentry{com (library)|hyperpage}{16}
\indexentry{MMIO-com|hyperpage}{17} \indexentry{MMIO-com|hyperpage}{18}
\indexentry{keycodes|hyperpage}{19} \indexentry{keycodes|hyperpage}{20}
\indexentry{code page|hyperpage}{21} \indexentry{code page|hyperpage}{22}
\indexentry{colour palette|hyperpage}{23} \indexentry{colour palette|hyperpage}{24}
\indexentry{MMIO-graphics|hyperpage}{25} \indexentry{graphics (library)|hyperpage}{26}
\indexentry{boot process|hyperpage}{28} \indexentry{graphics (library)|hyperpage}{26}
\indexentry{commands (DOS)|hyperpage}{29} \indexentry{MMIO-graphics|hyperpage}{26}
\indexentry{coreutils (DOS)|hyperpage}{29} \indexentry{boot process|hyperpage}{29}
\indexentry{filesystem (DOS)|hyperpage}{30} \indexentry{commands (DOS)|hyperpage}{30}
\indexentry{file descriptor (DOS)|hyperpage}{30} \indexentry{coreutils (DOS)|hyperpage}{30}
\indexentry{device file|hyperpage}{32} \indexentry{pipe (DOS)|hyperpage}{32}
\indexentry{input (DOS)|hyperpage}{34} \indexentry{filesystem (DOS)|hyperpage}{34}
\indexentry{gl (DOS)|hyperpage}{34} \indexentry{file descriptor (DOS)|hyperpage}{34}
\indexentry{device file|hyperpage}{36}
\indexentry{input (DOS)|hyperpage}{38}
\indexentry{gl (DOS)|hyperpage}{38}

View File

@@ -1,6 +1,6 @@
This is makeindex, version 2.16 [TeX Live 2022] (kpathsea + Thai support). This is makeindex, version 2.16 [TeX Live 2022] (kpathsea + Thai support).
Scanning input file tsvmman.idx....done (25 entries accepted, 0 rejected). Scanning input file tsvmman.idx....done (28 entries accepted, 0 rejected).
Sorting entries....done (120 comparisons). Sorting entries....done (138 comparisons).
Generating output file tsvmman.ind....done (53 lines written, 0 warnings). Generating output file tsvmman.ind....done (58 lines written, 0 warnings).
Output written in tsvmman.ind. Output written in tsvmman.ind.
Transcript written in tsvmman.ilg. Transcript written in tsvmman.ilg.

View File

@@ -1,36 +1,37 @@
\begin{theindex} \begin{theindex}
\item base64 (library), \hyperpage{11} \item base64 (library), \hyperpage{12}
\item block communication, \hyperpage{15} \item block communication, \hyperpage{16}
\item boot process, \hyperpage{28} \item boot process, \hyperpage{29}
\indexspace \indexspace
\item code page, \hyperpage{21} \item code page, \hyperpage{22}
\item colour palette, \hyperpage{23} \item colour palette, \hyperpage{24}
\item com (library), \hyperpage{15} \item com (library), \hyperpage{16}
\item commands (DOS), \hyperpage{29} \item commands (DOS), \hyperpage{30}
\item con (library), \hyperpage{8} \item con (library), \hyperpage{9}
\item console (library), \hyperpage{8} \item console (library), \hyperpage{9}
\item coreutils (DOS), \hyperpage{29} \item coreutils (DOS), \hyperpage{30}
\indexspace \indexspace
\item device file, \hyperpage{32} \item device file, \hyperpage{36}
\indexspace \indexspace
\item file descriptor (DOS), \hyperpage{30} \item file descriptor (DOS), \hyperpage{34}
\item filesystem (DOS), \hyperpage{30} \item filesystem (DOS), \hyperpage{34}
\indexspace \indexspace
\item gl (DOS), \hyperpage{34} \item gl (DOS), \hyperpage{38}
\item gzip (library), \hyperpage{10} \item graphics (library), \hyperpage{26}
\item gzip (library), \hyperpage{11}
\indexspace \indexspace
\item input (DOS), \hyperpage{34} \item input (DOS), \hyperpage{38}
\indexspace \indexspace
@@ -38,16 +39,20 @@
\indexspace \indexspace
\item keycodes, \hyperpage{19} \item keycodes, \hyperpage{20}
\indexspace \indexspace
\item MMIO-com, \hyperpage{17} \item MMIO-com, \hyperpage{18}
\item MMIO-graphics, \hyperpage{25} \item MMIO-graphics, \hyperpage{26}
\indexspace \indexspace
\item stdio (library), \hyperpage{8} \item pipe (DOS), \hyperpage{32}
\item sys (library), \hyperpage{12}
\indexspace
\item stdio (library), \hyperpage{9}
\item sys (library), \hyperpage{13}
\end{theindex} \end{theindex}

View File

@@ -244,7 +244,7 @@
\part{The Virtual Machine} \part{The Virtual Machine}
\input{implementation} \input{implementation}
\part{\thedos} \part{The DOS}
\input{tvdos} \input{tvdos}
\part*{Bibliography} \part*{Bibliography}
@@ -265,7 +265,7 @@
The source code for \thismachine\ and this documentation are distributed under the following terms: The source code for \thismachine\ and this documentation are distributed under the following terms:
\copyright\ 2020-- \ Minjae Song (``CuriousTorvald'') \copyright\ 2021-- \ Minjae Song (``CuriousTorvald'')
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the ``Software''), to deal of this software and associated documentation files (the ``Software''), to deal

View File

@@ -1,4 +1,4 @@
\chapter{Introduction} \chapter{\thedos}
\thedos\ is a Disk Operating System (usually) bundled with the distribution of the \thismachine. \thedos\ is a Disk Operating System (usually) bundled with the distribution of the \thismachine.
@@ -34,8 +34,6 @@ Variables can be set or changed using \textbf{SET} commands.
\index{commands (DOS)}\index{coreutils (DOS)}DOS commands are only valid under the DOS environment. \index{commands (DOS)}\index{coreutils (DOS)}DOS commands are only valid under the DOS environment.
To invoke the DOS commands from the Javascript-side, use:\\ \code{\_G.shell.coreutils.*}
\begin{outline} \begin{outline}
\1\dossynopsis{cat}{file}{Reads a file and pipes its contents to the pipe, or to the console if no pipes are specified.} \1\dossynopsis{cat}{file}{Reads a file and pipes its contents to the pipe, or to the console if no pipes are specified.}
\1\dossynopsis{cd}{dir}{Change the current working directory. Alias: chdir} \1\dossynopsis{cd}{dir}{Change the current working directory. Alias: chdir}
@@ -54,6 +52,49 @@ To invoke the DOS commands from the Javascript-side, use:\\ \code{\_G.shell.core
\chapter{Using DOS Utils on JS}
DOS coreutils and some of the internal functions can be used on Javascript program.
To invoke the coreutils, use \code{\_G.shell.coreutils.*}
\begin{outline}
\1\inlinesynopsis[\_G.shell]{resolvePathInput}{path}{Returns fully-qualified path of the input path, relative to the current working directory.}
\1\inlinesynopsis[\_G.shell]{getPwdString}{}{Returns the current working directory as a string.}
\1\inlinesynopsis[\_G.shell]{getCurrentDrive}{}{Returns the drive letter of the current working drive.}
\1\inlinesynopsis[\_G.shell]{execute}{command}{Executes the DOS command.}
\end{outline}
\chapter{Pipes}
\index{pipe (DOS)}Pipe is a way to chain the IO of the one program/command into the different programs/commands in series.
A pipe can be either named or anonymous: named pipes are ones that are created by the user while the anonymous pipes are created by the DOS process as a result of the command pipelining.
\section{Command Pipelining}
In \thedos, a pipe can be used to route the output of a command into the other command. For example, \code{dir | less} will route the output of the \code{dir} into the text viewer called \code{less} so that the user can take their time examining the list of files in the directory, even if the list is taller that the terminal's height.
\section{User-defined Pipe}
A user program can create and interact with the pipe so long as it's \emph{named}. The contents of the pipe can be read and modified just like a Javascript variable.
Named pipes can be retrieved on \code{\_G.shell.pipes.*}
\section{Pipe-related Functions}
\begin{outline}
\1\inlinesynopsis[\_G.shell]{getPipe}{}{Returns the currently opened pipe. \code{undefined} is returned if no pipes are opened.}
\1\inlinesynopsis[\_G.shell]{appendToCurrentPipe}{text}{Appends the given text to the current pipe.}
\1\inlinesynopsis[\_G.shell]{pushAnonPipe}{contents}{Pushes an anonymous pipe to the current pipe stack.}
\1\inlinesynopsis[\_G.shell]{pushPipe}{pipeName, contents}{Pushes the pipe of given name to the current pipe stack.}
\1\inlinesynopsis[\_G.shell]{hasPipe}{}{Returns true if there is a pipe currently opened.}
\1\inlinesynopsis[\_G.shell]{removePipe}{}{Destroys the currently opened pipe and returns it. Any pipes on the pipe stack will be shifted down to become the next current pipe.}
\end{outline}
\chapter{File I/O} \chapter{File I/O}
\index{filesystem (DOS)}In \thedos, drives are assigned with a drive letter, and the drive currently booted on is always drive \textbf{A}. \index{filesystem (DOS)}In \thedos, drives are assigned with a drive letter, and the drive currently booted on is always drive \textbf{A}.
@@ -133,7 +174,7 @@ Functions:
\chapter{DOS Libraries} \chapter{DOS Libraries}
\section{The Input Library} \section{Input}
\dosnamespaceis{Input}{input} \dosnamespaceis{Input}{input}
@@ -142,7 +183,7 @@ Functions:
\section{The GL} \section{GL}
\dosnamespaceis{Graphics}{gl} \dosnamespaceis{Graphics}{gl}