diff --git a/Makefile b/Makefile index 516e133..ba28834 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ CWD=$(CURDIR) -PATH_BUILD=${CWD}/build +PATH_BUILD=./build PATH_TOOLS=${CWD}/tools PATH_COMBINE_OUTPUT=${PATH_BUILD}/ease.js PATH_COMBINE_OUTPUT_FULL=${PATH_BUILD}/ease-full.js @@ -10,15 +10,18 @@ PATH_PERF_TEST=${PATH_TEST}/perf PERF_TESTS := $(shell find "$(PATH_PERF_TEST)" -name 'perf-*.js') -PATH_DOC=${CWD}/doc +PATH_DOC=./doc PATH_DOC_OUTPUT=${PATH_BUILD}/doc PATH_DOC_OUTPUT_INFO=${PATH_DOC_OUTPUT}/manual.info PATH_DOC_OUTPUT_PLAIN=${PATH_DOC_OUTPUT}/manual.txt PATH_DOC_OUTPUT_HTML=${PATH_DOC_OUTPUT}/manual PATH_DOC_OUTPUT_HTML1=${PATH_DOC_OUTPUT}/manual.html PATH_DOC_CSS=${PATH_DOC}/manual.css +PATH_DOC_IMG=${PATH_DOC}/img PATH_MANUAL_TEXI=${PATH_DOC}/manual.texi +doc_imgs := $(patsubst %.dia, %.png, $(wildcard $(PATH_DOC_IMG)/*.dia)) + COMBINE=${PATH_TOOLS}/combine TESTS := $(shell find "$(PATH_TEST)" \ @@ -36,7 +39,9 @@ all: combine doc # create build dir mkbuild: - mkdir -p "${PATH_BUILD}" + mkdir -p "$(PATH_BUILD)" +mkbuild-doc: + mkdir -p "$(PATH_DOC_OUTPUT)" # combine all modules into easily redistributable ease.js file (intended for # browser) @@ -62,26 +67,41 @@ perf-%.js: default # files that were generated # # generates: pdf, HTML (multiple pages), HTML (single page) -doc: mkbuild doc-pdf doc-texi doc-plain doc-html -doc-pdf: - pdftex -output-directory "${PATH_DOC}" "${PATH_MANUAL_TEXI}" - pdftex -output-directory "${PATH_DOC}" "${PATH_MANUAL_TEXI}" +doc: doc-pdf doc-texi doc-plain doc-html + +doc-img: $(doc_imgs) + +doc/img/%.png: doc/img/%.dia + dia -e $@ -s 600x $< + +doc-pdf: | mkbuild-doc doc-img + TEXINPUTS="$(PATH_DOC):" \ + pdftex -output-directory "${PATH_DOC}" "${PATH_MANUAL_TEXI}" && \ + TEXINPUTS="$(PATH_DOC):" \ + pdftex -output-directory "${PATH_DOC}" "${PATH_MANUAL_TEXI}" mv -f "${PATH_DOC}"/*.pdf "${PATH_DOC_OUTPUT}" cd "$(PATH_DOC)" && rm -f $(shell cat "$(PATH_DOC)/.gitignore") -doc-texi: - cd "${PATH_DOC}" && \ - makeinfo -o "${PATH_DOC_OUTPUT_INFO}" "${PATH_MANUAL_TEXI}"; -doc-plain: - cd "${PATH_DOC}" && \ - makeinfo --plain "${PATH_MANUAL_TEXI}" > "${PATH_DOC_OUTPUT_PLAIN}"; -doc-html: - cd "${PATH_DOC}" && \ - makeinfo --html --css-include="${PATH_DOC_CSS}" \ - -o "${PATH_DOC_OUTPUT_HTML}" "${PATH_MANUAL_TEXI}"; \ - makeinfo --no-split --html --css-include="${PATH_DOC_CSS}" \ - -o "${PATH_DOC_OUTPUT_HTML1}" "${PATH_MANUAL_TEXI}"; + +doc-texi: | mkbuild-doc + makeinfo -I "$(PATH_DOC)" -o "${PATH_DOC_OUTPUT_INFO}" \ + "${PATH_MANUAL_TEXI}"; + +doc-plain: | mkbuild-doc + makeinfo --plain -I "$(PATH_DOC)" "${PATH_MANUAL_TEXI}" \ + > "${PATH_DOC_OUTPUT_PLAIN}"; + +doc-html: | mkbuild-doc doc-img + makeinfo --html --css-include="${PATH_DOC_CSS}" \ + -I "$(PATH_DOC)" -o "${PATH_DOC_OUTPUT_HTML}" "${PATH_MANUAL_TEXI}"; \ + makeinfo --no-split --html --css-include="${PATH_DOC_CSS}" \ + -I "$(PATH_DOC)" -o "${PATH_DOC_OUTPUT_HTML1}" "${PATH_MANUAL_TEXI}"; + mkdir -p "$(PATH_DOC_OUTPUT_HTML)/img" + cp "$(PATH_DOC_IMG)"/*.png "$(PATH_DOC_OUTPUT_HTML)/img" + ln -s manual/img "$(PATH_DOC_OUTPUT)/img" + # clean up build dir clean: rm -rf "${PATH_BUILD}" + rm -rf $(PATH_DOC_IMG)/*.png diff --git a/doc/classes.texi b/doc/classes.texi index b1cc923..ecbdd5a 100644 --- a/doc/classes.texi +++ b/doc/classes.texi @@ -70,6 +70,7 @@ ease.js, until such a point where prototypes are no longer adequate. @menu * Declaring Classes:: Learn how to declare a class with ease.js +* Inheritance:: Extending classes from another * Member Visibility:: Encapsulation is a core concept of Object-Oriented programming @end menu @@ -291,6 +292,25 @@ declare static methods so that they may be accessed without the overhead of creating a new class instance. +@node Inheritance +@section Inheritance +Inheritance is a touchy subject. It can be a powerful feature, but it can also +be easily abused. @dfn{Inheritance} is the term used to describe the process of +creating a @dfn{child} class that @dfn{extends} (inherits members from) another +@dfn{parent} class. The parent class is also referred to as the @dfn{supertype} +and the child is called the @dfn{subtype}. Let's consider the following example, +where we have a dog, lazy dog, and a dog that walks on two legs: + +@float Figure, f:inheritance-ex +@image{img/inheritance-ex,,,,png} +@caption{Basic inheritance example} +@end float + +In the above example, we would say that @var{LazyDog} and @var{TwoLeggedDog} +are @emph{subtypes} of @var{Dog}, and that @var{Dog} is the @emph{supertype} +of the other two. + + @node Member Visibility @section Member Visibility One of the major hurdles ease.js aimed to address (indeed, one of the core diff --git a/doc/img/inheritance-ex.dia b/doc/img/inheritance-ex.dia new file mode 100644 index 0000000..096285b Binary files /dev/null and b/doc/img/inheritance-ex.dia differ diff --git a/doc/img/inheritance-ex.png b/doc/img/inheritance-ex.png new file mode 100644 index 0000000..1631bc1 Binary files /dev/null and b/doc/img/inheritance-ex.png differ diff --git a/doc/manual.texi b/doc/manual.texi index 6b3bb69..bbf9b81 100644 --- a/doc/manual.texi +++ b/doc/manual.texi @@ -52,10 +52,10 @@ Free Documentation License". @insertcopying @end ifnottex -@include ./about.texi -@include ./integration.texi -@include ./classes.texi -@include ./source-tree.texi -@include ./license.texi +@include about.texi +@include integration.texi +@include classes.texi +@include source-tree.texi +@include license.texi @bye