Skip to content

Commit

Permalink
Use ditaa instead of shaape
Browse files Browse the repository at this point in the history
shaape is not maintained since 2014.
ditaa looks to be still maintained, and more popular.
  • Loading branch information
hirotnk authored and happi committed Apr 22, 2020
1 parent 75b8a02 commit c76c60b
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 138 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ beam-book.pdf: xml/beam-book-from-ab.xml
dblatex $(DBLATEX_OPTS) xml/beam-book-from-ab.xml -o $@

### Experimental pdf command
beam-book2.pdf: chapters/opcodes_doc.asciidoc
asciidoctor-pdf -r ./custom-pdf-converter.rb --doctype book -a media=prepress -a pdf-style=pdf-theme.yml book.asciidoc -o $@
beam-book2.pdf: chapters/opcodes_doc.asciidoc book.asciidoc chapters/*.asciidoc
asciidoctor-pdf -r ./custom-pdf-converter.rb -r asciidoctor-diagram -a config=ditaa.cfg --doctype book -a media=prepress -a pdf-style=pdf-theme.yml book.asciidoc -o $@

index.html:
asciidoctor -r asciidoctor-diagram --backend=html5 --doctype=book -o site/index.html book.asciidoc
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ make
1. `easy_install dblatex`
1. Install [asciidoc](http://asciidoc.org/INSTALL.html)
1. Install [asciidoctor-diagram](http://asciidoctor.org/docs/asciidoctor-diagram/)
1. Install [shaape](https://github.com/christiangoltz/shaape)
1. Install [ditaa](https://github.com/stathissideris/ditaa)
1. Install [source-highlight](https://www.gnu.org/software/src-highlite/)
1. Install [wget](https://www.gnu.org/software/wget/)
1. `make`
Expand All @@ -174,8 +174,7 @@ make
1. Add `/Library/TeX/texbin` to your `PATH`.
1. `sudo easy_install dblatex`
1. `brew install asciidoc`
1. `brew install pygtk py2cairo pango`
1. `pip install shaape`
1. `brew install ditaa`
1. `brew install source-highlight`
1. `brew install wget`
1. `gem install asciidoctor-diagram`
Expand Down
3 changes: 3 additions & 0 deletions book.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
:sectlinks:
:!compat-mode:
:source-highlighter: rouge
:imagesdir: imagesdir
:ditaa-shadows: false
:ditaa-transparent: true

include::chapters/preface.asciidoc[]

Expand Down
6 changes: 1 addition & 5 deletions chapters/beam.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ then moves the value to a Y register.

[[x_and_y_regs_in_memory]]
.X and Y Registers in Memory
[shaape]
[ditaa]
----
hend -> +----+ -
|....|
Expand All @@ -142,10 +142,6 @@ then moves the value to a Y register.
X1 | |
(X0) | |
+----+
options:
- ".*": {fill: [[0.7, 0.7, 0.7], no-shadow], frame: [[0.9, 0.9, 0.9], line]}
- ".*": {text : ["Monospace 10", no-shadow]}
----

Let us compile the following program with the _'S'_ flag:
Expand Down
6 changes: 1 addition & 5 deletions chapters/beam_instructions.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ registers. E.g. if +Live+ is 2 then registers X0 and X1 are saved.
When allocating on the stack, the stack pointer (E) is decreased.

.Allocate 1 0
[shaape]
[ditaa]
----
Before After
| xxx | | xxx |
Expand All @@ -293,10 +293,6 @@ When allocating on the stack, the stack pointer (E) is decreased.
... ...
HTOP -> | | HTOP -> | |
| xxx | | xxx |
options:
- ".*": {fill: [[0.7, 0.7, 0.7], no-shadow], frame: [[0.9, 0.9, 0.9], line]}
- ".*": {text : ["Monospace 10", no-shadow]}
----

For a full listing of all types of allocate and deallocate
Expand Down
10 changes: 5 additions & 5 deletions chapters/beam_modules.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ TIP: `Beam_asm` is a module in the `compiler` application, part of the Erlang di

The reason behind this complicated design is to try and fit as much type and value data into the first byte as possible to make the code section more compact. After decoding, all encoded values become full size machine words or terms.

[shaape]
[ditaa]
----
7 6 5 4 3 | 2 1 0
----------+-------+
Expand All @@ -521,7 +521,7 @@ It uses the first 3 bits of a first byte to store the tag which defines the type

For values under 16, the value is placed entirely into bits 4-5-6-7 having bit 3 set to 0:

[shaape]
[ditaa]
----
7 6 5 4 | 3 | 2 1 0
--------+---+------
Expand All @@ -530,7 +530,7 @@ Value | 0 | Tag

For values under 2048 (16#800) bit 3 is set to 1, marks that 1 continuation byte will be used and 3 most significant bits of the value will extend into this byte’s bits 5-6-7:

[shaape]
[ditaa]
----
7 6 5 | 4 3 | 2 1 0
------+-----+------
Expand All @@ -539,7 +539,7 @@ Value | 0 1 | Tag

Larger and negative values are first converted to bytes. Then if the value takes 2..8 bytes, bits 3-4 will be set to 1, and bits 5-6-7 will contain the (Bytes-2) size for the value, which follows:

[shaape]
[ditaa]
----
7 6 5 | 4 3 | 2 1 0
--------+-----+------
Expand All @@ -548,7 +548,7 @@ Bytes-2 | 1 1 | Tag

If the following value is greater than 8 bytes, then all bits 3-4-5-6-7 will be set to 1, followed by a nested encoded unsigned literal (macro `?tag_u` in `beam_opcodes.hrl`) value of (Bytes-9):8, and then the data:

[shaape]
[ditaa]
----
7 6 5 4 3 | 2 1 0 || Followed by a ||
----------+------ || nested encoded literal || Data . . .
Expand Down
9 changes: 3 additions & 6 deletions chapters/compiler.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ xref:fig_compiler_passes[].

[[fig_compiler_passes]]
.Compiler Passes
[shaape]
[ditaa, scale=0.6]
----
[] = Compiler options, () = files, {} = erlang terms, boxes = passes
(.erl)
Expand Down Expand Up @@ -174,9 +174,6 @@ xref:fig_compiler_passes[].
v
(.beam)</pre>
options:
- ".*": {fill: [[0.7, 0.7, 0.7], no-shadow], frame: [[0.9, 0.9, 0.9], line]}
- ".*": {text : ["Monospace 10", no-shadow]}
----

If you want to see a complete and up to date list of compiler passes
Expand Down Expand Up @@ -511,7 +508,7 @@ The compilation of +json_test+ fails since the module contains invalid
Erlang syntax, but you get to see what the AST looks like. Now we can
just write some functions to traverse the AST and rewrite the json
code into Erlang code.footnote:[The translation here is done in
accordance with link:http://www.erlang.org/eeps/eep-0018.html[EEP 18]
accordance with link:http://www.erlang.org/eeps/eep-0018.html[EEP 18]
(Erlang Enhancement Proposal 18: "JSON bifs")]

[source,erlang]
Expand Down Expand Up @@ -778,7 +775,7 @@ the string/1 function that leex generates to tokenize the test file.
----
2> c(json_tokens).
{ok,json_tokens}.
3> f(File), f(L), {ok, File} = file:read_file("test.json"), L = binary_to_list(File), ok.
3> f(File), f(L), {ok, File} = file:read_file("test.json"), L = binary_to_list(File), ok.
ok
4> f(Tokens), {ok, Tokens,_} = json_tokens:string(L), hd(Tokens).
{'{',1}
Expand Down
29 changes: 8 additions & 21 deletions chapters/introduction.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ illustrated with two Erlang nodes running on one machine.

[[the_erts_stack]]
.ERTS Stack
[shaape]
[ditaa]
----
Node1 Node2
Expand All @@ -159,16 +159,14 @@ illustrated with two Erlang nodes running on one machine.
| HW or VM |
+----------------+
options:
- ".*": {fill: [[0.7, 0.7, 0.7], no-shadow], frame: [[0.9, 0.9, 0.9], line]}
- ".*": {text : ["Monospace 10", no-shadow]}
----

If you are using Elixir there is yet another layer to the stack.

[[the_elixir_stack]]
.Elixir Stack
[shaape]
[ditaa]
----
Node1 Node2
Expand All @@ -189,9 +187,6 @@ If you are using Elixir there is yet another layer to the stack.
| HW or VM |
+----------------+
options:
- ".*": {fill: [[0.7, 0.7, 0.7], no-shadow], frame: [[0.9, 0.9, 0.9], line]}
- ".*": {text : ["Monospace 10", no-shadow]}
----


Expand Down Expand Up @@ -275,7 +270,7 @@ just as if they were running in the same node.

[[a_distributed_application]]
.Distributed Applications
[shaape]
[ditaa]
----
Node1 Node2 Node3 Node4
Expand All @@ -299,10 +294,6 @@ just as if they were running in the same node.
| Network |
+-------------------------------------+
options:
- ".*": {fill: [[0.7, 0.7, 0.7], no-shadow], frame: [[0.9, 0.9, 0.9], line]}
- ".*": {text : ["Monospace 10", no-shadow]}
----


Expand Down Expand Up @@ -456,7 +447,7 @@ the BEAM compiler from the OTP layer to compile Erlang to Ling.

[[erlang_on_xen]]
.Erlang On Xen
[shaape]
[ditaa]
----
Node1 Node2 Node2 Node3
Expand All @@ -474,9 +465,7 @@ the BEAM compiler from the OTP layer to compile Erlang to Ling.
| HW | | HW or VM |
+----------------+ +----------------+
options:
- ".*": {fill: [[0.7, 0.7, 0.7], no-shadow], frame: [[0.9, 0.9, 0.9], line]}
- ".*": {text : ["Monospace 10", no-shadow]}
----

==== Erjang
Expand All @@ -493,7 +482,7 @@ in Java on top of the VM.

[[erlang_on_jvm]]
.Erlang on the JVM
[shaape]
[ditaa]
----
Node1 Node2 Node3 Node4
Expand All @@ -511,9 +500,7 @@ in Java on top of the VM.
| HW or VM | | HW or VM |
+----------------+ +----------------+
options:
- ".*": {fill: [[0.7, 0.7, 0.7], no-shadow], frame: [[0.9, 0.9, 0.9], line]}
- ".*": {text : ["Monospace 10", no-shadow]}
----

Now that you have a basic understanding of all the major pieces of
Expand Down
12 changes: 4 additions & 8 deletions chapters/io.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Erlang node.

[[port_communication]]
.Port Communication
[shaape]
[ditaa]
----
Erlang Node
+-------------------+
Expand All @@ -55,9 +55,7 @@ Erlang node.
| P2 |
+-------------------+
options:
- ".*": {fill: [[0.7, 0.7, 0.7], no-shadow], frame: [[0.9, 0.9, 0.9], line]}
- ".*": {text : ["Monospace 10", no-shadow]}
----

Process P1 has opened a port (Port1) to a file, and is the owner of
Expand Down Expand Up @@ -120,7 +118,7 @@ driver like: `multi_drv` and `sig_drv`.

[[entities_on_node]]
.Entities on an Erlang Node
[shaape]
[ditaa]
----
+-----------------------------------------------------------------------------------------------------+
| Entities on an Erlang Node |
Expand All @@ -132,9 +130,7 @@ driver like: `multi_drv` and `sig_drv`.
| | (Heart) || (ls) || tcp_inet ||| efile ||| ... |
+--------------------------------------------------+---------++------++----------+++-------+++--------+
options:
- ".*": {fill: [[0.7, 0.7, 0.7], no-shadow], frame: [[0.9, 0.9, 0.9], line]}
- ".*": {text : ["Monospace 10", no-shadow]}
----


Expand Down
30 changes: 10 additions & 20 deletions chapters/memory.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A program's memory layout looks something like this:

[[program_memory_layout]]
.Program Memory Layout
[shaape]
[ditaa]
----
high
addresses
Expand Down Expand Up @@ -62,9 +62,7 @@ A program's memory layout looks something like this:
low
addresses
options:
- ".*": {fill: [[0.7, 0.7, 0.7], no-shadow], frame: [[0.9, 0.9, 0.9], line]}
- ".*": {text : ["Monospace 10", no-shadow]}
----


Expand Down Expand Up @@ -310,7 +308,7 @@ of system flags below.
Most allocators also have one "main multiblock carrier" which is never
deallocated.

[shaape]
[ditaa]
----
high
addresses
Expand Down Expand Up @@ -343,9 +341,7 @@ multiblock | Block 2 | | MSmmbcs kb
low
addresses
options:
- ".*": {fill: [[0.7, 0.7, 0.7], no-shadow], frame: [[0.9, 0.9, 0.9], line]}
- ".*": {text : ["Monospace 10", no-shadow]}
----

// Want most data un multiblock carriers mbc
Expand Down Expand Up @@ -574,7 +570,7 @@ similar to:


[[fig-list_layout]]
[shaape]
[ditaa]
----
ADR BINARY VALUE + DESCRIPTION
hend -> +-------- -------- -------- --------+
Expand All @@ -597,9 +593,7 @@ similar to:
| ... |
heap -> +-----------------------------------+
options:
- ".*": {fill: [[0.7, 0.7, 0.7], no-shadow], frame: [[0.9, 0.9, 0.9], line]}
- ".*": {text : ["Monospace 10", no-shadow]}
----

If you then create a tuple with two instances of the list, all that is repeated is
Expand Down Expand Up @@ -690,7 +684,7 @@ Given the code in <<listing-send,send.erl>> the state of the system could
look like this just before the send in p1/1:


[shaape]
[ditaa]
----
x0 |00000000 00000000 00000000 00100011| Pid 2
Expand Down Expand Up @@ -723,9 +717,7 @@ look like this just before the send in p1/1:
P2
options:
- ".*": {fill: [[0.7, 0.7, 0.7], no-shadow], frame: [[0.9, 0.9, 0.9], line]}
- ".*": {text : ["Monospace 10", no-shadow]}
----

Then P1 start sending the message M to P2. It (through the code in
Expand Down Expand Up @@ -1336,7 +1328,7 @@ before.

Generations..

[shaape]
[ditaa]
----
hend -> +----+
|....|
Expand All @@ -1349,9 +1341,7 @@ Generations..
heap -> +----+ +----+ old_heap
The Heap Old Heap
options:
- ".*": {fill: [[0.7, 0.7, 0.7], no-shadow], frame: [[0.9, 0.9, 0.9], line]}
- ".*": {text : ["Monospace 10", no-shadow]}
----

+high_water, old_hend, old_htop, old_heap,
Expand Down
Loading

0 comments on commit c76c60b

Please sign in to comment.