-
Notifications
You must be signed in to change notification settings - Fork 0
/
jodappendices.tex
1021 lines (820 loc) · 36.3 KB
/
jodappendices.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% JOD appendicies
\appendix
%\section{Appendixes}
\newpage
\section{JOD Distribution}
JOD is distributed\index{installation!distribution} as a \emph{J addon}.
You can install JOD using \texttt{pacman} the
\href{https://code.jsoftware.com/wiki/Pacman}{\emph{J package manager}} \cite{jwiki:jal}.
The JOD distribution is broken into three \texttt{pacman} packages:
\begin{enumerate}
\item \href{https://www.jsoftware.com/jwiki/Addons/general/jod}{\texttt{jod}}
\cite{baker:jod}: This is the only package that must be installed to run JOD.
It contains JOD system code and supporting files.
\item \href{https://www.jsoftware.com/jwiki/Addons/general/jodsource}{\texttt{jodsource}}
\cite{baker:jodsource}: This addon consists of three
JOD dictionary dumps and a setup script. JOD dictionary dumps\index{dictionary!source!\texttt{jodsource}}
are J script files that can rebuild JOD dictionaries. Dump files are the best way to
distribute dictionary code since they are independent of J binary representations.
The \texttt{jodsource}\index{source code} addon contains.
\begin{enumerate}
\item \texttt{joddev.ijs} --- development put dictionary\index{put dictionary}
\item \texttt{jod.ijs} --- main JOD source and test script dictionary
\item \texttt{utils.ijs} --- common utilities dictionary
\item \texttt{jodsourcesetup.ijs} --- J script that creates and loads the three
JOD development dictionaries.
\end{enumerate}
\item \href{https://www.jsoftware.com/jwiki/Addons/general/joddocument}{\texttt{joddocument}} \cite{baker:joddocument}: this package contains
JOD PDF documents. Installing this
package places these documents on local drives
for \hyperlink{il:jodhelp}{\texttt{jodhelp}}, see page~\pageref{ss:jodhelp}.
\end{enumerate}
The \emph{packages} listed above are built from source scripts that are found in several GitHub\index{GitHub} repositories. To access raw
JOD code see:
\begin{enumerate}
\item The official \href{https://www.jsoftware.com}{\texttt{jsoftware.com}} repositories are:
\begin{enumerate}
\item \url{https://github.com/jsoftware/general_jod}
\item \url{https://github.com/jsoftware/general_joddocument}
\item \url{https://github.com/jsoftware/general_jodsource}
\end{enumerate}
\item My development repositories are:
\begin{enumerate}
\item \url{https://github.com/bakerjd99/jod}
\item \url{https://github.com/bakerjd99/joddumps}
\end{enumerate}
\item \LaTeX\ source for this document is at:
\begin{enumerate}
\item \url{https://github.com/bakerjd99/joddoc}
\end{enumerate}
\end{enumerate}
\newpage
\section{Building JOD}
JOD is an open-source system. Anyone is free to examine and modify JOD source code.
All JOD source is stored in JOD development dictionaries. Installing the
\href{https://www.jsoftware.com/jwiki/Addons/general/jodsource}{\texttt{jodsource}}\index{dictionary!source!\texttt{jodsource}}
addon makes this code available.
JOD dictionaries also contain utilities for building\index{building!JOD distribution} and distributing JOD.
\begin{lstlisting}[frame=single,framerule=0pt,basicstyle=\ttfamily\footnotesize]
NB. open JOD development dictionaries
od ;:'joddev jod utils' [ 3 od ''
NB. before building create required directories
NB. directory creation is a one time step
'test' getrx 'setbuilddirs'
1 setbuilddirs_test_ 0
NB. build JOD
rm 'buildjoddistribution'
\end{lstlisting}
\texttt{buildjoddistribution} extracts JOD source code from development dictionaries and generates the compressed or
\href{https://en.wikipedia.org/wiki/Minification_(programming)}{\emph{minimized}} scripts
used by the JOD addon.
\begin{lstlisting}[frame=single,framerule=0pt,basicstyle=\ttfamily\footnotesize]
NB.*buildjoddistribution s-- full JOD distribution build.
cocurrent 'base'
cocurrent jodtestlocale 'AAAbuildjoddistribution'
NB. record open dictionaries and open JOD dictionaries
od ;:'joddev jod utils' [ 3 od'' [ ooo=: }. did 0
NB. get JOD build utilities and version tracking nouns
tmploc get }. grp 'buildjod'
NB. set distribution directories
jddir=: 'JODDOCDIR JODSTAGEDIR JODGITDIR JODSOURCESTAGEDIR JODSTAGEPDFDIR JODSTAGEDOCDIR'
jddir=: jddir , ' JODGITDOCDIR JODADDONDIR JODSCRIPTDIR JODEXTSDIR'
(jddir)=: setbuilddirs 0
NB. generate distribution scripts
updatejodmanifest 0
JODVMD buildjodcompressed JODSTAGEDIR;JODGITDIR;JODADDONDIR;JODSCRIPTDIR
JODTOOLSVMD buildjodtoolscompressed JODSTAGEDIR;JODEXTSDIR;JODSCRIPTDIR
JODVMD updatejoddistribution JODSTAGEDIR;JODGITDIR;JODDOCDIR
JODVMD updatejodsourcedumps JODSOURCESTAGEDIR
JODVMD releasejod JODSTAGEDIR;JODSTAGEPDFDIR;JODSTAGEDOCDIR;JODGITDOCDIR
NB. destroy build locale
cocurrent 'base'
coerase <testlocale_ijod_
\end{lstlisting}
\newpage
\section{Testing JOD}\index{testing!running test scripts}
Software is either \emph{tested} or \emph{trash}! There are no other
options! JOD aspires to be more than trash. So, it shouldn't surprise
anyone to learn that JOD development dictionaries contain many test
scripts. Test scripts are organized into \emph{suites}. Suites are
collections of test scripts.
\begin{lstlisting}[frame=single,framerule=0pt,basicstyle=\ttfamily\footnotesize]
NB. open JOD development dictionaries to use test scripts.
od ;:'joddev jod utils' [ 3 od ''
NB. make jodtester script - used by most test scripts
mls 'jodtester'
NB. list JOD test suites
80 list }. 3 dnl 'jod'
jodbasictests jodcrushtests joddualsystests jodextensiontests
jodlargetests jodmanwintests jodpjmtest jodpreparetests
jodpurgetests jodsmoketests jodstresstests
\end{lstlisting}
\noindent Because test scripts are often more revealing and informative than
standard documentation, I have posted them on GitHub at
\medskip
\small \url{https://github.com/bakerjd99/jod/tree/master/jodunit}. \normalsize
\medskip
\noindent The majority
of the scripts can be run with JOD's \hyperlink{il:rtt}{\texttt{rtt}} verb, see page~\pageref{ss:rtt}.
\begin{lstlisting}[frame=single,framerule=0pt,basicstyle=\ttfamily\footnotesize]
NB. run silently - only explict output shown - expected result is 1
1 rtt 'bnlSmoke02'
NB. show all input and output
rtt 'bnlSmoke02'
\end{lstlisting}
\noindent The following test script is typical of JOD tests. Run with {\texttt{rtt}}.
\begin{lstlisting}[frame=single,framerule=0pt,basicstyle=\ttfamily\footnotesize]
NB.*bnlSmoke02 t-- (bnl) test hash failure detection.
cocurrent 'base'
require 'jodtester'
cocurrent jodtestlocale 'AAAbnlSmoke02'
testenvironment 'good';'JOD'
NB. -{TEST START}-
NB. is folder configured
iscf '~JODTEST'
NB. set test dictionary
er settdict tdict=: 'testjod00'
NB. read and write bytes
read=: 1!:1&(]`<@.(32&>@(3!:0)))
write=: 1!:2 ]`<@.(32&>@(3!:0))
NB. close any open and open test dictionary
er od tdict [ 3 od ''
NB. erase any current test dictionary backups
DL=: {: {.DPATH__ST__JODobj
0 0$ferase 1 dir BAK__DL,'*.*'
NB. no backup error expected
ner 14 bnl '.'
NB. insert random arrays between backups to insure
NB. hashes in the njhashes.txt sidecar files differ
hashhack=: ?5 5 5$1000000
hashmsg=: 'first backup'
er tmploc put 'hashhack'
er tmploc put 'hashmsg'
er packd tdict
hashhack=: ?5 5 5$1000000
hashmsg=: 'second backup'
er tmploc put 'hashhack'
er tmploc put 'hashmsg'
er packd tdict
NB. all hashes should pass
er showpass hashes=: 17 bnl '.'
*./ ; 1 1 }. rv_ajod_ hashes
NB. copy and rename older backup word files over
NB. newer backups - this will introduce a hash failure
jwords=: dirtree BAK__DL,'*jwords.ijf'
jwords=: (\: 1 {"1 jwords){jwords
(read ;0{{:jwords) write ;0{{.jwords
er showpass hckhashes=: 17 bnl '.'
NB. some hashes fail - 0s in 17 bnl '.'
0 e. ; 1 1 }. rv_ajod_ hckhashes
NB. -{TEST SUCCESSFUL}-
ereopen 0
cocurrent 'base'
coerase <testlocale_ijod_
\end{lstlisting}
\newpage
\section{JOD Classes}\label{ap:classes}
\begin{figure}[htbp]
\centering
\includegraphics[width=0.84\textwidth]{joddot}
\caption[JOD Classes]{This diagram\index{z interface}\index{ijod interface} shows how
JOD classes\index{classes} are related. JOD classes are loaded into
J addon \textbf{\texttt{a}} locales. The arrows\index{locale!classes} indicate how J names are resolved.
The \emph{blue diamond} locales \texttt{ijod} and \texttt{z} are on the \texttt{base} locale's
path: \texttt{copath 'base'}. \emph{Diagram Generated by} \texttt{Graphviz} \cite{jwiki:graphviz}.
}
\label{eps:joddot}
\end{figure}
\newpage
\section{Reference Path}\label{ap:refpath}
JOD groups and suites, (see \hyperlink{il:grp}{\texttt{grp}} on page~\pageref{ss:grp}), are defined with respect to a particular path. This path is called the \emph{reference path}. The reference path\index{reference path} is stored when the first put dictionary group or
suite is defined. Group and suite generation with \hyperlink{il:make}{\texttt{make}}, \hyperlink{il:mls}{\texttt{mls}} and \hyperlink{il:lg}{\texttt{lg}}, (see pages~\pageref{ss:make}, \pageref{ss:mls}, \pageref{ss:lg}), check the current path against the reference path. If the paths do not match an error is returned.
Reference paths display current dictionary names but the path is
stored as a unique list of extended dictionary
identification numbers: \texttt{DIDNUM}s. On Windows and Linux
systems the \texttt{DIDNUM}\index{DIDNUM} is based
on \texttt{GUID}s. \texttt{DIDNUM}s insure reference paths are unique.
A reference path can only be reset by clearing the put dictionary\index{put dictionary}
path, opening desired dictionaries and recreating a group or suite: see \hyperlink{il:dpset}{\texttt{dpset}} on page~\pageref{ss:dpset}.
\begin{lstlisting}[frame=single,framerule=0pt,basicstyle=\ttfamily\footnotesize]
NB. open first five dictionaries
od 5 {. }. od ''
+-+--------------------------+------+---+-----+--------+---+
|1|opened (rw/rw/ro/rw/rw) ->|budget|cbh|flick|flickdev|gps|
+-+--------------------------+------+---+-----+--------+---+
NB. display dictionary information - reference paths in last column
did ~ 0
+-+----------------------------------------------------------------------+
|1|+--------+--+-----+-----+-------+-------+------+---------------------+|
| || |--|Words|Tests|Groups*|Suites*|Macros|*Path ||
| |+--------+--+-----+-----+-------+-------+------+---------------------+|
| ||budget |rw|14 |0 |2 |0 |0 |/budget ||
| |+--------+--+-----+-----+-------+-------+------+---------------------+|
| ||cbh |rw|145 |0 |6 |0 |6 |/cbh/utils ||
| |+--------+--+-----+-----+-------+-------+------+---------------------+|
| ||flick |ro|296 |3 |9 |0 |9 |/flick/utils ||
| |+--------+--+-----+-----+-------+-------+------+---------------------+|
| ||flickdev|rw|96 |2 |2 |0 |2 |/flickdev/flick/utils||
| |+--------+--+-----+-----+-------+-------+------+---------------------+|
| ||gps |rw|11 |0 |0 |0 |0 |/gps/utils ||
| |+--------+--+-----+-----+-------+-------+------+---------------------+|
+-+----------------------------------------------------------------------+
\end{lstlisting}
\newpage
\section{JOD Argument Codes}\label{ap:objqualcodes}
The left, and some right, arguments of JOD verbs are specified with \emph{object}, \emph{qualifier} and \emph{option} codes. Object codes\index{codes!argument} are typically the first argument code while options and qualifiers usually occupy the second and third positions. Options and qualifiers are sometimes negative. Negative values modify codes: see tables~\ref{tab:objcodes}, \ref{tab:objneg} and
\ref{tab:qualcodes} on pages~\pageref{tab:objcodes}, \pageref{tab:objneg} and \pageref{tab:qualcodes}.
\begin{table}[htbp]
\centering
\scriptsize
\begin{tabular}{|l|l|l|p{4.0in}|} \hline
\multicolumn{4}{|c|}{\textbf{\normalsize Object Codes\T\B}} \\ \hline
\multicolumn{1}{|c|}{\textbf{\normalsize Noun\T}} &
\multicolumn{1}{|c|}{\textbf{\normalsize Code}} &
\multicolumn{1}{|c|}{\textbf{\normalsize Use}} &
\multicolumn{1}{|c|}{\textbf{\normalsize Example\B}} \\ \hline
\texttt{WORD\T\B} & 0 & word code & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|0 dnl '' | \textcolor{CodeComment}{\ttfamily\textsl{NB. list all words on path}} \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{TEST\T\B} & 1 & test case code & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|1 put 'test';'test code..' | \textcolor{CodeComment}{\ttfamily\textsl{NB. store test}} \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{GROUP\T\B} & 2 & group code & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|2 put 'name';'group header ...' | \textcolor{CodeComment}{\ttfamily\textsl{NB. store group header}} \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{SUITE\T\B} & 3 & suite code & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|3 grp 'suite' | \textcolor{CodeComment}{\ttfamily\textsl{NB. get suite members, list of test names}} \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{MACRO\T\B} & 4 & macro code & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|4 disp 'test' | \textcolor{CodeComment}{\ttfamily\textsl{NB. display macro}} \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{DICTIONARY\T\B} & 5 & dictionary code & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|5 get '' | \textcolor{CodeComment}{\ttfamily\textsl{NB. get dictionary documentation}} \\
\end{tabular}
\end{minipage} \\ \hline
\end{tabular}
\caption{JOD Object Codes}
\label{tab:objcodes}
\end{table}
The meaning of negative option and qualifier codes depends on the word. For
\hyperlink{il:dnl}{\texttt{dnl}} a negative option requests a \emph{path order list.}\index{path order list}
For \hyperlink{il:get}{\texttt{get}} and \hyperlink{il:put}{\texttt{put}} a negative
option code gets and puts timestamp arrays.
\begin{table}[htbp]
\centering
\scriptsize
\begin{tabular}{|l|l|p{4.7in}|} \hline
\multicolumn{3}{|c|}{\textbf{\normalsize Negative Codes\T\B}} \\ \hline
\multicolumn{1}{|c|}{\textbf{\normalsize Code\T}} &
\multicolumn{1}{|c|}{\textbf{\normalsize Use}} &
\multicolumn{1}{|c|}{\textbf{\normalsize Example\B}} \\ \hline
\verb|_1|\T\B & path order list & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|0 _1 dnl '' | \textcolor{CodeComment}{\ttfamily\textsl{NB. path order list of words}} \\
\end{tabular}
\end{minipage} \\ \hline
\verb|_2|\T\B & path order list & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|1 _2 dnl 'boo' | \textcolor{CodeComment}{\ttfamily\textsl{NB. path order list of test names containing boo}} \\
\end{tabular}
\end{minipage} \\ \hline
\verb|_14|\T\B & names and timestamps & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|1 _14 get }. revo'' | \textcolor{CodeComment}{\ttfamily\textsl{NB. names and timestamps array}} \\
\end{tabular}
\end{minipage} \\ \hline
\verb|_14|\T\B & names and timestamps & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|4 _14 put tsarray | \textcolor{CodeComment}{\ttfamily\textsl{NB. update macro timestamps}} \\
\end{tabular}
\end{minipage} \\ \hline
\end{tabular}
\caption{JOD Negative Codes}
\label{tab:objneg}
\end{table}
\newpage
\begin{table}[htbp]
\centering
\scriptsize
\begin{tabular}{|l|l|l|p{4.0in}|} \hline
\multicolumn{4}{|c|}{\textbf{\normalsize Qualifier Codes\T\B}} \\ \hline
\multicolumn{1}{|c|}{\textbf{\normalsize Noun\T}} &
\multicolumn{1}{|c|}{\textbf{\normalsize Code}} &
\multicolumn{1}{|c|}{\textbf{\normalsize Use}} &
\multicolumn{1}{|c|}{\textbf{\normalsize Example\B}} \\ \hline
\texttt{DEFAULT\T\B} & 7 & default action & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|0 7 get 'this' | \textcolor{CodeComment}{\ttfamily\textsl{NB. default behaviour}} \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{EXPLAIN\T\B} & 8 & short explanation text & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|0 8 put 'name';'explain name' | \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{DOCUMENT\T\B} & 9 & documentation text & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|2 9 put 'group';'very long group document ...' | \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{NVTABLE\T\B} & 10 & name value table & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|0 10 get }. dnl '' | \textcolor{CodeComment}{\ttfamily\textsl{NB. return all words in table}} \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{REFERENCE\T\B} & 11 & reference code & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|11 del 'earthdist' | \textcolor{CodeComment}{\ttfamily\textsl{NB. delete word references}} \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{NAMECLASS\T\B} & 12 & J name class code & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|0 12 get }. dnl ''| \textcolor{CodeComment}{\ttfamily\textsl{NB. fetch J name class codes}} \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{CREATION\T\B} & 13 & creation date & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|0 13 get }. dnl ''| \textcolor{CodeComment}{\ttfamily\textsl{NB. word creation dates}} \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{LASTPUT\T\B} & 14 & last change date & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|0 14 get }. dnl ''| \textcolor{CodeComment}{\ttfamily\textsl{NB. recent changes}} \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{HASH\T\B} & 17 & hash code & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|17 bnl '.'| \textcolor{CodeComment}{\ttfamily\textsl{NB. check backup files against hashes}} \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{BYTESIZE\T\B} & 15 & object byte size & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|0 15 get }. dnl ''| \textcolor{CodeComment}{\ttfamily\textsl{NB. word byte sizes}} \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{JSCRIPT\T\B} & 21 & J script code\index{postprocessor} & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|4 1 21 dnl 'POST_' | \textcolor{CodeComment}{\ttfamily\textsl{NB. list postprocessors}} \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{LATEX\T\B} & 22 & \LaTeX\ text code & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|4 get }. 4 3 22 dnl 'TEX' | \textcolor{CodeComment}{\ttfamily\textsl{NB. get LaTeX macros}} \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{HTML\T\B} & 23 & HTML text code & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|4 put 'HTMLtxt';23;'<a>hello world</a>' | \textcolor{CodeComment}{\ttfamily\textsl{NB. store html}} \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{XML\T\B} & 24 & XML text code & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|4 put 'XMLtext24;'<p>baby step xml</p>' | \textcolor{CodeComment}{\ttfamily\textsl{NB. store xml}}\\
\end{tabular}
\end{minipage} \\ \hline
\texttt{TEXT\T\B} & 25 & ASCII text code & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|4 3 25 dnl 'EPS' | \textcolor{CodeComment}{\ttfamily\textsl{NB. texts ending with EPS}} \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{BYTE\T\B} & 26 & BYTE characters & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|4 put 'BYTEME';a.| \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{MARKDOWN\T\B} & 27 & \href{https://daringfireball.net/projects/markdown/}{MARKDOWN} text code & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|5 put 'Main **dictionary** document' | \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{UTF8\T\B} & 28 & Unicode UTF8 text & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|4 put 'UTF8text';UTF8_ajod_;(8 u: 4 u: 56788 4578,65+i.5) | \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{PYTHON\T\B} & 29 & Python script text & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|4 put 'big_py';PYTHON_ajod_;'2 ** 1024' | \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{SQL\T\B} & 30 & SQL script text & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|4 put 'yada_sql';SQL_ajod_;'select * from yada' | \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{JSON\T\B} & 31 & JSON text & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|4 put 'fleece_json';JSON_ajod_;'{"json": "golden-fleece"}' | \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{IPYNB\T\B} & 32 & \href{https://jupyter.org/}{Jupyter} notebook & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|4 put 'notebook_ipynb';IPYNB_ajod_;'... ipynb ...' | \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{LEAN\T\B} & 33 & \href{https://leanprover-community.github.io/}{LEAN} source code & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|4 put 'theorem_lean';LEAN_ajod_;'... lean on me ...' | \\
\end{tabular}
\end{minipage} \\ \hline
\texttt{ZIG\T\B} & 34 & \href{https://ziglang.org/}{ZIG} source code & \begin{minipage}{3.9in}
\begin{tabular}{l}
\verb|4 put 'code_zig';ZIG_ajod_;'... ziggy code stuff ...' | \\
\end{tabular}
\end{minipage} \\ \hline
%\texttt{PYTHON\T\B} & 29 & Python script text & \begin{minipage}{3.9in}
%\begin{tabular}{l}
%\verb|4 put 'PYTHONTEXT';PYTHON_ajod_;'2 ** 1024' | \\
%\end{tabular}
%\end{minipage} \\ \hline
\end{tabular}
\caption{JOD Qualifier Codes}
\label{tab:qualcodes}
\end{table}
\textbf{Note:} suffixes like \texttt{notebook\_ipynb} are not required. I use them to make it easier to see what type of code is stored in a JOD macro.
\newpage
\section{\texttt{jodparms.ijs}}\label{ap:jodparms}
\verb|jodparms.ijs| is read when the master file\index{master file} \verb|jmaster.ijf| is created
and is used to set dictionary parameters.
Dictionary parameters are distributed to dictionary files and runtime
objects. New parameters can be added by editing \verb|jodparms.ijs|
and recreating the master file.
The last few lines of the following example show how to add
\texttt{COPYRIGHT} and \texttt{MYPARAMETER}.
When a parameter is added its value will appear in the directory
objects of all dictionaries but will only be \hyperlink{il:dpset}{\texttt{dpset}}'able in new dictionaries.
\begin{quotation}
To change default master dictionary parameters:
\begin{enumerate}
\item Exit J
\item Delete the files
\begin{description}
\item \verb|~addons/general/jod/jmaster.ijf|
\item \verb|~addons/general/jod/jod.ijn|
\end{description}
\item Edit
\begin{description}
\item \verb|~addons/general/jod/jodparms.ijs|
\end{description}
\item Restart J and reload JOD with
\begin{description}
\item \verb|load 'general/jod'|
\end{description}
\end{enumerate}
\end{quotation}
%\vspace{0.5cm}
\begin{lstlisting}[frame=single,framerule=0pt,basicstyle=\ttfamily\footnotesize]
NB.*jodparms s-- default dictionary parameters.
NB.
NB. This file is used to set the default dictionary parameters
NB. table in the master file. When a new dictionary is created
NB. the parameters in the master file are used to specify the
NB. parameters for a particular dictionary. The verb (dpset) can
NB. be used to modify parameter settings in individual
NB. dictionaries. Master file parameters can only be changed by
NB. editing this file and recreating the master file.
NB.
NB. The master file can be recreated with the call:
NB.
NB. createmast_ajod_ JMASTER_ajod_
NB.
NB. WARNING: all the parameters currently listed are required by
NB. the JOD system. If you remove any of them JOD will crash. You
NB. can safely add additional parameters but you cannot safely
NB. remove current parameters.
MASTERPARMS=: 0 : 0
NB. The format of this parameter file is:
NB. jname ; (type) description ; value
NB.
NB. jname is a valid J name
NB. (type) description documents the parameter - type is required
NB. only (+integer) is currently executed other types will
NB. be passed as character lists (see dptable).
NB. value is an executable J expression that produces a value
ASCII85 ; (+integer) when 1 use ascii85 in dumps (0 or 1) ; 1
COPYFACTOR ; (+integer) components copied in one loop pass (1<y<240) ; 100
DOCUMENTDICT ; (+integer) when 1 dictionary document is put (0 or 1) ; 1
DOCUMENTWIDTH ; (+integer) width of justified document text (20<y<255) ; 61
DUMPFACTOR ; (+integer) objects dumped in one loop pass (1<y<240) ; 50
GETFACTOR ; (+integer) words retrieved in one loop pass (10<y<2048) ; 250
PUTFACTOR ; (+integer) words stored in one loop pass (10<y<2048) ; 100
RETAINAGE ; (+integer) when 1 timestamps are saved in dumps (0 or 1) ; 1
HASHDUMP ; (+integer) when 1 a hash is prefixed to dumps (0 or 1) ; 1
NB. ROOTFOLDER is empty by default. If it is set to a (jpath) J configured
NB. folder ROOTFOLDER overrides default locations for (mls) generated scripts
ROOTFOLDER ; (character) redirects (mls) scripts to J folder ;
NB. typical nonempty setting
NB. ROOTFOLDER ; (character) redirects (mls) scripts to J folder ; ~user/jodroot
NB. Any added parameters are stored in the master file when
NB. created and distributed to JOD directory objects.
NB. WARNING: when defining J expressions be careful about the ; character
NB. the JOD code (dptable) that parses this string is rudimentary.
NB. COPYRIGHT ; (character) ; All rights reserved
NB. MYPARAMETER ; (+integer) the answer ; 42
)
\end{lstlisting}
\newpage
\section{\texttt{jodprofile.ijs}}\label{ap:jodprofile}
\verb|jodprofile.ijs| is an optional user profile script; it runs after
JOD loads and can be used to customize\index{configuration!\texttt{jodprofile.ijs}} your working environment. The following is an example
profile script.
%\lstset{numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt}
\begin{lstlisting}[frame=single,framerule=0pt,basicstyle=\ttfamily\footnotesize]
NB.*jodprofile s-- JOD dictionary profile.
NB.
NB. An example JOD profile script. Save this script in
NB.
NB. ~addons/general/jod/
NB.
NB. with the name jodprofile.ijs
NB.
NB. This script is executed after all dictionary objects have
NB. been created. It can be used to set up your default JOD
NB. working environment.
NB. set white space preservation on
9!:41 [ 1
NB. minimum print precision to show yyyymmdd dates (see jodage)
9!:11 [ 8
NB. set jqt windows console size - automatic for linux/mac/ios
Cwh_j_=: 160 24
NB. do not reset if you are running more than one JOD instance
NB. multiple JOD instances are permitted but not recommended
dpset 'RESETME'
NB. JOD interface locale - (ijod) is a good place for ad hoc JOD addons
coclass 'ijod'
NB. used by some macros: WHEREAMI=: ;0 { ;:'home work test'
WHEREAMI=: 'home'
NB. (ijod) error/ message text
ERRIJOD00=: 'current group name (jodg_ijod_) not set'
ERRIJOD01=: 'current suite name (jods_ijod_) not set'
ERRIJOD02=: 'invalid (x) search string'
OKIJOD00=: 'no matches'
OKIJOD01=: 'no objects'
NB. add delete objects from current group or current suite
ag=: {{if. wex_ajod_ <'jodg' do. jodg addgrp y else. jderr_ajod_ ERRIJOD00 end.}}
as=: {{if. wex_ajod_ <'jods' do. (jods;3) addgrp y else. jderr_ajod_ ERRIJOD01 end.}}
dg=: {{if. wex_ajod_ <'jodg' do. jodg delgrp y else. jderr_ajod_ ERRIJOD00 end.}}
ds=: {{if. wex_ajod_ <'jods' do. (jods;3) delgrp y else. jderr_ajod_ ERRIJOD01 end.}}
NB. referenced words not in current group
nx=: 3 : 0
if. -.wex_ajod_ <'jodg' do. jderr_ajod_ ERRIJOD00 return. end.
if. badrc_ajod_ gn=. grp jodg do. gn return. end.
(allrefs }. gn) -. gn
)
NB. words in current group using a word
ug=: 3 : 0
if. -.wex_ajod_ <'jodg' do. jderr_ajod_ ERRIJOD00 return. end.
if. badrc_ajod_ gn=. grp jodg do. gn return. end.
y usedby }. gn
)
NB. generate current group and save load script
sg=: {{if. wex_ajod_ <'jodg' do. mls jodg else. jderr_ajod_ ERRIJOD01 end.}}
NB. open entire (y) path
oep=: 6&od
NB. top (put dictionary) words, groups, suites in revision order
tw=: revo
tg=: 2&revo
ts=: 3&revo
NB. run tautology as plaintest - does not stop on nonzero results
rt=: 2&rtt
NB. run tautology silently - will show explict smoutput
rq=:1&rtt
NB. run macro silently - will show explict smoutput
rs=: 1&rm
NB. short help for groups/suites
hg=: [: hlpnl [: }. grp
hs=: 1 hlpnl [: }. 3 grp ]
NB. short help on put objects in revised order from code:
NB. hr 4 NB. macro
NB. hr 2 NB. groups
NB. 10 hr 0 NB. last ten words
hr=: 3 : 0
if. badrc_ajod_ w=. y revo '' do. w return. end.
y hlpnl }. w
:
if. badrc_ajod_ w=. y revo '' do. w return. end.
y hlpnl x {. }. w
)
NB. remove trailing blank rows
rebtbrow=: ] #~ [: -. [: *./"1 [: *./\. ' '&=
NB. appends trailing line feed character if necessary
tlf=:] , ((10{a.)"_ = {:) }. (10{a.)"_
NB. show long documents
NB. hld 0 NB. words
NB. hld 2 NB. groups
NB. 0 1 0 hld 0 NB. documented nouns
NB. 'NIMP:' hld 0 NB. word docs with string 'NIMP:'
NB. (] ,: #@hld"0) i. 5 NB. count docs on path
hld=: ''&$: :(4 : 0)
if. badcl_ajod_ x do. jderr_ajod_ ERRIJOD02 return. end.
if. badrc_ajod_ w=. y dnl '' do. w return. end.
if. 0=#&> w=. }. w do. ok_ajod_ OKIJOD01 return. end.
if. badrc_ajod_ d=. (({.y),9) get w do. d return. end.
d=. d #~ 0 < #&> 1 {"1 d=. >1{d
if. 0<#x do. d=. d #~ +./@(x&E.)&> 1 {"1 d end.
(0 {"1 d) ,. rebtbrow@(];._2)@tlf@(-.&CR)&.> 1 {"1 d
)
NB. search short help for string and list matching words
NB. hss 'see long' NB. search word short text
NB. 2 hss 'see long' NB. search group short text
NB. 4 hss 'post' NB. search macro short text
hss=: 0&$: :(4 : 0)
if. badrc_ajod_ w=. x dnl '' do. w return. end.
d=. x hlpnl }. w
if. 0=#w=. 1 >@{ d do. ok_ajod_ OKIJOD00 return. end.
if. 0=#s=. I. (,:y) +./"1@E. w do. ok_ajod_ OKIJOD00 return. end.
s&{ &.> d
)
NB. single line explanation
NB. slex 'word' NB. word
NB. 4 slex 'jodregister' NB. macro
NB. 1 slex 'thistest' NB. test
slex=: 0&$: :(4 : 0)
if. badcl_ajod_ sl=. x disp y do. sl return. end.
(x,8) put y;firstcomment__JODtools sl
)
NB. regenerate put dictionary word cross references
reref=: 3 : 0
if. badrc_ajod_ r=. revo '' do. r return. end.
(r,.s) #~ -.;0{"1 s=.0 globs&> r=.}.r
)
NB. handy cl doc helpers
docscr=: {{ctl_ajod_ (61;0;0;'NB.') docct2__UT__JODobj ];._1 LF,y-.CR}}
doctxt=: {{ctl_ajod_ (61;0;0;'') docct2__UT__JODobj ];._1 LF,y-.CR}}
NB. display noun on screen and return noun value
showpass=:] [ 1!:2&2
NB. portable box drawing characters
portchars=:[: 9!:7 '+++++++++|-'"_ [ ]
NB. windows lucida console box drawing characters
winlcchars=:[: 9!:7 (a.{~16+i.11)"_ [ ]
NB. edit command
DOCUMENTCOMMAND=: 'showpass pr ''{~N~}'''
NB. read & write files
read=:1!:1&(]`<@.(32&>@(3!:0)))
write=:1!:2 ]`<@.(32&>@(3!:0))
readnoun=:3!:2@(1!:1&(]`<@.(32&>@(3!:0))))
writenoun=:([: 3!:1 [) (1!:2 ]`<@.(32&>@(3!:0))) ]
NB. fetch edit text/macros and associate code
tt=:] ; gt
mt=:] ; 25"_ ; gt NB. *.txt
mj=:] ; 21"_ ; gt NB. *.ijs
md=:] ; 27"_ ; gt NB. *.markdown
mq=:] ; 30"_ ; gt NB. *.sql
mx=:] ; 22"_ ; gt NB. *.tex
NB. ~user/temp object text - default j script
os=: 'ijs'&$: : ([: jpath '~user/temp/' , (' ' -.~ ]) , '.' , ' ' -.~ [)
NB. read text from j user temp directory
jt=:[: read os
NB. load j script from j user temp
jl=: (0!:0)@jt
NB. load j script from configured j path
jp=: [: 0!:0 [: < jpath
NB. load and show j script from configured path
jps=: [: 0!:001 [: < jpath
NB. number of objects - used by various (utils) macros (sizeput, ageput, ...) if present
NOBS=: 10
NB. show (1) or suppress (0) dyadic (smoutput)
SHOWSMO=: 1
NB. create temporary named and labeled jod test locales for j 9.6 and beyond
NB. NOTE: WARNING: (jodtestlocale) is used in most JOD test scripts.
(3 : 0) ''
if. 9.6 <: jvn_ajod_'' do.
jodtestlocale=: {{'ijod' jodtestlocale y
:
((;:x),copath y) copath y [ _1 cocreate <y [ coerase <y=. y -. ' '
('tmploc_',y,'_')=: y [ testlocale_ijod_=:y}}
else.
jodtestlocale=: {{'ijod' jodtestlocale y
:
((;:x),copath y) copath y [ cocreate <y [ coerase <y=. y -. ' '
('tmploc_',y,'_')=: y [ testlocale_ijod_=: y}}
end.
'jodtestlocale defined'
)
NB. clear vestigal JOD objects during load - this value must exist
NB. and match 1 for vestigal objects to be cleared by (createjod)
CLEARVOBS=: 1
NB. clear dictionaries - used by (utils) macro (clearput) if present
NB. CLEARJDICS=: ;:''
NB. set a preferred local pandoc - used by (jodliterate) - try (where pandoc)
NB. PREFERREDPANDOC=: 'C:\Users\genric.user\AppData\Local\Pandoc\pandoc'
NB. PREFERREDPANDOC=: '/usr/local/bin/pandoc'
NB. JOD verbs typically run from the base locale
cocurrent 'base'
\end{lstlisting}
\newpage
\section{\texttt{joduserconfigbak.ijs}}\label{ap:jodusercfgbak}
\verb|joduserconfigbak.ijs| is an optional configuration\index{configuration!\texttt{joduserconfigbak.ijs}}
script. \verb|joduserconfigbak.ijs| is in the directory.
\begin{verbatim}
~addons/general/jod/jodbak
\end{verbatim}
\verb|joduserconfigbak.ijs| can be used to redefine class words before
any JOD objects are created.
\begin{lstlisting}[frame=single,framerule=0pt,basicstyle=\ttfamily\footnotesize]
NB.*joduserconfigbak s-- example JOD user configuration script.
NB.
NB. This script is executed BEFORE JOD objects are created. It
NB. can be used to redefine and customize various class words. To
NB. make this script active rename it to (joduserconfig.ijs) and
NB. copy it, with your edits, to the main jod directory:
NB.
NB. ~addons/general/jod
NB.
NB. The nouns listed below are good candidates for redefinition.
smoutput 'joduserconfig.ijs executing ...'
NB. PDF reader in jodutil class - Reset for other PDF readers
PDFREADER_ajodutil_=:'C:\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe'
NB. Reset J's PDF reader to match JOD's PDF reader - do for (jconsole.exe)
PDFReader_j_=: PDFREADER_ajodutil_
NB. Alternative Ghostscript compatible reader
NB. PDFREADER_ajodutil_=:'C:\Program Files\Ghostgum\gsview\gsview32.exe'
NB. Preferred web browser in jodutil class - default Windows FireFox directory
WWW0_ajodutil_=:'C:\Program Files\Mozilla Firefox\firefox.exe'
NB. Secondary web browser in jodutil class - default Windows directory
WWW1_ajodutil_=:'C:\Program Files\Internet Explorer\IEXPLORE.EXE'
NB. Text editor to use when running JOD in (jconsole.exe) on Windows systems
NB. QT/JHS configurations are not necessarily applied for (jconsole,exe)
EDCONSOLE_ajodutil_=:'"C:\Program Files (x86)\notepad++\notepad++.exe"'
\end{lstlisting}
\newpage
\section{JOD \texttt{startup.ijs} entries}\label{ap:startup}
\verb|startup.ijs| is J's optional user startup\index{configuration!\texttt{startup.ijs}}
script. \verb|startup.ijs| is in the directory.
\begin{verbatim}
~config
\end{verbatim}
JOD uses \verb|startup.ijs|
to store load scripts generated by \hyperlink{il:mls}{\texttt{mls}}: see page~\pageref{ss:mls}.
\begin{lstlisting}[frame=single,framerule=0pt,basicstyle=\ttfamily\footnotesize]
NB. WARNING: JOD managed section do not edit!
NB.<JOD_Load_Scripts>
buildpublic_j_ 0 : 0
bstats c:/jod/jutils/script/bstats.ijs
xmlutils c:/jod/utils/script/xmlutils.ijs
analystgraphs c:/jod/franklin/script/analystgraphs.ijs
TeXfrWpxml c:/jod/docs/script/TeXfrWpxml.ijs
jodtester c:/jod/joddev/script/jodtester.ijs
waypoints c:/jod/gps/script/waypoints.ijs
Weeks c:/jod/docs/script/Weeks.ijs
MirrorXref c:/jod/smugpyter/script/MirrorXref.ijs
DudTeXPreprocess c:/jod/docs/script/DudTeXPreprocess.ijs
BiblioHelper c:/jod/docs/script/BiblioHelper.ijs
RecodeSchedZ c:/jod/mwecc/script/RecodeSchedZ.ijs
)
NB.</JOD_Load_Scripts>
\end{lstlisting}
\newpage
\input{joddumptricks}
\newpage
\input{jodddef}
\newpage
\input{jodvcsys}
\newpage
\input{jodhung}
\newpage
\section{JOD Mnemonics}
%\centering
\large
\itshape
\href{https://www.acronymfinder.com/Mnemonics-Neatly-Eliminate-Man's-Only-Nemesis-_-Insufficient-Cerebral-Storage-(MNEMONICS).html}{``\textbf{M}nemonics \textbf{N}eatly \textbf{E}liminate \textbf{M}an's \textbf{O}nly \textbf{N}emesis - \textbf{I}nsufficient \textbf{C}erebral \textbf{S}torage.''}
\Large
\begin{center}
\hyperlink{il:jodhelp}{jodhelp} us!
I \hyperlink{il:get}{get} it!
\hyperlink{il:dnl}{dnl} is not just a river in Egypt.
And Jesse \hyperlink{il:bget}{bget} old code.
\hyperlink{il:put}{put} it where the sun don't shine.
\hyperlink{il:make}{make} my day.
\hyperlink{il:globs}{globs} of gunk.
We're living in a golden \hyperlink{il:jodage}{jodage}.
\hyperlink{il:did}{did}dle me this!
\hyperlink{il:grp}{grp}'ing in the dark.
Am I going to live \hyperlink{il:doc}{doc}?
It was \hyperlink{il:revo}{revo}lting.
He \hyperlink{il:od}{od}'ed man.
\hyperlink{il:et}{et} phone home.
It's a brand \hyperlink{il:newd}{newd}.