Skip to content

Commit

Permalink
Moving chapter files to chapters dir. (happi#33)
Browse files Browse the repository at this point in the history
* Moving chapter files to chapters dir.

* Adding .gitignore to make sure we have an ebin.

* Add .gitignore to make keep xml dir.

* Fix shell language.

* Remove revision history and add git contributers.

* Fix build.

* Fixing contributors generator.
  • Loading branch information
happi authored Apr 10, 2017
1 parent 0f5d82e commit 12a229f
Show file tree
Hide file tree
Showing 27 changed files with 634 additions and 161 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ beam-book-from-ab.xml
beam-book.pdf
opcodes_doc.asciidoc
.#.gitignore
genop.tab
book.html
chapters/contributors.txt
58 changes: 27 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@

ABFLAGS = --backend=docbook --doctype=book --attribute=revisionhistory
ABFLAGS = --backend=docbook --doctype=book
adocs = book.asciidoc \
beam.asciidoc \
beam_instructions.asciidoc \
beam_internal_instructions.asciidoc \
beam_modules.asciidoc \
calls.asciidoc \
compiler.asciidoc \
introduction.asciidoc \
memory.asciidoc \
opcodes_doc.asciidoc \
preface.asciidoc \
processes.asciidoc \
scheduling.asciidoc \
type_system.asciidoc \
ap-beam_instructions.asciidoc \
ap-code_listings.asciidoc \
chapters/beam.asciidoc \
chapters/beam_instructions.asciidoc \
chapters/beam_internal_instructions.asciidoc \
chapters/beam_modules.asciidoc \
chapters/building.asciidoc \
chapters/c.asciidoc \
chapters/calls.asciidoc \
chapters/compiler.asciidoc \
chapters/contributors.txt \
chapters/introduction.asciidoc \
chapters/memory.asciidoc \
chapters/opcodes_doc.asciidoc \
chapters/preface.asciidoc \
chapters/processes.asciidoc \
chapters/scheduling.asciidoc \
chapters/type_system.asciidoc \
chapters/ap-beam_instructions.asciidoc \
chapters/ap-code_listings.asciidoc \
code/beam_modules_chapter/src/beamfile.erl \
code/compiler_chapter/json_tokens.png \
code/compiler_chapter/src/json_parser.erl \
Expand All @@ -30,15 +33,14 @@ adocs = book.asciidoc \

all: beam-book.pdf book.html

book-revhistory.xml: .git hg2revhistory.xsl
./gitlog.sh git-log.xml $@
chapters/contributors.txt: .git
./bin/gitlog.sh $@

beam-book-from-ab.xml: $(adocs)\
book-revhistory.xml
xml/beam-book-from-ab.xml: $(adocs)
asciidoc $(ABFLAGS) -o $@ book.asciidoc

beam-book.pdf: beam-book-from-ab.xml book-revhistory.xml
dblatex beam-book-from-ab.xml -o $@
beam-book.pdf: xml/beam-book-from-ab.xml
dblatex xml/beam-book-from-ab.xml -o $@

book.html:
asciidoc --backend=html5 --doctype=book book.asciidoc
Expand All @@ -50,17 +52,11 @@ book.html:
# asciidoc -o index.html -a icons -a toc2 book.asciidoc

code/book/ebin/generate_op_doc.beam: code/book/src/generate_op_doc.erl
erlc -o $@ $<
erlc -o $(dir $@) $<

opcodes_doc.asciidoc: genop.tab code/book/ebin/generate_op_doc.beam
erl -noshell -s generate_op_doc from_shell genop.tab opcodes_doc.asciidoc
chapters/opcodes_doc.asciidoc: genop.tab code/book/ebin/generate_op_doc.beam
erl -pa code/book/ebin/ -noshell -s generate_op_doc from_shell genop.tab chapters/opcodes_doc.asciidoc

genop.tab:
wget -O genop.tab https://raw.githubusercontent.com/erlang/otp/master/lib/compiler/src/genop.tab
touch $@

# generate_op_doc.beam: generate_op_doc.erl
# erlc generate_op_doc.erl

# opcodes_doc.asciidoc: ../otp/lib/compiler/src/genop.tab generate_op_doc.beam
# erl -noshell -s generate_op_doc from_shell ../otp/lib/compiler/src/genop.tab opcodes_doc.asciidoc
88 changes: 0 additions & 88 deletions ap-code_listings.asciidoc

This file was deleted.

3 changes: 3 additions & 0 deletions bin/gitlog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#/bin/sh

git log | grep Author | sed -- 's/Author: /\* /g' | sed -- 's/<.*>//g' | sort -u | sed -- 's/\* Your Name//g' > $1
49 changes: 24 additions & 25 deletions book.asciidoc
Original file line number Diff line number Diff line change
@@ -1,66 +1,65 @@
= The Erlang Runtime System

include::preface.asciidoc[]
include::chapters/preface.asciidoc[]

// Part I

include::introduction.asciidoc[]
include::chapters/introduction.asciidoc[]

include::compiler.asciidoc[]
include::chapters/compiler.asciidoc[]

include::processes.asciidoc[]
include::chapters/processes.asciidoc[]

include::type_system.asciidoc[]
include::chapters/type_system.asciidoc[]

include::beam.asciidoc[]
include::chapters/beam.asciidoc[]

include::beam_modules.asciidoc[]
include::chapters/beam_modules.asciidoc[]

include::beam_instructions.asciidoc[]
include::chapters/beam_instructions.asciidoc[]

include::calls.asciidoc[]
include::chapters/calls.asciidoc[]

include::beam_loader.asciidoc[]
include::chapters/beam_loader.asciidoc[]

include::beam_internal_instructions.asciidoc[]
include::chapters/beam_internal_instructions.asciidoc[]

include::scheduling.asciidoc[]
include::chapters/scheduling.asciidoc[]

include::memory.asciidoc[]
include::chapters/memory.asciidoc[]

== Advanced data structures (ETS, DETS, Mnesia)
// include::data_structures.asciidoc[]
// include::chapters/data_structures.asciidoc[]

include::io.asciidoc[]
include::chapters/io.asciidoc[]

== Distribution
// include::distribution.asciidoc[]
// include::chapters/distribution.asciidoc[]

== Interfacing C -- BIFs NIFs and Linked in Drivers
// include::c.asciidoc[]
include::chapters/c.asciidoc[]

== Native code
// include::hipe.asciidoc[]
// include::chapters/hipe.asciidoc[]

// Part II
[[P-Running]]
= Running ERTS

== Operation and Maintenance

// include::ops.asciidoc[]
// include::chapters/ops.asciidoc[]

// include::tweak.asciidoc[]
// include::chapters/tweak.asciidoc[]

[appendix]
= Apendicies
// include::index.asciidoc[]
// include::chapters/index.asciidoc[]

=== Building Erlang OTP
include::chapters/building.asciidoc[]

include::ap-beam_instructions.asciidoc[]
include::chapters/ap-beam_instructions.asciidoc[]

include::ap-code_listings.asciidoc[]
include::chapters/ap-code_listings.asciidoc[]



Expand Down
File renamed without changes.
88 changes: 88 additions & 0 deletions chapters/ap-code_listings.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@

[[AP-listings]]
== Appendix B: Full Code Listings

[source,erlang]
----
include::../code/beam_modules_chapter/src/beamfile.erl[]
----

// [source,erlang]
// ----
// include::../stack_machine.erl[]
// ----

[source,erlang]
----
include::../code/compiler_chapter/src/world.erl[]
----

[source,erlang]
----
include::../code/compiler_chapter/src/json_parser.erl[]
----

[source,erlang]
----
include::../code/compiler_chapter/src/json_test.erl[]
----

[source,erlang]
----
include::../code/beam_chapter/src/stack_machine_compiler.erl[]
----

[source,c]
----
include::../code/beam_chapter/src/vsm.c[]
----

[source,c]
----
include::../code/beam_chapter/src/token_threaded_vsm.c[]
----

// [source,erlang]
// ----
// include::../add.erl[]
// ----

// [source,beam]
// ----
// include::../add.S[]
// ----

[[listing-share]]

[source,erlang]
----
include::../code/memory_chapter/src/share.erl[]
----

[[listing-send]]


[source,erlang]
----
include::../code/memory_chapter/src/send.erl[]
----

[[listing-lb]]
Load Balancer.

[source,erlang]
----
include::../code/memory_chapter/src/lb.erl[]
----

// [[listing-lbS]]
// [source,beam]
// ----
// include::../lb.S[]
// ----

// [[listing-gdb]]
// [source,c]
// ----
// include::../gdb_scripts[]
// ----
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions beam_modules.asciidoc → chapters/beam_modules.asciidoc
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ This file format prepends all areas with the size of the following area making i

[source,erlang]
----
include::code/beam_modules_chapter/src/beamfile1.erl[]
include::../code/beam_modules_chapter/src/beamfile1.erl[]
----


Expand Down Expand Up @@ -113,7 +113,7 @@ Let us add a decoder for the atom chunk to our Beam file reader:

[source,erlang]
----
include::code/beam_modules_chapter/src/beamfile2.erl[]
include::../code/beam_modules_chapter/src/beamfile2.erl[]
----

[[export_table_chunk]]
Expand Down
Loading

0 comments on commit 12a229f

Please sign in to comment.