From 84adefa331c4159d432d22840663c38f155cd4c1 Mon Sep 17 00:00:00 2001 From: Erlang/OTP Date: Fri, 20 Nov 2009 14:54:40 +0000 Subject: The R13B03 release. --- system/doc/Books/src/HOWTO.txt | 35 + system/doc/Books/src/Makefile | 127 + system/doc/Books/src/basic_application.xml | 107 + system/doc/Books/src/corba_service.xml | 137 + system/doc/Books/src/database_management.xml | 118 + system/doc/Books/src/frame_crop.header.src | 101 + system/doc/Books/src/insidecover.xml | 35 + system/doc/Books/src/interfaces.xml | 144 + system/doc/Books/src/make_headers | 30 + system/doc/Books/src/operation_maintenance.xml | 94 + system/doc/Books/src/orber_ic.xml | 112 + system/doc/Books/src/stdlib.xml | 73 + system/doc/Books/src/tools.xml | 139 + system/doc/Books/src/ug.xml | 127 + system/doc/Makefile | 46 + system/doc/book.xml | 52 + system/doc/definitions/cite.defs | 26 + system/doc/definitions/cite.defs.xml | 70 + system/doc/definitions/term.defs | 215 + system/doc/definitions/term.defs.xml | 1525 +++++ system/doc/design_principles/Makefile | 115 + system/doc/design_principles/applications.xml | 378 ++ system/doc/design_principles/appup_cookbook.xml | 627 ++ system/doc/design_principles/book.xml | 42 + system/doc/design_principles/clientserver.fig | 40 + system/doc/design_principles/clientserver.gif | Bin 0 -> 2140 bytes system/doc/design_principles/clientserver.ps | 199 + system/doc/design_principles/des_princ.xml | 285 + system/doc/design_principles/dist1.fig | 20 + system/doc/design_principles/dist1.gif | Bin 0 -> 687 bytes system/doc/design_principles/dist1.ps | 131 + system/doc/design_principles/dist2.fig | 41 + system/doc/design_principles/dist2.gif | Bin 0 -> 1491 bytes system/doc/design_principles/dist2.ps | 160 + system/doc/design_principles/dist3.fig | 33 + system/doc/design_principles/dist3.gif | Bin 0 -> 1108 bytes system/doc/design_principles/dist3.ps | 148 + system/doc/design_principles/dist4.fig | 16 + system/doc/design_principles/dist4.gif | Bin 0 -> 518 bytes system/doc/design_principles/dist4.ps | 125 + system/doc/design_principles/dist5.fig | 40 + system/doc/design_principles/dist5.gif | Bin 0 -> 1649 bytes system/doc/design_principles/dist5.ps | 165 + .../design_principles/distributed_applications.xml | 217 + system/doc/design_principles/events.xml | 221 + system/doc/design_principles/fsm.xml | 313 + .../doc/design_principles/gen_server_concepts.xml | 269 + system/doc/design_principles/inclappls.fig | 33 + system/doc/design_principles/inclappls.gif | Bin 0 -> 2899 bytes system/doc/design_principles/inclappls.ps | 808 +++ .../design_principles/included_applications.xml | 150 + system/doc/design_principles/make.dep | 31 + system/doc/design_principles/note.gif | Bin 0 -> 1539 bytes system/doc/design_principles/part.xml | 43 + system/doc/design_principles/release_handling.xml | 667 +++ system/doc/design_principles/release_structure.xml | 302 + system/doc/design_principles/spec_proc.xml | 460 ++ system/doc/design_principles/sup4.fig | 32 + system/doc/design_principles/sup4.gif | Bin 0 -> 1974 bytes system/doc/design_principles/sup4.ps | 153 + system/doc/design_principles/sup5.fig | 43 + system/doc/design_principles/sup5.gif | Bin 0 -> 2536 bytes system/doc/design_principles/sup5.ps | 168 + system/doc/design_principles/sup6.fig | 46 + system/doc/design_principles/sup6.gif | Bin 0 -> 1629 bytes system/doc/design_principles/sup6.ps | 163 + system/doc/design_principles/sup_princ.xml | 349 ++ system/doc/design_principles/warning.gif | Bin 0 -> 1498 bytes system/doc/design_principles/xmlfiles.mk | 32 + system/doc/efficiency_guide/Makefile | 117 + system/doc/efficiency_guide/README | 122 + system/doc/efficiency_guide/advanced.xml | 204 + system/doc/efficiency_guide/all.erl | 106 + system/doc/efficiency_guide/appendix.xml | 72 + system/doc/efficiency_guide/bench.erl | 488 ++ system/doc/efficiency_guide/bench.hrl | 22 + system/doc/efficiency_guide/binaryhandling.xml | 528 ++ system/doc/efficiency_guide/book.xml | 42 + system/doc/efficiency_guide/call_bm.erl | 75 + system/doc/efficiency_guide/call_result.html | 26 + system/doc/efficiency_guide/commoncaveats.xml | 239 + system/doc/efficiency_guide/digger.ps | 197 + system/doc/efficiency_guide/drivers.xml | 148 + system/doc/efficiency_guide/efficiency_guide.erl | 214 + system/doc/efficiency_guide/functions.xml | 234 + system/doc/efficiency_guide/introduction.xml | 69 + system/doc/efficiency_guide/listhandling.xml | 241 + system/doc/efficiency_guide/make.dep | 16 + system/doc/efficiency_guide/myths.xml | 203 + system/doc/efficiency_guide/part.xml | 42 + system/doc/efficiency_guide/processes.xml | 264 + system/doc/efficiency_guide/profiling.xml | 258 + system/doc/efficiency_guide/tablesDatabases.xml | 379 ++ system/doc/efficiency_guide/xmlfiles.mk | 32 + system/doc/embedded/Makefile | 103 + system/doc/embedded/book.xml | 43 + system/doc/embedded/embedded_nt.xml | 84 + system/doc/embedded/embedded_solaris.xml | 734 +++ system/doc/embedded/intro.xml | 95 + system/doc/embedded/make.dep | 14 + system/doc/embedded/note.gif | Bin 0 -> 1539 bytes system/doc/embedded/part.xml | 50 + system/doc/embedded/starting.xml | 249 + system/doc/embedded/target.xml | 414 ++ system/doc/embedded/vme_problems.xml | 61 + system/doc/embedded/vxworks.xml | 193 + system/doc/embedded/warning.gif | Bin 0 -> 1498 bytes system/doc/embedded/xmlfiles.mk | 22 + system/doc/embedded/xntp.xml | 75 + system/doc/extensions/Makefile | 142 + system/doc/extensions/bit_syntax.xml | 403 ++ system/doc/extensions/book.xml | 45 + system/doc/extensions/fun_test.erl | 17 + system/doc/extensions/funparse.erl | 74 + system/doc/extensions/funs.xml | 486 ++ system/doc/extensions/funs1.erl | 125 + system/doc/extensions/include.xml | 81 + system/doc/extensions/list_comprehensions.erl | 118 + system/doc/extensions/list_comprehensions.xml | 205 + system/doc/extensions/list_comrehensions.erl | 75 + system/doc/extensions/macros.xml | 177 + system/doc/extensions/make.dep | 21 + system/doc/extensions/mexpand.erl | 16 + system/doc/extensions/misc.xml | 310 + system/doc/extensions/part.xml | 57 + system/doc/extensions/records.xml | 284 + system/doc/extensions/warning.gif | Bin 0 -> 1498 bytes system/doc/getting_started/Makefile | 100 + system/doc/getting_started/book.xml | 43 + system/doc/getting_started/conc_prog.xml | 894 +++ system/doc/getting_started/intro.xml | 66 + system/doc/getting_started/make.dep | 14 + system/doc/getting_started/part.xml | 36 + system/doc/getting_started/records_macros.xml | 328 ++ system/doc/getting_started/robustness.xml | 483 ++ system/doc/getting_started/seq_prog.xml | 1231 ++++ system/doc/getting_started/xmlfiles.mk | 24 + system/doc/html/.gitignore | 0 system/doc/images/.gitignore | 0 system/doc/installation_guide/Makefile | 100 + system/doc/installation_guide/book.xml | 43 + system/doc/installation_guide/install.xml | 148 + system/doc/installation_guide/make.dep | 13 + system/doc/installation_guide/note.gif | Bin 0 -> 1539 bytes system/doc/installation_guide/part.xml | 37 + system/doc/installation_guide/verification.xml | 102 + system/doc/installation_guide/warning.gif | Bin 0 -> 1498 bytes system/doc/installation_guide/xmlfiles.mk | 21 + system/doc/oam/Makefile | 102 + system/doc/oam/book.xml | 43 + system/doc/oam/make.dep | 26 + system/doc/oam/note.gif | Bin 0 -> 1539 bytes system/doc/oam/oam_intro.xml | 269 + system/doc/oam/part.xml | 36 + system/doc/oam/snmp_model_1.fig | 42 + system/doc/oam/snmp_model_1.gif | Bin 0 -> 2343 bytes system/doc/oam/snmp_model_1.ps | 160 + system/doc/oam/snmp_model_2.fig | 52 + system/doc/oam/snmp_model_2.gif | Bin 0 -> 2239 bytes system/doc/oam/snmp_model_2.ps | 168 + system/doc/oam/snmp_model_3.fig | 56 + system/doc/oam/snmp_model_3.gif | Bin 0 -> 3134 bytes system/doc/oam/snmp_model_3.ps | 182 + system/doc/oam/terminology.fig | 37 + system/doc/oam/terminology.gif | Bin 0 -> 1406 bytes system/doc/oam/terminology.ps | 154 + system/doc/oam/warning.gif | Bin 0 -> 1498 bytes system/doc/oam/xmlfiles.mk | 19 + system/doc/pdf/.gitignore | 0 system/doc/pics/Makefile | 58 + system/doc/pics/app.gif | Bin 0 -> 285 bytes system/doc/pics/ede.gif | Bin 0 -> 13644 bytes system/doc/pics/ede_logo.gif | Bin 0 -> 757 bytes system/doc/pics/min_head.gif | Bin 0 -> 2652 bytes system/doc/pics/notes.gif | Bin 0 -> 2005 bytes system/doc/pics/otp.gif | Bin 0 -> 13737 bytes system/doc/pics/otp_logo.gif | Bin 0 -> 1660 bytes system/doc/pics/ps.gif | Bin 0 -> 618 bytes system/doc/pics/ref_man.gif | Bin 0 -> 1530 bytes system/doc/pics/user_guide.gif | Bin 0 -> 1581 bytes system/doc/programming_examples/Makefile | 98 + system/doc/programming_examples/bit_syntax.xml | 327 ++ system/doc/programming_examples/book.xml | 37 + system/doc/programming_examples/fun_test.erl | 17 + system/doc/programming_examples/funparse.erl | 74 + system/doc/programming_examples/funs.xmlsrc | 515 ++ system/doc/programming_examples/funs1.erl | 125 + .../programming_examples/list_comprehensions.xml | 206 + system/doc/programming_examples/make.dep | 20 + system/doc/programming_examples/part.xml | 39 + system/doc/programming_examples/records.xml | 232 + system/doc/programming_examples/xmlfiles.mk | 23 + system/doc/reference_manual/Makefile | 113 + system/doc/reference_manual/book.xml | 43 + system/doc/reference_manual/code_loading.xml | 158 + system/doc/reference_manual/data_types.xml | 399 ++ system/doc/reference_manual/distributed.xml | 279 + system/doc/reference_manual/errors.xml | 217 + system/doc/reference_manual/expressions.xml | 1422 +++++ system/doc/reference_manual/functions.xml | 168 + system/doc/reference_manual/introduction.xml | 155 + system/doc/reference_manual/macros.xml | 211 + system/doc/reference_manual/make.dep | 16 + system/doc/reference_manual/modules.xml | 254 + system/doc/reference_manual/part.xml | 44 + system/doc/reference_manual/patterns.xml | 59 + system/doc/reference_manual/ports.xml | 159 + system/doc/reference_manual/processes.xml | 205 + system/doc/reference_manual/records.xml | 169 + system/doc/reference_manual/xmlfiles.mk | 33 + system/doc/system_architecture_intro/Makefile | 97 + system/doc/system_architecture_intro/book.xml | 43 + system/doc/system_architecture_intro/make.dep | 13 + system/doc/system_architecture_intro/note.gif | Bin 0 -> 1539 bytes system/doc/system_architecture_intro/part.xml | 33 + .../system_architecture_intro/sys_arch_intro.xml | 179 + system/doc/system_architecture_intro/warning.gif | Bin 0 -> 1498 bytes system/doc/system_architecture_intro/xmlfiles.mk | 19 + system/doc/system_principles/Makefile | 95 + system/doc/system_principles/book.xml | 43 + system/doc/system_principles/create_target.xml | 502 ++ system/doc/system_principles/error_logging.xml | 116 + system/doc/system_principles/make.dep | 14 + system/doc/system_principles/part.xml | 35 + system/doc/system_principles/system_principles.xml | 236 + system/doc/system_principles/warning.gif | Bin 0 -> 1498 bytes system/doc/system_principles/xmlfiles.mk | 22 + system/doc/top/Makefile | 242 + system/doc/top/PR.template.src | 20 + system/doc/top/bin/otp_man_index | 1 + system/doc/top/book.xml | 52 + system/doc/top/ebin/.gitignore | 0 system/doc/top/highlights.xml | 238 + system/doc/top/incompatible.xml | 383 ++ system/doc/top/print.html | 55 + system/doc/top/src/erl_html_tools.erl | 1 + system/doc/top/src/erlresolvelinks.erl | 1 + system/doc/top/src/permuted_index.erl | 1 + system/doc/top/templates/applications.html.src | 34 + system/doc/top/templates/erlang.gif | Bin 0 -> 2162 bytes system/doc/top/templates/first.html.src | 104 + system/doc/top/templates/flip_closed.gif | Bin 0 -> 82 bytes system/doc/top/templates/flip_google.gif | Bin 0 -> 257 bytes system/doc/top/templates/flip_open.gif | Bin 0 -> 86 bytes system/doc/top/templates/flip_static.gif | Bin 0 -> 109 bytes system/doc/top/templates/flipmenu.js | 342 ++ system/doc/top/templates/index.html.src | 180 + system/doc/top/templates/otp_top.css | 53 + system/doc/top/templates/system.html.src | 281 + system/doc/top/templates/toc_.html.src | 105 + system/doc/tutorial/Makefile | 121 + system/doc/tutorial/appendix.xmlsrc | 100 + system/doc/tutorial/book.xml | 43 + system/doc/tutorial/c_port.xmlsrc | 128 + system/doc/tutorial/c_portdriver.xmlsrc | 183 + system/doc/tutorial/cnode.xmlsrc | 189 + system/doc/tutorial/cnode_c.c | 64 + system/doc/tutorial/cnode_s.c | 99 + system/doc/tutorial/cnode_s2.c | 102 + system/doc/tutorial/complex.c | 9 + system/doc/tutorial/complex1.erl | 50 + system/doc/tutorial/complex2.erl | 45 + system/doc/tutorial/complex3.erl | 14 + system/doc/tutorial/complex4.erl | 14 + system/doc/tutorial/complex5.erl | 56 + system/doc/tutorial/distribution.xml | 69 + system/doc/tutorial/ei.c | 38 + system/doc/tutorial/erl_comm.c | 52 + system/doc/tutorial/erl_interface.xmlsrc | 142 + system/doc/tutorial/example.xmlsrc | 46 + system/doc/tutorial/introduction.xml | 46 + system/doc/tutorial/make.dep | 35 + system/doc/tutorial/overview.xml | 131 + system/doc/tutorial/part.xml | 38 + system/doc/tutorial/port.c | 23 + system/doc/tutorial/port.gif | Bin 0 -> 1838 bytes system/doc/tutorial/port.ps | 5981 ++++++++++++++++++++ system/doc/tutorial/port_driver.c | 52 + system/doc/tutorial/port_driver.gif | Bin 0 -> 5394 bytes system/doc/tutorial/port_driver.ps | 901 +++ system/doc/tutorial/xmlfiles.mk | 29 + 281 files changed, 42733 insertions(+) create mode 100644 system/doc/Books/src/HOWTO.txt create mode 100644 system/doc/Books/src/Makefile create mode 100644 system/doc/Books/src/basic_application.xml create mode 100644 system/doc/Books/src/corba_service.xml create mode 100644 system/doc/Books/src/database_management.xml create mode 100644 system/doc/Books/src/frame_crop.header.src create mode 100644 system/doc/Books/src/insidecover.xml create mode 100644 system/doc/Books/src/interfaces.xml create mode 100755 system/doc/Books/src/make_headers create mode 100644 system/doc/Books/src/operation_maintenance.xml create mode 100644 system/doc/Books/src/orber_ic.xml create mode 100644 system/doc/Books/src/stdlib.xml create mode 100644 system/doc/Books/src/tools.xml create mode 100644 system/doc/Books/src/ug.xml create mode 100644 system/doc/Makefile create mode 100644 system/doc/book.xml create mode 100644 system/doc/definitions/cite.defs create mode 100644 system/doc/definitions/cite.defs.xml create mode 100644 system/doc/definitions/term.defs create mode 100644 system/doc/definitions/term.defs.xml create mode 100644 system/doc/design_principles/Makefile create mode 100644 system/doc/design_principles/applications.xml create mode 100644 system/doc/design_principles/appup_cookbook.xml create mode 100644 system/doc/design_principles/book.xml create mode 100644 system/doc/design_principles/clientserver.fig create mode 100644 system/doc/design_principles/clientserver.gif create mode 100644 system/doc/design_principles/clientserver.ps create mode 100644 system/doc/design_principles/des_princ.xml create mode 100644 system/doc/design_principles/dist1.fig create mode 100644 system/doc/design_principles/dist1.gif create mode 100644 system/doc/design_principles/dist1.ps create mode 100644 system/doc/design_principles/dist2.fig create mode 100644 system/doc/design_principles/dist2.gif create mode 100644 system/doc/design_principles/dist2.ps create mode 100644 system/doc/design_principles/dist3.fig create mode 100644 system/doc/design_principles/dist3.gif create mode 100644 system/doc/design_principles/dist3.ps create mode 100644 system/doc/design_principles/dist4.fig create mode 100644 system/doc/design_principles/dist4.gif create mode 100644 system/doc/design_principles/dist4.ps create mode 100644 system/doc/design_principles/dist5.fig create mode 100644 system/doc/design_principles/dist5.gif create mode 100644 system/doc/design_principles/dist5.ps create mode 100644 system/doc/design_principles/distributed_applications.xml create mode 100644 system/doc/design_principles/events.xml create mode 100644 system/doc/design_principles/fsm.xml create mode 100644 system/doc/design_principles/gen_server_concepts.xml create mode 100644 system/doc/design_principles/inclappls.fig create mode 100644 system/doc/design_principles/inclappls.gif create mode 100644 system/doc/design_principles/inclappls.ps create mode 100644 system/doc/design_principles/included_applications.xml create mode 100644 system/doc/design_principles/make.dep create mode 100644 system/doc/design_principles/note.gif create mode 100644 system/doc/design_principles/part.xml create mode 100644 system/doc/design_principles/release_handling.xml create mode 100644 system/doc/design_principles/release_structure.xml create mode 100644 system/doc/design_principles/spec_proc.xml create mode 100644 system/doc/design_principles/sup4.fig create mode 100644 system/doc/design_principles/sup4.gif create mode 100644 system/doc/design_principles/sup4.ps create mode 100644 system/doc/design_principles/sup5.fig create mode 100644 system/doc/design_principles/sup5.gif create mode 100644 system/doc/design_principles/sup5.ps create mode 100644 system/doc/design_principles/sup6.fig create mode 100644 system/doc/design_principles/sup6.gif create mode 100644 system/doc/design_principles/sup6.ps create mode 100644 system/doc/design_principles/sup_princ.xml create mode 100644 system/doc/design_principles/warning.gif create mode 100644 system/doc/design_principles/xmlfiles.mk create mode 100644 system/doc/efficiency_guide/Makefile create mode 100644 system/doc/efficiency_guide/README create mode 100644 system/doc/efficiency_guide/advanced.xml create mode 100644 system/doc/efficiency_guide/all.erl create mode 100644 system/doc/efficiency_guide/appendix.xml create mode 100644 system/doc/efficiency_guide/bench.erl create mode 100644 system/doc/efficiency_guide/bench.hrl create mode 100644 system/doc/efficiency_guide/binaryhandling.xml create mode 100644 system/doc/efficiency_guide/book.xml create mode 100644 system/doc/efficiency_guide/call_bm.erl create mode 100644 system/doc/efficiency_guide/call_result.html create mode 100644 system/doc/efficiency_guide/commoncaveats.xml create mode 100644 system/doc/efficiency_guide/digger.ps create mode 100644 system/doc/efficiency_guide/drivers.xml create mode 100644 system/doc/efficiency_guide/efficiency_guide.erl create mode 100644 system/doc/efficiency_guide/functions.xml create mode 100644 system/doc/efficiency_guide/introduction.xml create mode 100644 system/doc/efficiency_guide/listhandling.xml create mode 100644 system/doc/efficiency_guide/make.dep create mode 100644 system/doc/efficiency_guide/myths.xml create mode 100644 system/doc/efficiency_guide/part.xml create mode 100644 system/doc/efficiency_guide/processes.xml create mode 100644 system/doc/efficiency_guide/profiling.xml create mode 100644 system/doc/efficiency_guide/tablesDatabases.xml create mode 100644 system/doc/efficiency_guide/xmlfiles.mk create mode 100644 system/doc/embedded/Makefile create mode 100644 system/doc/embedded/book.xml create mode 100644 system/doc/embedded/embedded_nt.xml create mode 100644 system/doc/embedded/embedded_solaris.xml create mode 100644 system/doc/embedded/intro.xml create mode 100644 system/doc/embedded/make.dep create mode 100644 system/doc/embedded/note.gif create mode 100644 system/doc/embedded/part.xml create mode 100644 system/doc/embedded/starting.xml create mode 100644 system/doc/embedded/target.xml create mode 100644 system/doc/embedded/vme_problems.xml create mode 100644 system/doc/embedded/vxworks.xml create mode 100644 system/doc/embedded/warning.gif create mode 100644 system/doc/embedded/xmlfiles.mk create mode 100644 system/doc/embedded/xntp.xml create mode 100644 system/doc/extensions/Makefile create mode 100644 system/doc/extensions/bit_syntax.xml create mode 100644 system/doc/extensions/book.xml create mode 100644 system/doc/extensions/fun_test.erl create mode 100644 system/doc/extensions/funparse.erl create mode 100644 system/doc/extensions/funs.xml create mode 100644 system/doc/extensions/funs1.erl create mode 100644 system/doc/extensions/include.xml create mode 100644 system/doc/extensions/list_comprehensions.erl create mode 100644 system/doc/extensions/list_comprehensions.xml create mode 100644 system/doc/extensions/list_comrehensions.erl create mode 100644 system/doc/extensions/macros.xml create mode 100644 system/doc/extensions/make.dep create mode 100644 system/doc/extensions/mexpand.erl create mode 100644 system/doc/extensions/misc.xml create mode 100644 system/doc/extensions/part.xml create mode 100644 system/doc/extensions/records.xml create mode 100644 system/doc/extensions/warning.gif create mode 100644 system/doc/getting_started/Makefile create mode 100644 system/doc/getting_started/book.xml create mode 100644 system/doc/getting_started/conc_prog.xml create mode 100644 system/doc/getting_started/intro.xml create mode 100644 system/doc/getting_started/make.dep create mode 100644 system/doc/getting_started/part.xml create mode 100644 system/doc/getting_started/records_macros.xml create mode 100644 system/doc/getting_started/robustness.xml create mode 100644 system/doc/getting_started/seq_prog.xml create mode 100644 system/doc/getting_started/xmlfiles.mk create mode 100644 system/doc/html/.gitignore create mode 100644 system/doc/images/.gitignore create mode 100644 system/doc/installation_guide/Makefile create mode 100644 system/doc/installation_guide/book.xml create mode 100644 system/doc/installation_guide/install.xml create mode 100644 system/doc/installation_guide/make.dep create mode 100644 system/doc/installation_guide/note.gif create mode 100644 system/doc/installation_guide/part.xml create mode 100644 system/doc/installation_guide/verification.xml create mode 100644 system/doc/installation_guide/warning.gif create mode 100644 system/doc/installation_guide/xmlfiles.mk create mode 100644 system/doc/oam/Makefile create mode 100644 system/doc/oam/book.xml create mode 100644 system/doc/oam/make.dep create mode 100644 system/doc/oam/note.gif create mode 100644 system/doc/oam/oam_intro.xml create mode 100644 system/doc/oam/part.xml create mode 100644 system/doc/oam/snmp_model_1.fig create mode 100644 system/doc/oam/snmp_model_1.gif create mode 100644 system/doc/oam/snmp_model_1.ps create mode 100644 system/doc/oam/snmp_model_2.fig create mode 100644 system/doc/oam/snmp_model_2.gif create mode 100644 system/doc/oam/snmp_model_2.ps create mode 100644 system/doc/oam/snmp_model_3.fig create mode 100644 system/doc/oam/snmp_model_3.gif create mode 100644 system/doc/oam/snmp_model_3.ps create mode 100644 system/doc/oam/terminology.fig create mode 100644 system/doc/oam/terminology.gif create mode 100644 system/doc/oam/terminology.ps create mode 100644 system/doc/oam/warning.gif create mode 100644 system/doc/oam/xmlfiles.mk create mode 100644 system/doc/pdf/.gitignore create mode 100644 system/doc/pics/Makefile create mode 100644 system/doc/pics/app.gif create mode 100644 system/doc/pics/ede.gif create mode 100644 system/doc/pics/ede_logo.gif create mode 100644 system/doc/pics/min_head.gif create mode 100644 system/doc/pics/notes.gif create mode 100644 system/doc/pics/otp.gif create mode 100644 system/doc/pics/otp_logo.gif create mode 100644 system/doc/pics/ps.gif create mode 100644 system/doc/pics/ref_man.gif create mode 100644 system/doc/pics/user_guide.gif create mode 100644 system/doc/programming_examples/Makefile create mode 100644 system/doc/programming_examples/bit_syntax.xml create mode 100644 system/doc/programming_examples/book.xml create mode 100644 system/doc/programming_examples/fun_test.erl create mode 100644 system/doc/programming_examples/funparse.erl create mode 100644 system/doc/programming_examples/funs.xmlsrc create mode 100644 system/doc/programming_examples/funs1.erl create mode 100644 system/doc/programming_examples/list_comprehensions.xml create mode 100644 system/doc/programming_examples/make.dep create mode 100644 system/doc/programming_examples/part.xml create mode 100644 system/doc/programming_examples/records.xml create mode 100644 system/doc/programming_examples/xmlfiles.mk create mode 100644 system/doc/reference_manual/Makefile create mode 100644 system/doc/reference_manual/book.xml create mode 100644 system/doc/reference_manual/code_loading.xml create mode 100644 system/doc/reference_manual/data_types.xml create mode 100644 system/doc/reference_manual/distributed.xml create mode 100644 system/doc/reference_manual/errors.xml create mode 100644 system/doc/reference_manual/expressions.xml create mode 100644 system/doc/reference_manual/functions.xml create mode 100644 system/doc/reference_manual/introduction.xml create mode 100644 system/doc/reference_manual/macros.xml create mode 100644 system/doc/reference_manual/make.dep create mode 100644 system/doc/reference_manual/modules.xml create mode 100644 system/doc/reference_manual/part.xml create mode 100644 system/doc/reference_manual/patterns.xml create mode 100644 system/doc/reference_manual/ports.xml create mode 100644 system/doc/reference_manual/processes.xml create mode 100644 system/doc/reference_manual/records.xml create mode 100644 system/doc/reference_manual/xmlfiles.mk create mode 100644 system/doc/system_architecture_intro/Makefile create mode 100644 system/doc/system_architecture_intro/book.xml create mode 100644 system/doc/system_architecture_intro/make.dep create mode 100644 system/doc/system_architecture_intro/note.gif create mode 100644 system/doc/system_architecture_intro/part.xml create mode 100644 system/doc/system_architecture_intro/sys_arch_intro.xml create mode 100644 system/doc/system_architecture_intro/warning.gif create mode 100644 system/doc/system_architecture_intro/xmlfiles.mk create mode 100644 system/doc/system_principles/Makefile create mode 100644 system/doc/system_principles/book.xml create mode 100644 system/doc/system_principles/create_target.xml create mode 100644 system/doc/system_principles/error_logging.xml create mode 100644 system/doc/system_principles/make.dep create mode 100644 system/doc/system_principles/part.xml create mode 100644 system/doc/system_principles/system_principles.xml create mode 100644 system/doc/system_principles/warning.gif create mode 100644 system/doc/system_principles/xmlfiles.mk create mode 100644 system/doc/top/Makefile create mode 100644 system/doc/top/PR.template.src create mode 120000 system/doc/top/bin/otp_man_index create mode 100644 system/doc/top/book.xml create mode 100644 system/doc/top/ebin/.gitignore create mode 100644 system/doc/top/highlights.xml create mode 100644 system/doc/top/incompatible.xml create mode 100644 system/doc/top/print.html create mode 120000 system/doc/top/src/erl_html_tools.erl create mode 120000 system/doc/top/src/erlresolvelinks.erl create mode 120000 system/doc/top/src/permuted_index.erl create mode 100644 system/doc/top/templates/applications.html.src create mode 100644 system/doc/top/templates/erlang.gif create mode 100644 system/doc/top/templates/first.html.src create mode 100755 system/doc/top/templates/flip_closed.gif create mode 100755 system/doc/top/templates/flip_google.gif create mode 100755 system/doc/top/templates/flip_open.gif create mode 100755 system/doc/top/templates/flip_static.gif create mode 100755 system/doc/top/templates/flipmenu.js create mode 100644 system/doc/top/templates/index.html.src create mode 100644 system/doc/top/templates/otp_top.css create mode 100644 system/doc/top/templates/system.html.src create mode 100644 system/doc/top/templates/toc_.html.src create mode 100644 system/doc/tutorial/Makefile create mode 100644 system/doc/tutorial/appendix.xmlsrc create mode 100644 system/doc/tutorial/book.xml create mode 100644 system/doc/tutorial/c_port.xmlsrc create mode 100644 system/doc/tutorial/c_portdriver.xmlsrc create mode 100644 system/doc/tutorial/cnode.xmlsrc create mode 100644 system/doc/tutorial/cnode_c.c create mode 100644 system/doc/tutorial/cnode_s.c create mode 100644 system/doc/tutorial/cnode_s2.c create mode 100644 system/doc/tutorial/complex.c create mode 100644 system/doc/tutorial/complex1.erl create mode 100644 system/doc/tutorial/complex2.erl create mode 100644 system/doc/tutorial/complex3.erl create mode 100644 system/doc/tutorial/complex4.erl create mode 100644 system/doc/tutorial/complex5.erl create mode 100644 system/doc/tutorial/distribution.xml create mode 100644 system/doc/tutorial/ei.c create mode 100644 system/doc/tutorial/erl_comm.c create mode 100644 system/doc/tutorial/erl_interface.xmlsrc create mode 100644 system/doc/tutorial/example.xmlsrc create mode 100644 system/doc/tutorial/introduction.xml create mode 100644 system/doc/tutorial/make.dep create mode 100644 system/doc/tutorial/overview.xml create mode 100644 system/doc/tutorial/part.xml create mode 100644 system/doc/tutorial/port.c create mode 100644 system/doc/tutorial/port.gif create mode 100644 system/doc/tutorial/port.ps create mode 100644 system/doc/tutorial/port_driver.c create mode 100644 system/doc/tutorial/port_driver.gif create mode 100644 system/doc/tutorial/port_driver.ps create mode 100644 system/doc/tutorial/xmlfiles.mk (limited to 'system/doc') diff --git a/system/doc/Books/src/HOWTO.txt b/system/doc/Books/src/HOWTO.txt new file mode 100644 index 0000000000..1fa47446e3 --- /dev/null +++ b/system/doc/Books/src/HOWTO.txt @@ -0,0 +1,35 @@ +Peter Högfeldt 2001-04-27 A + +HOWTO for building books for printing +------------------------------------- + +Note: Books are also built automatically by a daily build script. + That is the only safe way to build books. + +Note: Manual handling of dependency files has been removed. + +1. To build a book, ug say, in pdf format with a frame, be sure + to have a clean view, and run + + i) clearmake -V clean + ii) clearmake -V depend + iii) clearmake -V ug.frame.pdf + + You can build the following variants: ug.ps, ug.pdf, ug.frame.ps, + ug.frame.pdf, ug.crop.ps, and ug.crop.pdf. + + To build all frame.pdf and crop.pdf books replace iii) by + + iii) clearmake -V release_books TESTROOT=/some/dest/dir + + and you will get all books in /some/dest/dir. + +2. To change the contents of a book you have to: + + i) Edit the sgml book file, e.g. ug.sgml. + + ii) Do the corresponding changes in the Makefile (if needed). + + + + diff --git a/system/doc/Books/src/Makefile b/system/doc/Books/src/Makefile new file mode 100644 index 0000000000..9d346cb230 --- /dev/null +++ b/system/doc/Books/src/Makefile @@ -0,0 +1,127 @@ +# ---------------------------------------------------- +# Copyright (C) 1997, Ericsson Telecommunications +# Author: Lars Thorsen, Hans Nilsson +# ---------------------------------------------------- +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Include dependency +# ---------------------------------------------------- + +ifeq (ug.dep,$(wildcard ug.dep)) +include ug.dep +include database_management.dep +include orber_ic.dep +include basic_application.dep +include tools.dep +include operation_maintenance.dep +include interfaces.dep +include stdlib.dep +include corba_service.dep +endif + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +BOOKS = \ + ug \ + database_management \ + orber_ic \ + corba_service \ + basic_application \ + tools \ + operation_maintenance \ + interfaces \ + stdlib + +TEX_FILES = $(shell for i in $(BOOKS) ; do (echo $$i.tex); done) + +FRAME_CROP_PDF_FILES = $(BOOKS:%=%.frame.pdf) $(BOOKS:%=%.crop.pdf) + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAG_booksty = -booksty otpBOOK +DVIPS_FLAGS += -O '19mm,32.5mm' + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + +all: $(FRAME_CROP_PDF_FILES) + +books: all + +clean: + rm -f $(TEX_FILES) + rm -f *.psframe *.pscrop *.ps + rm -f $(TOP_PS_FILES) + rm -f errs core *~ $(LATEX_CLEAN) + rm -f *.dep *.pdf + +dep depend: + @for i in $(BOOKS); do \ + echo "Running docdepend for $$i ..." ; \ + docdepend $$i.xml | \ + sed s/insidecover.tex/insidecover.xml/ > $$i.dep ; \ + done + +# ---------------------------------------------------- +# Rules +# ---------------------------------------------------- +.SUFFIXES: .psframe .pscrop + +# The following rules are for multiple suffixes, e.g. kalle.pdf, +# kalle.frame.pdf. The order of the rules is important. Default rules +# from otp.mk are disabled in order to get it right. + +%.pdf: %.ps + +%.ps: %.dvi + +%.pdf: %.dvi + +%.frame.ps: %.dvi + BOOK=$@ ./make_headers + $(DVI2PS) -frame $(DVIPS_FLAGS) -f $< > $@ + +%.frame.pdf: %.dvi + BOOK=$@ ./make_headers + $(DVI2PS) -frame $(DVIPS_FLAGS) -f $< | \ + $(DISTILL) $(DISTILL_FLAGS) > $@ + +%.crop.ps: %.dvi + BOOK=$@ ./make_headers + $(DVI2PS) -crop $(DVIPS_FLAGS) -f $< > $@ + +%.crop.pdf: %.dvi + BOOK=$@ ./make_headers + $(DVI2PS) -crop $(DVIPS_FLAGS) -f $< | \ + $(DISTILL) $(DISTILL_FLAGS) > $@ + +%.pdf: %.dvi + $(DVI2PS) $(DVIPS_FLAGS) -f $< | \ + $(DISTILL) $(DISTILL_FLAGS) > $@ + +%.ps: %.dvi + $(DVI2PS) $(DVIPS_FLAGS) -f $< > $@ + +%.pdf: %.dvi + $(DVI2PS) $(DVIPS_FLAGS) -f $< | \ + $(DISTILL) $(DISTILL_FLAGS) > $@ + +# ---------------------------------------------------- +# Release targets +# ---------------------------------------------------- +# + +ifeq ($(TESTROOT),) +release_books: all + +else +release_books: all + $(INSTALL_DIR) $(TESTROOT)/books + $(INSTALL_DATA) $(FRAME_CROP_PDF_FILES) $(TESTROOT)/books +endif + diff --git a/system/doc/Books/src/basic_application.xml b/system/doc/Books/src/basic_application.xml new file mode 100644 index 0000000000..8097dafd7e --- /dev/null +++ b/system/doc/Books/src/basic_application.xml @@ -0,0 +1,107 @@ + + + + +
+ + 2000 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Erlang 5.1/OTP R8 Run-Time System and Basic Applications + Bengt Nilsson + + 2000-10-17 + +
+ + + + Erlang/OTP Run-Time System and Basic Applications + + + +

Introduction

+This documentation describes the Open + Telecom Platform (Erlang/OTP), a middle-ware based on the Erlang + programming language, aiming at providing time-saving and flexible + development for robust, adaptable telecom systems.

+

Organization of the Documentation

+ + The documentation is divided into eight parts:

+ + Erlang 5.0/OTP R7 System Documentation, EN/LZT 1084095 R1 + Erlang 5.0/OTP R7 Run-Time System and Basic Applications, + EN/LZT 108 4106 R1 + Erlang 5.0/OTP R7 Standard Library Application, EN/LZT 108 4107 + R1 + Erlang 5.0/OTP R7 Database Applications, EN/LZT 108 194 R3 + Erlang 5.0/OTP R7 CORBA and IDL Applications, + EN/LZT 151 810 R2 + Erlang 5.0/OTP R7 Interface and Communication Applications, + EN/LZT 108 4110 R1 + Erlang 5.0/OTP R7 Operation and Maintenance Applications, + EN/LZT 108 4108 R1 + Erlang 5.0/OTP R7 Tool Applications, EN/LZT 108 4109 R1 + +

About this Book

+This book is a collection of User's Guides for

+ + ERTS + SASL + +

and of Reference Manuals for

+ + ERTS + SASL + Compiler + Kernel + +

The Standard Libraries (STDLIB), which are in close + connection with Kernel, are documented in a volume of its + own.

+

+
+
+ ERTS + + ERTS User's Guide + + + + + + SASL + + SASL User's Guide + + + + + + Kernel + + + + Compiler + + + + Erlang/OTP Run-Time System and Basic Applications +
+ diff --git a/system/doc/Books/src/corba_service.xml b/system/doc/Books/src/corba_service.xml new file mode 100644 index 0000000000..dce2894a52 --- /dev/null +++ b/system/doc/Books/src/corba_service.xml @@ -0,0 +1,137 @@ + + + + +
+ + 2001 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Erlang 5.1/OTP R8 CORBA Services + + EN/LZT 151 ??? R1 + 1997-05-27 + + +
+ + + + Erlang/OTP CORBA Services + + + +

Introduction

+ + This documentation describes the Open + Telecom Platform (Erlang/OTP), a middle-ware based on the Erlang + programming language, aiming at providing time-saving and flexible + development for robust, adaptable telecom systems.

+

Organization of the Documentation

+ + The documentation is divided into eight parts:

+ + Erlang 5.0/OTP R7 System Documentation, EN/LZT 1084095 R1 + Erlang 5.0/OTP R7 Run-Time System and Basic Applications, + EN/LZT 108 4106 R1 + Erlang 5.0/OTP R7 Standard Library Application, EN/LZT 108 4107 + R1 + Erlang 5.0/OTP R7 Database Applications, EN/LZT 108 194 R3 + Erlang 5.0/OTP R7 CORBA and IDL Applications, + EN/LZT 151 810 R2 + Erlang 5.0/OTP R7 Interface and Communication Applications, + EN/LZT 108 4110 R1 + Erlang 5.0/OTP R7 Operation and Maintenance Applications, + EN/LZT 108 4108 R1 + Erlang 5.0/OTP R7 Tool Applications, EN/LZT 108 4109 R1 + +

About this Book

+

+

This book contains documentation about the six applications in Erlang/OTP that + implement the CORBA services. + These applications are:

+ + cosEvent, an Erlang implementation of the + CORBA service CosEvent. + cosEventDomain, an Erlang implementation of the + CORBA service CosEventDomainAdmin. + cosFileTransfer, an Erlang implementation of the + CORBA service CosFileTransfer. + cosNotificaton, an Erlang implementation of the + CORBA service CosNotification. + cosProperty, an Erlang implementation of the + CORBA service CosProperty. + cosTime, an Erlang implementation of the + CORBA service CosTime. + cosTransaction, an Erlang implementation of the + CORBA service CosTransaction. + +
+
+ cosEvent + + cosEvent User's Guide + + + + + + cosEventDomain + + cosEventDomain User's Guide + + + + + + cosFileTransfert + + cosFileTransfer User's Guide + + + + + + cosNotification + + cosNotification User's Guide + + + + + + cosTime + + cosTime User's Guide + + + + + + cosProperty + + cosProperty User's Guide + + + + + + Erlang/OTP CORBA Services +
+ diff --git a/system/doc/Books/src/database_management.xml b/system/doc/Books/src/database_management.xml new file mode 100644 index 0000000000..268612a990 --- /dev/null +++ b/system/doc/Books/src/database_management.xml @@ -0,0 +1,118 @@ + + + + +
+ + 1997 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Erlang 5.1/OTP R8 Database Applications + + EN/LZT 108 194 R2 + 1997-05-27 + + +
+ + + + Erlang/OTP Database Applications + + + +

Introduction

+This documentation describes the Open + Telecom Platform (Erlang/OTP), a middle-ware based on the Erlang + programming language, aiming at providing time-saving and flexible + development for robust, adaptable telecom systems.

+

Organization of the Documentation

+ + The documentation is divided into eight parts:

+ + Erlang 5.0/OTP R7 System Documentation, EN/LZT 1084095 R1 + Erlang 5.0/OTP R7 Run-Time System and Basic Applications, + EN/LZT 108 4106 R1 + Erlang 5.0/OTP R7 Standard Library Application, EN/LZT 108 4107 + R1 + Erlang 5.0/OTP R7 Database Applications, EN/LZT 108 194 R3 + Erlang 5.0/OTP R7 CORBA and IDL Applications, + EN/LZT 151 810 R2 + Erlang 5.0/OTP R7 Interface and Communication Applications, + EN/LZT 108 4110 R1 + Erlang 5.0/OTP R7 Operation and Maintenance Applications, + EN/LZT 108 4108 R1 + Erlang 5.0/OTP R7 Tool Applications, EN/LZT 108 4109 R1 + +

About this Book

+

+

This book is common for the four applications in Erlang/OTP, which + manage databases. These applications are:

+ + Mnesia; to be used when + a continuous + operation and soft real-time properties are required. + Mnesia_Session; to be used when the Mnesia Database + Management + System has to be accessed from other programming languages than + Erlang. + Mnemosyne; to be used as a query language for the + Mnesia Database + Management System. + ODBC, Open DataBase Connectivity; to be used when + various SQL + databases will be accessed. + +
+
+ Mnesia + + Mnesia User's Guide + + + + + + Mnesia_Session + + Mnesia_Session User's Guide + + + + + + Mnemosyne + + Mnemosyne User's Guide + + + + + + ODBC + + ODBC User's Guide + + + + + + Erlang/OTP Database Applications +
+ diff --git a/system/doc/Books/src/frame_crop.header.src b/system/doc/Books/src/frame_crop.header.src new file mode 100644 index 0000000000..131045ef8d --- /dev/null +++ b/system/doc/Books/src/frame_crop.header.src @@ -0,0 +1,101 @@ +%% This PostScript file centers the page on an A4 paper and draws a +%% crop marks. dvips is assumed. + +%% DEBUG +%% /mydict 20 dict def mydict begin + +%% Millimeter to postscript points: + +/mm{ 25.4 div 72 mul }def + + +%% The size of the retangle is: + +/papw 172 mm def +/paph 232 mm def + +%% The text area size is: + +%%/txtw{131 mm}def +%%/txth{285 mm}def + + +%% A4 size is: + +/A4w 209 mm def +/A4h 296 mm def + +%% Draw crop marks + +/mkcrop{ + 0.3 setlinewidth + 0 0 mkonecrop + papw 0 mkonecrop + 0 paph mkonecrop + papw paph mkonecrop +} def + +/mkonecrop{gsave + translate + newpath + 0 18 moveto + 0 -18 lineto + stroke + newpath + -18 0 moveto + 18 0 lineto + stroke + grestore } def + +%% Draw a frame + +/mkframe{ + gsave + 0 A4h paph sub moveto + papw 0 rlineto + 0 paph rlineto + papw neg 0 rlineto + 0 paph neg rlineto + stroke + grestore +} def + +/mkmarks{mk@MARKS@} def + +/mkinfo{ gsave + 72 68 moveto (Book: @BOOK@) show + 72 60 moveto (Generated by dvips: @DATE@) show + 72 52 moveto (Config spec: @CSFILE@) show + 72 44 moveto (View: @VIEW@) show + 72 36 moveto (User: @USER@) show + 72 28 moveto (Latex: @LATEX@) show + 72 20 moveto (@DOCBVSN@ @DOCB@) show + 72 12 moveto (@DVIPSVSN@ @DVIPS@) show + 288 68 moveto (Book build: @BOOKBUILD@) show + 288 60 moveto (Build script: @BUILDSCRIPT@) show + grestore +} def + + +%% Beginning-of-page hook (the thing called by dvips): + +/bop-hook{ + gsave + /Helvetica findfont 7 scalefont setfont + gsave + A4w papw sub 2 div + A4h paph sub 2 div neg + translate + mkmarks + grestore + mkinfo + grestore +} def + +%% DEBUG +%%/bop-hook +%%showpage +%%end + + + diff --git a/system/doc/Books/src/insidecover.xml b/system/doc/Books/src/insidecover.xml new file mode 100644 index 0000000000..e6b4b4206c --- /dev/null +++ b/system/doc/Books/src/insidecover.xml @@ -0,0 +1,35 @@ + + + + +Ericsson Utvecklings AB provides this publication ``as is'' without warranty of any kind. In no event shall Ericsson Utvecklings AB be liable for any damage arising from any defect or error in this publication. The contents of this publication is subject to revision without notice due to continued progress in design.

+

+Copyright © 1996-2000 Ericsson Utvecklings AB.

+

+All rights reserved including the right of reproduction in whole or in part in any form.

+ +

+ Editors & Layout: +Anna Fedoriw and Bengt Nilsson

+ Written and Produced by: +The Open Telecom Platform Project

+ Cover by: +Röjning & Co

+

+Fourth revised and restructured edition.

+

+Printed in Sweden by XBS Koncerntryck, Stockholm 2000

+

+ +

+For more information: URL http://www.erlang.se +

+

+

+Ericsson Utvecklings AB

+OTP Product Development

+Box 1505

+SE-125 25 ÄLVSJÖ

+Sweden

+
+ diff --git a/system/doc/Books/src/interfaces.xml b/system/doc/Books/src/interfaces.xml new file mode 100644 index 0000000000..b225f9581a --- /dev/null +++ b/system/doc/Books/src/interfaces.xml @@ -0,0 +1,144 @@ + + + + +
+ + 2000 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Erlang 5.1/OTP R8 Interface and Communication Applications + Bengt Nilsson + + 2000-02-09 + +
+ + + + Erlang/OTP Interface and Communication + + + +

Introduction

+This documentation describes the Open + Telecom Platform (Erlang/OTP), a middle-ware based on the Erlang + programming language, aiming at providing time-saving and flexible + development for robust, adaptable telecom systems.

+

Organization of the Documentation

+ + The documentation is divided into eight parts:

+ + Erlang 5.0/OTP R7 System Documentation, EN/LZT 1084095 R1 + Erlang 5.0/OTP R7 Run-Time System and Basic Applications, + EN/LZT 108 4106 R1 + Erlang 5.0/OTP R7 Standard Library Application, EN/LZT 108 4107 + R1 + Erlang 5.0/OTP R7 Database Applications, EN/LZT 108 194 R3 + Erlang 5.0/OTP R7 CORBA and IDL Applications, + EN/LZT 151 810 R2 + Erlang 5.0/OTP R7 Interface and Communication Applications, + EN/LZT 108 4110 R1 + Erlang 5.0/OTP R7 Operation and Maintenance Applications, + EN/LZT 108 4108 R1 + Erlang 5.0/OTP R7 Tool Applications, EN/LZT 108 4109 R1 + +

About this Book

+

+

This book is a collection of the documentation of following applications:

+ + Asn1 + Comet + Crypto + Erl_Interface + GS + Inets + Jinterface + Megaco + SSL + +
+
+ Asn1 + + Asn1 User's Guide + + + + + + Comet + + Comet User's Guide + + + + + + Crypto + + + + Erl_Interface + + Erl_Interface User's Guide + + + + + + GS + + GS User's Guide + + + + + + Inets + + + + Jinterface + + Jinterface User's Guide + + + + + + Megaco + + Megaco User's Guide + + + + + + SSL + + SSL Users Guide + + + + + + Erlang/OTP Interface and Communication +
+ diff --git a/system/doc/Books/src/make_headers b/system/doc/Books/src/make_headers new file mode 100755 index 0000000000..0ec7aca632 --- /dev/null +++ b/system/doc/Books/src/make_headers @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Make Postscript header files (frame and crop marks) +# +# From environment: BOOK CSFILE USER BOOKBUILD + +DATE=`date` +VIEW=`cleartool pwv -s -set` +LATEX=`which latex` +DVIPSVSN=`dvips -version` +DVIPS=`which dvips` +DOCBVSN=`docb_transform -version` +DOCB=`which docb_transform` +for marks in frame crop; do + sed -e "s/@DATE@/$DATE/g" \ + -e "s/@BOOK@/$BOOK/g" \ + -e "s/@MARKS@/$marks/g" \ + -e "s;@CSFILE@;$CSFILE;g" \ + -e "s/@VIEW@/$VIEW/g" \ + -e "s/@USER@/$USER/g" \ + -e "s;@LATEX@;$LATEX;g" \ + -e "s;@DVIPSVSN@;$DVIPSVSN;g" \ + -e "s;@DVIPS@;$DVIPS;g" \ + -e "s/@DOCBVSN@/$DOCBVSN/g" \ + -e "s;@DOCB@;$DOCB;g" \ + -e "s;@BOOKBUILD@;$BOOKBUILD;g" \ + -e "s;@BUILDSCRIPT@;$BUILDSCRIPT;g" \ + frame_crop.header.src > $marks.header +done + diff --git a/system/doc/Books/src/operation_maintenance.xml b/system/doc/Books/src/operation_maintenance.xml new file mode 100644 index 0000000000..41bdd3dff7 --- /dev/null +++ b/system/doc/Books/src/operation_maintenance.xml @@ -0,0 +1,94 @@ + + + + +
+ + 2000 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Erlang 5.1/OTP R8 Operation and Maintenance Applications + Bengt Nilsson + + 2000-02-09 + +
+ + + + Erlang/OTP Operation and Maintenance + + + +

Introduction

+This documentation describes the Open + Telecom Platform (Erlang/OTP), a middle-ware based on the Erlang + programming language, aiming at providing time-saving and flexible + development for robust, adaptable telecom systems.

+

Organization of the Documentation

+the documentation is + divided into eight parts:

+ + Erlang 5.0/OTP R7 System Documentation, EN/LZT 1084095 R1 + Erlang 5.0/OTP R7 Run-Time System and Basic Applications, + EN/LZT 108 4106 R1 + Erlang 5.0/OTP R7 Standard Library Application, EN/LZT 108 4107 R1 + Erlang 5.0/OTP R7 Database Applications, EN/LZT 108 194 R3 + Erlang 5.0/OTP R7 CORBA and IDL Applications, + EN/LZT 151 810 R2 + Erlang 5.0/OTP R7 Interface and Communication Applications, + EN/LZT 108 4110 R1 + Erlang 5.0/OTP R7 Operation and Maintenance Applications, + EN/LZT 108 4108 R1 + Erlang 5.0/OTP R7 Tool Applications, EN/LZT 108 4109 R1 + +

About this Book

+ + This book is a collection of Erlang application used during Operation and Maintenance. The following applications are covered:

+ + EVA + OS_Mon + SNMP + +
+
+ EVA + + EVA User's Guide + + + + + + + OS_Mon + + + + SNMP + + SNMP User's Guide + + + + + + Erlang/OTP Operation and Maintenance +
+ diff --git a/system/doc/Books/src/orber_ic.xml b/system/doc/Books/src/orber_ic.xml new file mode 100644 index 0000000000..16eb076dc7 --- /dev/null +++ b/system/doc/Books/src/orber_ic.xml @@ -0,0 +1,112 @@ + + + + +
+ + 1999 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Erlang 5.1/OTP R8 CORBA and IDL Applications + + EN/LZT 151 810 R1 + 1997-05-27 + + +
+ + + + Erlang/OTP CORBA and IDL + + + +

Introduction

+ + This documentation describes the Open + Telecom Platform (Erlang/OTP), a middle-ware based on the Erlang + programming language, aiming at providing time-saving and flexible + development for robust, adaptable telecom systems.

+

Organization of the Documentation

+ + The documentation is divided into eight parts:

+ + Erlang 5.0/OTP R7 System Documentation, EN/LZT 1084095 R1 + Erlang 5.0/OTP R7 Run-Time System and Basic Applications, + EN/LZT 108 4106 R1 + Erlang 5.0/OTP R7 Standard Library Application, EN/LZT 108 4107 + R1 + Erlang 5.0/OTP R7 Database Applications, EN/LZT 108 194 R3 + Erlang 5.0/OTP R7 CORBA and IDL Applications, + EN/LZT 151 810 R2 + Erlang 5.0/OTP R7 Interface and Communication Applications, + EN/LZT 108 4110 R1 + Erlang 5.0/OTP R7 Operation and Maintenance Applications, + EN/LZT 108 4108 R1 + Erlang 5.0/OTP R7 Tool Applications, EN/LZT 108 4109 R1 + +

About this Book

+

+

This book contains documentation about the six applications in Erlang/OTP that + implement the CORBA standard. + These applications are:

+ + +

IC, a compiler for OMG Interface Definition + Language (IDL). + The OMG IDL is used for + language-independent interface specifications.

+

The compiler + is capable of producing;

+ + Erlang stub/skeleton code for CORBA (default behavior) + Erlang stub/skeleton code for OTP generic servers + C stub/skeleton code for OTP generic servers + Java stub/skeleton code for OTP generic servers + Erlang code for module interfaces + +
+ Orber, which is an Object Request Broker that can be + used for + accessing distributed services in an + soft real-time environment. It is especially useful for applications + that use a heterogeneous + language environments. +
+
+
+ IC + + IC User's Guide + + + + + + Orber + + Orber User's Guide + + + + + + Erlang/OTP CORBA and IDL +
+ diff --git a/system/doc/Books/src/stdlib.xml b/system/doc/Books/src/stdlib.xml new file mode 100644 index 0000000000..31ea0d6962 --- /dev/null +++ b/system/doc/Books/src/stdlib.xml @@ -0,0 +1,73 @@ + + + + +
+ + 2000 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Erlang 5.1/OTP R8 Standard Library Application + Bengt Nilsson + + 2000-05-30 + +
+ + + + Erlang/OTP Standard Library Application + + + +

Introduction

+This documentation describes the Open + Telecom Platform (Erlang/OTP), a middle-ware based on the Erlang + programming language, aiming at providing time-saving and flexible + development for robust, adaptable telecom systems.

+

Organization of the Documentation

+ + The documentation is divided into eight parts:

+ + Erlang 5.0/OTP R7 System Documentation, EN/LZT 1084095 R1 + Erlang 5.0/OTP R7 Run-Time System and Basic Applications, + EN/LZT 108 4106 R1 + Erlang 5.0/OTP R7 Standard Library Application, EN/LZT 108 4107 + R1 + Erlang 5.0/OTP R7 Database Applications, EN/LZT 108 194 R3 + Erlang 5.0/OTP R7 CORBA and IDL Applications, + EN/LZT 151 810 R2 + Erlang 5.0/OTP R7 Interface and Communication Applications, + EN/LZT 108 4110 R1 + Erlang 5.0/OTP R7 Operation and Maintenance Applications, + EN/LZT 108 4108 R1 + Erlang 5.0/OTP R7 Tool Applications, EN/LZT 108 4109 R1 + +

About this Book

+

+

This book describes all standard libraries in Erlang/OTP. + It contains modules for manipulating lists, strings, and files etc. +

+
+
+ + + +
+ diff --git a/system/doc/Books/src/tools.xml b/system/doc/Books/src/tools.xml new file mode 100644 index 0000000000..9d7bf45f31 --- /dev/null +++ b/system/doc/Books/src/tools.xml @@ -0,0 +1,139 @@ + + + + +
+ + 2000 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Erlang 5.1/OTP R8 Tool Applications + Bengt Nilsson + + 2000-02-09 + +
+ + + + Erlang/OTP Tools + + + +

Introduction

+This documentation describes the Open + Telecom Platform (Erlang/OTP), a middle-ware based on the Erlang + programming language, aiming at providing time-saving and flexible + development for robust, adaptable telecom systems.

+

Organization of the Documentation

+ + The documentation is divided into eight parts:

+ + Erlang 5.0/OTP R7 System Documentation, EN/LZT 1084095 R1 + Erlang 5.0/OTP R7 Run-Time System and Basic Applications, + EN/LZT 108 4106 R1 + Erlang 5.0/OTP R7 Standard Library Application, + EN/LZT 108 4107 R1 + Erlang 5.0/OTP R7 Database Applications, EN/LZT 108 194 R3 + Erlang 5.0/OTP R7 CORBA and IDL Applications, + EN/LZT 151 810 R2 + Erlang 5.0/OTP R7 Interface and Communication Applications, + EN/LZT 108 4110 R1 + Erlang 5.0/OTP R7 Operation and Maintenance Applications, + EN/LZT 108 4108 R1 + Erlang 5.0/OTP R7 Tool Applications, EN/LZT 108 4109 R1 + +

About this Book

+This book contains User's Guides + and Reference Manuals + for the following applications:

+ + Appmon + Debugger + Pman + Toolbar + Tools + TV + +

For the following applications, only Reference Manuals are available:

+ + Parsetools + Runtime_Tools + +
+
+ Appmon + + Appmon User's Guide + + + + + + Debugger + + Debugger User's Guide + + + + + + Pman + + Pman User's Guide + + + + + + Toolbar + + Toolbar User's Guide + + + + + + Tools + + Tools User's Guide + + + + + + TV + + TV User's Guide + + + + + + Parsetools + + + + Runtime_Tools + + + + Erlang/OTP Tools +
+ diff --git a/system/doc/Books/src/ug.xml b/system/doc/Books/src/ug.xml new file mode 100644 index 0000000000..15b3dc0a31 --- /dev/null +++ b/system/doc/Books/src/ug.xml @@ -0,0 +1,127 @@ + + + + +
+ + 1997 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Erlang 5.1/OTP R8 System Documentation + + EN/LZT 151 247 R2 + + +
+ + + + Erlang/OTP System Documentation + + + +

Introduction

+This documentation describes the Open + Telecom Platform (Erlang/OTP), a middle-ware based on the Erlang + programming language, aiming at providing time-saving and flexible + development for robust, adaptable telecom systems.

+

Organization of the Documentation

+ + The documentation is divided into eight parts:

+ + Erlang 5.0/OTP R7 System Documentation, EN/LZT 1084095 R1 + Erlang 5.0/OTP R7 Run-Time System and Basic Applications, + EN/LZT 108 4106 R1 + Erlang 5.0/OTP R7 Standard Library Application, EN/LZT 108 4107 + R1 + Erlang 5.0/OTP R7 Database Applications, EN/LZT 108 194 R3 + Erlang 5.0/OTP R7 CORBA and IDL Applications, + EN/LZT 151 810 R2 + Erlang 5.0/OTP R7 Interface and Communication Applications, + EN/LZT 108 4110 R1 + Erlang 5.0/OTP R7 Operation and Maintenance Applications, + EN/LZT 108 4108 R1 + Erlang 5.0/OTP R7 Tool Applications, EN/LZT 108 4109 R1 + +

About this Book

+ This book is the starting point of the documentation and contains information about the Erlang programming language and runtime system, the OTP design principles, and how to install and configure Erlang/OTP.

+ + Chapter 1: Introduction + Chapter 2: "Getting Started with Erlang" gives an introduction to the Erlang runtime system and to tools such as Compiler and Debugger. + Chapter 3: "OTP Design Principles" describes a way to structure Erlang code in terms of applications and supervision trees. The standard behaviors are described and examples illustrate how to apply these behaviors to typical applications. + Chapter 4: "System Principles" describes the strategies + and options, which are available to start an Erlang/OTP system. + Chapter 5: "Operation and Management Principles" describes the model for operation and maintenance of sub-systems. + Chapter 6: "Installation Guide"gives guidelines on how to install Erlang/OTP on UNIX or Windows. + Chapter 7: "Embedded Systems" is a supplement to "Installation Guide", It describes issues that are specific for running Erlang/OTP on an embedded system. + Chapter 8: "Erlang Extensions Since 4.4" lists all extensions to the Erlang programming languages since the latest version of the book Concurrent Programming in ERLANG. + Chapter 9: "Interoperability Tutorial" gives an orientation of the different + interoperability mechanisms, which can be used when integrating an + Erlang program with a program written in an other programming language. + +
+
+ Introduction + + Introduction + + + Getting Started with Erlang + + Getting Started with Erlang + + + Design Principles + + OTP Design Principles + + + System Principles + + System Principles + + + Operation and Management Principles + + Operation and Management Principles + + + Installation Guide + + Installation Guide + + + Embedded System + + Embedded System + + + Erlang Extensions since 4.4 + + Erlang Extensions since 4.4 + + + Interoperability Tutorial + + Interoperability Tutorial + + + Erlang/OTP System Documentation +
+ diff --git a/system/doc/Makefile b/system/doc/Makefile new file mode 100644 index 0000000000..3f32e35561 --- /dev/null +++ b/system/doc/Makefile @@ -0,0 +1,46 @@ +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# The Initial Developer of the Original Code is Ericsson Utvecklings AB. +# Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +# AB. All Rights Reserved.'' +# +# $Id$ +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# +# Macros +# + +SUB_DIRECTORIES = design_principles \ + getting_started \ + system_architecture_intro \ + embedded \ + system_principles \ + oam \ + installation_guide \ + tutorial \ + efficiency_guide \ + reference_manual \ + programming_examples \ + top + +# pics \ + +SPECIAL_TARGETS = + +# +# Default Subdir Targets +# +include $(ERL_TOP)/make/otp_subdir.mk + diff --git a/system/doc/book.xml b/system/doc/book.xml new file mode 100644 index 0000000000..d1ec093019 --- /dev/null +++ b/system/doc/book.xml @@ -0,0 +1,52 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Erlang/OTP System Documentation + OTP Team + + 2009-08-21 + A + book.xml +
+ + + + + + + + + + + + + + + + + + + + +
+ diff --git a/system/doc/definitions/cite.defs b/system/doc/definitions/cite.defs new file mode 100644 index 0000000000..41fffc1460 --- /dev/null +++ b/system/doc/definitions/cite.defs @@ -0,0 +1,26 @@ +[ +{"4711","CCITT","CCITT, Red Book Vol.-FASCILE VIII.7, Recomm. X400-X.430, Geneva, 1985","jocke"}, +{"X.680","ITU-T X.680","ITU-T Recommendation X.680 (1994) | ISO/IEC 8824-1: 1995, Abstract Syntax Notation One (ASN.1): Specification of Basic Notation"}, +{"X.682","ITU-T X.682","ITU-T Recommendation X.682 (1994) | ISO/IEC 8824-3: 1995, Abstract Syntax Notation One (ASN.1): Constraint Specification"}, +{"X.690","ITU-T X.690","ITU-T Recommendation X.690 (1994) | ISO/IEC 8825-1: 1995, ASN.1 Encoding Rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)"}, +{"X.691","ITU-T X.691","ITU-T Recommendation X.691 (04/95) | ISO/IEC 8825-2: 1995, ASN.1 Encoding Rules: Specification of Packed Encoding Rules (PER)"}, +{"X.681","ITU-T X.681","ITU-T Recommendation X.681 (1994) | ISO/IEC 8824-2: 1995, Abstract Syntax Notation One (ASN.1): Information Object Specification"}, +{"X.683","ITU-T X.683","ITU-T Recommendation X.683 (1994) | ISO/IEC 8824-4: 1995, Abstract Syntax Notation One (ASN.1): Parameterization of ASN.1 Specifications"}, +{ + "DUBUISSON", + "ASN.1 Communication between Heterogeneous Systems", + "Oliver Dubuisson, ASN.1 Communication between Heterogeneous Systems, " + "June 2000 ISBN 0-126333361-0", "nibe" + }, + { + "erlbook2", + "Concurrent Programming in ERLANG", + "J. Armstrong, R. Virding, C. Wikstrom, M. Williams, " + "Concurrent Programming in ERLANG, Prentice Hall, 1996, ISBN 0-13-508301-X", + "kent" + }, + {"practsgml", "Practical SGML", + "Eric van Herwijnen: Practical SGML, Kluwer Academic Publishers, 1990.", + "peter" +} +]. diff --git a/system/doc/definitions/cite.defs.xml b/system/doc/definitions/cite.defs.xml new file mode 100644 index 0000000000..e54251fa24 --- /dev/null +++ b/system/doc/definitions/cite.defs.xml @@ -0,0 +1,70 @@ + + + + + + 4711 + CCITT + +CCITT, Red Book Vol.-FASCILE VIII.7, Recomm. X400-X.430, Geneva, 1985. + jocke + + + X.680 + ITU-T X.680 + +ITU-T Recommendation X.680 (1994) | ISO/IEC 8824-1: 1995, Abstract Syntax Notation One (ASN.1): Specification of Basic Notation. + + + X.682 + ITU-T X.682 + +ITU-T Recommendation X.682 (1994) | ISO/IEC 8824-3: 1995, Abstract Syntax Notation One (ASN.1): Constraint Specification. + + + X.690 + ITU-T X.690 + +ITU-T Recommendation X.690 (1994) | ISO/IEC 8825-1: 1995, ASN.1 Encoding Rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER). + + + X.691 + ITU-T X.691 + +ITU-T Recommendation X.691 (04/95) | ISO/IEC 8825-2: 1995, ASN.1 Encoding Rules: Specification of Packed Encoding Rules (PER). + + + X.681 + ITU-T X.681 + +ITU-T Recommendation X.681 (1994) | ISO/IEC 8824-2: 1995, Abstract Syntax Notation One (ASN.1): Information Object Specification. + + + X.683 + ITU-T X.683 + +ITU-T Recommendation X.683 (1994) | ISO/IEC 8824-4: 1995, Abstract Syntax Notation One (ASN.1): Parameterization of ASN.1 Specifications. + + + DUBUISSON + ASN.1 Communication between Heterogeneous Systems + +Oliver Dubuisson, ASN.1 Communication between Heterogeneous Systems, June 2000 ISBN 0-126333361-0. + nibe + + + erlbook2 + Concurrent Programming in ERLANG + +J. Armstrong, R. Virding, C. Wikstrom, M. Williams, Concurrent Programming in ERLANG, Prentice Hall, 1996, ISBN 0-13-508301-X. + kent + + + practsgml + Practical SGML + +Eric van Herwijnen: Practical SGML, Kluwer Academic Publishers, 1990. + peter + + + diff --git a/system/doc/definitions/term.defs b/system/doc/definitions/term.defs new file mode 100644 index 0000000000..f3d6f865d2 --- /dev/null +++ b/system/doc/definitions/term.defs @@ -0,0 +1,215 @@ +[{"agent","agent","An entity that terminates a management protocol in the Network Element.","mbj"}, +{"API","API","Application Programming Interface. The interface towards an application. Usually this is a set of functions available, but can also be a set of messages sent to or from an application.","mbj"}, +{"application","application","A collection of resources which is required to offer a specific service.","mbj"}, +{"appmon","Application Monitor","A graphical node and application process tree viewer. See also appmon.","mbj"}, +{"Appmon","Appmon","Application name for the Application Monitor within Erlang/OTP. A graphical node and process viewer.","mbj"}, +{"app callback","application callback module","A module which is called when the application is started, and when it has stopped. Every application has one application callback module.","mbj"}, +{"AC","application controller","A process which coordinates all operations on applications.","mbj"}, +{"app master","application master","The application master is a process that monitors the application. It is provided by the Erlang run-time system. Every application has an application master process.","mbj"}, +{".app file","application resource file","Specifies the resources required by the application and how the application should be started. Every application has one application resource file, called AppName.app.","mbj"}, +{"arity","arity","Denotes the number of arguments to a function.","jocke"}, +{"ASN.1","ASN.1","Abstract Syntax Notation One - an ITU-T and ISO standard notation for describing data formats used in communication protocols.","kenneth"}, +{"ASN.1 Compiler","ASN.1 Compiler","The Erlang/OTP ASN.1 Compiler translates an ASN.1 module into a corresponding Erlang module with encode and decode functions.","kenneth"}, +{"atom","atom","An atom is a constant. Atoms always starts with a lower case letter (a-z) and are terminated by a non-alphanumeric character - otherwise they must be quoted (enclosed in \' \'). An atom is a data type in Erlang, used to enhance the legibility of programs.","kenneth"}, +{"atomicity","atomicity","Atomicity refers to the \"all or nothing\" property. If a transaction succeeds (i.e. commits), then all its effects on the data is captured in the database. If the transaction does not succeed (i.e. aborts), then none of its effect on the data is captured in the database. In other words, the transaction processing algorithm guarantees that the database will not reflect a partitial effect of a transaction.","hakan"}, +{"attach","attach","The debugger may attach to a process. When attached, the debugger may show process details, such as message queues and variable bindings.","olin"}, +{"behaviour","behaviour","A \"pattern of design\" which can be used to build applications and processes in an applications.","mbj"}, +{"BIF","BIF","Built-In Functions which perform operations that are impossible or inefficient to program in Erlang itself. Are defined in +the module Erlang in the application kernel","kenneth"}, +{"binary","binary","A data type in Erlang which is used to store an area of untyped memory. Binaries are used for efficiently handling large quantities of untyped data.","kenneth"}, +{"boolean","boolean","A common data type in programming and specification languages. The value can be either true or false.","kenneth"}, +{"boot file","boot file","A binary file with extension .boot which is read during start of an Erlang node. See SASL User's Guide for more info.","kenneth"}, +{"break point","break point","By setting a break point using the debugger, the user specifies a position in the source code of a module where execution is to be suspended and control transferred to the debugger.","olin"}, +{"CAshort","CA","See Certification Authority.","helen"}, +{"CA certificate","CA certificate","A certificate containing a CA's public key. Network entities use this public key to verify certificates signed with the CA's private key.","helen"}, +{"callback function","callback function","A callback function is a function exported from a callback module, that a generic behaviour calls to perform a specific task.", "mbj"}, +{"callback module","callback module","A callback module is a module that implements the specific parts of a generic behaviour. The generic behaviour specifies which callback functions must be exported from the module.","mbj"}, +{"certificate","certificate","A file used for authenticating network entities under the SSL protocol. A certificate contains information about its owner (called the subject) and issuer, plus the owner's public key and a signature made by a CA. Network entities verify these signatures using CA certificates.","helen"}, +{"CAlong","Certification Authority (CA)","A trusted third party whose purpose is to sign certificates for network entities it has authenticated using secure means. Other network entities can check the signature to verify that a CA has authenticated the bearer of a certificate.","helen"}, +{"CSRlong","Certificate Signing Request (CSR)","An unsigned certificate for submission to a Certification Authority, which signs it with its private key. Once the CSR is signed, it becomes a certificate.","helen"}, +{"child","child","A supervised process. See also permanent, transient, temporary child.","mbj"}, +{"cipher","cipher","A system of encryption.","helen"}, +{"ClearCase","ClearCase","A configuration management system from Rational Software Corporation.","lars"}, +{"client-server model","client-server model","A model where there is a server, which manages some resource, and a number of clients which send requests to the server to access the resource. The client-server model is one of the basic programming techniques for coordinating the activities of several parallel processes.","mbj"}, +{"cover","Coverage Analyser","Module name for the coverage analyser tool, located in the Tools application.","gunilla"}, +{"CORBAlong","Common Object Request Broker Architecture (CORBA)","A specification of an architecture for a distributed object system","lars"},{"CORBA","Common Object Request Broker Architecture (CORBA)","A specification of an architecture for a distributed object system","lars"}, +{"compiler","compiler","A compiler is a translator. A common type of compilers are those who takes source code for a programming language and translates it into code that is executable on a specific platform. E.g. the Erlang compiler translates Erlang source code to an intermediary code that is executable by the Erlang Run Time System.","kenneth"}, +{"consistency","consistency","Consistency refers to the requirement that, given a consistent initial database state, the state of the database after the successful execution of a transaction is also consistent; that is, a transaction transforms the database from a consistent state to another consistent state. Database consistency may be defined as a set of rules or constraints. If the execution of a transaction causes the consistency constraints to be violated, the transaction is not accepted (and thus aborted) by the system.","hakan"}, +{"cookie","cookie","A magic cookie is a secret atom assigned to each Erlang node. The Erlang nodes in a distributed system must know each others cookies in order to authorize each other for communication","kenneth"}, +{"CORBAshort","CORBA","See Common Object RequestBroker Architecture.","lars"}, +{"Coverage Analyser","Coverage Analyser","A tool which provides a set of functions for coverage analysis of Erlang programs, i.e observing how many times each line or function are executed. See also cover.","olin"}, +{"coverage analysis","coverage analysis","The task of determining which lines, or how many lines of code, has actually been executed. Useful for determining the completeness of test suites.","olin"}, +{"cross reference tool","cross reference tool","A tool that can be used for finding dependencies between functions, modules, applications and releases. The Erlang/OTP cross reference tool is called xref and is part of the Tools application.","gunilla"}, +{"CSRshort","CSR","See Certificate Signing Request.","helen"}, +{"data type","data type","The data types in Erlang are numbers, atoms, tuples, lists, pids, funs, records, ports, references and binaries. The values of Erlang data types can be stored in variables.","kenneth"}, +{"DBMSlong","Database Management System (DBMS)","A database is a collection of data and a DBMS is a system which manages the database. Applications accesses the database through the database management system.","hakan"}, +{"DBMSshort","DBMS","See Database Management System.","hakan"}, +{"Debugger","Debugger","An Erlang/OTP tool which provides mechanisms which makes it possible to see what happens during the execution of code in specified modules, or when processes crash.","olin"}, +{"dets","dets","A module within the stdlib application, which provides a term storage, and which is used as the underlying file storage mechanism by the Mnesia DBMS.","hakan"}, +{"dirty operations","dirty operations","Functions which manipulate data in a DBMS, without using transactions.","hakan"}, +{"distributed application","distributed application","An application which runs on one of several nodes. May be restarted on another node. (See local application.)","mbj"}, +{"DNSshort","DNS","See Domain Name System.","lars"}, +{"Docbuilder","Docbuilder","The documentation system used in Erlang/OTP.","jocke"}, +{"DNSlong","Domain Name System (DNS)","DNS is a service that map names to internet addresses","lars"}, +{"DTD","DTD","Document Type Definition as defined in SGML.","jocke"}, +{"durability","durability","If a transaction succeeds, then its effect on the data is persistently captured, and will survive subsequent system failures resulting in loss of data in volatile memory. Durability is usually enforced by first writing modified data to some non-volatile memory (usually disc), before a transaction is allowed to commit. If there is a system failure, the state of the non-volatile memory must be recovered to reflect the effect of all and only committed transactions.","hakan"}, +{"Emacs","Emacs"," A widely used text editor which allows customization of its behaviour. An Erlang mode for Emacs is included in the Erlang deliverables.","kenneth"}, +{"Emacs for Erlang","Emacs for Erlang","A tool which provides a major mode for editing Erlang source files in Emacs.","olin"}, +{"encaps","encapsulation","Data can be encapsulated into another data element.","kent"}, +{"eprof","eprof","A module in the tools application. See Profiler.","olin"}, +{"erl","erl","The command which starts an Erlang run-time system.","kenneth"}, +{"erl_interface","erl_interface library","A thread safe library with C-functions which makes it possible to write a C-program which appears as one of the nodes in a system of distributed Erlang nodes.","kenneth"}, +{"Erlang","Erlang","Erlang is a functional programming language intended for designing large industrial soft real time systems.","kenneth"}, +{"Erlang emulator","Erlang emulator","Another word for Erlang Virtual Machine.","kenneth"}, +{"ERTSlong","Erlang Run Time System","A fundamental part of Erlang/OTP which contains the Erlang Virtual Machine, the kernel and stdlib applications. The Erlang Run Time System is a mandatory part which all other Erlang applications are dependent upon.","kenneth"}, +{"Erlang VM","Erlang Virtual Machine","The virtual machine, which makes Erlang/OTP work together with a specific OS/HW platform. The Erlang Virtual Machine is available on several different platforms. The Erlang Virtual Machine is the glue which makes it possible to run an Erlang application on any platform without change.","kenneth"}, +{"ERTSshort","ERTS","See Erlang Run Time System.","kenneth"}, +{"ETS","ETS","Erlang Term Storage tables.","olin"}, +{"EVAshort","EVA","See Event and Alarm handling application","mbj"}, +{"EVAlong","Event and Alarm handling application (EVA)","An application that consists of Fault Management functionality, such as sending and logging of events and alarms.","mbj"}, +{"event handler","event handler","A module exporting functions which can process events sent to an event manager process. The event handler is a behaviour of type gen_event.","mbj"}, +{"event manager","event manager","A process to which events of a certain category is sent. gen_event handler can be installed in the event manager.","mbj"}, +{"exit signal","exit signal","A signal which is sent from a terminating process to the processes and ports it is linked to. An EXIT signal has the following format: {'EXIT', Exiting_Process_Id, Reason}.","kent"}, +{"foo","foo","Algebraic place holder.","kent"}, +{"FSM","FSM","Finite State Machine.","kenneth"}, +{"fun","fun","A data type, introduced in Erlang 4.4, which represent functional objects.","kenneth"}, +{"function","function","Erlang programs are written entirely in terms of modules with functions. A function can have arguments and does always return a result. A function can be exported which makes it available for calls from other modules. Non exported functions can only be called internally within the module.","kenneth"}, +{"Gateway","gateway","A server which acts as an intermediary for some other server. Unlike a proxy, a gateway receives requests as if it were the origin server for the requested resource; the requesting client may not be aware that it is communicating with a gateway.","jocke"}, +{"gen_event","gen_event","A behaviour used for programming event handling mechanisms, such as alarm handlers, error loggers, and plug-and-play handlers.","mbj"}, +{"gen_fsm","gen_fsm","A behaviour used for programming finite state machines.","mbj"}, +{"gen_server","gen_server","A behaviour used for programming client-server processes.","mbj"}, +{"gterm","Global Glossary Database","A glossary database used to list common acronymns and defintions etc.","jocke"}, +{"xref","xref","A cross reference tool that can be used for finding dependencies between functions, modules, applications and releases. Part of the Tools application.","gunilla"}, +{"GSlong","Graphics System","A library module which provides a graphics interface for Erlang.","mbj"}, +{"grid","grid","A multi-column object which is used to display tables. (Graphics System.)","mbj"}, +{"GSshort","GS","See Graphics System.","olin"}, +{"GS Contributions","GS Contributions","Unsupported user supplied tools which are included with the Erlang/OTP software release.","olin"}, +{"GUI","GUI","Graphical User Interface","mbj"}, +{"Home Directory","Home Directory","The position of a user account in the file system. The Home Directory is automatically passed to the Erlang run-time system at startup. On Unix the contents of the environment variable \"HOME\" is passed. Om Win32 the concatenation of the environment variables \"HOMEDRIVE\" and \"HOMEPATH\" is passed, or if these variables are not set, the value returned by the Win32 API function \"GetWindowsDirectory\" is passed.","kenneth"}, +{"host name","host name","The name of a machine on a network, e.g. erlang.ericsson.se.","kent"}, +{"HTML","HTML","Hypertext Markup Language.","jocke"}, +{"HTTP","HTTP","Hypertext Transfer Protocol.","jocke"}, +{"HTTPS","HTTPS","The Hypertext Transport Protocol, Secure, the standard SSL communication mechanism of the World Wide Web.","helen"}, +{"IDLshort","IDL","See Interface Description Language.","lars"}, +{"IDLlong","Interface Description Language (IDL)","The interface specification language created by OMG.","lars"}, +{"indexing","indexing","Fast lookup using an (usually enumerated) key.","kent"}, +{"I1","INETS","The Internet Services application","jocke"}, +{"initial call","initial call","The first call to an interpreted function (when using the Interpreter).","kent"}, +{"instrumentation function","instrumentation function","A function used to implement a Managed Object, i.e. give access to the real resources behind an MO.","mbj"}, +{"IDLlong","Interface Description Language (IDL)","The interface specification language created by OMG.","lars"}, +{"interpreter","interpreter","An application which provides mechanisms which make it possible to see what happens during the execution of code in specified (interpreted) modules, or when processes crash.","kent"}, +{"isolation","isolation","A transaction executes as if no other concurrent transactions are executing, and thus its execution results are equivalent to those obtained by executing database transactions serially. A system which maintains transaction isolation is also said to be enforcing serializability.","hakan"}, +{"kernel","kernel","An application which contains file servers, code servers and other code necessary for the Erlang run-time system.","kenneth"}, +{"key","key","A file containing the value that must be fed into an algorithm in order to encrypt or decrypt a message.","helen"}, +{"key pair","key pair","A set of two keys used in public key cryptography. One is the public key used to encrypt data, and the other is the private key necessary to decrypt the same data.","helen"}, +{"list","list","Terms separated by commas and enclosed in square brackets [ ] are called lists. A list is a data type in Erlang, used for storing a variable number of terms. It is dynamically sized. The first element of the list is referred to as the head of the list, and the remainer of the list as the tail.","kenneth"}, +{"list box","list box ","A list of labels with optional scroll bars attached. (Graphics System.)","mbj"}, +{"lc","list comprehension","A language construct in Erlang which are analogous to set comprehensions in Zermelo-Frankel set theory. Analogous to the 'setof' and 'findall' predicates in Prolog.","kenneth"}, +{"local application","local application","An application which runs on one node and which are always started at the local node only. (See distributed application.)","mbj"}, +{"manager","manager","An entity that terminates a management protocol in the Network Management Station.","mbj"}, +{"Master Agent","Master Agent","The SNMP agent system consists of one Master Agent which terminates the SNMP protocol","mbj"}, {"MIB","Management Information Base (MIB)","An abstract definition of the management information available through a management interface in a system.","mbj"}, +{"matching","matching","See pattern matching.","kenneth"}, +{"message queue","message queue","The queue of not yet received messages that are in the mailbox of a process.","olin"}, +{"Mnemosyne","Mnemosyne","Mnemosyne was the query language of Mnesia up to the R11B release. Supersed by QLC.","hakan"}, +{"Mnesia","Mnesia","Mnesia is a distributed Database Management System, appropriate for telecommunications applications and other applications with need of continuous operation and soft real-time properties.","hakan"}, +{"MIBshort","MIB","See Management Information Base.","mbj"}, +{"MIME","MIME","Multi-purpose Internet Mail Extensions.","jocke"}, +{"MOlong","Managed Object (MO)","The abstract management information defined in a MIB.","mbj"}, {"MO", "MO","Managed Object; The abstract management information defined in a MIB.","nibe"}, +{"MOshort","MO","See Managed Object.","mbj"}, +{"module","module","Module is the unit for compilation and for loading in Erlang. A Module contains a module declaration, export declarations and code representing the functions in the module.","kenneth"}, +{"NCSA","NCSA","The National Center for Supercomputing Applications.","jocke"}, +{"NEshort","NE","See Network Element.","mbj"}, +{"NElong", "Network Element","In OTP, the Network Element is the entire distributed OTP system, meaning that the distributed OTP system is managed as one entity.","mbj"}, {"NE", "NE","Network Element; In OTP, the Network Element is the entire distributed OTP system, meaning that the distributed OTP system is managed as one entity.","mbj"}, +{"NMSlong","Network Management Station (NMS)","The place where the operator manages the network.","mbj"}, {"NMS","NMS","Network Management Station; The place where the operator manages the network.","nibe"}, +{"NMSshort","NMS","See Network Management Station.","mbj"}, +{"node","node","An executing Erlang run-time system which can communicate with other Erlang run-time systems.","kenneth"}, +{"node name","node name","A node name is an atom constructed as the concatenation of a name supplied by the user, an \"@\" character, and the name of the host where the node is executing.","kenneth"}, +{"notation","notation","How things are written.","kent"}, +{"notification","notification","Information of an event.","kent"}, +{"NROFF","NROFF","A text formatting language for line printer quality output devices that runs on the UNIX operating system.","jocke"}, +{"number","number","A data type in Erlang. Are subdivided into integers, for storing natural numbers, or floats, for storing real numbers.","kenneth"}, +{"OMGlong","Object Managment Group (OMG)","A standardisation group for all specifications in the area of CORBA.","lars"}, +{"OMGshort","OMG","Object Managment Group.","lars"}, +{"OTP","OTP","Open Telecom Platform","mike"}, +{"os_mon","os_mon","An application which monitors the behaviour of the underlying operating system","mbj"}, +{"parser generator","parser generator","A tool for making compilers which takes a grammar description as input and generates a complete program (a parser) which recognizes input which complies with the grammar. YECC is a parser generator included in the Erlang/OTP.","kenneth"}, +{"pass phrase","pass phrase","The word or phrase which authenticates the user who is authorized to use private key file. The pass phrase prevents unauthorized users from starting, restarting, or reconfiguring the server.","helen"}, +{"pattern matching","pattern matching","A basic mechanism in Erlang for assigning values to variables and for controlling the flow of a program.","kenneth"}, +{"permanent child","permanent child","A supervised process which always is restarted when it dies.","mbj"}, +{"Pid","Pid","Process Identifier. A data type in Erlang for storing process references. The process identity of the process displayed in the line.","kenneth"}, +{"Pman","Pman","Module and application name for the Process Trace Tool.","olin"}, +{"point","point","A unit used to indicate the size of a typeface. Equal to 1/72 inches.","jocke"}, +{"pointer","pointer","A pointer tells where data is stored. Memory pointers are not used in Erlang.","kent"}, +{"port","port","A data type in Erlang. Ports provide the basic mechanism for communication with the external world.","peterl"}, +{"port controller","port controller","An Erlang process which controls a port program. A port has exactly one port controller.","peterl"}, +{"port program","port program","A program that runs as an external program in the operating system and which the Erlang run-time system can start and communicate with by means of the Erlang port mechanism.","kenneth"}, +{"PostScript","PostScript","A language describing a fully laid-out page in terms of fonts, lines, grey scales, and so on, in a way that is interpretable by a printer. The language was developed by Adobe Systems.","jocke"}, +{"pretty-printed","pretty-printed","Nicely formatted code or data, e.g. C or Erlang, with indents and tabs etc.","jocke"}, +{"primitive","primitive","The basic elements in a programming language.","kent"}, +{"private key","private key","The secret key in a pair, used to decrypt incoming messages and sign outgoing ones.","helen"}, +{"process","process","A process is a self-contained separate unit of execution which exists concurrently with other processes in the system. The BIF \"spawn/3\" creates and starts the execution of a new process.","kenneth"}, +{"process dictionary","process dictionary","Each process has an associated dictionary which provides the process with simple destructive storage capabilities.","kenneth"}, +{"Process Manager","Process Manager","Obsolete name for the Process Trace Tool.","olin"}, +{"Process Trace Tool","Process Trace Tool","A tool which gives an overview of the processes in the Erlang run-time system. See also Pman.","olin"}, +{"Profiler","Profiler","Another name for eprof, a tool used to profile a system in order to find out how much time is spent in various segments of a program.","olin"}, +{"program","program","Routines which can be executed by a computer.","kent"}, +{"Proxy","proxy","An intermediary program which acts as both a server and a client for the purpose of making requests on behalf of other clients.","jocke"}, +{"public key","public key","The publicly available key in a key pair, used to encrypt messages bound for its owner and to decrypt signatures made by its owner.","helen"}, +{"query","query","Queries are used for accessing the data in a Database Management System. The query specify a maybe complicated relation that should hold for all of the selected data. This could involve several tables as well as conditions like for instance less then and greater then.","hakan"}, +{"query language","query language","A language which is specially designed to express database queries. Examples of query languages are QLC and SQL.","hakan"}, +{"receive","receive","A primitive for message processing in Erlang, receives a message from a process.","kenneth"}, +{"record","record","A data structure intended for storing a fixed number of related Erlang terms, it is similar to a \"struct\" in C or a \"record\" in Pascal.","kenneth"}, +{"recursion","recursion","A function is recursive if it calls itself until the result desired is attained. Recursion is the heart of functional programming.","kenneth"}, +{"reference","reference","A data type in Erlang for storing system unique references.","kenneth"}, +{"release handler","release handler","A SASL process which handles software upgrade.","mbj"}, +{"relup","release upgrade script","A script with instructions to the release handler of how the release should be installed in the system.","mbj"}, +{"RPC","Remote Proceedure Call","A technique for evaluating a function transparently on a remote node.","kenneth"}, +{"resource","resource","The actual resource to be managed. A resource is represented by a Managed Object. Each resource is mapped to one or several resources.","mbj"},{"resources","resources","The actual resources to be managed. A resource is represented by a Managed Object. Each resource is mapped to one or several resources.","nibe"}, +{"RFC","RFC","A \"Request for Comments\" used as a proposed standard by IETF.","jocke"}, +{"SASLshort","SASL","See System Architecture Support Libraries.","mbj"}, +{"schema","schema","The schema contains the definitions and whereabouts for all tables. In Mnesia it is realized as a special table named \"schema\".","hakan"}, +{"schema functions","schema functions","The functions which are available for managing schemas.","hakan"}, +{"SDL","SDL","Specification and Description Language. A ITU-T standard specification language which is used to specify the behaviour of switching systems.","kenneth"}, +{"send","send","A primitive for message processing in Erlang, sends a message to a process.","kenneth"}, +{"shell","shell"," The shell is an interactive front-end to an Erlang node where Erlang expressions can be evaluated. ","kenneth"}, +{"shell prompt","shell prompt","The text or symbol shown on the screen when the shell is ready to receive commands.","kent"}, +{"SNMPEAlong","Simple Network Management Protocol Extensible Agent (SNMPEA).","An Erlang/OTP application that includes a bilingual extensible SNMP agent.","mbj"}, +{"single assignment","single assignment","Means that once a variable has been assigned a value, the value can never be changed. Erlang is a single assignment language.","kenneth"}, +{"single step","single step","Single stepping is a function provided by the debugger. By single stepping the developer may use the debugger to follow the execution of a process and see what actually happens at each function call.","olin"}, +{"slave","slave","Not in control, can never take over by himself.","kent"}, +{"SSLlong","Secure Sockets Layer (SSL)","A protocol created by Netscape Communications Corporation for authentication and encryption over TCP/IP networks, including Web.","helen"}, +{"signature","signature","An encrypted text block that validates a certificate or other file. A Certification Authority (CA) creates a signature by generating a hash of the public key embedded in a certificate, then encrypting the hash with its own private key. Only the CA's public key can decrypt the signature, verifying that the CA has authenticated the network entity that owns the certificate.","helen"}, +{"SNMPshort","SNMP","Simple Network Management Protocol.","mbj"}, +{"SNMPshort","SNMPEA","See Simple Network Management Protocol Extensible Agent.","mbj"}, +{"spawn","spawn","A primitive for multiprocessing in Erlang, that starts a parallel computation (called a process). The creation of a new process","kenneth"}, +{"SSLshort","SSL","See Secure Sockets Layer.","helen"}, +{"SSLeay","SSLeay","An SSL library developed by Eric Yong (eay@mincom.oz.au).","helen"}, +{"SSLTOP","SSLTOP","The path to your SSL directory, a subdirectory of ServerRoot.","helen"}, +{"start script","start script","A start script is a file with .script extension which is the source when a boot file is created. See SASL User's Guide for more info.","kenneth"}, +{"stdlib","stdlib","An application within Erlang/OTP which contains modules for manipulating lists, strings, files, etc.","kenneth"}, +{"sticky directory","sticky directory","A directory containing Erlang object code that is part of the runtime system.","kent"}, +{"sticky lock","sticky lock","A lock which lingers at a node after the transaction which first acquired the lock has terminated. Once a process has obtained a sticky lock on a node, subsequent locks acquired by processes on the same node, can be set without need of involving remote nodes.","hakan"}, +{"string","string","The ASCII or ISO-8859-1 representation of the list of characters occurring within quotation marks in Erlang code.","kent"}, +{"Subagent","Subagent","The SNMP agent system consists of one Master Agent (See Master Agent) and zero or more Subagents which can be used to distribute the SNMP agent system on several nodes.","mbj"}, +{"supervision tree","supervision tree","A hierarcial tree of processes used to program fault tolerant systems.","mbj"}, +{"supervisor","supervisor","A behaviour to stucture fault tolerant computations, and program supervision trees with.","mbj"}, +{"sup_bridge","supervisor bridge"," A behaviour used to connect a process, or subsystem, to a supervisor tree.","mbj"}, +{"SASLlong","System Architecture Support Libraries (SASL)","An Erlang/OTP application which contains services for error logging, release handling and report browsing.","mbj"}, {".config","system configuration file","A file which specifies configuration parameters for the applications in the system.","mbj"}, +{"table lock","table lock","Table locks are locks which are set on whole tables. They may either be read locks or write locks.","hakan"}, +{"Table Visualizer","Table Visualizer","A tool which enables the user to examine ETS and Mnesia tables.","olin"}, +{"temporary child","temporary child","A supervised process which is never restarted when it dies.","mbj"}, +{"term","term","The super type of all Erlang types.","kenneth"}, +{"Toolbar","Toolbar","A tool that provides an simplistic interface to the other various Erlang/OTP tools","olin"}, +{"tools","tools","An application within Erlang/OTP which contains the tools which are not applications themselves.","olin"}, +{"transaction","transaction","Transactions groups a set of database accesses into an atomic unit. All transactions has the ACID (atomicity, concistency, isolation and durability) properties.","hakan"}, +{"transient child","transient child","A supervised process which is restarted if it dies non-normally.","mbj"}, +{"trigger","trigger","The Interpreter. A break point that is reached by a process triggers if it is active, and the execution of the process is stopped.","olin"}, +{"tty","tty","tty is a simple command line interface program where keystrokes are collected and interpreted. Originally meant teletypewriter equipment. Now it usually means the user console/terminal/shell window.","kent"}, +{"tuple","tuple","A tuple is a data type in Erlang. Tuples are used as place holders for complex data structures. Tuples may contain anything of any size, and are written as sequences of terms separated by commas, and enclosed in curly brackets { }.","kenneth"}, +{"variable","variable","An alias for a memory position, in which a value can be put. Erlang variables always start with an upper case letter.","kenneth"}, +{"workers","workers","The lower nodes in a supervision tree. These are the processes that actually performs some real work, e.g. servers.","mbj"}, +{"YECC","YECC","A LALR-1 parser generator included in Erlang/OTP. It is written in Erlang and generates a parser as an Erlang module.","kenneth"}]. + + + + diff --git a/system/doc/definitions/term.defs.xml b/system/doc/definitions/term.defs.xml new file mode 100644 index 0000000000..28ac0d6eaf --- /dev/null +++ b/system/doc/definitions/term.defs.xml @@ -0,0 +1,1525 @@ + + + + + + agent + agent + +An entity that terminates a management protocol in the Network Element. + mbj + + + API + API + +Application Programming Interface. The interface towards an application. Usually this is a set of functions available, but can also be a set of messages sent to or from an application. + mbj + + + application + application + +A collection of resources which is required to offer a specific service. + mbj + + + appmon + Application Monitor + +A graphical node and application process tree viewer. See also appmon. + mbj + + + Appmon + Appmon + +Application name for the Application Monitor within Erlang/OTP. A graphical node and process viewer. + mbj + + + app callback + application callback module + +A module which is called when the application is started, and when it has stopped. Every application has one application callback module. + mbj + + + AC + application controller + +A process which coordinates all operations on applications. + mbj + + + app master + application master + +The application master is a process that monitors the application. It is provided by the Erlang run-time system. Every application has an application master process. + mbj + + + .app file + application resource file + +Specifies the resources required by the application and how the application should be started. Every application has one application resource file, called AppName.app. + mbj + + + arity + arity + +Denotes the number of arguments to a function. + jocke + + + ASN.1 + ASN.1 + +Abstract Syntax Notation One - an ITU-T and ISO standard notation for describing data formats used in communication protocols. + kenneth + + + ASN.1 Compiler + ASN.1 Compiler + +The Erlang/OTP ASN.1 Compiler translates an ASN.1 module into a corresponding Erlang module with encode and decode functions. + kenneth + + + atom + atom + +An atom is a constant. Atoms always starts with a lower case letter (a-z) and are terminated by a non-alphanumeric character - otherwise they must be quoted (enclosed in ' '). An atom is a data type in Erlang, used to enhance the legibility of programs. + kenneth + + + atomicity + atomicity + +Atomicity refers to the "all or nothing" property. If a transaction succeeds (i.e. commits), then all its effects on the data is captured in the database. If the transaction does not succeed (i.e. aborts), then none of its effect on the data is captured in the database. In other words, the transaction processing algorithm guarantees that the database will not reflect a partitial effect of a transaction. + hakan + + + attach + attach + +The debugger may attach to a process. When attached, the debugger may show process details, such as message queues and variable bindings. + olin + + + behaviour + behaviour + +A "pattern of design" which can be used to build applications and processes in an applications. + mbj + + + BIF + BIF + +Built-In Functions which perform operations that are impossible or inefficient to program in Erlang itself. Are defined in the module Erlang in the application kernel + kenneth + + + binary + binary + +A data type in Erlang which is used to store an area of untyped memory. Binaries are used for efficiently handling large quantities of untyped data. + kenneth + + + boolean + boolean + +A common data type in programming and specification languages. The value can be either true or false. + kenneth + + + boot file + boot file + +A binary file with extension .boot which is read during start of an Erlang node. See SASL User's Guide for more info. + kenneth + + + break point + break point + +By setting a break point using the debugger, the user specifies a position in the source code of a module where execution is to be suspended and control transferred to the debugger. + olin + + + CAshort + CA + +See Certification Authority. + helen + + + CA certificate + CA certificate + +A certificate containing a CA's public key. Network entities use this public key to verify certificates signed with the CA's private key. + helen + + + callback function + callback function + +A callback function is a function exported from a callback module, that a generic behaviour calls to perform a specific task. + mbj + + + callback module + callback module + +A callback module is a module that implements the specific parts of a generic behaviour. The generic behaviour specifies which callback functions must be exported from the module. + mbj + + + certificate + certificate + +A file used for authenticating network entities under the SSL protocol. A certificate contains information about its owner (called the subject) and issuer, plus the owner's public key and a signature made by a CA. Network entities verify these signatures using CA certificates. + helen + + + CAlong + Certification Authority (CA) + +A trusted third party whose purpose is to sign certificates for network entities it has authenticated using secure means. Other network entities can check the signature to verify that a CA has authenticated the bearer of a certificate. + helen + + + CSRlong + Certificate Signing Request (CSR) + +An unsigned certificate for submission to a Certification Authority, which signs it with its private key. Once the CSR is signed, it becomes a certificate. + helen + + + child + child + +A supervised process. See also permanent, transient, temporary child. + mbj + + + cipher + cipher + +A system of encryption. + helen + + + ClearCase + ClearCase + +A configuration management system from Rational Software Corporation. + lars + + + client-server model + client-server model + +A model where there is a server, which manages some resource, and a number of clients which send requests to the server to access the resource. The client-server model is one of the basic programming techniques for coordinating the activities of several parallel processes. + mbj + + + cover + Coverage Analyser + +Module name for the coverage analyser tool, located in the Tools application. + gunilla + + + CORBAlong + Common Object Request Broker Architecture (CORBA) + +A specification of an architecture for a distributed object system + lars + + + CORBA + Common Object Request Broker Architecture (CORBA) + +A specification of an architecture for a distributed object system + lars + + + compiler + compiler + +A compiler is a translator. A common type of compilers are those who takes source code for a programming language and translates it into code that is executable on a specific platform. E.g. the Erlang compiler translates Erlang source code to an intermediary code that is executable by the Erlang Run Time System. + kenneth + + + consistency + consistency + +Consistency refers to the requirement that, given a consistent initial database state, the state of the database after the successful execution of a transaction is also consistent; that is, a transaction transforms the database from a consistent state to another consistent state. Database consistency may be defined as a set of rules or constraints. If the execution of a transaction causes the consistency constraints to be violated, the transaction is not accepted (and thus aborted) by the system. + hakan + + + cookie + cookie + +A magic cookie is a secret atom assigned to each Erlang node. The Erlang nodes in a distributed system must know each others cookies in order to authorize each other for communication + kenneth + + + CORBAshort + CORBA + +See Common Object RequestBroker Architecture. + lars + + + Coverage Analyser + Coverage Analyser + +A tool which provides a set of functions for coverage analysis of Erlang programs, i.e observing how many times each line or function are executed. See also cover. + olin + + + coverage analysis + coverage analysis + +The task of determining which lines, or how many lines of code, has actually been executed. Useful for determining the completeness of test suites. + olin + + + cross reference tool + cross reference tool + +A tool that can be used for finding dependencies between functions, modules, applications and releases. The Erlang/OTP cross reference tool is called xref and is part of the Tools application. + gunilla + + + CSRshort + CSR + +See Certificate Signing Request. + helen + + + data type + data type + +The data types in Erlang are numbers, atoms, tuples, lists, pids, funs, records, ports, references and binaries. The values of Erlang data types can be stored in variables. + kenneth + + + DBMSlong + Database Management System (DBMS) + +A database is a collection of data and a DBMS is a system which manages the database. Applications accesses the database through the database management system. + hakan + + + DBMSshort + DBMS + +See Database Management System. + hakan + + + Debugger + Debugger + +An Erlang/OTP tool which provides mechanisms which makes it possible to see what happens during the execution of code in specified modules, or when processes crash. + olin + + + dets + dets + +A module within the stdlib application, which provides a term storage, and which is used as the underlying file storage mechanism by the Mnesia DBMS. + hakan + + + dirty operations + dirty operations + +Functions which manipulate data in a DBMS, without using transactions. + hakan + + + distributed application + distributed application + +An application which runs on one of several nodes. May be restarted on another node. (See local application.) + mbj + + + DNSshort + DNS + +See Domain Name System. + lars + + + Docbuilder + Docbuilder + +The documentation system used in Erlang/OTP. + jocke + + + DNSlong + Domain Name System (DNS) + +DNS is a service that map names to internet addresses + lars + + + DTD + DTD + +Document Type Definition as defined in SGML. + jocke + + + durability + durability + +If a transaction succeeds, then its effect on the data is persistently captured, and will survive subsequent system failures resulting in loss of data in volatile memory. Durability is usually enforced by first writing modified data to some non-volatile memory (usually disc), before a transaction is allowed to commit. If there is a system failure, the state of the non-volatile memory must be recovered to reflect the effect of all and only committed transactions. + hakan + + + Emacs + Emacs + +A widely used text editor which allows customization of its behaviour. An Erlang mode for Emacs is included in the Erlang deliverables. + kenneth + + + Emacs for Erlang + Emacs for Erlang + +A tool which provides a major mode for editing Erlang source files in Emacs. + olin + + + encaps + encapsulation + +Data can be encapsulated into another data element. + kent + + + eprof + eprof + +A module in the tools application. See Profiler. + olin + + + erl + erl + +The command which starts an Erlang run-time system. + kenneth + + + erl_interface + erl_interface library + +A thread safe library with C-functions which makes it possible to write a C-program which appears as one of the nodes in a system of distributed Erlang nodes. + kenneth + + + Erlang + Erlang + +Erlang is a functional programming language intended for designing large industrial soft real time systems. + kenneth + + + Erlang emulator + Erlang emulator + +Another word for Erlang Virtual Machine. + kenneth + + + ERTSlong + Erlang Run Time System + +A fundamental part of Erlang/OTP which contains the Erlang Virtual Machine, the kernel and stdlib applications. The Erlang Run Time System is a mandatory part which all other Erlang applications are dependent upon. + kenneth + + + Erlang VM + Erlang Virtual Machine + +The virtual machine, which makes Erlang/OTP work together with a specific OS/HW platform. The Erlang Virtual Machine is available on several different platforms. The Erlang Virtual Machine is the glue which makes it possible to run an Erlang application on any platform without change. + kenneth + + + ERTSshort + ERTS + +See Erlang Run Time System. + kenneth + + + ETS + ETS + +Erlang Term Storage tables. + olin + + + EVAshort + EVA + +See Event and Alarm handling application + mbj + + + EVAlong + Event and Alarm handling application (EVA) + +An application that consists of Fault Management functionality, such as sending and logging of events and alarms. + mbj + + + event handler + event handler + +A module exporting functions which can process events sent to an event manager process. The event handler is a behaviour of type gen_event. + mbj + + + event manager + event manager + +A process to which events of a certain category is sent. gen_event handler can be installed in the event manager. + mbj + + + exit signal + exit signal + +A signal which is sent from a terminating process to the processes and ports it is linked to. An EXIT signal has the following format: {'EXIT', Exiting_Process_Id, Reason}. + kent + + + foo + foo + +Algebraic place holder. + kent + + + FSM + FSM + +Finite State Machine. + kenneth + + + fun + fun + +A data type, introduced in Erlang 4.4, which represent functional objects. + kenneth + + + function + function + +Erlang programs are written entirely in terms of modules with functions. A function can have arguments and does always return a result. A function can be exported which makes it available for calls from other modules. Non exported functions can only be called internally within the module. + kenneth + + + Gateway + gateway + +A server which acts as an intermediary for some other server. Unlike a proxy, a gateway receives requests as if it were the origin server for the requested resource; the requesting client may not be aware that it is communicating with a gateway. + jocke + + + gen_event + gen_event + +A behaviour used for programming event handling mechanisms, such as alarm handlers, error loggers, and plug-and-play handlers. + mbj + + + gen_fsm + gen_fsm + +A behaviour used for programming finite state machines. + mbj + + + gen_server + gen_server + +A behaviour used for programming client-server processes. + mbj + + + gterm + Global Glossary Database + +A glossary database used to list common acronymns and defintions etc. + jocke + + + xref + xref + +A cross reference tool that can be used for finding dependencies between functions, modules, applications and releases. Part of the Tools application. + gunilla + + + GSlong + Graphics System + +A library module which provides a graphics interface for Erlang. + mbj + + + grid + grid + +A multi-column object which is used to display tables. (Graphics System.) + mbj + + + GSshort + GS + +See Graphics System. + olin + + + GS Contributions + GS Contributions + +Unsupported user supplied tools which are included with the Erlang/OTP software release. + olin + + + GUI + GUI + +Graphical User Interface + mbj + + + Home Directory + Home Directory + +The position of a user account in the file system. The Home Directory is automatically passed to the Erlang run-time system at startup. On Unix the contents of the environment variable "HOME" is passed. Om Win32 the concatenation of the environment variables "HOMEDRIVE" and "HOMEPATH" is passed, or if these variables are not set, the value returned by the Win32 API function "GetWindowsDirectory" is passed. + kenneth + + + host name + host name + +The name of a machine on a network, e.g. erlang.ericsson.se. + kent + + + HTML + HTML + +Hypertext Markup Language. + jocke + + + HTTP + HTTP + +Hypertext Transfer Protocol. + jocke + + + HTTPS + HTTPS + +The Hypertext Transport Protocol, Secure, the standard SSL communication mechanism of the World Wide Web. + helen + + + IDLshort + IDL + +See Interface Description Language. + lars + + + IDLlong + Interface Description Language (IDL) + +The interface specification language created by OMG. + lars + + + indexing + indexing + +Fast lookup using an (usually enumerated) key. + kent + + + I1 + INETS + +The Internet Services application + jocke + + + initial call + initial call + +The first call to an interpreted function (when using the Interpreter). + kent + + + instrumentation function + instrumentation function + +A function used to implement a Managed Object, i.e. give access to the real resources behind an MO. + mbj + + + IDLlong + Interface Description Language (IDL) + +The interface specification language created by OMG. + lars + + + interpreter + interpreter + +An application which provides mechanisms which make it possible to see what happens during the execution of code in specified (interpreted) modules, or when processes crash. + kent + + + isolation + isolation + +A transaction executes as if no other concurrent transactions are executing, and thus its execution results are equivalent to those obtained by executing database transactions serially. A system which maintains transaction isolation is also said to be enforcing serializability. + hakan + + + kernel + kernel + +An application which contains file servers, code servers and other code necessary for the Erlang run-time system. + kenneth + + + key + key + +A file containing the value that must be fed into an algorithm in order to encrypt or decrypt a message. + helen + + + key pair + key pair + +A set of two keys used in public key cryptography. One is the public key used to encrypt data, and the other is the private key necessary to decrypt the same data. + helen + + + list + list + +Terms separated by commas and enclosed in square brackets [ ] are called lists. A list is a data type in Erlang, used for storing a variable number of terms. It is dynamically sized. The first element of the list is referred to as the head of the list, and the remainer of the list as the tail. + kenneth + + + list box + list box + +A list of labels with optional scroll bars attached. (Graphics System.) + mbj + + + lc + list comprehension + +A language construct in Erlang which are analogous to set comprehensions in Zermelo-Frankel set theory. Analogous to the 'setof' and 'findall' predicates in Prolog. + kenneth + + + local application + local application + +An application which runs on one node and which are always started at the local node only. (See distributed application.) + mbj + + + manager + manager + +An entity that terminates a management protocol in the Network Management Station. + mbj + + + Master Agent + Master Agent + +The SNMP agent system consists of one Master Agent which terminates the SNMP protocol + mbj + + + MIB + Management Information Base (MIB) + +An abstract definition of the management information available through a management interface in a system. + mbj + + + matching + matching + +See pattern matching. + kenneth + + + message queue + message queue + +The queue of not yet received messages that are in the mailbox of a process. + olin + + + Mnemosyne + Mnemosyne + +Mnemosyne was the query language of Mnesia up to the R11B release. Supersed by QLC. + hakan + + + Mnesia + Mnesia + +Mnesia is a distributed Database Management System, appropriate for telecommunications applications and other applications with need of continuous operation and soft real-time properties. + hakan + + + MIBshort + MIB + +See Management Information Base. + mbj + + + MIME + MIME + +Multi-purpose Internet Mail Extensions. + jocke + + + MOlong + Managed Object (MO) + +The abstract management information defined in a MIB. + mbj + + + MO + MO + +Managed Object; The abstract management information defined in a MIB. + nibe + + + MOshort + MO + +See Managed Object. + mbj + + + module + module + +Module is the unit for compilation and for loading in Erlang. A Module contains a module declaration, export declarations and code representing the functions in the module. + kenneth + + + NCSA + NCSA + +The National Center for Supercomputing Applications. + jocke + + + NEshort + NE + +See Network Element. + mbj + + + NElong + Network Element + +In OTP, the Network Element is the entire distributed OTP system, meaning that the distributed OTP system is managed as one entity. + mbj + + + NE + NE + +Network Element; In OTP, the Network Element is the entire distributed OTP system, meaning that the distributed OTP system is managed as one entity. + mbj + + + NMSlong + Network Management Station (NMS) + +The place where the operator manages the network. + mbj + + + NMS + NMS + +Network Management Station; The place where the operator manages the network. + nibe + + + NMSshort + NMS + +See Network Management Station. + mbj + + + node + node + +An executing Erlang run-time system which can communicate with other Erlang run-time systems. + kenneth + + + node name + node name + +A node name is an atom constructed as the concatenation of a name supplied by the user, an "@" character, and the name of the host where the node is executing. + kenneth + + + notation + notation + +How things are written. + kent + + + notification + notification + +Information of an event. + kent + + + NROFF + NROFF + +A text formatting language for line printer quality output devices that runs on the UNIX operating system. + jocke + + + number + number + +A data type in Erlang. Are subdivided into integers, for storing natural numbers, or floats, for storing real numbers. + kenneth + + + OMGlong + Object Managment Group (OMG) + +A standardisation group for all specifications in the area of CORBA. + lars + + + OMGshort + OMG + +Object Managment Group. + lars + + + OTP + OTP + +Open Telecom Platform + mike + + + os_mon + os_mon + +An application which monitors the behaviour of the underlying operating system + mbj + + + parser generator + parser generator + +A tool for making compilers which takes a grammar description as input and generates a complete program (a parser) which recognizes input which complies with the grammar. YECC is a parser generator included in the Erlang/OTP. + kenneth + + + pass phrase + pass phrase + +The word or phrase which authenticates the user who is authorized to use private key file. The pass phrase prevents unauthorized users from starting, restarting, or reconfiguring the server. + helen + + + pattern matching + pattern matching + +A basic mechanism in Erlang for assigning values to variables and for controlling the flow of a program. + kenneth + + + permanent child + permanent child + +A supervised process which always is restarted when it dies. + mbj + + + Pid + Pid + +Process Identifier. A data type in Erlang for storing process references. The process identity of the process displayed in the line. + kenneth + + + Pman + Pman + +Module and application name for the Process Trace Tool. + olin + + + point + point + +A unit used to indicate the size of a typeface. Equal to 1/72 inches. + jocke + + + pointer + pointer + +A pointer tells where data is stored. Memory pointers are not used in Erlang. + kent + + + port + port + +A data type in Erlang. Ports provide the basic mechanism for communication with the external world. + peterl + + + port controller + port controller + +An Erlang process which controls a port program. A port has exactly one port controller. + peterl + + + port program + port program + +A program that runs as an external program in the operating system and which the Erlang run-time system can start and communicate with by means of the Erlang port mechanism. + kenneth + + + PostScript + PostScript + +A language describing a fully laid-out page in terms of fonts, lines, grey scales, and so on, in a way that is interpretable by a printer. The language was developed by Adobe Systems. + jocke + + + pretty-printed + pretty-printed + +Nicely formatted code or data, e.g. C or Erlang, with indents and tabs etc. + jocke + + + primitive + primitive + +The basic elements in a programming language. + kent + + + private key + private key + +The secret key in a pair, used to decrypt incoming messages and sign outgoing ones. + helen + + + process + process + +A process is a self-contained separate unit of execution which exists concurrently with other processes in the system. The BIF "spawn/3" creates and starts the execution of a new process. + kenneth + + + process dictionary + process dictionary + +Each process has an associated dictionary which provides the process with simple destructive storage capabilities. + kenneth + + + Process Manager + Process Manager + +Obsolete name for the Process Trace Tool. + olin + + + Process Trace Tool + Process Trace Tool + +A tool which gives an overview of the processes in the Erlang run-time system. See also Pman. + olin + + + Profiler + Profiler + +Another name for eprof, a tool used to profile a system in order to find out how much time is spent in various segments of a program. + olin + + + program + program + +Routines which can be executed by a computer. + kent + + + Proxy + proxy + +An intermediary program which acts as both a server and a client for the purpose of making requests on behalf of other clients. + jocke + + + public key + public key + +The publicly available key in a key pair, used to encrypt messages bound for its owner and to decrypt signatures made by its owner. + helen + + + query + query + +Queries are used for accessing the data in a Database Management System. The query specify a maybe complicated relation that should hold for all of the selected data. This could involve several tables as well as conditions like for instance less then and greater then. + hakan + + + query language + query language + +A language which is specially designed to express database queries. Examples of query languages are QLC and SQL. + hakan + + + receive + receive + +A primitive for message processing in Erlang, receives a message from a process. + kenneth + + + record + record + +A data structure intended for storing a fixed number of related Erlang terms, it is similar to a "struct" in C or a "record" in Pascal. + kenneth + + + recursion + recursion + +A function is recursive if it calls itself until the result desired is attained. Recursion is the heart of functional programming. + kenneth + + + reference + reference + +A data type in Erlang for storing system unique references. + kenneth + + + release handler + release handler + +A SASL process which handles software upgrade. + mbj + + + relup + release upgrade script + +A script with instructions to the release handler of how the release should be installed in the system. + mbj + + + RPC + Remote Proceedure Call + +A technique for evaluating a function transparently on a remote node. + kenneth + + + resource + resource + +The actual resource to be managed. A resource is represented by a Managed Object. Each resource is mapped to one or several resources. + mbj + + + resources + resources + +The actual resources to be managed. A resource is represented by a Managed Object. Each resource is mapped to one or several resources. + nibe + + + RFC + RFC + +A "Request for Comments" used as a proposed standard by IETF. + jocke + + + SASLshort + SASL + +See System Architecture Support Libraries. + mbj + + + schema + schema + +The schema contains the definitions and whereabouts for all tables. In Mnesia it is realized as a special table named "schema". + hakan + + + schema functions + schema functions + +The functions which are available for managing schemas. + hakan + + + SDL + SDL + +Specification and Description Language. A ITU-T standard specification language which is used to specify the behaviour of switching systems. + kenneth + + + send + send + +A primitive for message processing in Erlang, sends a message to a process. + kenneth + + + shell + shell + +The shell is an interactive front-end to an Erlang node where Erlang expressions can be evaluated. + kenneth + + + shell prompt + shell prompt + +The text or symbol shown on the screen when the shell is ready to receive commands. + kent + + + SNMPEAlong + Simple Network Management Protocol Extensible Agent (SNMPEA). + +An Erlang/OTP application that includes a bilingual extensible SNMP agent. + mbj + + + single assignment + single assignment + +Means that once a variable has been assigned a value, the value can never be changed. Erlang is a single assignment language. + kenneth + + + single step + single step + +Single stepping is a function provided by the debugger. By single stepping the developer may use the debugger to follow the execution of a process and see what actually happens at each function call. + olin + + + slave + slave + +Not in control, can never take over by himself. + kent + + + SSLlong + Secure Sockets Layer (SSL) + +A protocol created by Netscape Communications Corporation for authentication and encryption over TCP/IP networks, including Web. + helen + + + signature + signature + +An encrypted text block that validates a certificate or other file. A Certification Authority (CA) creates a signature by generating a hash of the public key embedded in a certificate, then encrypting the hash with its own private key. Only the CA's public key can decrypt the signature, verifying that the CA has authenticated the network entity that owns the certificate. + helen + + + SNMPshort + SNMP + +Simple Network Management Protocol. + mbj + + + SNMPshort + SNMPEA + +See Simple Network Management Protocol Extensible Agent. + mbj + + + spawn + spawn + +A primitive for multiprocessing in Erlang, that starts a parallel computation (called a process). The creation of a new process + kenneth + + + SSLshort + SSL + +See Secure Sockets Layer. + helen + + + SSLeay + SSLeay + +An SSL library developed by Eric Yong (eay@mincom.oz.au). + helen + + + SSLTOP + SSLTOP + +The path to your SSL directory, a subdirectory of ServerRoot. + helen + + + start script + start script + +A start script is a file with .script extension which is the source when a boot file is created. See SASL User's Guide for more info. + kenneth + + + stdlib + stdlib + +An application within Erlang/OTP which contains modules for manipulating lists, strings, files, etc. + kenneth + + + sticky directory + sticky directory + +A directory containing Erlang object code that is part of the runtime system. + kent + + + sticky lock + sticky lock + +A lock which lingers at a node after the transaction which first acquired the lock has terminated. Once a process has obtained a sticky lock on a node, subsequent locks acquired by processes on the same node, can be set without need of involving remote nodes. + hakan + + + string + string + +The ASCII or ISO-8859-1 representation of the list of characters occurring within quotation marks in Erlang code. + kent + + + Subagent + Subagent + +The SNMP agent system consists of one Master Agent (See Master Agent) and zero or more Subagents which can be used to distribute the SNMP agent system on several nodes. + mbj + + + supervision tree + supervision tree + +A hierarcial tree of processes used to program fault tolerant systems. + mbj + + + supervisor + supervisor + +A behaviour to stucture fault tolerant computations, and program supervision trees with. + mbj + + + sup_bridge + supervisor bridge + +A behaviour used to connect a process, or subsystem, to a supervisor tree. + mbj + + + SASLlong + System Architecture Support Libraries (SASL) + +An Erlang/OTP application which contains services for error logging, release handling and report browsing. + mbj + + + .config + system configuration file + +A file which specifies configuration parameters for the applications in the system. + mbj + + + table lock + table lock + +Table locks are locks which are set on whole tables. They may either be read locks or write locks. + hakan + + + Table Visualizer + Table Visualizer + +A tool which enables the user to examine ETS and Mnesia tables. + olin + + + temporary child + temporary child + +A supervised process which is never restarted when it dies. + mbj + + + term + term + +The super type of all Erlang types. + kenneth + + + Toolbar + Toolbar + +A tool that provides an simplistic interface to the other various Erlang/OTP tools + olin + + + tools + tools + +An application within Erlang/OTP which contains the tools which are not applications themselves. + olin + + + transaction + transaction + +Transactions groups a set of database accesses into an atomic unit. All transactions has the ACID (atomicity, concistency, isolation and durability) properties. + hakan + + + transient child + transient child + +A supervised process which is restarted if it dies non-normally. + mbj + + + trigger + trigger + +The Interpreter. A break point that is reached by a process triggers if it is active, and the execution of the process is stopped. + olin + + + tty + tty + +tty is a simple command line interface program where keystrokes are collected and interpreted. Originally meant teletypewriter equipment. Now it usually means the user console/terminal/shell window. + kent + + + tuple + tuple + +A tuple is a data type in Erlang. Tuples are used as place holders for complex data structures. Tuples may contain anything of any size, and are written as sequences of terms separated by commas, and enclosed in curly brackets { }. + kenneth + + + variable + variable + +An alias for a memory position, in which a value can be put. Erlang variables always start with an upper case letter. + kenneth + + + workers + workers + +The lower nodes in a supervision tree. These are the processes that actually performs some real work, e.g. servers. + mbj + + + YECC + YECC + +A LALR-1 parser generator included in Erlang/OTP. It is written in Erlang and generates a parser as an Erlang module. + kenneth + + + diff --git a/system/doc/design_principles/Makefile b/system/doc/design_principles/Makefile new file mode 100644 index 0000000000..b3fe136644 --- /dev/null +++ b/system/doc/design_principles/Makefile @@ -0,0 +1,115 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include $(ERL_TOP)/erts/vsn.mk + +APPLICATION=otp-system-documentation +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/doc/design_principles + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +XML_PART_FILES = part.xml + +include xmlfiles.mk + +XML_CHAPTER_FILES=$(DESIGN_PRINCIPLES_CHAPTER_FILES) + +TOPDOCDIR=.. + +BOOK_FILES = book.xml + +GIF_FILES = \ + note.gif \ + clientserver.gif \ + dist1.gif \ + dist2.gif \ + dist3.gif \ + dist4.gif \ + dist5.gif \ + inclappls.gif \ + sup4.gif \ + sup5.gif \ + sup6.gif + +XML_FILES = \ + $(BOOK_FILES) $(XML_CHAPTER_FILES) \ + $(XML_PART_FILES) + +# ---------------------------------------------------- + +HTML_FILES = \ + $(XML_PART_FILES:%.xml=%.html) + +HTMLDIR = ../html/design_principles + +HTML_UG_FILE = $(HTMLDIR)/users_guide.html + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAGS += +DVIPS_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +$(HTMLDIR)/%.gif: %.gif + $(INSTALL_DATA) $< $@ + +docs: html + +local_docs: PDFDIR=../../pdf + +html: $(HTML_UG_FILE) gifs + +gifs: $(GIF_FILES:%=$(HTMLDIR)/%) + +debug opt: + +clean clean_docs: + rm -rf $(HTMLDIR) + rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f errs core *~ + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_docs_spec: docs +# $(INSTALL_DIR) $(RELEASE_PATH)/pdf +# $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELEASE_PATH)/pdf + $(INSTALL_DIR) $(RELSYSDIR) + $(INSTALL_DATA) $(GIF_FILES) $(HTMLDIR)/*.html \ + $(RELSYSDIR) + + +release_spec: + + diff --git a/system/doc/design_principles/applications.xml b/system/doc/design_principles/applications.xml new file mode 100644 index 0000000000..121c0179c6 --- /dev/null +++ b/system/doc/design_principles/applications.xml @@ -0,0 +1,378 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Applications + + + + + applications.xml +
+ +

This chapter should be read in conjunction with app(4) and + application(3).

+ +
+ Application Concept +

When we have written code implementing some specific + functionality, we might want to make the code into an + application, that is a component that can be started and + stopped as a unit, and which can be re-used in other systems as + well.

+

To do this, we create an + application callback module, where we describe how the application should + be started and stopped.

+

Then, an application specification is needed, which is + put in an application resource file. Among other things, we specify which + modules the application consists of and the name of the callback + module.

+

If we use systools, the Erlang/OTP tools for packaging code + (see Releases), + the code for each application is placed in a separate directory + following a pre-defined directory structure.

+
+ +
+ + Application Callback Module +

How to start and stop the code for the application, i.e. + the supervision tree, is described by two callback functions:

+ +start(StartType, StartArgs) -> {ok, Pid} | {ok, Pid, State} +stop(State) +

start is called when starting the application and should + create the supervision tree by starting the top supervisor. + It is expected to return the pid of the top supervisor and an + optional term State, which defaults to []. This term is + passed as-is to stop.

+

StartType is usually the atom normal. It has other + values only in the case of a takeover or failover, see + Distributed Applications. StartArgs is defined by the key + mod in the application resource file file.

+

stop/1 is called after the application has been + stopped and should do any necessary cleaning up. Note that + the actual stopping of the application, that is the shutdown of + the supervision tree, is handled automatically as described in + Starting and Stopping Applications.

+ +

Example of an application callback module for packaging + the supervision tree from + the Supervisor chapter:

+ +-module(ch_app). +-behaviour(application). + +-export([start/2, stop/1]). + +start(_Type, _Args) -> + ch_sup:start_link(). + +stop(_State) -> + ok. +

A library application, which can not be started or stopped, + does not need any application callback module.

+
+ +
+ + Application Resource File +

To define an application, we create an application specification which is put in an application resource file, or in short .app file:

+ +{application, Application, [Opt1,...,OptN]}. +

Application, an atom, is the name of the application. + The file must be named Application.app.

+

Each Opt is a tuple {Key, Value} which define a + certain property of the application. All keys are optional. + Default values are used for any omitted keys.

+

The contents of a minimal .app file for a library + application libapp looks like this:

+ +{application, libapp, []}. +

The contents of a minimal .app file ch_app.app for + a supervision tree application like ch_app looks like this:

+ +{application, ch_app, + [{mod, {ch_app,[]}}]}. +

The key mod defines the callback module and start + argument of the application, in this case ch_app and + [], respectively. This means that

+ +ch_app:start(normal, []) +

will be called when the application should be started and

+ +ch_app:stop([]) +

will be called when the application has been stopped.

+

When using systools, the Erlang/OTP tools for packaging + code (see Releases), + the keys description, vsn, modules, + registered and applications should also be + specified:

+ +{application, ch_app, + [{description, "Channel allocator"}, + {vsn, "1"}, + {modules, [ch_app, ch_sup, ch3]}, + {registered, [ch3]}, + {applications, [kernel, stdlib, sasl]}, + {mod, {ch_app,[]}} + ]}. + + description + A short description, a string. Defaults to "". + vsn + Version number, a string. Defaults to "". + modules + All modules introduced by this application. + systools uses this list when generating boot scripts and + tar files. A module must be defined in one and only one + application. Defaults to []. + registered + All names of registered processes in the application. + systools uses this list to detect name clashes + between applications. Defaults to []. + applications + All applications which must be started before this + application is started. systools uses this list to + generate correct boot scripts. Defaults to [], but note that + all applications have dependencies to at least kernel + and stdlib. + +

The syntax and contents of of the application resource file + are described in detail in app(4).

+
+ +
+ + Directory Structure +

When packaging code using systools, the code for each + application is placed in a separate directory + lib/Application-Vsn, where Vsn is the version number.

+

This may be useful to know, even if systools is not used, + since Erlang/OTP itself is packaged according to the OTP principles + and thus comes with this directory structure. The code server + (see code(3)) will automatically use code from + the directory with the highest version number, if there are + more than one version of an application present.

+

The application directory structure can of course be used in + the development environment as well. The version number may then + be omitted from the name.

+

The application directory have the following sub-directories:

+ + src + ebin + priv + include + + + src + Contains the Erlang source code. + ebin + Contains the Erlang object code, the beam files. + The .app file is also placed here. + priv + Used for application specific files. For example, C + executables are placed here. The function code:priv_dir/1 + should be used to access this directory. + include + Used for include files. + +
+ +
+ + Application Controller +

When an Erlang runtime system is started, a number of processes + are started as part of the Kernel application. One of these + processes is the application controller process, + registered as application_controller.

+

All operations on applications are coordinated by the application + controller. It is interfaced through the functions in + the module application, see application(3). + In particular, applications can be loaded, unloaded, started and + stopped.

+
+ +
+ Loading and Unloading Applications +

Before an application can be started, it must be loaded. + The application controller reads and stores the information from + the .app file.

+
+1> application:load(ch_app).
+ok
+2> application:loaded_applications().
+[{kernel,"ERTS  CXC 138 10","2.8.1.3"},
+ {stdlib,"ERTS  CXC 138 10","1.11.4.3"},
+ {ch_app,"Channel allocator","1"}]
+

An application that has been stopped, or has never been started, + can be unloaded. The information about the application is + erased from the internal database of the application controller.

+
+3> application:unload(ch_app).
+ok
+4> application:loaded_applications().
+[{kernel,"ERTS  CXC 138 10","2.8.1.3"},
+ {stdlib,"ERTS  CXC 138 10","1.11.4.3"}]
+ +

Loading/unloading an application does not load/unload the code + used by the application. Code loading is done the usual way.

+
+
+ +
+ + Starting and Stopping Applications +

An application is started by calling:

+
+5> application:start(ch_app).
+ok
+6> application:which_applications().
+[{kernel,"ERTS  CXC 138 10","2.8.1.3"},
+ {stdlib,"ERTS  CXC 138 10","1.11.4.3"},
+ {ch_app,"Channel allocator","1"}]
+

If the application is not already loaded, the application + controller will first load it using application:load/1. It + will check the value of the applications key, to ensure + that all applications that should be started before this + application are running.

+ +

The application controller then creates an application master for the application. The application master is + the group leader of all the processes in the application. + The application master starts the application by calling + the application callback function start/2 in the module, + and with the start argument, defined by the mod key in + the .app file.

+

An application is stopped, but not unloaded, by calling:

+
+7> application:stop(ch_app).
+ok
+

The application master stops the application by telling the top + supervisor to shutdown. The top supervisor tells all its child + processes to shutdown etc. and the entire tree is terminated in + reversed start order. The application master then calls + the application callback function stop/1 in the module + defined by the mod key.

+
+ +
+ Configuring an Application +

An application can be configured using configuration parameters. These are a list of {Par, Val} tuples + specified by a key env in the .app file.

+ +{application, ch_app, + [{description, "Channel allocator"}, + {vsn, "1"}, + {modules, [ch_app, ch_sup, ch3]}, + {registered, [ch3]}, + {applications, [kernel, stdlib, sasl]}, + {mod, {ch_app,[]}}, + {env, [{file, "/usr/local/log"}]} + ]}. +

Par should be an atom, Val is any term. + The application can retrieve the value of a configuration + parameter by calling application:get_env(App, Par) or a + number of similar functions, see application(3).

+

Example:

+
+% erl
+Erlang (BEAM) emulator version 5.2.3.6 [hipe] [threads:0]
+
+Eshell V5.2.3.6  (abort with ^G)
+1> application:start(ch_app).
+ok
+2> application:get_env(ch_app, file).
+{ok,"/usr/local/log"}
+

The values in the .app file can be overridden by values + in a system configuration file. This is a file which + contains configuration parameters for relevant applications:

+ +[{Application1, [{Par11,Val11},...]}, + ..., + {ApplicationN, [{ParN1,ValN1},...]}]. +

The system configuration should be called Name.config and + Erlang should be started with the command line argument + -config Name. See config(4) for more information.

+

Example: A file test.config is created with the following + contents:

+ +[{ch_app, [{file, "testlog"}]}]. +

The value of file will override the value of file + as defined in the .app file:

+
+% erl -config test
+Erlang (BEAM) emulator version 5.2.3.6 [hipe] [threads:0]
+
+Eshell V5.2.3.6  (abort with ^G)
+1> application:start(ch_app).
+ok
+2> application:get_env(ch_app, file).
+{ok,"testlog"}
+

If + release handling + is used, exactly one system configuration file should be used and + that file should be called sys.config

+

The values in the .app file, as well as the values in a + system configuration file, can be overridden directly from + the command line:

+
+% erl -ApplName Par1 Val1 ... ParN ValN
+

Example:

+
+% erl -ch_app file '"testlog"'
+Erlang (BEAM) emulator version 5.2.3.6 [hipe] [threads:0]
+
+Eshell V5.2.3.6  (abort with ^G)
+1> application:start(ch_app).
+ok
+2> application:get_env(ch_app, file).
+{ok,"testlog"}
+
+ +
+ Application Start Types +

A start type is defined when starting the application:

+ +application:start(Application, Type) +

application:start(Application) is the same as calling + application:start(Application, temporary). The type can + also be permanent or transient:

+ + If a permanent application terminates, all other + applications and the runtime system are also terminated. + If a transient application terminates with reason + normal, this is reported but no other applications are + terminated. If a transient application terminates abnormally, + that is with any other reason than normal, all other + applications and the runtime system are also terminated. + If a temporary application terminates, this is reported but + no other applications are terminated. + +

It is always possible to stop an application explicitly by + calling application:stop/1. Regardless of the mode, no + other applications will be affected.

+

Note that transient mode is of little practical use, since when + a supervision tree terminates, the reason is set to + shutdown, not normal.

+
+
+ diff --git a/system/doc/design_principles/appup_cookbook.xml b/system/doc/design_principles/appup_cookbook.xml new file mode 100644 index 0000000000..bc61578953 --- /dev/null +++ b/system/doc/design_principles/appup_cookbook.xml @@ -0,0 +1,627 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Appup Cookbook + + + + + appup_cookbook.xml +
+

This chapter contains examples of .appup files for + typical cases of upgrades/downgrades done in run-time.

+ +
+ Changing a Functional Module +

When a change has been made to a functional module, for example + if a new function has been added or a bug has been corrected, + simple code replacement is sufficient.

+

Example:

+ +{"2", + [{"1", [{load_module, m}]}], + [{"1", [{load_module, m}]}] +}. +
+ +
+ Changing a Residence Module +

In a system implemented according to the OTP Design Principles, + all processes, except system processes and special processes, + reside in one of the behaviours supervisor, + gen_server, gen_fsm or gen_event. These + belong to the STDLIB application and upgrading/downgrading + normally requires an emulator restart.

+

OTP thus provides no support for changing residence modules + except in the case of special processes.

+
+ +
+ Changing a Callback Module +

A callback module is a functional module, and for code + extensions simple code replacement is sufficient.

+

Example: When adding a function to ch3 as described in + the example in Release Handling, ch_app.appup looks as follows:

+ +{"2", + [{"1", [{load_module, ch3}]}], + [{"1", [{load_module, ch3}]}] +}. +

OTP also supports changing the internal state of behaviour + processes, see Changing Internal State below.

+
+ +
+ + Changing Internal State +

In this case, simple code replacement is not sufficient. + The process must explicitly transform its state using the callback + function code_change before switching to the new version + of the callback module. Thus synchronized code replacement is + used.

+

Example: Consider the gen_server ch3 from the chapter + about the gen_server behaviour. The internal state is a term Chs + representing the available channels. Assume we want add a counter + N which keeps track of the number of alloc requests + so far. This means we need to change the format to + {Chs,N}.

+

The .appup file could look as follows:

+ +{"2", + [{"1", [{update, ch3, {advanced, []}}]}], + [{"1", [{update, ch3, {advanced, []}}]}] +}. +

The third element of the update instruction is a tuple + {advanced,Extra} which says that the affected processes + should do a state transformation before loading the new version + of the module. This is done by the processes calling the callback + function code_change (see gen_server(3)). The term + Extra, in this case [], is passed as-is to the function:

+ + +-module(ch3). +... +-export([code_change/3]). +... +code_change({down, _Vsn}, {Chs, N}, _Extra) -> + {ok, Chs}; +code_change(_Vsn, Chs, _Extra) -> + {ok, {Chs, 0}}. +

The first argument is {down,Vsn} in case of a downgrade, + or Vsn in case of an upgrade. The term Vsn is + fetched from the 'original' version of the module, i.e. + the version we are upgrading from, or downgrading to.

+

The version is defined by the module attribute vsn, if + any. There is no such attribute in ch3, so in this case + the version is the checksum (a huge integer) of the BEAM file, an + uninteresting value which is ignored.

+

(The other callback functions of ch3 need to be modified + as well and perhaps a new interface function added, this is not + shown here).

+
+ +
+ Module Dependencies +

Assume we extend a module by adding a new interface function, as + in the example in Release Handling, where a function available/0 is + added to ch3.

+

If we also add a call to this function, say in the module + m1, a run-time error could occur during release upgrade if + the new version of m1 is loaded first and calls + ch3:available/0 before the new version of ch3 is + loaded.

+

Thus, ch3 must be loaded before m1 is, in + the upgrade case, and vice versa in the downgrade case. We say + that m1is dependent onch3. In a release + handling instruction, this is expressed by the element + DepMods:

+ +{load_module, Module, DepMods} +{update, Module, {advanced, Extra}, DepMods} +

DepMods is a list of modules, on which Module is + dependent.

+

Example: The module m1 in the application myapp is + dependent on ch3 when upgrading from "1" to "2", or + downgrading from "2" to "1":

+ +myapp.appup: + +{"2", + [{"1", [{load_module, m1, [ch3]}]}], + [{"1", [{load_module, m1, [ch3]}]}] +}. + +ch_app.appup: + +{"2", + [{"1", [{load_module, ch3}]}], + [{"1", [{load_module, ch3}]}] +}. +

If m1 and ch3 had belonged to the same application, + the .appup file could have looked like this:

+ +{"2", + [{"1", + [{load_module, ch3}, + {load_module, m1, [ch3]}]}], + [{"1", + [{load_module, ch3}, + {load_module, m1, [ch3]}]}] +}. +

Note that it is m1 that is dependent on ch3 also + when downgrading. systools knows the difference between + up- and downgrading and will generate a correct relup, + where ch3 is loaded before m1 when upgrading but + m1 is loaded before ch3 when downgrading.

+
+ +
+ + Changing Code For a Special Process +

In this case, simple code replacement is not sufficient. + When a new version of a residence module for a special process + is loaded, the process must make a fully qualified call to + its loop function to switch to the new code. Thus synchronized + code replacement must be used.

+ +

The name(s) of the user-defined residence module(s) must be + listed in the Modules part of the child specification + for the special process, in order for the release handler to + find the process.

+
+

Example. Consider the example ch4 from the chapter about + sys and proc_lib. + When started by a supervisor, the child specification could look + like this:

+ +{ch4, {ch4, start_link, []}, + permanent, brutal_kill, worker, [ch4]} +

If ch4 is part of the application sp_app and a new + version of the module should be loaded when upgrading from + version "1" to "2" of this application, sp_app.appup could + look like this:

+ +{"2", + [{"1", [{update, ch4, {advanced, []}}]}], + [{"1", [{update, ch4, {advanced, []}}]}] +}. +

The update instruction must contain the tuple + {advanced,Extra}. The instruction will make the special + process call the callback function system_code_change/4, a + function the user must implement. The term Extra, in this + case [], is passed as-is to system_code_change/4:

+ +-module(ch4). +... +-export([system_code_change/4]). +... + +system_code_change(Chs, _Module, _OldVsn, _Extra) -> + {ok, Chs}. +

The first argument is the internal state State passed from + the function sys:handle_system_msg(Request, From, Parent, Module, Deb, State), called by the special process when + a system message is received. In ch4, the internal state is + the set of available channels Chs.

+

The second argument is the name of the module (ch4).

+

The third argument is Vsn or {down,Vsn} as + described for + gen_server:code_change/3.

+

In this case, all arguments but the first are ignored and + the function simply returns the internal state again. This is + enough if the code only has been extended. If we had wanted to + change the internal state (similar to the example in + Changing Internal State), + it would have been done in this function and + {ok,Chs2} returned.

+
+ +
+ + Changing a Supervisor +

The supervisor behaviour supports changing the internal state, + i.e. changing restart strategy and maximum restart frequency + properties, as well as changing existing child specifications.

+

Adding and deleting child processes are also possible, but not + handled automatically. Instructions must be given by in + the .appup file.

+ +
+ Changing Properties +

Since the supervisor should change its internal state, + synchronized code replacement is required. However, + a special update instruction must be used.

+

The new version of the callback module must be loaded first + both in the case of upgrade and downgrade. Then the new return + value of init/1 can be checked and the internal state be + changed accordingly.

+

The following upgrade instruction is used for + supervisors:

+ +{update, Module, supervisor} +

Example: Assume we want to change the restart strategy of + ch_sup from the Supervisor Behaviour chapter from one_for_one to one_for_all. + We change the callback function init/1 in + ch_sup.erl:

+ +-module(ch_sup). +... + +init(_Args) -> + {ok, {{one_for_all, 1, 60}, ...}}. +

The file ch_app.appup:

+ +{"2", + [{"1", [{update, ch_sup, supervisor}]}], + [{"1", [{update, ch_sup, supervisor}]}] +}. +
+ +
+ Changing Child Specifications +

The instruction, and thus the .appup file, when + changing an existing child specification, is the same as when + changing properties as described above:

+ +{"2", + [{"1", [{update, ch_sup, supervisor}]}], + [{"1", [{update, ch_sup, supervisor}]}] +}. +

The changes do not affect existing child processes. For + example, changing the start function only specifies how + the child process should be restarted, if needed later on.

+

Note that the id of the child specification cannot be changed.

+

Note also that changing the Modules field of the child + specification may affect the release handling process itself, + as this field is used to identify which processes are affected + when doing a synchronized code replacement.

+
+ + +
+ Adding And Deleting Child Processes +

As stated above, changing child specifications does not affect + existing child processes. New child specifications are + automatically added, but not deleted. Also, child processes are + not automatically started or terminated. Instead, this must be + done explicitly using apply instructions.

+

Example: Assume we want to add a new child process m1 to + ch_sup when upgrading ch_app from "1" to "2". + This means m1 should be deleted when downgrading from + "2" to "1":

+ +{"2", + [{"1", + [{update, ch_sup, supervisor}, + {apply, {supervisor, restart_child, [ch_sup, m1]}} + ]}], + [{"1", + [{apply, {supervisor, terminate_child, [ch_sup, m1]}}, + {apply, {supervisor, delete_child, [ch_sup, m1]}}, + {update, ch_sup, supervisor} + ]}] +}. +

Note that the order of the instructions is important.

+

Note also that the supervisor must be registered as + ch_sup for the script to work. If the supervisor is not + registered, it cannot be accessed directly from the script. + Instead a help function that finds the pid of the supervisor + and calls supervisor:restart_child etc. must be written, + and it is this function that should be called from the script + using the apply instruction.

+

If the module m1 is introduced in version "2" of + ch_app, it must also be loaded when upgrading and + deleted when downgrading:

+ +{"2", + [{"1", + [{add_module, m1}, + {update, ch_sup, supervisor}, + {apply, {supervisor, restart_child, [ch_sup, m1]}} + ]}], + [{"1", + [{apply, {supervisor, terminate_child, [ch_sup, m1]}}, + {apply, {supervisor, delete_child, [ch_sup, m1]}}, + {update, ch_sup, supervisor}, + {delete_module, m1} + ]}] +}. +

Note again that the order of the instructions is important. + When upgrading, m1 must be loaded and the supervisor's + child specification changed, before the new child process can + be started. When downgrading, the child process must be + terminated before child specification is changed and the module + is deleted.

+
+
+ +
+ Adding or Deleting a Module +

Example: A new functional module m is added to + ch_app:

+ +{"2", + [{"1", [{add_module, m}]}], + [{"1", [{delete_module, m}]}] +
+ +
+ Starting or Terminating a Process +

In a system structured according to the OTP design principles, + any process would be a child process belonging to a supervisor, + see Adding and Deleting Child Processes above.

+
+ +
+ Adding or Removing an Application +

When adding or removing an application, no .appup file + is needed. When generating relup, the .rel files + are compared and add_application and + remove_application instructions are added automatically.

+
+ +
+ Restarting an Application +

Restarting an application is useful when a change is too + complicated to be made without restarting the processes, for + example if the supervisor hierarchy has been restructured.

+

Example: When adding a new child m1 to ch_sup, as + in the example above, an + alternative to updating the supervisor is to restart the entire + application:

+ +{"2", + [{"1", [{restart_application, ch_app}]}], + [{"1", [{restart_application, ch_app}]}] +}. +
+ +
+ + Changing an Application Specification +

When installing a release, the application specifications are + automatically updated before evaluating the relup script. + Hence, no instructions are needed in the .appup file:

+
+{"2",
+ [{"1", []}],
+ [{"1", []}]
+}.
+
+ +
+ Changing Application Configuration +

Changing an application configuration by updating the env + key in the .app file is an instance of changing an + application specification, see above.

+

Alternatively, application configuration parameters can be + added or updated in sys.config.

+
+ +
+ Changing Included Applications +

The release handling instructions for adding, removing and + restarting applications apply to primary applications only. + There are no corresponding instructions for included + applications. However, since an included application is really a + supervision tree with a topmost supervisor, started as a child + process to a supervisor in the including application, a + relup file can be manually created.

+

Example: Assume we have a release containing an application + prim_app which have a supervisor prim_sup in its + supervision tree.

+

In a new version of the release, our example application + ch_app should be included in prim_app. That is, + its topmost supervisor ch_sup should be started as a child + process to prim_sup.

+

1) Edit the code for prim_sup:

+ +init(...) -> + {ok, {...supervisor flags..., + [..., + {ch_sup, {ch_sup,start_link,[]}, + permanent,infinity,supervisor,[ch_sup]}, + ...]}}. +

2) Edit the .app file for prim_app:

+ +{application, prim_app, + [..., + {vsn, "2"}, + ..., + {included_applications, [ch_app]}, + ... + ]}. +

3) Create a new .rel file, including ch_app:

+ +{release, + ..., + [..., + {prim_app, "2"}, + {ch_app, "1"}]}. + +
+ Application Restart +

4a) One way to start the included application is to restart + the entire prim_app application. Normally, we would then + use the restart_application instruction in + the .appup file for prim_app.

+

However, if we did this and then generated a relup file, + not only would it contain instructions for restarting (i.e. + removing and adding) prim_app, it would also contain + instructions for starting ch_app (and stopping it, in + the case of downgrade). This is due to the fact that + ch_app is included in the new .rel file, but not + in the old one.

+

Instead, a correct relup file can be created manually, + either from scratch or by editing the generated version. + The instructions for starting/stopping ch_app are + replaced by instructions for loading/unloading the application:

+ +{"B", + [{"A", + [], + [{load_object_code,{ch_app,"1",[ch_sup,ch3]}}, + {load_object_code,{prim_app,"2",[prim_app,prim_sup]}}, + point_of_no_return, + {apply,{application,stop,[prim_app]}}, + {remove,{prim_app,brutal_purge,brutal_purge}}, + {remove,{prim_sup,brutal_purge,brutal_purge}}, + {purge,[prim_app,prim_sup]}, + {load,{prim_app,brutal_purge,brutal_purge}}, + {load,{prim_sup,brutal_purge,brutal_purge}}, + {load,{ch_sup,brutal_purge,brutal_purge}}, + {load,{ch3,brutal_purge,brutal_purge}}, + {apply,{application,load,[ch_app]}}, + {apply,{application,start,[prim_app,permanent]}}]}], + [{"A", + [], + [{load_object_code,{prim_app,"1",[prim_app,prim_sup]}}, + point_of_no_return, + {apply,{application,stop,[prim_app]}}, + {apply,{application,unload,[ch_app]}}, + {remove,{ch_sup,brutal_purge,brutal_purge}}, + {remove,{ch3,brutal_purge,brutal_purge}}, + {purge,[ch_sup,ch3]}, + {remove,{prim_app,brutal_purge,brutal_purge}}, + {remove,{prim_sup,brutal_purge,brutal_purge}}, + {purge,[prim_app,prim_sup]}, + {load,{prim_app,brutal_purge,brutal_purge}}, + {load,{prim_sup,brutal_purge,brutal_purge}}, + {apply,{application,start,[prim_app,permanent]}}]}] +}. +
+ +
+ Supervisor Change +

4b) Another way to start the included application (or stop it + in the case of downgrade) is by combining instructions for + adding and removing child processes to/from prim_sup with + instructions for loading/unloading all ch_app code and + its application specification.

+

Again, the relup file is created manually. Either from + scratch or by editing a generated version. Load all code for + ch_app first, and also load the application + specification, before prim_sup is updated. When + downgrading, prim_sup should be updated first, before + the code for ch_app and its application specification + are unloaded.

+ +{"B", + [{"A", + [], + [{load_object_code,{ch_app,"1",[ch_sup,ch3]}}, + {load_object_code,{prim_app,"2",[prim_sup]}}, + point_of_no_return, + {load,{ch_sup,brutal_purge,brutal_purge}}, + {load,{ch3,brutal_purge,brutal_purge}}, + {apply,{application,load,[ch_app]}}, + {suspend,[prim_sup]}, + {load,{prim_sup,brutal_purge,brutal_purge}}, + {code_change,up,[{prim_sup,[]}]}, + {resume,[prim_sup]}, + {apply,{supervisor,restart_child,[prim_sup,ch_sup]}}]}], + [{"A", + [], + [{load_object_code,{prim_app,"1",[prim_sup]}}, + point_of_no_return, + {apply,{supervisor,terminate_child,[prim_sup,ch_sup]}}, + {apply,{supervisor,delete_child,[prim_sup,ch_sup]}}, + {suspend,[prim_sup]}, + {load,{prim_sup,brutal_purge,brutal_purge}}, + {code_change,down,[{prim_sup,[]}]}, + {resume,[prim_sup]}, + {remove,{ch_sup,brutal_purge,brutal_purge}}, + {remove,{ch3,brutal_purge,brutal_purge}}, + {purge,[ch_sup,ch3]}, + {apply,{application,unload,[ch_app]}}]}] +}. +
+
+ +
+ Changing Non-Erlang Code +

Changing code for a program written in another programming + language than Erlang, for example a port program, is very + application dependent and OTP provides no special support for it.

+

Example, changing code for a port program: Assume that + the Erlang process controlling the port is a gen_server + portc and that the port is opened in the callback function + init/1:

+ +init(...) -> + ..., + PortPrg = filename:join(code:priv_dir(App), "portc"), + Port = open_port({spawn,PortPrg}, [...]), + ..., + {ok, #state{port=Port, ...}}. +

If the port program should be updated, we can extend the code for + the gen_server with a code_change function which closes + the old port and opens a new port. (If necessary, the gen_server + may first request data that needs to be saved from the port + program and pass this data to the new port):

+ +code_change(_OldVsn, State, port) -> + State#state.port ! close, + receive + {Port,close} -> + true + end, + PortPrg = filename:join(code:priv_dir(App), "portc"), + Port = open_port({spawn,PortPrg}, [...]), + {ok, #state{port=Port, ...}}. +

Update the application version number in the .app file + and write an .appup file:

+ +["2", + [{"1", [{update, portc, {advanced,port}}]}], + [{"1", [{update, portc, {advanced,port}}]}] +]. +

Make sure the priv directory where the C program is + located is included in the new release package:

+
+1> systools:make_tar("my_release", [{dirs,[priv]}]).
+...
+
+ +
+ Emulator Restart +

If the emulator can or should be restarted, the very simple + .relup file can be created manually:

+ +{"B", + [{"A", + [], + [restart_new_emulator]}], + [{"A", + [], + [restart_new_emulator]}] +}. +

This way, the release handler framework with automatic packing + and unpacking of release packages, automatic path updates etc. can + be used without having to specify .appup files.

+

If some transformation of persistent data, for example database + contents, needs to be done before installing the new release + version, instructions for this can be added to the .relup + file as well.

+
+
+ diff --git a/system/doc/design_principles/book.xml b/system/doc/design_principles/book.xml new file mode 100644 index 0000000000..615722ac12 --- /dev/null +++ b/system/doc/design_principles/book.xml @@ -0,0 +1,42 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + OTP Design Principles + + + + +
+ + + OTP Design Principles + + + + + + + + +
+ diff --git a/system/doc/design_principles/clientserver.fig b/system/doc/design_principles/clientserver.fig new file mode 100644 index 0000000000..5854169ced --- /dev/null +++ b/system/doc/design_principles/clientserver.fig @@ -0,0 +1,40 @@ +#FIG 3.1 +Landscape +Center +Inches +1200 2 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 3150 750 404 404 3150 750 3300 1125 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 2175 2025 404 404 2175 2025 2325 2400 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 1650 3525 404 404 1650 3525 1800 3900 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 5025 2925 404 404 5025 2925 5175 3300 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 3375 1275 4575 2550 +2 1 1 1 -1 7 0 0 -1 4.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 4725 2325 3600 1125 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 2550 2400 4275 2925 +2 1 1 1 -1 7 0 0 -1 4.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 4275 2700 2700 2175 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 2175 3300 4125 3150 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1 + 3975 3300 +2 1 1 1 -1 7 0 0 -1 4.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 4050 3300 2250 3450 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 5475 525 7050 525 +2 1 1 1 -1 7 0 0 -1 4.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 6975 1125 5550 1125 +4 0 -1 0 0 2 14 0.0000 4 150 645 5700 3075 Server\001 +4 0 -1 0 0 2 14 0.0000 4 150 675 900 1200 Clients\001 +4 0 -1 0 0 2 14 0.0000 4 195 570 5850 300 Query\001 +4 0 -1 0 0 2 14 0.0000 4 195 570 5850 975 Reply\001 +4 0 -1 0 0 2 14 0.0000 4 150 2370 2400 4500 The Client-server model\001 diff --git a/system/doc/design_principles/clientserver.gif b/system/doc/design_principles/clientserver.gif new file mode 100644 index 0000000000..371ece4c12 Binary files /dev/null and b/system/doc/design_principles/clientserver.gif differ diff --git a/system/doc/design_principles/clientserver.ps b/system/doc/design_principles/clientserver.ps new file mode 100644 index 0000000000..7e4e98152e --- /dev/null +++ b/system/doc/design_principles/clientserver.ps @@ -0,0 +1,199 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: clientserver.fig +%%Creator: fig2dev Version 3.1 Patchlevel 2 +%%CreationDate: Thu May 15 12:48:28 1997 +%%For: jocke@akvavit (Joakim Greben|,ETX/B/DUP) +%Magnification: 1.00 +%%Orientation: Portrait +%%BoundingBox: 0 0 370 264 +%%Pages: 0 +%%BeginSetup +%%IncludeFeature: *PageSize A4 +%%EndSetup +%%EndComments +/$F2psDict 200 dict def +$F2psDict begin +$F2psDict /mtrx matrix put +/col-1 {0 setgray} bind def +/col0 {0.000 0.000 0.000 srgb} bind def +/col1 {0.000 0.000 1.000 srgb} bind def +/col2 {0.000 1.000 0.000 srgb} bind def +/col3 {0.000 1.000 1.000 srgb} bind def +/col4 {1.000 0.000 0.000 srgb} bind def +/col5 {1.000 0.000 1.000 srgb} bind def +/col6 {1.000 1.000 0.000 srgb} bind def +/col7 {1.000 1.000 1.000 srgb} bind def +/col8 {0.000 0.000 0.560 srgb} bind def +/col9 {0.000 0.000 0.690 srgb} bind def +/col10 {0.000 0.000 0.820 srgb} bind def +/col11 {0.530 0.810 1.000 srgb} bind def +/col12 {0.000 0.560 0.000 srgb} bind def +/col13 {0.000 0.690 0.000 srgb} bind def +/col14 {0.000 0.820 0.000 srgb} bind def +/col15 {0.000 0.560 0.560 srgb} bind def +/col16 {0.000 0.690 0.690 srgb} bind def +/col17 {0.000 0.820 0.820 srgb} bind def +/col18 {0.560 0.000 0.000 srgb} bind def +/col19 {0.690 0.000 0.000 srgb} bind def +/col20 {0.820 0.000 0.000 srgb} bind def +/col21 {0.560 0.000 0.560 srgb} bind def +/col22 {0.690 0.000 0.690 srgb} bind def +/col23 {0.820 0.000 0.820 srgb} bind def +/col24 {0.500 0.190 0.000 srgb} bind def +/col25 {0.630 0.250 0.000 srgb} bind def +/col26 {0.750 0.380 0.000 srgb} bind def +/col27 {1.000 0.500 0.500 srgb} bind def +/col28 {1.000 0.630 0.630 srgb} bind def +/col29 {1.000 0.750 0.750 srgb} bind def +/col30 {1.000 0.880 0.880 srgb} bind def +/col31 {1.000 0.840 0.000 srgb} bind def + +end +save +-54.0 272.0 translate +1 -1 scale + +/cp {closepath} bind def +/ef {eofill} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth} bind def +/tr {translate} bind def +/tnt {dup dup currentrgbcolor + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} + bind def +/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul + 4 -2 roll mul srgb} bind def + /DrawEllipse { + /endangle exch def + /startangle exch def + /yrad exch def + /xrad exch def + /y exch def + /x exch def + /savematrix mtrx currentmatrix def + x y tr xrad yrad sc 0 0 1 startangle endangle arc + closepath + savematrix setmatrix + } def + +/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def +/$F2psEnd {$F2psEnteredState restore end} def +%%EndProlog + +$F2psBegin +10 setmiterlimit +n 0 842 m 0 0 l 595 0 l 595 842 l cp clip + 0.06000 0.06000 sc +7.500 slw +% Ellipse +n 3150 750 404 404 0 360 DrawEllipse gs col-1 s gr + +% Ellipse +n 2175 2025 404 404 0 360 DrawEllipse gs col-1 s gr + +% Ellipse +n 1650 3525 404 404 0 360 DrawEllipse gs col-1 s gr + +% Ellipse +n 5025 2925 404 404 0 360 DrawEllipse gs col-1 s gr + +% Polyline +gs clippath +4496 2422 m 4556 2530 l 4452 2464 l 4563 2581 l 4607 2540 l cp clip +n 3375 1275 m 4575 2550 l gs col-1 s gr gr + +% arrowhead +n 4496 2422 m 4556 2530 l 4452 2464 l 4474 2443 l 4496 2422 l cp gs 0.00 setgray ef gr col-1 s +% Polyline + [66.7] 0 sd +gs clippath +3679 1253 m 3618 1144 l 3722 1212 l 3612 1094 l 3568 1135 l cp clip +n 4725 2325 m 3600 1125 l gs col-1 s gr gr + [] 0 sd +% arrowhead +n 3679 1253 m 3618 1144 l 3722 1212 l 3701 1232 l 3679 1253 l cp gs 0.00 setgray ef gr col-1 s +% Polyline +gs clippath +4143 2853 m 4249 2917 l 4126 2911 l 4281 2958 l 4298 2901 l cp clip +n 2550 2400 m 4275 2925 l gs col-1 s gr gr + +% arrowhead +n 4143 2853 m 4249 2917 l 4126 2911 l 4134 2882 l 4143 2853 l cp gs 0.00 setgray ef gr col-1 s +% Polyline + [66.7] 0 sd +gs clippath +2830 2250 m 2725 2183 l 2849 2193 l 2695 2142 l 2676 2199 l cp clip +n 4275 2700 m 2700 2175 l gs col-1 s gr gr + [] 0 sd +% arrowhead +n 2830 2250 m 2725 2183 l 2849 2193 l 2839 2221 l 2830 2250 l cp gs 0.00 setgray ef gr col-1 s +% Polyline +gs clippath +3976 3131 m 4098 3152 l 3981 3191 l 4142 3179 l 4138 3119 l cp clip +n 2175 3300 m 4125 3150 l gs col-1 s gr gr + +% arrowhead +n 3976 3131 m 4098 3152 l 3981 3191 l 3978 3161 l 3976 3131 l cp gs 0.00 setgray ef gr col-1 s +% Polyline +n 3975 3300 m 3975 3300 l gs col-1 s gr +% Polyline + [66.7] 0 sd +gs clippath +2399 3468 m 2276 3447 l 2394 3408 l 2233 3421 l 2238 3481 l cp clip +n 4050 3300 m 2250 3450 l gs col-1 s gr gr + [] 0 sd +% arrowhead +n 2399 3468 m 2276 3447 l 2394 3408 l 2396 3438 l 2399 3468 l cp gs 0.00 setgray ef gr col-1 s +% Polyline +gs clippath +6903 495 m 7023 525 l 6903 555 l 7065 555 l 7065 495 l cp clip +n 5475 525 m 7050 525 l gs col-1 s gr gr + +% arrowhead +n 6903 495 m 7023 525 l 6903 555 l 6903 525 l 6903 495 l cp gs 0.00 setgray ef gr col-1 s +% Polyline + [66.7] 0 sd +gs clippath +5697 1155 m 5577 1125 l 5697 1095 l 5535 1095 l 5535 1155 l cp clip +n 6975 1125 m 5550 1125 l gs col-1 s gr gr + [] 0 sd +% arrowhead +n 5697 1155 m 5577 1125 l 5697 1095 l 5697 1125 l 5697 1155 l cp gs 0.00 setgray ef gr col-1 s +/Times-Bold ff 210.00 scf sf +5700 3075 m +gs 1 -1 sc (Server) col-1 sh gr +/Times-Bold ff 210.00 scf sf +900 1200 m +gs 1 -1 sc (Clients) col-1 sh gr +/Times-Bold ff 210.00 scf sf +5850 300 m +gs 1 -1 sc (Query) col-1 sh gr +/Times-Bold ff 210.00 scf sf +5850 975 m +gs 1 -1 sc (Reply) col-1 sh gr +/Times-Bold ff 210.00 scf sf +2400 4500 m +gs 1 -1 sc (The Client-server model) col-1 sh gr +$F2psEnd +rs diff --git a/system/doc/design_principles/des_princ.xml b/system/doc/design_principles/des_princ.xml new file mode 100644 index 0000000000..977eda49b5 --- /dev/null +++ b/system/doc/design_principles/des_princ.xml @@ -0,0 +1,285 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Overview + + + + + des_princ.xml +
+

The OTP Design Principles is a set of principles for how + to structure Erlang code in terms of processes, modules and + directories.

+ +
+ Supervision Trees +

A basic concept in Erlang/OTP is the supervision tree. + This is a process structuring model based on the idea of + workers and supervisors.

+ + Workers are processes which perform computations, that is, + they do the actual work. + Supervisors are processes which monitor the behaviour of + workers. A supervisor can restart a worker if something goes + wrong. + The supervision tree is a hierarchical arrangement of + code into supervisors and workers, making it possible to + design and program fault-tolerant software. + + + + Supervision Tree + +

In the figure above, square boxes represents supervisors and + circles represent workers.

+
+ +
+ Behaviours +

In a supervision tree, many of the processes have similar + structures, they follow similar patterns. For example, + the supervisors are very similar in structure. The only difference + between them is which child processes they supervise. Also, many + of the workers are servers in a server-client relation, finite + state machines, or event handlers such as error loggers.

+

Behaviours are formalizations of these common patterns. + The idea is to divide the code for a process in a generic part + (a behaviour module) and a specific part (a callback module).

+

The behaviour module is part of Erlang/OTP. To implement a + process such as a supervisor, the user only has to implement + the callback module which should export a pre-defined set of + functions, the callback functions.

+

An example to illustrate how code can be divided into a generic + and a specific part: Consider the following code (written in + plain Erlang) for a simple server, which keeps track of a number + of "channels". Other processes can allocate and free the channels + by calling the functions alloc/0 and free/1, + respectively.

+ + +-module(ch1). +-export([start/0]). +-export([alloc/0, free/1]). +-export([init/0]). + +start() -> + spawn(ch1, init, []). + +alloc() -> + ch1 ! {self(), alloc}, + receive + {ch1, Res} -> + Res + end. + +free(Ch) -> + ch1 ! {free, Ch}, + ok. + +init() -> + register(ch1, self()), + Chs = channels(), + loop(Chs). + +loop(Chs) -> + receive + {From, alloc} -> + {Ch, Chs2} = alloc(Chs), + From ! {ch1, Ch}, + loop(Chs2); + {free, Ch} -> + Chs2 = free(Ch, Chs), + loop(Chs2) + end. +

The code for the server can be rewritten into a generic part + server.erl:

+ +-module(server). +-export([start/1]). +-export([call/2, cast/2]). +-export([init/1]). + +start(Mod) -> + spawn(server, init, [Mod]). + +call(Name, Req) -> + Name ! {call, self(), Req}, + receive + {Name, Res} -> + Res + end. + +cast(Name, Req) -> + Name ! {cast, Req}, + ok. + +init(Mod) -> + register(Mod, self()), + State = Mod:init(), + loop(Mod, State). + +loop(Mod, State) -> + receive + {call, From, Req} -> + {Res, State2} = Mod:handle_call(Req, State), + From ! {Mod, Res}, + loop(Mod, State2); + {cast, Req} -> + State2 = Mod:handle_cast(Req, State), + loop(Mod, State2) + end. +

and a callback module ch2.erl:

+ +-module(ch2). +-export([start/0]). +-export([alloc/0, free/1]). +-export([init/0, handle_call/2, handle_cast/2]). + +start() -> + server:start(ch2). + +alloc() -> + server:call(ch2, alloc). + +free(Ch) -> + server:cast(ch2, {free, Ch}). + +init() -> + channels(). + +handle_call(alloc, Chs) -> + alloc(Chs). % => {Ch,Chs2} + +handle_cast({free, Ch}, Chs) -> + free(Ch, Chs). % => Chs2 +

Note the following:

+ + The code in server can be re-used to build many + different servers. + The name of the server, in this example the atom + ch2, is hidden from the users of the client functions. + This means the name can be changed without affecting them. + The protcol (messages sent to and received from the server) + is hidden as well. This is good programming practice and allows + us to change the protocol without making changes to code using + the interface functions. + We can extend the functionality of server, without + having to change ch2 or any other callback module. + +

(In ch1.erl and ch2.erl above, the implementation + of channels/0, alloc/1 and free/2 has been + intentionally left out, as it is not relevant to the example. + For completeness, one way to write these functions are given + below. Note that this is an example only, a realistic + implementation must be able to handle situations like running out + of channels to allocate etc.)

+ +channels() -> + {_Allocated = [], _Free = lists:seq(1,100)}. + +alloc({Allocated, [H|T] = _Free}) -> + {H, {[H|Allocated], T}}. + +free(Ch, {Alloc, Free} = Channels) -> + case lists:member(Ch, Alloc) of + true -> + {lists:delete(Ch, Alloc), [Ch|Free]}; + false -> + Channels + end. +

Code written without making use of behaviours may be more + efficient, but the increased efficiency will be at the expense of + generality. The ability to manage all applications in the system + in a consistent manner is very important.

+

Using behaviours also makes it easier to read and understand + code written by other programmers. Ad hoc programming structures, + while possibly more efficient, are always more difficult to + understand.

+

The module server corresponds, greatly simplified, + to the Erlang/OTP behaviour gen_server.

+

The standard Erlang/OTP behaviours are:

+ + gen_server + For implementing the server of a client-server relation. + gen_fsm + For implementing finite state machines. + gen_event + For implementing event handling functionality. + supervisor + For implementing a supervisor in a supervision tree. + +

The compiler understands the module attribute + -behaviour(Behaviour) and issues warnings about + missing callback functions. Example:

+ +-module(chs3). +-behaviour(gen_server). +... + +3> c(chs3). +./chs3.erl:10: Warning: undefined call-back function handle_call/3 +{ok,chs3} +
+ +
+ Applications +

Erlang/OTP comes with a number of components, each implementing + some specific functionality. Components are with Erlang/OTP + terminology called applications. Examples of Erlang/OTP + applications are Mnesia, which has everything needed for + programming database services, and Debugger which is used to + debug Erlang programs. The minimal system based on Erlang/OTP + consists of the applications Kernel and STDLIB.

+

The application concept applies both to program structure + (processes) and directory structure (modules).

+

The simplest kind of application does not have any processes, + but consists of a collection of functional modules. Such an + application is called a library application. An example + of a library application is STDLIB.

+

An application with processes is easiest implemented as a + supervision tree using the standard behaviours.

+

How to program applications is described in + Applications.

+
+ +
+ Releases +

A release is a complete system made out from a subset of + the Erlang/OTP applications and a set of user-specific + applications.

+

How to program releases is described in + Releases.

+

How to install a release in a target environment is described + in the chapter about Target Systems in System Principles.

+
+ +
+ Release Handling +

Release handling is upgrading and downgrading between + different versions of a release, in a (possibly) running system. + How to do this is described in + Release Handling.

+
+
+ diff --git a/system/doc/design_principles/dist1.fig b/system/doc/design_principles/dist1.fig new file mode 100644 index 0000000000..ffdb112d71 --- /dev/null +++ b/system/doc/design_principles/dist1.fig @@ -0,0 +1,20 @@ +#FIG 3.1 +Landscape +Center +Inches +1200 2 +6 2025 525 2775 1275 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 2400 900 318 318 2400 900 2625 1125 +4 0 -1 0 0 0 12 0.0000 4 180 255 2272 945 cp2\001 +-6 +6 3375 525 4125 1275 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 3750 900 318 318 3750 900 3975 1125 +4 0 -1 0 0 0 12 0.0000 4 180 255 3622 945 cp3\001 +-6 +6 675 525 1425 1575 +6 675 525 1425 1275 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 1050 900 318 318 1050 900 1275 1125 +4 0 -1 0 0 0 12 0.0000 4 180 255 922 945 cp1\001 +-6 +4 0 -1 0 0 0 12 0.0000 4 135 480 810 1500 myapp\001 +-6 diff --git a/system/doc/design_principles/dist1.gif b/system/doc/design_principles/dist1.gif new file mode 100644 index 0000000000..b2cde85841 Binary files /dev/null and b/system/doc/design_principles/dist1.gif differ diff --git a/system/doc/design_principles/dist1.ps b/system/doc/design_principles/dist1.ps new file mode 100644 index 0000000000..3b841d2cd4 --- /dev/null +++ b/system/doc/design_principles/dist1.ps @@ -0,0 +1,131 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: dist1.fig +%%Creator: fig2dev Version 3.1 Patchlevel 2 +%%CreationDate: Thu May 15 13:13:44 1997 +%%For: jocke@akvavit (Joakim Greben|,ETX/B/DUP) +%Magnification: 1.00 +%%Orientation: Portrait +%%BoundingBox: 0 0 202 58 +%%Pages: 0 +%%BeginSetup +%%IncludeFeature: *PageSize A4 +%%EndSetup +%%EndComments +/$F2psDict 200 dict def +$F2psDict begin +$F2psDict /mtrx matrix put +/col-1 {0 setgray} bind def +/col0 {0.000 0.000 0.000 srgb} bind def +/col1 {0.000 0.000 1.000 srgb} bind def +/col2 {0.000 1.000 0.000 srgb} bind def +/col3 {0.000 1.000 1.000 srgb} bind def +/col4 {1.000 0.000 0.000 srgb} bind def +/col5 {1.000 0.000 1.000 srgb} bind def +/col6 {1.000 1.000 0.000 srgb} bind def +/col7 {1.000 1.000 1.000 srgb} bind def +/col8 {0.000 0.000 0.560 srgb} bind def +/col9 {0.000 0.000 0.690 srgb} bind def +/col10 {0.000 0.000 0.820 srgb} bind def +/col11 {0.530 0.810 1.000 srgb} bind def +/col12 {0.000 0.560 0.000 srgb} bind def +/col13 {0.000 0.690 0.000 srgb} bind def +/col14 {0.000 0.820 0.000 srgb} bind def +/col15 {0.000 0.560 0.560 srgb} bind def +/col16 {0.000 0.690 0.690 srgb} bind def +/col17 {0.000 0.820 0.820 srgb} bind def +/col18 {0.560 0.000 0.000 srgb} bind def +/col19 {0.690 0.000 0.000 srgb} bind def +/col20 {0.820 0.000 0.000 srgb} bind def +/col21 {0.560 0.000 0.560 srgb} bind def +/col22 {0.690 0.000 0.690 srgb} bind def +/col23 {0.820 0.000 0.820 srgb} bind def +/col24 {0.500 0.190 0.000 srgb} bind def +/col25 {0.630 0.250 0.000 srgb} bind def +/col26 {0.750 0.380 0.000 srgb} bind def +/col27 {1.000 0.500 0.500 srgb} bind def +/col28 {1.000 0.630 0.630 srgb} bind def +/col29 {1.000 0.750 0.750 srgb} bind def +/col30 {1.000 0.880 0.880 srgb} bind def +/col31 {1.000 0.840 0.000 srgb} bind def + +end +save +-43.0 92.0 translate +1 -1 scale + +/cp {closepath} bind def +/ef {eofill} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth} bind def +/tr {translate} bind def +/tnt {dup dup currentrgbcolor + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} + bind def +/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul + 4 -2 roll mul srgb} bind def + /DrawEllipse { + /endangle exch def + /startangle exch def + /yrad exch def + /xrad exch def + /y exch def + /x exch def + /savematrix mtrx currentmatrix def + x y tr xrad yrad sc 0 0 1 startangle endangle arc + closepath + savematrix setmatrix + } def + +/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def +/$F2psEnd {$F2psEnteredState restore end} def +%%EndProlog + +$F2psBegin +10 setmiterlimit +n 0 842 m 0 0 l 595 0 l 595 842 l cp clip + 0.06000 0.06000 sc +7.500 slw +% Ellipse +n 2400 900 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +2272 945 m +gs 1 -1 sc (cp2) col-1 sh gr +% Ellipse +n 3750 900 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +3622 945 m +gs 1 -1 sc (cp3) col-1 sh gr +% Ellipse +n 1050 900 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +922 945 m +gs 1 -1 sc (cp1) col-1 sh gr +/Times-Roman ff 180.00 scf sf +810 1500 m +gs 1 -1 sc (myapp) col-1 sh gr +$F2psEnd +rs diff --git a/system/doc/design_principles/dist2.fig b/system/doc/design_principles/dist2.fig new file mode 100644 index 0000000000..973cbc4a31 --- /dev/null +++ b/system/doc/design_principles/dist2.fig @@ -0,0 +1,41 @@ +#FIG 3.1 +Landscape +Center +Inches +1200 2 +6 675 525 1425 1575 +6 675 525 1425 1275 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 1050 900 318 318 1050 900 1275 1125 +4 0 -1 0 0 0 12 0.0000 4 180 255 922 945 cp1\001 +-6 +4 0 -1 0 0 0 12 0.0000 4 135 480 810 1500 myapp\001 +-6 +6 2025 525 4125 1275 +6 2025 525 2775 1275 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 2400 900 318 318 2400 900 2625 1125 +4 0 -1 0 0 0 12 0.0000 4 180 255 2272 945 cp2\001 +-6 +6 3375 525 4125 1275 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 3750 900 318 318 3750 900 3975 1125 +4 0 -1 0 0 0 12 0.0000 4 180 255 3622 945 cp3\001 +-6 +-6 +6 2700 3300 3450 4050 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 3075 3675 318 318 3075 3675 3300 3900 +4 0 -1 0 0 0 12 0.0000 4 180 255 2947 3720 cp3\001 +-6 +6 1350 3300 2100 4425 +6 1350 3300 2100 4050 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 1725 3675 318 318 1725 3675 1950 3900 +4 0 -1 0 0 0 12 0.0000 4 180 255 1597 3720 cp2\001 +-6 +4 0 -1 0 0 0 12 0.0000 4 135 480 1485 4350 myapp\001 +-6 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 525 1200 1500 525 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 600 525 1575 1350 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 2325 1725 2325 2850 +4 0 -1 0 0 0 12 0.0000 4 135 480 2550 2325 5 secs.\001 diff --git a/system/doc/design_principles/dist2.gif b/system/doc/design_principles/dist2.gif new file mode 100644 index 0000000000..8351e8b7f0 Binary files /dev/null and b/system/doc/design_principles/dist2.gif differ diff --git a/system/doc/design_principles/dist2.ps b/system/doc/design_principles/dist2.ps new file mode 100644 index 0000000000..6fe592a4fc --- /dev/null +++ b/system/doc/design_principles/dist2.ps @@ -0,0 +1,160 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: dist2.fig +%%Creator: fig2dev Version 3.1 Patchlevel 2 +%%CreationDate: Thu May 15 13:13:55 1997 +%%For: jocke@akvavit (Joakim Greben|,ETX/B/DUP) +%Magnification: 1.00 +%%Orientation: Portrait +%%BoundingBox: 0 0 215 233 +%%Pages: 0 +%%BeginSetup +%%IncludeFeature: *PageSize A4 +%%EndSetup +%%EndComments +/$F2psDict 200 dict def +$F2psDict begin +$F2psDict /mtrx matrix put +/col-1 {0 setgray} bind def +/col0 {0.000 0.000 0.000 srgb} bind def +/col1 {0.000 0.000 1.000 srgb} bind def +/col2 {0.000 1.000 0.000 srgb} bind def +/col3 {0.000 1.000 1.000 srgb} bind def +/col4 {1.000 0.000 0.000 srgb} bind def +/col5 {1.000 0.000 1.000 srgb} bind def +/col6 {1.000 1.000 0.000 srgb} bind def +/col7 {1.000 1.000 1.000 srgb} bind def +/col8 {0.000 0.000 0.560 srgb} bind def +/col9 {0.000 0.000 0.690 srgb} bind def +/col10 {0.000 0.000 0.820 srgb} bind def +/col11 {0.530 0.810 1.000 srgb} bind def +/col12 {0.000 0.560 0.000 srgb} bind def +/col13 {0.000 0.690 0.000 srgb} bind def +/col14 {0.000 0.820 0.000 srgb} bind def +/col15 {0.000 0.560 0.560 srgb} bind def +/col16 {0.000 0.690 0.690 srgb} bind def +/col17 {0.000 0.820 0.820 srgb} bind def +/col18 {0.560 0.000 0.000 srgb} bind def +/col19 {0.690 0.000 0.000 srgb} bind def +/col20 {0.820 0.000 0.000 srgb} bind def +/col21 {0.560 0.000 0.560 srgb} bind def +/col22 {0.690 0.000 0.690 srgb} bind def +/col23 {0.820 0.000 0.820 srgb} bind def +/col24 {0.500 0.190 0.000 srgb} bind def +/col25 {0.630 0.250 0.000 srgb} bind def +/col26 {0.750 0.380 0.000 srgb} bind def +/col27 {1.000 0.500 0.500 srgb} bind def +/col28 {1.000 0.630 0.630 srgb} bind def +/col29 {1.000 0.750 0.750 srgb} bind def +/col30 {1.000 0.880 0.880 srgb} bind def +/col31 {1.000 0.840 0.000 srgb} bind def + +end +save +-30.0 263.0 translate +1 -1 scale + +/cp {closepath} bind def +/ef {eofill} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth} bind def +/tr {translate} bind def +/tnt {dup dup currentrgbcolor + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} + bind def +/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul + 4 -2 roll mul srgb} bind def + /DrawEllipse { + /endangle exch def + /startangle exch def + /yrad exch def + /xrad exch def + /y exch def + /x exch def + /savematrix mtrx currentmatrix def + x y tr xrad yrad sc 0 0 1 startangle endangle arc + closepath + savematrix setmatrix + } def + +/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def +/$F2psEnd {$F2psEnteredState restore end} def +%%EndProlog + +$F2psBegin +10 setmiterlimit +n 0 842 m 0 0 l 595 0 l 595 842 l cp clip + 0.06000 0.06000 sc +7.500 slw +% Ellipse +n 1050 900 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +922 945 m +gs 1 -1 sc (cp1) col-1 sh gr +/Times-Roman ff 180.00 scf sf +810 1500 m +gs 1 -1 sc (myapp) col-1 sh gr +% Ellipse +n 2400 900 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +2272 945 m +gs 1 -1 sc (cp2) col-1 sh gr +% Ellipse +n 3750 900 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +3622 945 m +gs 1 -1 sc (cp3) col-1 sh gr +% Ellipse +n 3075 3675 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +2947 3720 m +gs 1 -1 sc (cp3) col-1 sh gr +% Ellipse +n 1725 3675 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +1597 3720 m +gs 1 -1 sc (cp2) col-1 sh gr +/Times-Roman ff 180.00 scf sf +1485 4350 m +gs 1 -1 sc (myapp) col-1 sh gr +% Polyline +n 525 1200 m 1500 525 l gs col-1 s gr +% Polyline +n 600 525 m 1575 1350 l gs col-1 s gr +% Polyline +gs clippath +2355 2703 m 2325 2823 l 2295 2703 l 2295 2865 l 2355 2865 l cp clip +n 2325 1725 m 2325 2850 l gs col-1 s gr gr + +% arrowhead +n 2355 2703 m 2325 2823 l 2295 2703 l col-1 s +/Times-Roman ff 180.00 scf sf +2550 2325 m +gs 1 -1 sc (5 secs.) col-1 sh gr +$F2psEnd +rs diff --git a/system/doc/design_principles/dist3.fig b/system/doc/design_principles/dist3.fig new file mode 100644 index 0000000000..d7e32d0887 --- /dev/null +++ b/system/doc/design_principles/dist3.fig @@ -0,0 +1,33 @@ +#FIG 3.1 +Landscape +Center +Inches +1200 2 +6 1275 300 2325 1125 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 1275 975 2250 300 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 1350 300 2325 1125 +-6 +6 2775 300 3525 1050 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 3150 675 318 318 3150 675 3375 900 +4 0 -1 0 0 0 12 0.0000 4 180 255 3022 720 cp3\001 +-6 +6 1425 300 2175 1425 +6 1425 300 2175 1050 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 1800 675 318 318 1800 675 2025 900 +4 0 -1 0 0 0 12 0.0000 4 180 255 1672 720 cp2\001 +-6 +4 0 -1 0 0 0 12 0.0000 4 135 480 1560 1350 myapp\001 +-6 +6 1950 3225 2700 4350 +6 1950 3225 2700 3975 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 2325 3600 318 318 2325 3600 2550 3825 +4 0 -1 0 0 0 12 0.0000 4 180 255 2197 3645 cp3\001 +-6 +4 0 -1 0 0 0 12 0.0000 4 135 480 2085 4275 myapp\001 +-6 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 2325 1725 2325 2850 +4 0 -1 0 0 0 12 0.0000 4 135 480 2550 2325 5 secs.\001 diff --git a/system/doc/design_principles/dist3.gif b/system/doc/design_principles/dist3.gif new file mode 100644 index 0000000000..e95958cc16 Binary files /dev/null and b/system/doc/design_principles/dist3.gif differ diff --git a/system/doc/design_principles/dist3.ps b/system/doc/design_principles/dist3.ps new file mode 100644 index 0000000000..3e0e93f5db --- /dev/null +++ b/system/doc/design_principles/dist3.ps @@ -0,0 +1,148 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: dist3.fig +%%Creator: fig2dev Version 3.1 Patchlevel 2 +%%CreationDate: Thu May 15 13:14:01 1997 +%%For: jocke@akvavit (Joakim Greben|,ETX/B/DUP) +%Magnification: 1.00 +%%Orientation: Portrait +%%BoundingBox: 0 0 134 242 +%%Pages: 0 +%%BeginSetup +%%IncludeFeature: *PageSize A4 +%%EndSetup +%%EndComments +/$F2psDict 200 dict def +$F2psDict begin +$F2psDict /mtrx matrix put +/col-1 {0 setgray} bind def +/col0 {0.000 0.000 0.000 srgb} bind def +/col1 {0.000 0.000 1.000 srgb} bind def +/col2 {0.000 1.000 0.000 srgb} bind def +/col3 {0.000 1.000 1.000 srgb} bind def +/col4 {1.000 0.000 0.000 srgb} bind def +/col5 {1.000 0.000 1.000 srgb} bind def +/col6 {1.000 1.000 0.000 srgb} bind def +/col7 {1.000 1.000 1.000 srgb} bind def +/col8 {0.000 0.000 0.560 srgb} bind def +/col9 {0.000 0.000 0.690 srgb} bind def +/col10 {0.000 0.000 0.820 srgb} bind def +/col11 {0.530 0.810 1.000 srgb} bind def +/col12 {0.000 0.560 0.000 srgb} bind def +/col13 {0.000 0.690 0.000 srgb} bind def +/col14 {0.000 0.820 0.000 srgb} bind def +/col15 {0.000 0.560 0.560 srgb} bind def +/col16 {0.000 0.690 0.690 srgb} bind def +/col17 {0.000 0.820 0.820 srgb} bind def +/col18 {0.560 0.000 0.000 srgb} bind def +/col19 {0.690 0.000 0.000 srgb} bind def +/col20 {0.820 0.000 0.000 srgb} bind def +/col21 {0.560 0.000 0.560 srgb} bind def +/col22 {0.690 0.000 0.690 srgb} bind def +/col23 {0.820 0.000 0.820 srgb} bind def +/col24 {0.500 0.190 0.000 srgb} bind def +/col25 {0.630 0.250 0.000 srgb} bind def +/col26 {0.750 0.380 0.000 srgb} bind def +/col27 {1.000 0.500 0.500 srgb} bind def +/col28 {1.000 0.630 0.630 srgb} bind def +/col29 {1.000 0.750 0.750 srgb} bind def +/col30 {1.000 0.880 0.880 srgb} bind def +/col31 {1.000 0.840 0.000 srgb} bind def + +end +save +-75.0 259.0 translate +1 -1 scale + +/cp {closepath} bind def +/ef {eofill} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth} bind def +/tr {translate} bind def +/tnt {dup dup currentrgbcolor + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} + bind def +/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul + 4 -2 roll mul srgb} bind def + /DrawEllipse { + /endangle exch def + /startangle exch def + /yrad exch def + /xrad exch def + /y exch def + /x exch def + /savematrix mtrx currentmatrix def + x y tr xrad yrad sc 0 0 1 startangle endangle arc + closepath + savematrix setmatrix + } def + +/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def +/$F2psEnd {$F2psEnteredState restore end} def +%%EndProlog + +$F2psBegin +10 setmiterlimit +n 0 842 m 0 0 l 595 0 l 595 842 l cp clip + 0.06000 0.06000 sc +7.500 slw +% Polyline +n 1275 975 m 2250 300 l gs col-1 s gr +% Polyline +n 1350 300 m 2325 1125 l gs col-1 s gr +% Ellipse +n 3150 675 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +3022 720 m +gs 1 -1 sc (cp3) col-1 sh gr +% Ellipse +n 1800 675 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +1672 720 m +gs 1 -1 sc (cp2) col-1 sh gr +/Times-Roman ff 180.00 scf sf +1560 1350 m +gs 1 -1 sc (myapp) col-1 sh gr +% Ellipse +n 2325 3600 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +2197 3645 m +gs 1 -1 sc (cp3) col-1 sh gr +/Times-Roman ff 180.00 scf sf +2085 4275 m +gs 1 -1 sc (myapp) col-1 sh gr +% Polyline +gs clippath +2355 2703 m 2325 2823 l 2295 2703 l 2295 2865 l 2355 2865 l cp clip +n 2325 1725 m 2325 2850 l gs col-1 s gr gr + +% arrowhead +n 2355 2703 m 2325 2823 l 2295 2703 l col-1 s +/Times-Roman ff 180.00 scf sf +2550 2325 m +gs 1 -1 sc (5 secs.) col-1 sh gr +$F2psEnd +rs diff --git a/system/doc/design_principles/dist4.fig b/system/doc/design_principles/dist4.fig new file mode 100644 index 0000000000..d40be27ad6 --- /dev/null +++ b/system/doc/design_principles/dist4.fig @@ -0,0 +1,16 @@ +#FIG 3.1 +Landscape +Center +Inches +1200 2 +6 1425 300 2175 1050 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 1800 675 318 318 1800 675 2025 900 +4 0 -1 0 0 0 12 0.0000 4 180 255 1672 720 cp2\001 +-6 +6 2775 300 3525 1500 +6 2775 300 3525 1050 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 3150 675 318 318 3150 675 3375 900 +4 0 -1 0 0 0 12 0.0000 4 180 255 3022 720 cp3\001 +-6 +4 0 -1 0 0 0 12 0.0000 4 135 480 2910 1425 myapp\001 +-6 diff --git a/system/doc/design_principles/dist4.gif b/system/doc/design_principles/dist4.gif new file mode 100644 index 0000000000..b1d996b861 Binary files /dev/null and b/system/doc/design_principles/dist4.gif differ diff --git a/system/doc/design_principles/dist4.ps b/system/doc/design_principles/dist4.ps new file mode 100644 index 0000000000..9bcf3dd880 --- /dev/null +++ b/system/doc/design_principles/dist4.ps @@ -0,0 +1,125 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: dist4.fig +%%Creator: fig2dev Version 3.1 Patchlevel 2 +%%CreationDate: Thu May 15 13:14:06 1997 +%%For: jocke@akvavit (Joakim Greben|,ETX/B/DUP) +%Magnification: 1.00 +%%Orientation: Portrait +%%BoundingBox: 0 0 121 67 +%%Pages: 0 +%%BeginSetup +%%IncludeFeature: *PageSize A4 +%%EndSetup +%%EndComments +/$F2psDict 200 dict def +$F2psDict begin +$F2psDict /mtrx matrix put +/col-1 {0 setgray} bind def +/col0 {0.000 0.000 0.000 srgb} bind def +/col1 {0.000 0.000 1.000 srgb} bind def +/col2 {0.000 1.000 0.000 srgb} bind def +/col3 {0.000 1.000 1.000 srgb} bind def +/col4 {1.000 0.000 0.000 srgb} bind def +/col5 {1.000 0.000 1.000 srgb} bind def +/col6 {1.000 1.000 0.000 srgb} bind def +/col7 {1.000 1.000 1.000 srgb} bind def +/col8 {0.000 0.000 0.560 srgb} bind def +/col9 {0.000 0.000 0.690 srgb} bind def +/col10 {0.000 0.000 0.820 srgb} bind def +/col11 {0.530 0.810 1.000 srgb} bind def +/col12 {0.000 0.560 0.000 srgb} bind def +/col13 {0.000 0.690 0.000 srgb} bind def +/col14 {0.000 0.820 0.000 srgb} bind def +/col15 {0.000 0.560 0.560 srgb} bind def +/col16 {0.000 0.690 0.690 srgb} bind def +/col17 {0.000 0.820 0.820 srgb} bind def +/col18 {0.560 0.000 0.000 srgb} bind def +/col19 {0.690 0.000 0.000 srgb} bind def +/col20 {0.820 0.000 0.000 srgb} bind def +/col21 {0.560 0.000 0.560 srgb} bind def +/col22 {0.690 0.000 0.690 srgb} bind def +/col23 {0.820 0.000 0.820 srgb} bind def +/col24 {0.500 0.190 0.000 srgb} bind def +/col25 {0.630 0.250 0.000 srgb} bind def +/col26 {0.750 0.380 0.000 srgb} bind def +/col27 {1.000 0.500 0.500 srgb} bind def +/col28 {1.000 0.630 0.630 srgb} bind def +/col29 {1.000 0.750 0.750 srgb} bind def +/col30 {1.000 0.880 0.880 srgb} bind def +/col31 {1.000 0.840 0.000 srgb} bind def + +end +save +-88.0 88.0 translate +1 -1 scale + +/cp {closepath} bind def +/ef {eofill} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth} bind def +/tr {translate} bind def +/tnt {dup dup currentrgbcolor + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} + bind def +/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul + 4 -2 roll mul srgb} bind def + /DrawEllipse { + /endangle exch def + /startangle exch def + /yrad exch def + /xrad exch def + /y exch def + /x exch def + /savematrix mtrx currentmatrix def + x y tr xrad yrad sc 0 0 1 startangle endangle arc + closepath + savematrix setmatrix + } def + +/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def +/$F2psEnd {$F2psEnteredState restore end} def +%%EndProlog + +$F2psBegin +10 setmiterlimit +n 0 842 m 0 0 l 595 0 l 595 842 l cp clip + 0.06000 0.06000 sc +7.500 slw +% Ellipse +n 1800 675 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +1672 720 m +gs 1 -1 sc (cp2) col-1 sh gr +% Ellipse +n 3150 675 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +3022 720 m +gs 1 -1 sc (cp3) col-1 sh gr +/Times-Roman ff 180.00 scf sf +2910 1425 m +gs 1 -1 sc (myapp) col-1 sh gr +$F2psEnd +rs diff --git a/system/doc/design_principles/dist5.fig b/system/doc/design_principles/dist5.fig new file mode 100644 index 0000000000..77f2d74c59 --- /dev/null +++ b/system/doc/design_principles/dist5.fig @@ -0,0 +1,40 @@ +#FIG 3.1 +Landscape +Center +Inches +1200 2 +6 750 3000 4200 4050 +6 2100 3000 2850 3750 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 2475 3375 318 318 2475 3375 2700 3600 +4 0 -1 0 0 0 12 0.0000 4 180 255 2347 3420 cp2\001 +-6 +6 3450 3000 4200 3750 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 3825 3375 318 318 3825 3375 4050 3600 +4 0 -1 0 0 0 12 0.0000 4 180 255 3697 3420 cp3\001 +-6 +6 750 3000 1500 4050 +6 750 3000 1500 3750 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 1125 3375 318 318 1125 3375 1350 3600 +4 0 -1 0 0 0 12 0.0000 4 180 255 997 3420 cp1\001 +-6 +4 0 -1 0 0 0 12 0.0000 4 135 480 885 3975 myapp\001 +-6 +-6 +6 2100 300 2850 1050 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 2475 675 318 318 2475 675 2700 900 +4 0 -1 0 0 0 12 0.0000 4 180 255 2347 720 cp2\001 +-6 +6 3450 300 4200 1425 +6 3450 300 4200 1050 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 3825 675 318 318 3825 675 4050 900 +4 0 -1 0 0 0 12 0.0000 4 180 255 3697 720 cp3\001 +-6 +4 0 -1 0 0 0 12 0.0000 4 135 480 3585 1350 myapp\001 +-6 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 2175 2325 1425 2925 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 3600 1350 2775 1950 +4 0 -1 0 0 0 12 0.0000 4 180 3270 750 2175 cp1: application:takeover(myapp, permanent)\001 diff --git a/system/doc/design_principles/dist5.gif b/system/doc/design_principles/dist5.gif new file mode 100644 index 0000000000..3ef5cda3f6 Binary files /dev/null and b/system/doc/design_principles/dist5.gif differ diff --git a/system/doc/design_principles/dist5.ps b/system/doc/design_principles/dist5.ps new file mode 100644 index 0000000000..daeb56b2b7 --- /dev/null +++ b/system/doc/design_principles/dist5.ps @@ -0,0 +1,165 @@ +%!PS-Adobe-2.0 +%%Title: dist5.fig +%%Creator: fig2dev Version 3.1 Patchlevel 2 +%%CreationDate: Mon Feb 15 08:40:37 1999 +%%For: nibe@gundor (Bengt Nilsson, ETX/DN/SP) +%Magnification: 1.00 +%%Orientation: Portrait +%%BoundingBox: 203 286 408 506 +%%Pages: 1 +%%BeginSetup +%%IncludeFeature: *PageSize Letter +%%EndSetup +%%EndComments +/$F2psDict 200 dict def +$F2psDict begin +$F2psDict /mtrx matrix put +/col-1 {0 setgray} bind def +/col0 {0.000 0.000 0.000 srgb} bind def +/col1 {0.000 0.000 1.000 srgb} bind def +/col2 {0.000 1.000 0.000 srgb} bind def +/col3 {0.000 1.000 1.000 srgb} bind def +/col4 {1.000 0.000 0.000 srgb} bind def +/col5 {1.000 0.000 1.000 srgb} bind def +/col6 {1.000 1.000 0.000 srgb} bind def +/col7 {1.000 1.000 1.000 srgb} bind def +/col8 {0.000 0.000 0.560 srgb} bind def +/col9 {0.000 0.000 0.690 srgb} bind def +/col10 {0.000 0.000 0.820 srgb} bind def +/col11 {0.530 0.810 1.000 srgb} bind def +/col12 {0.000 0.560 0.000 srgb} bind def +/col13 {0.000 0.690 0.000 srgb} bind def +/col14 {0.000 0.820 0.000 srgb} bind def +/col15 {0.000 0.560 0.560 srgb} bind def +/col16 {0.000 0.690 0.690 srgb} bind def +/col17 {0.000 0.820 0.820 srgb} bind def +/col18 {0.560 0.000 0.000 srgb} bind def +/col19 {0.690 0.000 0.000 srgb} bind def +/col20 {0.820 0.000 0.000 srgb} bind def +/col21 {0.560 0.000 0.560 srgb} bind def +/col22 {0.690 0.000 0.690 srgb} bind def +/col23 {0.820 0.000 0.820 srgb} bind def +/col24 {0.500 0.190 0.000 srgb} bind def +/col25 {0.630 0.250 0.000 srgb} bind def +/col26 {0.750 0.380 0.000 srgb} bind def +/col27 {1.000 0.500 0.500 srgb} bind def +/col28 {1.000 0.630 0.630 srgb} bind def +/col29 {1.000 0.750 0.750 srgb} bind def +/col30 {1.000 0.880 0.880 srgb} bind def +/col31 {1.000 0.840 0.000 srgb} bind def + +end +save +158.5 527.0 translate +1 -1 scale + +/cp {closepath} bind def +/ef {eofill} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth} bind def +/tr {translate} bind def +/tnt {dup dup currentrgbcolor + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} + bind def +/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul + 4 -2 roll mul srgb} bind def + /DrawEllipse { + /endangle exch def + /startangle exch def + /yrad exch def + /xrad exch def + /y exch def + /x exch def + /savematrix mtrx currentmatrix def + x y tr xrad yrad sc 0 0 1 startangle endangle arc + closepath + savematrix setmatrix + } def + +/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def +/$F2psEnd {$F2psEnteredState restore end} def +%%EndProlog + +$F2psBegin +10 setmiterlimit +n 0 792 m 0 0 l 612 0 l 612 792 l cp clip + 0.06000 0.06000 sc +%%Page: 1 1 +7.500 slw +% Ellipse +n 2475 3375 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +2347 3420 m +gs 1 -1 sc (cp2) col-1 sh gr +% Ellipse +n 3825 3375 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +3697 3420 m +gs 1 -1 sc (cp3) col-1 sh gr +% Ellipse +n 1125 3375 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +997 3420 m +gs 1 -1 sc (cp1) col-1 sh gr +/Times-Roman ff 180.00 scf sf +885 3975 m +gs 1 -1 sc (myapp) col-1 sh gr +% Ellipse +n 2475 675 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +2347 720 m +gs 1 -1 sc (cp2) col-1 sh gr +% Ellipse +n 3825 675 318 318 0 360 DrawEllipse gs col-1 s gr + +/Times-Roman ff 180.00 scf sf +3697 720 m +gs 1 -1 sc (cp3) col-1 sh gr +/Times-Roman ff 180.00 scf sf +3585 1350 m +gs 1 -1 sc (myapp) col-1 sh gr +% Polyline +gs clippath +1559 2857 m 1446 2908 l 1521 2810 l 1395 2911 l 1432 2958 l cp clip +n 2175 2325 m 1425 2925 l gs col-1 s gr gr + +% arrowhead +n 1559 2857 m 1446 2908 l 1521 2810 l col-1 s +% Polyline +gs clippath +2912 1888 m 2796 1934 l 2876 1839 l 2745 1935 l 2781 1983 l cp clip +n 3600 1350 m 2775 1950 l gs col-1 s gr gr + +% arrowhead +n 2912 1888 m 2796 1934 l 2876 1839 l col-1 s +/Times-Roman ff 180.00 scf sf +750 2175 m +gs 1 -1 sc (cp1: application:takeover\(myapp, permanent\)) col-1 sh gr +showpage +$F2psEnd +rs diff --git a/system/doc/design_principles/distributed_applications.xml b/system/doc/design_principles/distributed_applications.xml new file mode 100644 index 0000000000..39a24b3598 --- /dev/null +++ b/system/doc/design_principles/distributed_applications.xml @@ -0,0 +1,217 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Distributed Applications + + + + + distributed_applications.xml +
+ +
+ Definition +

In a distributed system with several Erlang nodes, there may be + a need to control applications in a distributed manner. If + the node, where a certain application is running, goes down, + the application should be restarted at another node.

+

Such an application is called a distributed application. + Note that it is the control of the application which is + distributed, all applications can of course be distributed in + the sense that they, for example, use services on other nodes.

+

Because a distributed application may move between nodes, some + addressing mechanism is required to ensure that it can be + addressed by other applications, regardless on which node it + currently executes. This issue is not addressed here, but the + Kernel module global or STDLIB module pg can be + used for this purpose.

+
+ +
+ Specifying Distributed Applications +

Distributed applications are controlled by both the application + controller and a distributed application controller process, + dist_ac. Both these processes are part of the kernel + application. Therefore, distributed applications are specified by + configuring the kernel application, using the following + configuration parameter (see also kernel(6)):

+ + distributed = [{Application, [Timeout,] NodeDesc}] + +

Specifies where the application Application = atom() + may execute. NodeDesc = [Node | {Node,...,Node}] is + a list of node names in priority order. The order between + nodes in a tuple is undefined.

+

Timeout = integer() specifies how many milliseconds to + wait before restarting the application at another node. + Defaults to 0.

+
+
+

For distribution of application control to work properly, + the nodes where a distributed application may run must contact + each other and negotiate where to start the application. This is + done using the following kernel configuration parameters:

+ + sync_nodes_mandatory = [Node] + Specifies which other nodes must be started (within + the timeout specified by sync_nodes_timeout. + sync_nodes_optional = [Node] + Specifies which other nodes can be started (within + the timeout specified by sync_nodes_timeout. + sync_nodes_timeout = integer() | infinity + Specifies how many milliseconds to wait for the other nodes + to start. + +

When started, the node will wait for all nodes specified by + sync_nodes_mandatory and sync_nodes_optional to + come up. When all nodes have come up, or when all mandatory nodes + have come up and the time specified by sync_nodes_timeout + has elapsed, all applications will be started. If not all + mandatory nodes have come up, the node will terminate.

+

Example: An application myapp should run at the node + cp1@cave. If this node goes down, myapp should + be restarted at cp2@cave or cp3@cave. A system + configuration file cp1.config for cp1@cave could + look like:

+ +[{kernel, + [{distributed, [{myapp, 5000, [cp1@cave, {cp2@cave, cp3@cave}]}]}, + {sync_nodes_mandatory, [cp2@cave, cp3@cave]}, + {sync_nodes_timeout, 5000} + ] + } +]. +

The system configuration files for cp2@cave and + cp3@cave are identical, except for the list of mandatory + nodes which should be [cp1@cave, cp3@cave] for + cp2@cave and [cp1@cave, cp2@cave] for + cp3@cave.

+ +

All involved nodes must have the same value for + distributed and sync_nodes_timeout, or + the behaviour of the system is undefined.

+
+
+ +
+ Starting and Stopping Distributed Applications +

When all involved (mandatory) nodes have been started, + the distributed application can be started by calling + application:start(Application) at all of these nodes.

+

It is of course also possible to use a boot script (see + Releases) which + automatically starts the application.

+

The application will be started at the first node, specified + by the distributed configuration parameter, which is up + and running. The application is started as usual. That is, an + application master is created and calls the application callback + function:

+ +Module:start(normal, StartArgs) +

Example: Continuing the example from the previous section, + the three nodes are started, specifying the system configuration + file:

+
+> erl -sname cp1 -config cp1
+> erl -sname cp2 -config cp2
+> erl -sname cp3 -config cp3
+

When all nodes are up and running, myapp can be started. + This is achieved by calling application:start(myapp) at + all three nodes. It is then started at cp1, as shown in + the figure below.

+ + + Application myapp - Situation 1 + +

Similarly, the application must be stopped by calling + application:stop(Application) at all involved nodes.

+
+ +
+ Failover +

If the node where the application is running goes down, + the application is restarted (after the specified timeout) at + the first node, specified by the distributed configuration + parameter, which is up and running. This is called a + failover.

+

The application is started the normal way at the new node, + that is, by the application master calling:

+ +Module:start(normal, StartArgs) +

Exception: If the application has the start_phases key + defined (see Included Applications), then the application is instead started + by calling:

+ +Module:start({failover, Node}, StartArgs) +

where Node is the terminated node.

+

Example: If cp1 goes down, the system checks which one of + the other nodes, cp2 or cp3, has the least number of + running applications, but waits for 5 seconds for cp1 to + restart. If cp1 does not restart and cp2 runs fewer + applications than cp3, then myapp is restarted on + cp2.

+ + + Application myapp - Situation 2 + +

Suppose now that cp2 goes down as well and does not + restart within 5 seconds. myapp is now restarted on + cp3.

+ + + Application myapp - Situation 3 + +
+ +
+ Takeover +

If a node is started, which has higher priority according + to distributed, than the node where a distributed + application is currently running, the application will be + restarted at the new node and stopped at the old node. This is + called a takeover.

+

The application is started by the application master calling:

+ +Module:start({takeover, Node}, StartArgs) +

where Node is the old node.

+

Example: If myapp is running at cp3, and if + cp2 now restarts, it will not restart myapp, + because the order between nodes cp2 and cp3 is + undefined.

+ + + Application myapp - Situation 4 + +

However, if cp1 restarts as well, the function + application:takeover/2 moves myapp to cp1, + because cp1 has a higher priority than cp3 for this + application. In this case, + Module:start({takeover, cp3@cave}, StartArgs) is executed + at cp1 to start the application.

+ + + Application myapp - Situation 5 + +
+
+ diff --git a/system/doc/design_principles/events.xml b/system/doc/design_principles/events.xml new file mode 100644 index 0000000000..5579f1e459 --- /dev/null +++ b/system/doc/design_principles/events.xml @@ -0,0 +1,221 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Gen_Event Behaviour + + + + + events.xml +
+ +

This chapter should be read in conjunction with + gen_event(3), where all interface functions and callback + functions are described in detail.

+ +
+ Event Handling Principles +

In OTP, an event manager is a named object to which + events can be sent. An event could be, for example, + an error, an alarm or some information that should be logged.

+

In the event manager, zero, one or several event handlers are installed. When the event manager is notified + about an event, the event will be processed by all the installed + event handlers. For example, an event manager for handling errors + can by default have a handler installed which writes error + messages to the terminal. If the error messages during a certain + period should be saved to a file as well, the user adds another + event handler which does this. When logging to file is no longer + necessary, this event handler is deleted.

+

An event manager is implemented as a process and each event + handler is implemented as a callback module.

+

The event manager essentially maintains a list of + {Module, State} pairs, where each Module is an + event handler, and State the internal state of that event + handler.

+
+ +
+ Example +

The callback module for the event handler writing error messages + to the terminal could look like:

+ +-module(terminal_logger). +-behaviour(gen_event). + +-export([init/1, handle_event/2, terminate/2]). + +init(_Args) -> + {ok, []}. + +handle_event(ErrorMsg, State) -> + io:format("***Error*** ~p~n", [ErrorMsg]), + {ok, State}. + +terminate(_Args, _State) -> + ok. +

The callback module for the event handler writing error messages + to a file could look like:

+ +-module(file_logger). +-behaviour(gen_event). + +-export([init/1, handle_event/2, terminate/2]). + +init(File) -> + {ok, Fd} = file:open(File, read), + {ok, Fd}. + +handle_event(ErrorMsg, Fd) -> + io:format(Fd, "***Error*** ~p~n", [ErrorMsg]), + {ok, Fd}. + +terminate(_Args, Fd) -> + file:close(Fd). +

The code is explained in the next sections.

+
+ +
+ + Starting an Event Manager +

To start an event manager for handling errors, as described in + the example above, call the following function:

+ +gen_event:start_link({local, error_man}) +

This function spawns and links to a new process, an event + manager.

+

The argument, {local, error_man} specifies the name. In + this case, the event manager will be locally registered as + error_man.

+

If the name is omitted, the event manager is not registered. + Instead its pid must be used. The name could also be given + as {global, Name}, in which case the event manager is + registered using global:register_name/2.

+

gen_event:start_link must be used if the event manager is + part of a supervision tree, i.e. is started by a supervisor. + There is another function gen_event:start to start a + stand-alone event manager, i.e. an event manager which is not + part of a supervision tree.

+
+ +
+ Adding an Event Handler +

Here is an example using the shell on how to start an event + manager and add an event handler to it:

+
+1> gen_event:start({local, error_man}).
+{ok,<0.31.0>}
+2> gen_event:add_handler(error_man, terminal_logger, []).
+ok
+

This function sends a message to the event manager registered as + error_man, telling it to add the event handler + terminal_logger. The event manager will call the callback + function terminal_logger:init([]), where the argument [] + is the third argument to add_handler. init is + expected to return {ok, State}, where State is + the internal state of the event handler.

+ +init(_Args) -> + {ok, []}. +

Here, init does not need any input data and ignores its + argument. Also, for terminal_logger the internal state is + not used. For file_logger, the internal state is used + to save the open file descriptor.

+ +init(File) -> + {ok, Fd} = file:open(File, read), + {ok, Fd}. +
+ +
+ Notifying About Events +
+3> gen_event:notify(error_man, no_reply).
+***Error*** no_reply
+ok
+

error_man is the name of the event manager and + no_reply is the event.

+

The event is made into a message and sent to the event manager. + When the event is received, the event manager calls + handle_event(Event, State) for each installed event + handler, in the same order as they were added. The function is + expected to return a tuple {ok, State1}, where + State1 is a new value for the state of the event handler.

+

In terminal_logger:

+ +handle_event(ErrorMsg, State) -> + io:format("***Error*** ~p~n", [ErrorMsg]), + {ok, State}. +

In file_logger:

+ +handle_event(ErrorMsg, Fd) -> + io:format(Fd, "***Error*** ~p~n", [ErrorMsg]), + {ok, Fd}. +
+ +
+ Deleting an Event Handler +
+4> gen_event:delete_handler(error_man, terminal_logger, []).
+ok
+

This function sends a message to the event manager registered as + error_man, telling it to delete the event handler + terminal_logger. The event manager will call the callback + function terminal_logger:terminate([], State), where + the argument [] is the third argument to delete_handler. + terminate should be the opposite of init and do any + necessary cleaning up. Its return value is ignored.

+

For terminal_logger, no cleaning up is necessary:

+ +terminate(_Args, _State) -> + ok. +

For file_logger, the file descriptor opened in init + needs to be closed:

+ +terminate(_Args, Fd) -> + file:close(Fd). +
+ +
+ Stopping +

When an event manager is stopped, it will give each of + the installed event handlers the chance to clean up by calling + terminate/2, the same way as when deleting a handler.

+ +
+ In a Supervision Tree +

If the event manager is part of a supervision tree, no stop + function is needed. The event manager will automatically be + terminated by its supervisor. Exactly how this is done is + defined by a shutdown strategy set in the supervisor.

+
+ +
+ Stand-Alone Event Managers +

An event manager can also be stopped by calling:

+
+> gen_event:stop(error_man).
+ok
+
+
+
+ diff --git a/system/doc/design_principles/fsm.xml b/system/doc/design_principles/fsm.xml new file mode 100644 index 0000000000..7cdd62057b --- /dev/null +++ b/system/doc/design_principles/fsm.xml @@ -0,0 +1,313 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Gen_Fsm Behaviour + + + + + fsm.xml +
+

This chapter should be read in conjunction with gen_fsm(3), + where all interface functions and callback functions are described + in detail.

+ +
+ Finite State Machines +

A finite state machine, FSM, can be described as a set of + relations of the form:

+
+State(S) x Event(E) -> Actions(A), State(S')
+

These relations are interpreted as meaning:

+ +

If we are in state S and the event E occurs, we + should perform the actions A and make a transition to + the state S'.

+
+

For an FSM implemented using the gen_fsm behaviour, + the state transition rules are written as a number of Erlang + functions which conform to the following convention:

+
+StateName(Event, StateData) ->
+    .. code for actions here ...
+    {next_state, StateName', StateData'}
+
+ +
+ Example +

A door with a code lock could be viewed as an FSM. Initially, + the door is locked. Anytime someone presses a button, this + generates an event. Depending on what buttons have been pressed + before, the sequence so far may be correct, incomplete or wrong.

+

If it is correct, the door is unlocked for 30 seconds (30000 ms). + If it is incomplete, we wait for another button to be pressed. If + it is is wrong, we start all over, waiting for a new button + sequence.

+

Implementing the code lock FSM using gen_fsm results in + this callback module:

+ + + gen_fsm:start_link({local, code_lock}, code_lock, Code, []). + +button(Digit) -> + gen_fsm:send_event(code_lock, {button, Digit}). + +init(Code) -> + {ok, locked, {[], Code}}. + +locked({button, Digit}, {SoFar, Code}) -> + case [Digit|SoFar] of + Code -> + do_unlock(), + {next_state, open, {[], Code}, 3000}; + Incomplete when length(Incomplete) + {next_state, locked, {Incomplete, Code}}; + _Wrong -> + {next_state, locked, {[], Code}} + end. + +open(timeout, State) -> + do_lock(), + {next_state, locked, State}.]]> +

The code is explained in the next sections.

+
+ +
+ Starting a Gen_Fsm +

In the example in the previous section, the gen_fsm is started by + calling code_lock:start_link(Code):

+ +start_link(Code) -> + gen_fsm:start_link({local, code_lock}, code_lock, Code, []). +

start_link calls the function gen_fsm:start_link/4. + This function spawns and links to a new process, a gen_fsm.

+ + +

The first argument {local, code_lock} specifies + the name. In this case, the gen_fsm will be locally registered + as code_lock.

+

If the name is omitted, the gen_fsm is not registered. + Instead its pid must be used. The name could also be given as + {global, Name}, in which case the gen_fsm is registered + using global:register_name/2.

+
+ +

The second argument, code_lock, is the name of + the callback module, that is the module where the callback + functions are located.

+

In this case, the interface functions (start_link and + button) are located in the same module as the callback + functions (init, locked and open). This + is normally good programming practice, to have the code + corresponding to one process contained in one module.

+
+ +

The third argument, Code, is a term which is passed + as-is to the callback function init. Here, init + gets the correct code for the lock as indata.

+
+ +

The fourth argument, [], is a list of options. See + gen_fsm(3) for available options.

+
+
+

If name registration succeeds, the new gen_fsm process calls + the callback function code_lock:init(Code). This function + is expected to return {ok, StateName, StateData}, where + StateName is the name of the initial state of the gen_fsm. + In this case locked, assuming the door is locked to begin + with. StateData is the internal state of the gen_fsm. (For + gen_fsms, the internal state is often referred to 'state data' to + distinguish it from the state as in states of a state machine.) + In this case, the state data is the button sequence so far (empty + to begin with) and the correct code of the lock.

+ +init(Code) -> + {ok, locked, {[], Code}}. +

Note that gen_fsm:start_link is synchronous. It does not + return until the gen_fsm has been initialized and is ready to + receive notifications.

+

gen_fsm:start_link must be used if the gen_fsm is part of + a supervision tree, i.e. is started by a supervisor. There is + another function gen_fsm:start to start a stand-alone + gen_fsm, i.e. a gen_fsm which is not part of a supervision tree.

+
+ +
+ Notifying About Events +

The function notifying the code lock about a button event is + implemented using gen_fsm:send_event/2:

+ +button(Digit) -> + gen_fsm:send_event(code_lock, {button, Digit}). +

code_lock is the name of the gen_fsm and must agree with + the name used to start it. {button, Digit} is the actual + event.

+

The event is made into a message and sent to the gen_fsm. When + the event is received, the gen_fsm calls + StateName(Event, StateData) which is expected to return a + tuple {next_state, StateName1, StateData1}. + StateName is the name of the current state and + StateName1 is the name of the next state to go to. + StateData1 is a new value for the state data of + the gen_fsm.

+ + case [Digit|SoFar] of + Code -> + do_unlock(), + {next_state, open, {[], Code}, 30000}; + Incomplete when length(Incomplete) + {next_state, locked, {Incomplete, Code}}; + _Wrong -> + {next_state, locked, {[], Code}}; + end. + +open(timeout, State) -> + do_lock(), + {next_state, locked, State}.]]> +

If the door is locked and a button is pressed, the complete + button sequence so far is compared with the correct code for + the lock and, depending on the result, the door is either unlocked + and the gen_fsm goes to state open, or the door remains in + state locked.

+
+ +
+ Timeouts +

When a correct code has been givened, the door is unlocked and + the following tuple is returned from locked/2:

+ +{next_state, open, {[], Code}, 30000}; +

30000 is a timeout value in milliseconds. After 30000 ms, i.e. + 30 seconds, a timeout occurs. Then StateName(timeout, StateData) is called. In this case, the timeout occurs when + the door has been in state open for 30 seconds. After that + the door is locked again:

+ +open(timeout, State) -> + do_lock(), + {next_state, locked, State}. +
+ +
+ All State Events +

Sometimes an event can arrive at any state of the gen_fsm. + Instead of sending the message with gen_fsm:send_event/2 + and writing one clause handling the event for each state function, + the message can be sent with gen_fsm:send_all_state_event/2 + and handled with Module:handle_event/3:

+ +-module(code_lock). +... +-export([stop/0]). +... + +stop() -> + gen_fsm:send_all_state_event(code_lock, stop). + +... + +handle_event(stop, _StateName, StateData) -> + {stop, normal, StateData}. +
+ +
+ Stopping + +
+ In a Supervision Tree +

If the gen_fsm is part of a supervision tree, no stop function + is needed. The gen_fsm will automatically be terminated by its + supervisor. Exactly how this is done is defined by a + shutdown strategy + set in the supervisor.

+

If it is necessary to clean up before termination, the shutdown + strategy must be a timeout value and the gen_fsm must be set to + trap exit signals in the init function. When ordered + to shutdown, the gen_fsm will then call the callback function + terminate(shutdown, StateName, StateData):

+ +init(Args) -> + ..., + process_flag(trap_exit, true), + ..., + {ok, StateName, StateData}. + +... + +terminate(shutdown, StateName, StateData) -> + ..code for cleaning up here.. + ok. +
+ +
+ Stand-Alone Gen_Fsms +

If the gen_fsm is not part of a supervision tree, a stop + function may be useful, for example:

+ +... +-export([stop/0]). +... + +stop() -> + gen_fsm:send_all_state_event(code_lock, stop). +... + +handle_event(stop, _StateName, StateData) -> + {stop, normal, StateData}. + +... + +terminate(normal, _StateName, _StateData) -> + ok. +

The callback function handling the stop event returns a + tuple {stop,normal,StateData1}, where normal + specifies that it is a normal termination and StateData1 + is a new value for the state data of the gen_fsm. This will + cause the gen_fsm to call + terminate(normal,StateName,StateData1) and then + terminate gracefully:

+
+
+ +
+ Handling Other Messages +

If the gen_fsm should be able to receive other messages than + events, the callback function handle_info(Info, StateName, StateData) must be implemented to handle them. Examples of + other messages are exit messages, if the gen_fsm is linked to + other processes (than the supervisor) and trapping exit signals.

+ +handle_info({'EXIT', Pid, Reason}, StateName, StateData) -> + ..code to handle exits here.. + {next_state, StateName1, StateData1}. +
+
+ diff --git a/system/doc/design_principles/gen_server_concepts.xml b/system/doc/design_principles/gen_server_concepts.xml new file mode 100644 index 0000000000..8131c47a69 --- /dev/null +++ b/system/doc/design_principles/gen_server_concepts.xml @@ -0,0 +1,269 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Gen_Server Behaviour + + + + + gen_server_concepts.xml +
+ +

This chapter should be read in conjunction with + gen_server(3), + where all interface functions and callback + functions are described in detail.

+ +
+ Client-Server Principles +

The client-server model is characterized by a central server + and an arbitrary number of clients. The client-server model is + generally used for resource management operations, where several + different clients want to share a common resource. The server is + responsible for managing this resource.

+ + + Client-Server Model + +
+ +
+ Example +

An example of a simple server written in plain Erlang was + given in Overview. + The server can be re-implemented using gen_server, + resulting in this callback module:

+ + +-module(ch3). +-behaviour(gen_server). + +-export([start_link/0]). +-export([alloc/0, free/1]). +-export([init/1, handle_call/3, handle_cast/2]). + +start_link() -> + gen_server:start_link({local, ch3}, ch3, [], []). + +alloc() -> + gen_server:call(ch3, alloc). + +free(Ch) -> + gen_server:cast(ch3, {free, Ch}). + +init(_Args) -> + {ok, channels()}. + +handle_call(alloc, _From, Chs) -> + {Ch, Chs2} = alloc(Chs), + {reply, Ch, Chs2}. + +handle_cast({free, Ch}, Chs) -> + Chs2 = free(Ch, Chs), + {noreply, Chs2}. +

The code is explained in the next sections.

+
+ +
+ Starting a Gen_Server +

In the example in the previous section, the gen_server is started + by calling ch3:start_link():

+ +start_link() -> + gen_server:start_link({local, ch3}, ch3, [], []) => {ok, Pid} +

start_link calls the function + gen_server:start_link/4. This function spawns and links to + a new process, a gen_server.

+ + +

The first argument {local, ch3} specifies the name. In + this case, the gen_server will be locally registered as + ch3.

+

If the name is omitted, the gen_server is not registered. + Instead its pid must be used. The name could also be given + as {global, Name}, in which case the gen_server is + registered using global:register_name/2.

+
+ +

The second argument, ch3, is the name of the callback + module, that is the module where the callback functions are + located.

+

In this case, the interface functions (start_link, + alloc and free) are located in the same module + as the callback functions (init, handle_call and + handle_cast). This is normally good programming + practice, to have the code corresponding to one process + contained in one module.

+
+ +

The third argument, [], is a term which is passed as-is to + the callback function init. Here, init does not + need any indata and ignores the argument.

+
+ +

The fourth argument, [], is a list of options. See + gen_server(3) for available options.

+
+
+

If name registration succeeds, the new gen_server process calls + the callback function ch3:init([]). init is expected + to return {ok, State}, where State is the internal + state of the gen_server. In this case, the state is the available + channels.

+ +init(_Args) -> + {ok, channels()}. +

Note that gen_server:start_link is synchronous. It does + not return until the gen_server has been initialized and is ready + to receive requests.

+

gen_server:start_link must be used if the gen_server is + part of a supervision tree, i.e. is started by a supervisor. + There is another function gen_server:start to start a + stand-alone gen_server, i.e. a gen_server which is not part of a + supervision tree.

+
+ +
+ Synchronous Requests - Call +

The synchronous request alloc() is implemented using + gen_server:call/2:

+ +alloc() -> + gen_server:call(ch3, alloc). +

ch3 is the name of the gen_server and must agree with + the name used to start it. alloc is the actual request.

+

The request is made into a message and sent to the gen_server. + When the request is received, the gen_server calls + handle_call(Request, From, State) which is expected to + return a tuple {reply, Reply, State1}. Reply is + the reply which should be sent back to the client, and + State1 is a new value for the state of the gen_server.

+ +handle_call(alloc, _From, Chs) -> + {Ch, Chs2} = alloc(Chs), + {reply, Ch, Chs2}. +

In this case, the reply is the allocated channel Ch and + the new state is the set of remaining available channels + Chs2.

+

Thus, the call ch3:alloc() returns the allocated channel + Ch and the gen_server then waits for new requests, now + with an updated list of available channels.

+
+ +
+ Asynchronous Requests - Cast +

The asynchronous request free(Ch) is implemented using + gen_server:cast/2:

+ +free(Ch) -> + gen_server:cast(ch3, {free, Ch}). +

ch3 is the name of the gen_server. {free, Ch} is + the actual request.

+

The request is made into a message and sent to the gen_server. + cast, and thus free, then returns ok.

+

When the request is received, the gen_server calls + handle_cast(Request, State) which is expected to + return a tuple {noreply, State1}. State1 is a new + value for the state of the gen_server.

+ +handle_cast({free, Ch}, Chs) -> + Chs2 = free(Ch, Chs), + {noreply, Chs2}. +

In this case, the new state is the updated list of available + channels Chs2. The gen_server is now ready for new + requests.

+
+ +
+ Stopping + +
+ In a Supervision Tree +

If the gen_server is part of a supervision tree, no stop + function is needed. The gen_server will automatically be + terminated by its supervisor. Exactly how this is done is + defined by a shutdown strategy set in the supervisor.

+

If it is necessary to clean up before termination, the shutdown + strategy must be a timeout value and the gen_server must be set + to trap exit signals in the init function. When ordered + to shutdown, the gen_server will then call the callback function + terminate(shutdown, State):

+ +init(Args) -> + ..., + process_flag(trap_exit, true), + ..., + {ok, State}. + +... + +terminate(shutdown, State) -> + ..code for cleaning up here.. + ok. +
+ +
+ Stand-Alone Gen_Servers +

If the gen_server is not part of a supervision tree, a stop + function may be useful, for example:

+ +... +export([stop/0]). +... + +stop() -> + gen_server:cast(ch3, stop). +... + +handle_cast(stop, State) -> + {stop, normal, State}; +handle_cast({free, Ch}, State) -> + .... + +... + +terminate(normal, State) -> + ok. +

The callback function handling the stop request returns + a tuple {stop, normal, State1}, where normal + specifies that it is a normal termination and State1 is + a new value for the state of the gen_server. This will cause + the gen_server to call terminate(normal,State1) and then + terminate gracefully.

+
+
+ +
+ Handling Other Messages +

If the gen_server should be able to receive other messages than + requests, the callback function handle_info(Info, State) + must be implemented to handle them. Examples of other messages + are exit messages, if the gen_server is linked to other processes + (than the supervisor) and trapping exit signals.

+ +handle_info({'EXIT', Pid, Reason}, State) -> + ..code to handle exits here.. + {noreply, State1}. +
+
+ diff --git a/system/doc/design_principles/inclappls.fig b/system/doc/design_principles/inclappls.fig new file mode 100644 index 0000000000..03885c72d6 --- /dev/null +++ b/system/doc/design_principles/inclappls.fig @@ -0,0 +1,33 @@ +#FIG 3.1 +Landscape +Center +Inches +1200 2 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 2700 900 530 530 2700 900 3075 1275 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 750 2400 375 375 750 2400 975 2700 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 1950 2400 375 375 1950 2400 2175 2700 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 3150 2475 375 375 3150 2475 3375 2775 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 4425 2475 375 375 4425 2475 4650 2775 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 5700 2475 375 375 5700 2475 5925 2775 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 3600 3600 375 375 3600 3600 3825 3900 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 2625 3600 375 375 2625 3600 2850 3900 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 675 3600 375 375 675 3600 900 3900 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 975 2100 2250 1200 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2025 2025 2475 1425 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 3000 2100 2850 1425 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 3150 1275 4125 2250 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 3225 1050 5400 2250 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 675 2775 675 3225 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 3225 2850 3525 3225 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 3075 2850 2700 3225 +4 0 -1 0 0 2 14 0.0000 4 195 1905 3525 975 Primary application \001 +4 0 -1 0 0 2 14 0.0000 4 195 1950 6525 2550 Included applications\001 +4 0 -1 0 0 2 14 0.0000 4 195 1950 6525 3675 Included applications\001 diff --git a/system/doc/design_principles/inclappls.gif b/system/doc/design_principles/inclappls.gif new file mode 100644 index 0000000000..8b88d6d23e Binary files /dev/null and b/system/doc/design_principles/inclappls.gif differ diff --git a/system/doc/design_principles/inclappls.ps b/system/doc/design_principles/inclappls.ps new file mode 100644 index 0000000000..239be1b3b3 --- /dev/null +++ b/system/doc/design_principles/inclappls.ps @@ -0,0 +1,808 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%Creator: (ImageMagick) +%%Title: (./inclappls.tmp.eps) +%%CreationDate: (Tue Jun 12 17:22:15 2001) +%%BoundingBox: 0 20 377 197 +%%DocumentData: Clean7Bit +%%LanguageLevel: 1 +%%Pages: 0 +%%EndComments + +%%BeginDefaults +%%PageOrientation: Portrait +%%EndDefaults + +%%BeginProlog +% +% Display a color image. The image is displayed in color on +% Postscript viewers or printers that support color, otherwise +% it is displayed as grayscale. +% +/buffer 512 string def +/byte 1 string def +/color_packet 3 string def +/pixels 768 string def + +/DirectClassPacket +{ + % + % Get a DirectClass packet. + % + % Parameters: + % red. + % green. + % blue. + % length: number of pixels minus one of this color (optional). + % + currentfile color_packet readhexstring pop pop + compression 0 gt + { + /number_pixels 3 def + } + { + currentfile byte readhexstring pop 0 get + /number_pixels exch 1 add 3 mul def + } ifelse + 0 3 number_pixels 1 sub + { + pixels exch color_packet putinterval + } for + pixels 0 number_pixels getinterval +} bind def + +/DirectClassImage +{ + % + % Display a DirectClass image. + % + systemdict /colorimage known + { + columns rows 8 + [ + columns 0 0 + rows neg 0 rows + ] + { DirectClassPacket } false 3 colorimage + } + { + % + % No colorimage operator; convert to grayscale. + % + columns rows 8 + [ + columns 0 0 + rows neg 0 rows + ] + { GrayDirectClassPacket } image + } ifelse +} bind def + +/GrayDirectClassPacket +{ + % + % Get a DirectClass packet; convert to grayscale. + % + % Parameters: + % red + % green + % blue + % length: number of pixels minus one of this color (optional). + % + currentfile color_packet readhexstring pop pop + color_packet 0 get 0.299 mul + color_packet 1 get 0.587 mul add + color_packet 2 get 0.114 mul add + cvi + /gray_packet exch def + compression 0 gt + { + /number_pixels 1 def + } + { + currentfile byte readhexstring pop 0 get + /number_pixels exch 1 add def + } ifelse + 0 1 number_pixels 1 sub + { + pixels exch gray_packet put + } for + pixels 0 number_pixels getinterval +} bind def + +/GrayPseudoClassPacket +{ + % + % Get a PseudoClass packet; convert to grayscale. + % + % Parameters: + % index: index into the colormap. + % length: number of pixels minus one of this color (optional). + % + currentfile byte readhexstring pop 0 get + /offset exch 3 mul def + /color_packet colormap offset 3 getinterval def + color_packet 0 get 0.299 mul + color_packet 1 get 0.587 mul add + color_packet 2 get 0.114 mul add + cvi + /gray_packet exch def + compression 0 gt + { + /number_pixels 1 def + } + { + currentfile byte readhexstring pop 0 get + /number_pixels exch 1 add def + } ifelse + 0 1 number_pixels 1 sub + { + pixels exch gray_packet put + } for + pixels 0 number_pixels getinterval +} bind def + +/PseudoClassPacket +{ + % + % Get a PseudoClass packet. + % + % Parameters: + % index: index into the colormap. + % length: number of pixels minus one of this color (optional). + % + currentfile byte readhexstring pop 0 get + /offset exch 3 mul def + /color_packet colormap offset 3 getinterval def + compression 0 gt + { + /number_pixels 3 def + } + { + currentfile byte readhexstring pop 0 get + /number_pixels exch 1 add 3 mul def + } ifelse + 0 3 number_pixels 1 sub + { + pixels exch color_packet putinterval + } for + pixels 0 number_pixels getinterval +} bind def + +/PseudoClassImage +{ + % + % Display a PseudoClass image. + % + % Parameters: + % class: 0-PseudoClass or 1-Grayscale. + % + currentfile buffer readline pop + token pop /class exch def pop + class 0 gt + { + currentfile buffer readline pop + token pop /depth exch def pop + /grays columns 8 add depth sub depth mul 8 idiv string def + columns rows depth + [ + columns 0 0 + rows neg 0 rows + ] + { currentfile grays readhexstring pop } image + } + { + % + % Parameters: + % colors: number of colors in the colormap. + % colormap: red, green, blue color packets. + % + currentfile buffer readline pop + token pop /colors exch def pop + /colors colors 3 mul def + /colormap colors string def + currentfile colormap readhexstring pop pop + systemdict /colorimage known + { + columns rows 8 + [ + columns 0 0 + rows neg 0 rows + ] + { PseudoClassPacket } false 3 colorimage + } + { + % + % No colorimage operator; convert to grayscale. + % + columns rows 8 + [ + columns 0 0 + rows neg 0 rows + ] + { GrayPseudoClassPacket } image + } ifelse + } ifelse +} bind def + +/DisplayImage +{ + % + % Display a DirectClass or PseudoClass image. + % + % Parameters: + % x & y translation. + % x & y scale. + % label pointsize. + % image label. + % image columns & rows. + % class: 0-DirectClass or 1-PseudoClass. + % compression: 0-RunlengthEncodedCompression or 1-NoCompression. + % hex color packets. + % + gsave + currentfile buffer readline pop + token pop /x exch def + token pop /y exch def pop + x y translate + currentfile buffer readline pop + token pop /x exch def + token pop /y exch def pop + currentfile buffer readline pop + token pop /pointsize exch def pop + /Helvetica findfont pointsize scalefont setfont + x y scale + currentfile buffer readline pop + token pop /columns exch def + token pop /rows exch def pop + currentfile buffer readline pop + token pop /class exch def pop + currentfile buffer readline pop + token pop /compression exch def pop + class 0 gt { PseudoClassImage } { DirectClassImage } ifelse + grestore +} bind def +%%EndProlog +%%Page: 1 1 +%%PageBoundingBox: 0 20 377 197 +userdict begin +%%BeginData: +DisplayImage +0 20 +377.000000 177.000000 +12 +566 266 +1 +1 +1 +1 +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffffffff +fffffffffffff000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffffffffff +ffffffffff0fff0fffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffffffffffff +fffffff8fffff1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffffffffffffff +ffffe7fffffe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffcffffffffffffffffffffffffffffffffffff +ff9fffffff9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffcfffffffffffffffffffffffffffffffffffffe +7fffffffe7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffcfffffffffffffffffffffffffffffffffffffdff +fffffffbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffcfffffffffffffffffffffffffffffffffffff3ffff +fffffcffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffcffffffffffffffffffffffffffffffffffffefffffff +ffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffcffffffffffffffffffffffffffffffffffffdfffffffff +ffbfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffcffffffffffffffffffffffffffffffffffffbfffffffffff +dfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffcffffffffffffffffffffffffffffffffffff7fffffffffffef +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffcfffffffffffffffffffffffffffffffffffefffffffffffff7ff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffcfffffffffffffffffffffffffffffffffffdfffffffffffffbffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffcfffffffffffffffffffffffffffffffffffbfffffffffffffdffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffcfffffffffffffffffffffffffffffffffffbfffffffffffffdffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffcfffffffffffffffffffffffffffffffffff7fffffffffffffeffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffcffffffffffffffffffffffffffffffffffefffffffffffffff7fffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffcffffffffffffffffffffffffffffffffffefffffffffffffff7fffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffcffffffffffffffffffffffffffffffffffdfffffffffffffffbfffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffcffffffffffffffffffffffffffffffffffdfffffffffffffffbfffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fcffffffffffffffffffffffffffffffffffbfffffffffffffffdfffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc +ffffffffffffffffffffffffffffffffffbfffffffffffffffdfffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcff +ffffffffffffffffffffffffffffffff7fffffffffffffffefffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffff +ffffffffffffffffffffffffffffff7fffffffffffffffefffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffff +ffffffffffffffffffffffffffff7fffffffffffffffefffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffff +fffffffffffffffffffffffffefffffffffffffffff7ffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffff +fffffffffffffffffffffffefffffffffffffffff7ffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffff +fffffffffffffffffffffefffffffffffffffff7ffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffff +fffffffffffffffffffefffffffffffffffff7ffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffff +fffffffffffffffffdfffffffffffffffffbffff01fe7ffffffffffffffc4fffff3fffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffff +fffffffffffffffdfffffffffffffffffbffff9cfe7ffffffffffffffe4ffffb3fffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffff +fffffffffffffdfffffffffffffffffbffff9cfffffffffffffffffe7ffff3ffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffff +fffffffffffdfffffffffffffffffbffff9c9062230c813f0c8c8e0f086038623fffffff +fffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffff +fffffffffdfffffffffffffffffbffff9cc871126649be6666664e433333313fffffffff +fffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffffff +fffffffdfffffffffffffffffbffff81ce73326679be6666664e733333333fffffffffff +fffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffffffff +fffffdfffffffffffffffffbffff9fce7333867d7f8666664e7c3333333fffffffffffff +fffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffffffffff +fffdfffffffffffffffffbffff9fce7332667c7e6666664e733333333fffffffffffffff +fffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffffffffffff +fdfffffffffffffffffbffff9fce7332667c7e6626264e233233333fffffffffffffffff +fffffffffffffffffffffffffffffffffffffcfffffffffffffffffffffffffffffffffd +fffffffffffffffffbffff0f842110103efe124e4c07109018611fffffffffffffffffff +fffffffffffffffffffffffffffffffffffcfffffffffffffffffffffffffffffffffdff +fffffffffffffffbfffffffffffffffefffe7e7fffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffcfffffffffffffffffffffffffffffffffdffff +fffffffffffffbfffffffffffffff2fffe7e7fffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffcfffffffffffffffffffffffffffffffffeffffff +fffffffffff7fffffffffffffff1fffc3c3fffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffcfffffffffffffffffffffffffffffffffeffffffff +fffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffcfffffffffffffffffffffffffffffffffeffffffffff +fffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffcfffffffffffffffffffffffffffffffffeffffffffffff +fffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffcffffffffffffffffffffffffffffffffff7fffffffffffff +ffe9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffcffffffffffffffffffffffffffffffffff7fffffffffffffff +ee7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffcffffffffffffffffffffffffffffffffff7fffffffffffffffef +9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffcffffffffffffffffffffffffffffffffffbfffffffffffffffdfe7 +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffcffffffffffffffffffffffffffffffffffbfffffffffffffffdffbff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffcffffffffffffffffffffffffffffffffffdfffffffffffffffbffcffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffcffffffffffffffffffffffffffffffffffdfffffffffffffffbfff3fffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffcffffffffffffffffffffffffffffffffffefffffffffffffff7fffcfffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffcffffffffffffffffffffffffffffffffffefffffffffffffff7ffff3ffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffcffffffffffffffffffffffffffffffffffe7fffffffffffffefffffcffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffcffffffffffffffffffffffffffffffffff9bfffffffffffffdffffff7fffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fcffffffffffffffffffffffffffffffffff7bfffffffffffffdffffff9fffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc +fffffffffffffffffffffffffffffffffefdfffffffffffffbffffffe7ffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcff +fffffffffffffffffffffffffffffff9fefffffffffffff7fffffff9ffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffff +fffffffffffffffffffffffffffff7ff7fffffffffffeefffffffe7fffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffff +ffffffffffffffffffffffffffcfffbfffffffffffdf7fffffffbfffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffff +ffffffffffffffffffffffffbfffdfffffffffffbfbfffffffcfffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffff +fffffffffffffffffffffe7fffefffffffffff7fdffffffff3ffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffff +fffffffffffffffffffdfffff3fffffffffcffeffffffffcffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffff +fffffffffffffffffbfffffdfffffffffbfff7ffffffff3fffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffff +ffffffffffffffe7fffffe7fffffffe7fffbffffffffdfffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffff +ffffffffffffdfffffff9fffffff9ffffdffffffffe7ffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffff +ffffffffff3fffffffe7fffffe7ffffefffffffff9ffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffff +fffffffefffffffff8fffff1ffffff7ffffffffe7fffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffff +fffffdffffffffdf0fff0fffffffbfffffffff9fffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffffff +fff3ffffffffbff000efffffffdfffffffffe7ffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffffffff +efffffffffbfffffefffffffeffffffffffbffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffffffff9f +ffffffff7ffffff7fffffff7fffffffffcffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffffffff7fff +fffffefffffff7fffffffbffffffffff3fffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffcfffffffffffffffffffffffffffcffffff +fffdfffffff7fffffffdffffffffffcfffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffcfffffffffffffffffffffffffffbffffffff +fdfffffff7fffffffefffffffffff3ffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffcfffffffffffffffffffffffffff7fffffffffb +fffffffbffffffff7ffffffffffdffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffcffffffffffffffffffffffffffcffffffffff7ff +fffffbffffffffbffffffffffe7fffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffcffffffffffffffffffffffffffbfffffffffefffff +fffbffffffffdfffffffffff9fffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffcfffffffffffffffffffffffffe7fffffffffefffffff +fbffffffffefffffffffffe7ffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffcfffffffffffffffffffffffffdffffffffffdffffffffb +fffffffff7fffffffffff9ffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffcfffffffffffffffffffffffffbffffffffffbffffffffdff +fffffffbfffffffffffeffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffcffffffffffffffffffffffffe7ffffffffff7ffffffffdffff +fffffdffffffffffff3fffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffcffffffffffffffffffffffffdfffffffffff7ffffffffdffffff +fffeffffffffffffcfffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffcffffffffffffffffffffffff3ffffffffffefffffffffdffffffff +ff7ffffffffffff3ffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffcfffffffffffffffffffffffefffffffffffdfffffffffeffffffffff +bffffffffffffcffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffcfffffffffffffffffffffff9fffffffffffbfffffffffeffffffffffdf +ffffffffffff3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffcfffffffffffffffffffffff7fffffffffffbfffffffffeffffffffffefff +ffffffffffdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffcffffffffffffffffffffffeffffffffffff7fffffffffefffffffffff7ffff +ffffffffe7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffcffffffffffffffffffffff9fffffffffffeffffffffffefffffffffffbffffff +fffffff9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffcffffffffffffffffffffff7fffffffffffdfffffffffff7ffffffffffdffffffff +fffffe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffcfffffffffffffffffffffcffffffffffffdfffffffffff7ffffffffffeffffffffff +ffff9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fcfffffffffffffffffffffbffffffffffffbfffffffffff7fffffffffff7fffffffffff +ffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc +fffffffffffffffffffff7ffffffffffff7fffffffffff7fffffffffffbfffffffffffff +f3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcff +ffffffffffffffffffcffffffffffffeffffffffffffbfffffffffffdffffffffffffffc +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffff +ffffffffffffffffbffffffffffffeffffffffffffbfffffffffffefffffffffffffff3f +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffff +fffffffffffffe7ffffffffffffdffffffffffffbffffffffffff7ffffffffffffffcfff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffff +fffffffffffdfffffffffffffbffffffffffffbffffffffffffbfffffffffffffff7ffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffff +fffffffff3fffffffffffff7ffffffffffffbffffffffffffdfffffffffffffff9ffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffff +ffffffeffffffffffffff7ffffffffffffdffffffffffffefffffffffffffffe7fffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffff +ffffdfffffffffffffefffffffffffffdfffffffffffff7fffffffffffffff9fffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffff +ff3fffffffffffffdfffffffffffffdfffffffffffffbfffffffffffffffe7ffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffcfffffffffffffffffe +ffffffffffffffbfffffffffffffdfffffffffffffdffffffffffffffff9ffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffcfffffffffffffffff9ff +ffffffffffffbfffffffffffffefffffffffffffeffffffffffffffffeffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffcfffffffffffffffff7ffff +ffffffffff7fffffffffffffeffffffffffffff7ffffffffffffffff3fffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffefffffff +fffffffeffffffffffffffeffffffffffffffbffffffffffffffffcfffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffff9fffffffff +fffffdffffffffffffffeffffffffffffffdfffffffffffffffff3ffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffcffffffffffffffff7fffffffffff +fffdffffffffffffffeffffffffffffffefffffffffffffffffcffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffcfffffffffffffffcffffffffffffff +fbfffffffffffffff7ffffffffffffff7fffffffffffffffff7fffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffcffffffffe00ffffbffffffffffffe007 +fffffffffffffff7ffffffffffffffbfffffffffffffffff9fffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffcfffffffe1ff0ffe7fffffffffffe1ff0ff +fffffffffffff7ffffffffffffffdfffffffffffffffffe7ffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffcfffffff9ffff3fdffffffffffff9ffff3fff +fffffffffff7ffffffffffffffeffffffffffffffffff9ffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffcffffffe7ffffcfbfffffffffffe7ffffcfffff +fffffffffbfffffffffffffff7fffffffffffffffffe7fffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffcffffff9ffffff27fffffffffff9ffffff3ffffff +fffffffbfffffffffffffffbffffffffffffffffffbfffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffcffffff7ffffffdffffffffffff7ffffffdffffffff +fffffbe00ffffffffffffdffffff007fffffffffcffffffff803ffffffffffffffffffff +fffffffffffffffffffffffffffcfffffefffffffefffffffffffefffffffeffffffffff +fffe1ff0fffffffffffefffff0ff87fffffffff3ffffff87fc3fffffffffffffffffffff +fffffffffffffffffffffffffcfffffdffffffff7ffffffffffdffffffff7fffffffffff +f9ffff3fffffffffff7fffcffff9fffffffffcfffffe7fffcfffffffffffffffffffffff +fffffffffffffffffffffffcfffffbffffffffbffffffffffbffffffffbfffffffffffe7 +ffffcfffffffffffbfff3ffffe7fffffffff3ffff9fffff3ffffffffffffffffffffffff +fffffffffffffffffffffcfffff7ffffffffdffffffffff7ffffffffdfffffffffff9fff +fff3ffffffffffdffcffffff9fffffffffcfffe7fffffcffffffffffffffffffffffffff +fffffffffffffffffffcffffefffffffffefffffffffefffffffffefffffffffff7fffff +fdffffffffffeffbffffffeffffffffff7ffdfffffff7fffffffffffffffffffffffffff +fffffffffffffffffcffffdffffffffff7ffffffffdffffffffff7fffffffffefffffffe +fffffffffff7f7fffffff7fffffffff9ffbfffffffbfffffffffffffffffffffffffffff +fffffffffffffffcffffdffffffffff7ffffffffdffffffffff7fffffffffdffffffff7f +fffffffffbeffffffffbfffffffffe7f7fffffffdfffffffffffffffffffffffffffffff +fffffffffffffcffffbffffffffffbffffffffbffffffffffbfffffffffbffffffffbfff +fffffffddffffffffdffffffffff9effffffffefffffffffffffffffffffffffffffffff +fffffffffffcffffbffffffffffbffffffffbffffffffffbfffffffff7ffffffffdfffff +fffffebffffffffeffffffffffe5fffffffff7ffffffffffffffffffffffffffffffffff +fffffffffcffff7ffffffffffdffffffff7ffffffffffdffffffffefffffffffefffffff +ffff7fffffffff7ffffffffffbfffffffffbffffffffffffffffffffffffffffffffffff +fffffffcffff7ffffffffffdffffffff7ffffffffffdffffffffdffffffffff7ffffffff +feffffffffffbffffffffff7fffffffffdffffffffffffffffffffffffffffffffffffff +fffffcfffefffffffffffefffffffefffffffffffeffffffffdffffffffff7fffffffffe +ffffffffffbffffffffff7fffffffffdffffffffffffffffffffffffffffffffffffffff +fffcfffefffffffffffefffffffefffffffffffeffffffffbffffffffffbfffffffffdff +ffffffffdfffffffffeffffffffffeffffffffffffffffffffffffffffffffffffffffff +fcfffefffffffffffefffffffefffffffffffeffffffffbffffffffffbfffffffffdffff +ffffffdfffffffffeffffffffffefffffffffffffffffffffffffffffffffffffffffffc +fffefffffffffffefffffffefffffffffffeffffffff7ffffffffffdfffffffffbffffff +ffffefffffffffdfffffffffff7ffffffffffffffffffffffffffffffffffffffffffcff +fdffffffffffff7ffffffdffffffffffff7fffffff7ffffffffffdfffffffffbffffffff +ffefffffffffdfffffffffff7ffffffffffffffffffffffffffffffffffffffffffcfffd +ffffffffffff7ffffffdffffffffffff7ffffffefffffffffffefffffffff7ffffffffff +f7ffffffffbfffffffffffbffffffffffffffffffffffffffffffffffffffffffcfffdff +ffffffffff7ffffffdffffffffffff7ffffffefffffffffffefffffffff7fffffffffff7 +ffffffffbfffffffffffbffffffffffffffffffffffffffffffffffffffffffcfffdffff +ffffffff7ffffffdffffffffffff7ffffffefffffffffffefffffffff7fffffffffff7ff +ffffffbfffffffffffbffffffffffffffffffffffffffffffffffffffffffcfffdffffff +ffffff7ffffffdffffffffffff7ffffffefffffffffffefffffffff7fffffffffff7ffff +ffffbfffffffffffbfffffff87ffe3ffc7ff1fffffff13ffffcffffffffcfffdffffffff +ffff7ffffffdffffffffffff7ffffffdffffffffffff7fffffffeffffffffffffbffffff +ff7fffffffffffdfffffffcffff3ffe7ff9fffffff93fffecffffffffcfffdffffffffff +ff7ffffffdffffffffffff7ffffffdffffffffffff7fffffffeffffffffffffbffffffff +7fffffffffffdfffffffcffff3ffe7ff9fffffff9ffffcfffffffffcfffdffffffffffff +7ffffffdffffffffffff7ffffffdffffffffffff7fffffffeffffffffffffbffffffff7f +ffffffffffdfffffffc88e1223270c9fc3232383c2180e188c3ffcfffdffffffffffff7f +fffffdffffffffffff7ffffffdffffffffffff7fffffffeffffffffffffbffffffff7fff +ffffffffdfffffffcc4c933246611f9999999390cccccc49bffcfffefffffffffffeffff +fffefffffffffffefffffffdffffffffffff7fffffffeffffffffffffbffffffff7fffff +ffffffdfffffffccccf33266619f999999939cccccccc8fffcfffefffffffffffeffffff +fefffffffffffefffffffdffffffffffff7fffffffeffffffffffffbffffffff7fffffff +ffffdfffffffccccf33266019fe19999939f0ccccccc3ffcfffefffffffffffefffffffe +fffffffffffefffffffdffffffffffff7fffffffeffffffffffffbffffffff7fffffffff +ffdfffffffccccf33266799f999999939ccccccccf3ffcfffefffffffffffefffffffeff +fffffffffefffffffdffffffffffff7fffffffeffffffffffffbffffffff7fffffffffff +dfffffffcccc532266719f9989899388cc8ccccbbffcffff7ffffffffffdffffffff7fff +fffffffdfffffffdffffffffffff7fffffffeffffffffffffbffffffff7fffffffffffdf +ffffff80462111130c4f84939301c4240618407ffcffff7ffffffffffdffffffff7fffff +fffffdfffffffefffffffffffefffffffff7fffffffffff7ffffffffbfffffffffffbfff +ffffffffffffffffffff9f9ffffffffffffffffcffffbffffffffffbffffffffbfffffff +fffbfffffffefffffffffffefffffffff7fffffffffff7ffffffffbfffffffffffbfffff +ffffffffffffffffff9f9ffffffffffffffffcffffbffffffffffbffffffffbfffffffff +fbfffffffefffffffffffefffffffff7fffffffffff7ffffffffbfffffffffffbfffffff +ffffffffffffffff0f0ffffffffffffffffcffffdffffffffff7ffffffffdffffffffff7 +fffffffefffffffffffefffffffff7fffffffffff7ffffffffbfffffffffffbfffffffff +fffffffffffffffffffffffffffffffffcffffdffffffffff7ffffffffdffffffffff7ff +ffffff7ffffffffffdfffffffffbffffffffffefffffffffdfffffffffff7fffffffffff +fffffffffffffffffffffffffffffffcffffefffffffffefffffffffefffffffffefffff +ffff7ffffffffffdfffffffffbffffffffffefffffffffdfffffffffff7fffffffffffff +fffffffffffffffffffffffffffffcfffff7ffffffffdffffffffff7ffffffffdfffffff +ffbffffffffffbfffffffffdffffffffffdfffffffffeffffffffffeffffffffffffffff +fffffffffffffffffffffffffffcfffffbffffffffbffffffffffbffffffffbfffffffff +bffffffffffbfffffffffdffffffffffdfffffffffeffffffffffeffffffffffffffffff +fffffffffffffffffffffffffcfffffdffffffff7ffffffffffdffffffff7fffffffffdf +fffffffff7fffffffffeffffffffffbffffffffff7fffffffffdffffffffffffffffffff +fffffffffffffffffffffffcfffffefffffffefffffffffffefffffffeffffffffffdfff +fffffff7fffffffffeffffffffffbffffffffff7fffffffffdffffffffffffffffffffff +fffffffffffffffffffffcffffff7ffffffdffffffffffff7ffffffdffffffffffefffff +ffffefffffffffff7fffffffff7ffffffffffbfffffffffbffffffffffffffffffffffff +fffffffffffffffffffcffffff9ffffff3ffffffffffff9ffffff3fffffffffff7ffffff +ffdfffffffffffbffffffffefffffffffffdfffffffff7ffffffffffffffffffffffffff +fffffffffffffffffcffffffe7ffffcfffffffffffffe7ffffcffffffffffffbffffffff +bfffffffffffdffffffffdfffffffffffeffffffffefffffffffffffffffffffffffffff +fffffffffffffffcfffffff9ffff3ffffffffffffff9ffff3ffffffffffffdffffffff7f +ffffffffffeffffffffbffffffffffff7fffffffdfffffffffffffffffffffffffffffff +fffffffffffffcfffffffe1ff0fffffffffffffffe1ff0fffffffffffffefffffffeffff +fffffffff7fffffff7ffffffffffffbfffffffbfffffffffffffffffffffffffffffffff +fffffffffffcffffffffc00fffffffffffffffffe00fffffffffffffff7ffffffdffffff +fffffffbffffffefffffffffffffdfffffff7fffffffffffffffffffffffffffffffffff +fffffffffcffffffffdfffffffffffffffffffffffffffffffffffff9ffffff3ffffffff +fffffcffffff9fffffffffffffe7fffffcffffffffffffffffffffffffffffffffffffff +fffffffcffffffffdfffffffffffffffffffffffffffffffffffffe7ffffcfffffffffff +ffff3ffffe7ffffffffffffff9fffff3ffffffffffffffffffffffffffffffffffffffff +fffffcffffffffdffffffffffffffffffffffffffffffffffffff9ffff3fffffffffffff +ffcffff9fffffffffffffffe7fffcfffffffffffffffffffffffffffffffffffffffffff +fffcffffffffdffffffffffffffffffffffffffffffffffffffe1ff0ffffffffffffffff +f0ff87ffffffffffffffff87fc3fffffffffffffffffffffffffffffffffffffffffffff +fcffffffffdfffffffffffffffffffffffffffffffffffffffc007ffffffffffffffffff +007ffffffffffffffffff803fffffffffffffffffffffffffffffffffffffffffffffffc +ffffffffdfffffffffffffffffffffffffffffffffffffffbffbffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcff +ffffffdfffffffffffffffffffffffffffffffffffffff7ffdffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffff +ffffdffffffffffffffffffffffffffffffffffffffefffdffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffff +ffdffffffffffffffffffffffffffffffffffffffdfffeffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffff +dffffffffffffffffffffffffffffffffffffffbffff7fffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffdf +fffffffffffffffffffffffffffffffffffff7ffffbfffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffdfff +ffffffffffffffffffffffffffffffffffefffffdfffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffdfffff +ffffffffffffffffffffffffffffffffdfffffdfffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffdfffffff +ffffffffffffffffffffffffffffffbfffffefffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffdfffffffff +ffffffffffffffffffffffffffff7ffffff7ffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffdfffffffffff +fffffffffffffffffffffffffefffffffbffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffcffffffffdfffffffffffff +fffffffffffffffffffffffdfffffffdffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffcffffffffdfffffffffffffff +fffffffffffffffffffffbfffffffdffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffcffffffffdfffffffffffffffff +fffffffffffffffffff7fffffffeffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffcffffffffdfffffffffffffffffff +ffffffffffffffffefffffffff7fffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffcffffffffdfffffffffffffffffffff +ffffffffffffffdfffffffffbfffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffcffffffffdfffffffffffffffffffffff +ffffffffffffbfffffffffdfffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffcffffffffdfffffffffffffffffffffffff +ffffffffff7fffffffffdfffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffcffffffffdfffffffffffffffffffffffffff +fffffffeffffffffffefffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffcffffffffdfffffffffffffffffffffffffffff +fffffdfffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffcffffffffdfffffffffffffffffffffffffffffff +fffbfffffffffffbffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffcffffffffdfffffffffffffffffffffffffffffffff +f7fffffffffffdffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffcffffffffdfffffffffffffffffffffffffffffffffef +fffffffffffdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffcffffffffdfffffffffffffffffffffffffffffffffdfff +fffffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffcfffffffc01ffffffffffffffffffffffffffffff003fffff +ffffffff003fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffcffffffc3fe1ffffffffffffffffffffffffffff0ff87ffffff +fffff87fc3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffcffffff3fffe7ffffffffffffffffffffffffffcffff9ffffffff +ffe7fffcffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffcfffffcfffff9ffffffffffffffffffffffffff3ffffe7fffffffff +9fffff3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffcfffff3fffffe7ffffffffffffffffffffffffcffffff9ffffffffe7f +ffffcfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffcffffefffffffbffffffffffffffffffffffffbffffffeffffffffdffff +fff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffcffffdfffffffdffffffffffffffffffffffff7fffffff7fffffffbffffff +fbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffcffffbfffffffefffffffffffffffffffffffeffffffffbfffffff7fffffffd +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffcffff7ffffffff7ffffffffffffffffffffffdffffffffdffffffeffffffffeff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffcfffefffffffffbffffffffffffffffffffffbffffffffeffffffdfffffffff7fff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffcfffdfffffffffdffffffffffffffffffffff7fffffffff7fffffbfffffffffbfffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fcfffbfffffffffefffffffffffffffffffffeffffffffffbfffff7fffffffffdfffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc +fffbfffffffffefffffffffffffffffffffeffffffffffbfffff7fffffffffdfffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcff +f7ffffffffff7ffffffffffffffffffffdffffffffffdffffeffffffffffefffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcfff7 +ffffffffff7ffffffffffffffffffffdffffffffffdffffeffffffffffefffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffefff +ffffffffbffffffffffffffffffffbffffffffffeffffdfffffffffff7ffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffefffff +ffffffbffffffffffffffffffffbffffffffffeffffdfffffffffff7ffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffdfffffff +ffffdffffffffffffffffffff7fffffffffff7fffbfffffffffffbffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffdfffffffff +ffdffffffffffffffffffff7fffffffffff7fffbfffffffffffbffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffdfffffffffff +dffffffffffffffffffff7fffffffffff7fffbfffffffffffbffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffcffdfffffffffffdf +fffffffffffffffffff7fffffffffff7fffbfffffffffffbffffffffffffffffffffffff +ffffffffffffffffff87ffe3ffc7ff1fffffff13ffffcffffffffcffbfffffffffffefff +ffffffffffffffffeffffffffffffbfff7fffffffffffdffffffffffffffffffffffffff +ffffffffffffffffcffff3ffe7ff9fffffff93fffecffffffffcffbfffffffffffefffff +ffffffffffffffeffffffffffffbfff7fffffffffffdffffffffffffffffffffffffffff +ffffffffffffffcffff3ffe7ff9fffffff9ffffcfffffffffcffbfffffffffffefffffff +ffffffffffffeffffffffffffbfff7fffffffffffdffffffffffffffffffffffffffffff +ffffffffffffc88e1223270c9fc3232383c2180e188c3ffcffbfffffffffffefffffffff +ffffffffffeffffffffffffbfff7fffffffffffdffffffffffffffffffffffffffffffff +ffffffffffcc4c933246611f9999999390cccccc49bffcffbfffffffffffefffffffffff +ffffffffeffffffffffffbfff7fffffffffffdffffffffffffffffffffffffffffffffff +ffffffffccccf33266619f999999939cccccccc8fffcffbfffffffffffefffffffffffff +ffffffeffffffffffffbfff7fffffffffffdffffffffffffffffffffffffffffffffffff +ffffffccccf33266019fe19999939f0ccccccc3ffcffbfffffffffffefffffffffffffff +ffffeffffffffffffbfff7fffffffffffdffffffffffffffffffffffffffffffffffffff +ffffccccf33266799f999999939ccccccccf3ffcffbfffffffffffefffffffffffffffff +ffeffffffffffffbfff7fffffffffffdffffffffffffffffffffffffffffffffffffffff +ffcccc532266719f9989899388cc8ccccbbffcffbfffffffffffefffffffffffffffffff +effffffffffffbfff7fffffffffffdffffffffffffffffffffffffffffffffffffffffff +80462111130c4f84939301c4240618407ffcffdfffffffffffdffffffffffffffffffff7 +fffffffffff7fffbfffffffffffbffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffff9f9ffffffffffffffffcffdfffffffffffdffffffffffffffffffff7ff +fffffffff7fffbfffffffffffbffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff9f9ffffffffffffffffcffdfffffffffffdffffffffffffffffffff7ffff +fffffff7fffbfffffffffffbffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffff0f0ffffffffffffffffcffdfffffffffffdffffffffffffffffffff7ffffff +fffff7fffbfffffffffffbffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffcffefffffffffffbffffffffffffffffffffbffffffff +ffeffffdfffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffcffefffffffffffbffffffffffffffffffffbffffffffff +effffdfffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffcfff7ffffffffff7ffffffffffffffffffffdffffffffffdf +fffeffffffffffefffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffcfff7ffffffffff7ffffffffffffffffffffdffffffffffdfff +feffffffffffefffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffcfffbfffffffffefffffffffffffffffffffeffffffffffbfffff +7fffffffffdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffcfffbfffffffffefffffffffffffffffffffeffffffffffbfffff7f +ffffffffdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffcfffdfffffffffdffffffffffffffffffffff7fffffffff7fffffbfff +ffffffbfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffcfffefffffffffbffffffffffffffffffffffbffffffffeffffffdfffff +ffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffcffff7ffffffff7ffffffffffffffffffffffdffffffffdffffffefffffff +feffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffcffffbfffffffefffffffffffffffffffffffeffffffffbfffffff7fffffffd +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffcffffdfffffffdffffffffffffffffffffffff7fffffff7fffffffbfffffffbff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffcffffefffffffbffffffffffffffffffffffffbffffffeffffffffdfffffff7ffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffcfffff3fffffe7ffffffffffffffffffffffffcffffff9ffffffffe7fffffcfffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fcfffffcfffff9ffffffffffffffffffffffffff3ffffe7fffffffff9fffff3fffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc +ffffff3fffe7ffffffffffffffffffffffffffcffff9ffffffffffe7fffcffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcff +ffffc3fe1ffffffffffffffffffffffffffff0ff87fffffffffff87fc3ffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffff +fffc01ffffffffffffffffffffffffffffff007fffffffffffff803fffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffffffffffffffffffffffffffffc +%%EndData +end +%%PageTrailer +%%Trailer +%%BoundingBox: 0 20 377 197 +%%EOF diff --git a/system/doc/design_principles/included_applications.xml b/system/doc/design_principles/included_applications.xml new file mode 100644 index 0000000000..3adb27ea08 --- /dev/null +++ b/system/doc/design_principles/included_applications.xml @@ -0,0 +1,150 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Included Applications + + + + + included_applications.xml +
+ +
+ Definition +

An application can include other applications. + An included application has its own application directory + and .app file, but it is started as part of the supervisor + tree of another application.

+

An application can only be included by one other application.

+

An included application can include other applications.

+

An application which is not included by any other application is + called a primary application.

+ + + Primary Application and Included Applications. + +

The application controller will automatically load any included + applications when loading a primary application, but not start + them. Instead, the top supervisor of the included application + must be started by a supervisor in the including application.

+

This means that when running, an included application is in fact + part of the primary application and a process in an included + application will consider itself belonging to the primary + application.

+
+ +
+ Specifying Included Applications +

Which applications to include is defined by + the included_applications key in the .app file.

+
+{application, prim_app,
+ [{description, "Tree application"},
+  {vsn, "1"},
+  {modules, [prim_app_cb, prim_app_sup, prim_app_server]},
+  {registered, [prim_app_server]},
+  {included_applications, [incl_app]},
+  {applications, [kernel, stdlib, sasl]},
+  {mod, {prim_app_cb,[]}},
+  {env, [{file, "/usr/local/log"}]}
+ ]}.
+
+ +
+ Synchronizing Processes During Startup +

The supervisor tree of an included application is started as + part of the supervisor tree of the including application. + If there is a need for synchronization between processes in + the including and included applications, this can be achieved + by using start phases.

+

Start phases are defined by the start_phases key in + the .app file as a list of tuples {Phase,PhaseArgs}, + where Phase is an atom and PhaseArgs is a term. + Also, the value of the mod key of the including application + must be set to {application_starter,[Module,StartArgs]}, + where Module as usual is the application callback module + and StartArgs a term provided as argument to the callback + function Module:start/2.

+ +{application, prim_app, + [{description, "Tree application"}, + {vsn, "1"}, + {modules, [prim_app_cb, prim_app_sup, prim_app_server]}, + {registered, [prim_app_server]}, + {included_applications, [incl_app]}, + {start_phases, [{init,[]}, {go,[]}]}, + {applications, [kernel, stdlib, sasl]}, + {mod, {application_starter,[prim_app_cb,[]]}}, + {env, [{file, "/usr/local/log"}]} + ]}. + +{application, incl_app, + [{description, "Included application"}, + {vsn, "1"}, + {modules, [incl_app_cb, incl_app_sup, incl_app_server]}, + {registered, []}, + {start_phases, [{go,[]}]}, + {applications, [kernel, stdlib, sasl]}, + {mod, {incl_app_cb,[]}} + ]}. +

When starting a primary application with included applications, + the primary application is started the normal way: + The application controller creates an application master for + the application, and the application master calls + Module:start(normal, StartArgs) to start the top + supervisor.

+

Then, for the primary application and each included application + in top-down, left-to-right order, the application master calls + Module:start_phase(Phase, Type, PhaseArgs) for each phase + defined for for the primary application, in that order. + Note that if a phase is not defined for an included application, + the function is not called for this phase and application.

+

The following requirements apply to the .app file for + an included application:

+ + The {mod, {Module,StartArgs}} option must be + included. This option is used to find the callback module + Module of the application. StartArgs is ignored, + as Module:start/2 is called only for the primary + application. + If the included application itself contains included + applications, instead the option + {mod, {application_starter, [Module,StartArgs]}} must be + included. + The {start_phases, [{Phase,PhaseArgs}]} option must + be included, and the set of specified phases must be a subset + of the set of phases specified for the primary application. + +

When starting prim_app as defined above, the application + controller will call the following callback functions, before + application:start(prim_app) returns a value:

+ +application:start(prim_app) + => prim_app_cb:start(normal, []) + => prim_app_cb:start_phase(init, normal, []) + => prim_app_cb:start_phase(go, normal, []) + => incl_app_cb:start_phase(go, normal, []) +ok +
+
+ diff --git a/system/doc/design_principles/make.dep b/system/doc/design_principles/make.dep new file mode 100644 index 0000000000..05dd2333fb --- /dev/null +++ b/system/doc/design_principles/make.dep @@ -0,0 +1,31 @@ +# ---------------------------------------------------- +# >>>> Do not edit this file <<<< +# This file was automaticly generated by +# /home/gandalf/otp/bin/docdepend +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# TeX files that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: applications.tex appup_cookbook.tex book.tex \ + des_princ.tex distributed_applications.tex \ + events.tex fsm.tex gen_server_concepts.tex \ + included_applications.tex part.tex release_handling.tex \ + release_structure.tex spec_proc.tex sup_princ.tex + +# ---------------------------------------------------- +# Pictures that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: sup6.ps + +book.dvi: dist1.ps dist2.ps dist3.ps dist4.ps dist5.ps + +book.dvi: clientserver.ps + +book.dvi: inclappls.ps + +book.dvi: sup4.ps sup5.ps + diff --git a/system/doc/design_principles/note.gif b/system/doc/design_principles/note.gif new file mode 100644 index 0000000000..6fffe30419 Binary files /dev/null and b/system/doc/design_principles/note.gif differ diff --git a/system/doc/design_principles/part.xml b/system/doc/design_principles/part.xml new file mode 100644 index 0000000000..d40b7cb23e --- /dev/null +++ b/system/doc/design_principles/part.xml @@ -0,0 +1,43 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + OTP Design Principles + + + + +
+ + + + + + + + + + + + +
+ diff --git a/system/doc/design_principles/release_handling.xml b/system/doc/design_principles/release_handling.xml new file mode 100644 index 0000000000..1d62c242c0 --- /dev/null +++ b/system/doc/design_principles/release_handling.xml @@ -0,0 +1,667 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Release Handling + + + + + release_handling.xml +
+ +
+ Release Handling Principles +

An important feature of the Erlang programming language is + the ability to change module code in run-time, code replacement, as described in Erlang Reference Manual.

+

Based on this feature, the OTP application SASL provides a + framework for upgrading and downgrading between different + versions of an entire release in run-time. This is what we call + release handling.

+

The framework consists of off-line support (systools) for + generating scripts and building release packages, and on-line + support (release_handler) for unpacking and installing + release packages.

+

Note that the minimal system based on Erlang/OTP, enabling + release handling, thus consists of Kernel, STDLIB and SASL.

+ + +

A release is created as described in the previous chapter + Releases. + The release is transferred to and installed at target + environment. Refer to System Principles for + information of how to install the first target system.

+
+ +

Modifications, for example error corrections, are made to + the code in the development environment.

+
+ +

At some point it is time to make a new version of release. + The relevant .app files are updated and a new + .rel file is written.

+
+ +

For each modified application, an + application upgrade file, + .appup, is created. In this file, it is described how + to upgrade and/or downgrade between the old and new version of + the application.

+
+ +

Based on the .appup files, a + release upgrade file called + relup, is created. This file describes how to upgrade + and/or downgrade between the old and new version of + the entire release.

+
+ +

A new release package is made and transferred to + the target system.

+
+ +

The new release package is unpacked using the release + handler.

+
+ +

The new version of the release is installed, also using + the release handler. This is done by evaluating + the instructions in relup. Modules may be added, + deleted or re-loaded, applications may be started, stopped or + re-started etc. In some cases, it is even necessary to restart + the entire emulator.

+

If the installation fails, the system may be rebooted. + The old release version is then automatically used.

+
+ +

If the installation succeeds, the new version is made + the default version, which should now be used in case of a + system reboot.

+
+
+

The next chapter, Appup Cookbook, contains examples of .appup files + for typical cases of upgrades/downgrades that are normally easy + to handle in run-time. However, there are a many aspects that can + make release handling complicated. To name a few examples:

+ + +

Complicated or circular dependencies can make it difficult + or even impossible to decide in which order things must be + done without risking run-time errors during an upgrade or + downgrade. Dependencies may be:

+ + between nodes, + between processes, and + between modules. + +
+ +

During release handling, non-affected processes continue + normal execution. This may lead to timeouts or other problems. + For example, new processes created in the time window between + suspending processes using a certain module and loading a new + version of this module, may execute old code.

+
+
+

It is therefore recommended that code is changed in as small + steps as possible, and always kept backwards compatible.

+
+ +
+ + Requirements +

For release handling to work properly, the runtime system needs + to have knowledge about which release it is currently running. It + must also be able to change (in run-time) which boot script and + system configuration file should be used if the system is + rebooted, for example by heart after a failure. + Therefore, Erlang must be started as an embedded system, see + Embedded System for information on how to do this.

+

For system reboots to work properly, it is also required that + the system is started with heart beat monitoring, see + erl(1) and heart(3).

+

Other requirements:

+ + +

The boot script included in a release package must be + generated from the same .rel file as the release + package itself.

+

Information about applications are fetched from the script + when an upgrade or downgrade is performed.

+
+ +

The system must be configured using one and only one system + configuration file, called sys.config.

+

If found, this file is automatically included when a release + package is created.

+
+ +

All versions of a release, except the first one, must + contain a relup file.

+

If found, this file is automatically included when a release + package is created.

+
+
+
+ +
+ Distributed Systems +

If the system consists of several Erlang nodes, each node may use + its own version of the release. The release handler is a locally + registered process and must be called at each node where an + upgrade or downgrade is required. There is a release handling + instruction that can be used to synchronize the release handler + processes at a number of nodes: sync_nodes. See + appup(4).

+
+ +
+ + Release Handling Instructions +

OTP supports a set of release handling instructions + that is used when creating .appup files. The release + handler understands a subset of these, the low-level + instructions. To make it easier for the user, there are also a + number of high-level instructions, which are translated + to low-level instructions by systools:make_relup.

+

Here, some of the most frequently used instructions are + described. The complete list of instructions is found in + appup(4).

+

First, some definitions:

+ + Residence module + +

The module where a process has its tail-recursive loop + function(s). If the tail-recursive loop functions are + implemented in several modules, all those modules are residence + modules for the process.

+
+ Functional module + +

A module which is not a residence module for any process.

+
+
+

Note that for a process implemented using an OTP behaviour, + the behaviour module is the residence module for that process. + The callback module is a functional module.

+ +
+ load_module +

If a simple extension has been made to a functional module, it + is sufficient to simply load the new version of the module into + the system, and remove the old version. This is called + simple code replacement and for this the following + instruction is used:

+ +{load_module, Module} +
+ +
+ update +

If a more complex change has been made, for example a change + to the format of the internal state of a gen_server, simple code + replacement is not sufficient. Instead it is necessary to + suspend the processes using the module (to avoid that they try + to handle any requests before the code replacement is + completed), ask them to transform the internal state format and + switch to the new version of the module, remove the old version + and last, resume the processes. This is called synchronized code replacement and for this the following instructions + are used:

+ +{update, Module, {advanced, Extra}} +{update, Module, supervisor} +

update with argument {advanced,Extra} is used + when changing the internal state of a behaviour as described + above. It will cause behaviour processes to call the callback + function code_change, passing the term Extra and + some other information as arguments. See the man pages for + the respective behaviours and + Appup Cookbook.

+

update with argument supervisor is used when + changing the start specification of a supervisor. See + Appup Cookbook.

+

The release handler finds the processes using a module + to update by traversing the supervision tree of each running + application and checking all the child specifications:

+ +{Id, StartFunc, Restart, Shutdown, Type, Modules} +

A process is using a module if the name is listed in + Modules in the child specification for the process.

+

If Modules=dynamic, which is the case for event + managers, the event manager process informs the release handler + about the list of currently installed event handlers (gen_fsm) + and it is checked if the module name is in this list instead.

+

The release handler suspends, asks for code change, and + resumes processes by calling the functions + sys:suspend/1,2, sys:change_code/4,5 and + sys:resume/1,2 respectively.

+
+ +
+ add_module and delete_module +

If a new module is introduced, the following instruction is + used:

+ +{add_module, Module} +

The instruction loads the module and is absolutely necessary + when running Erlang in embedded mode. It is not strictly + required when running Erlang in interactive (default) mode, + since the code server automatically searches for and loads + unloaded modules.

+

The opposite of add_module is delete_module which + unloads a module:

+ +{delete_module, Module} +

Note that any process, in any application, with Module + as residence module, is killed when the instruction is + evaluated. The user should therefore ensure that all such + processes are terminated before deleting the module, to avoid + a possible situation with failing supervisor restarts.

+
+ +
+ Application Instructions +

Instruction for adding an application:

+ +{add_application, Application} +

Adding an application means that the modules defined by + the modules key in the .app file are loaded using + a number of add_module instructions, then the application + is started.

+

Instruction for removing an application:

+ +{remove_application, Application} +

Removing an application means that the application is stopped, + the modules are unloaded using a number of delete_module + instructions and then the application specification is unloaded + from the application controller.

+

Instruction for removing an application:

+ +{restart_application, Application} +

Restarting an application means that the application is stopped + and then started again similar to using the instructions + remove_application and add_application in + sequence.

+
+ +
+ apply (low-level) +

To call an arbitrary function from the release handler, + the following instruction is used:

+ +{apply, {M, F, A}} +

The release handler will evalute apply(M, F, A).

+
+ +
+ restart_new_emulator (low-level) +

This instruction is used when changing to a new emulator + version, or if a system reboot is needed for some other reason. + Requires that the system is started with heart beat + monitoring, see erl(1) and heart(3).

+

When the release handler encounters the instruction, it shuts + down the current emulator by calling init:reboot(), see + init(3). All processes are terminated gracefully and + the system can then be rebooted by the heart program, using + the new release version. This new version must still be made + permanent when the new emulator is up and running. Otherwise, + the old version is used in case of a new system reboot.

+

On UNIX, the release handler tells the heart program which + command to use to reboot the system. Note that the environment + variable HEART_COMMAND, normally used by the heart + program, in this case is ignored. The command instead defaults + to $ROOT/bin/start. Another command can be set + by using the SASL configuration parameter start_prg, see + sasl(6).

+
+
+ +
+ + Application Upgrade File +

To define how to upgrade/downgrade between the current version + and previous versions of an application, we create an + application upgrade file, or in short .appup file. + The file should be called Application.appup, where + Application is the name of the application:

+ +{Vsn, + [{UpFromVsn1, InstructionsU1}, + ..., + {UpFromVsnK, InstructionsUK}], + [{DownToVsn1, InstructionsD1}, + ..., + {DownToVsnK, InstructionsDK}]}. +

Vsn, a string, is the current version of the application, + as defined in the .app file. Each UpFromVsn + is a previous version of the application to upgrade from, and each + DownToVsn is a previous version of the application to + downgrade to. Each Instructions is a list of release + handling instructions.

+

The syntax and contents of the appup file are described + in detail in appup(4).

+

In the chapter Appup Cookbook, examples of .appup files for typical + upgrade/downgrade cases are given.

+

Example: Consider the release ch_rel-1 from + the Releases + chapter. Assume we want to add a function available/0 to + the server ch3 which returns the number of available + channels:

+

(Hint: When trying out the example, make the changes in a copy of + the original directory, so that the first versions are still + available.)

+ +-module(ch3). +-behaviour(gen_server). + +-export([start_link/0]). +-export([alloc/0, free/1]). +-export([available/0]). +-export([init/1, handle_call/3, handle_cast/2]). + +start_link() -> + gen_server:start_link({local, ch3}, ch3, [], []). + +alloc() -> + gen_server:call(ch3, alloc). + +free(Ch) -> + gen_server:cast(ch3, {free, Ch}). + +available() -> + gen_server:call(ch3, available). + +init(_Args) -> + {ok, channels()}. + +handle_call(alloc, _From, Chs) -> + {Ch, Chs2} = alloc(Chs), + {reply, Ch, Chs2}; +handle_call(available, _From, Chs) -> + N = available(Chs), + {reply, N, Chs}. + +handle_cast({free, Ch}, Chs) -> + Chs2 = free(Ch, Chs), + {noreply, Chs2}. +

A new version of the ch_app.app file must now be created, + where the version is updated:

+ +{application, ch_app, + [{description, "Channel allocator"}, + {vsn, "2"}, + {modules, [ch_app, ch_sup, ch3]}, + {registered, [ch3]}, + {applications, [kernel, stdlib, sasl]}, + {mod, {ch_app,[]}} + ]}. +

To upgrade ch_app from "1" to "2" (and + to downgrade from "2" to "1"), we simply need to + load the new (old) version of the ch3 callback module. + We create the application upgrade file ch_app.appup in + the ebin directory:

+ +{"2", + [{"1", [{load_module, ch3}]}], + [{"1", [{load_module, ch3}]}] +}. +
+ +
+ + Release Upgrade File +

To define how to upgrade/downgrade between the new version and + previous versions of a release, we create a release upgrade file, or in short relup file.

+

This file does not need to be created manually, it can be + generated by systools:make_relup/3,4. The relevant versions + of the .rel file, .app files and .appup files + are used as input. It is deducted which applications should be + added and deleted, and which applications that need to be upgraded + and/or downgraded. The instructions for this is fetched from + the .appup files and transformed into a single list of + low-level instructions in the right order.

+

If the relup file is relatively simple, it can be created + manually. Remember that it should only contain low-level + instructions.

+

The syntax and contents of the release upgrade file are + described in detail in relup(4).

+

Example, continued from the previous section. We have a new + version "2" of ch_app and an .appup file. We also + need a new version of the .rel file. This time the file is + called ch_rel-2.rel and the release version string is + changed changed from "A" to "B":

+ +{release, + {"ch_rel", "B"}, + {erts, "5.3"}, + [{kernel, "2.9"}, + {stdlib, "1.12"}, + {sasl, "1.10"}, + {ch_app, "2"}] +}. +

Now the relup file can be generated:

+
+1> systools:make_relup("ch_rel-2", ["ch_rel-1"], ["ch_rel-1"]).
+ok
+

This will generate a relup file with instructions for + how to upgrade from version "A" ("ch_rel-1") to version "B" + ("ch_rel-2") and how to downgrade from version "B" to version "A".

+

Note that both the old and new versions of the .app and + .rel files must be in the code path, as well as + the .appup and (new) .beam files. It is possible + to extend the code path by using the option path:

+
+1> systools:make_relup("ch_rel-2", ["ch_rel-1"], ["ch_rel-1"],
+[{path,["../ch_rel-1",
+"../ch_rel-1/lib/ch_app-1/ebin"]}]).
+ok
+
+ +
+ + Installing a Release +

When we have made a new version of a release, a release package + can be created with this new version and transferred to the target + environment.

+

To install the new version of the release in run-time, + the release handler is used. This is a process belonging + to the SASL application, that handles unpacking, installation, + and removal of release packages. It is interfaced through + the module release_handler, which is described in detail in + release_handler(3).

+

Assuming there is a target system up and running with + installation root directory $ROOT, the release package with + the new version of the release should be copied to + $ROOT/releases.

+

The first action is to unpack the release package, + the files are then extracted from the package:

+ +release_handler:unpack_release(ReleaseName) => {ok, Vsn} +

ReleaseName is the name of the release package except + the .tar.gz extension. Vsn is the version of + the unpacked release, as defined in its .rel file.

+

A directory $ROOT/lib/releases/Vsn will be created, where + the .rel file, the boot script start.boot, + the system configuration file sys.config and relup + are placed. For applications with new version numbers, + the application directories will be placed under $ROOT/lib. + Unchanged applications are not affected.

+

An unpacked release can be installed. The release + handler then evaluates the instructions in relup, step by + step:

+ +release_handler:install_release(Vsn) => {ok, FromVsn, []} +

If an error occurs during the installation, the system is + rebooted using the old version of the release. If installation + succeeds, the system is afterwards using the new version of + the release, but should anything happen and the system is + rebooted, it would start using the previous version again. To be + made the default version, the newly installed release must be made + permanent, which means the previous version becomes + old:

+ +release_handler:make_permanent(Vsn) => ok +

The system keeps information about which versions are old and + permanent in the files $ROOT/releases/RELEASES and + $ROOT/releases/start_erl.data.

+

To downgrade from Vsn to FromVsn, + install_release must be called again:

+ +release_handler:install_release(FromVsn) => {ok, Vsn, []} +

An installed, but not permanent, release can be removed. + Information about the release is then deleted from + $ROOT/releases/RELEASES and the release specific code, + that is the new application directories and + the $ROOT/releases/Vsn directory, are removed.

+ +release_handler:remove_release(Vsn) => ok +

Example, continued from the previous sections:

+

1) Create a target system as described in System Principles of the first version "A" of ch_rel + from + the Releases + chapter. This time sys.config must be included in + the release package. If no configuration is needed, the file + should contain the empty list:

+ +[]. +

2) Start the system as a simple target system. Note that in + reality, it should be started as an embedded system. However, + using erl with the correct boot script and .config + file is enough for illustration purposes:

+
+% cd $ROOT
+% bin/erl -boot $ROOT/releases/A/start -config $ROOT/releases/A/sys
+...
+

$ROOT is the installation directory of the target system.

+

3) In another Erlang shell, generate start scripts and create a + release package for the new version "B". Remember to + include (a possible updated) sys.config and + the relup file, see Release Upgrade File above.

+
+1> systools:make_script("ch_rel-2").
+ok
+2> systools:make_tar("ch_rel-2").
+ok
+

The new release package now contains version "2" of ch_app + and the relup file as well:

+ +% tar tf ch_rel-2.tar +lib/kernel-2.9/ebin/kernel.app +lib/kernel-2.9/ebin/application.beam +... +lib/stdlib-1.12/ebin/stdlib.app +lib/stdlib-1.12/ebin/beam_lib.beam +... +lib/sasl-1.10/ebin/sasl.app +lib/sasl-1.10/ebin/sasl.beam +... +lib/ch_app-2/ebin/ch_app.app +lib/ch_app-2/ebin/ch_app.beam +lib/ch_app-2/ebin/ch_sup.beam +lib/ch_app-2/ebin/ch3.beam +releases/B/start.boot +releases/B/relup +releases/B/sys.config +releases/ch_rel-2.rel +

4) Copy the release package ch_rel-2.tar.gz to + the $ROOT/releases directory.

+

5) In the running target system, unpack the release package:

+
+1> release_handler:unpack_release("ch_rel-2").
+{ok,"B"}
+

The new application version ch_app-2 is installed under + $ROOT/lib next to ch_app-1. The kernel, + stdlib and sasl directories are not affected, as + they have not changed.

+

Under $ROOT/releases, a new directory B is created, + containing ch_rel-2.rel, start.boot, + sys.config and relup.

+

6) Check if the function ch3:available/0 is available:

+
+2> ch3:available().
+** exception error: undefined function ch3:available/0
+

7) Install the new release. The instructions in + $ROOT/releases/B/relup are executed one by one, resulting + in the new version of ch3 being loaded. The function + ch3:available/0 is now available:

+
+3> release_handler:install_release("B").
+{ok,"A",[]}
+4> ch3:available().
+3
+5> code:which(ch3).
+".../lib/ch_app-2/ebin/ch3.beam"
+6> code:which(ch_sup).
+".../lib/ch_app-1/ebin/ch_sup.beam"
+

Note that processes in ch_app for which code have not + been updated, for example the supervisor, are still evaluating + code from ch_app-1.

+

8) If the target system is now rebooted, it will use version "A" + again. The "B" version must be made permanent, in order to be + used when the system is rebooted.

+
+7> release_handler:make_permanent("B").
+ok
+
+ +
+ + Updating Application Specifications +

When a new version of a release is installed, the application + specifications are automatically updated for all loaded + applications.

+ +

The information about the new application specifications are + fetched from the boot script included in the release package. + It is therefore important that the boot script is generated from + the same .rel file as is used to build the release + package itself.

+
+

Specifically, the application configuration parameters are + automatically updated according to (in increasing priority + order):

+ + The data in the boot script, fetched from the new + application resource file App.app + The new sys.config + Command line arguments -App Par Val + +

This means that parameter values set in the other system + configuration files, as well as values set using + application:set_env/3, are disregarded.

+

When an installed release is made permanent, the system process + init is set to point out the new sys.config.

+

After the installation, the application controller will compare + the old and new configuration parameters for all running + applications and call the callback function:

+ +Module:config_change(Changed, New, Removed) +

Module is the application callback module as defined by + the mod key in the .app file. Changed and + New are lists of {Par,Val} for all changed and + added configuration parameters, respectively. Removed is + a list of all parameters Par that have been removed.

+

The function is optional and may be omitted when implementing an + application callback module.

+
+
+ diff --git a/system/doc/design_principles/release_structure.xml b/system/doc/design_principles/release_structure.xml new file mode 100644 index 0000000000..2e1daa611a --- /dev/null +++ b/system/doc/design_principles/release_structure.xml @@ -0,0 +1,302 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Releases + + + + + release_structure.xml +
+

This chapter should be read in conjuction with rel(4), + systools(3) and script(4).

+ +
+ Release Concept +

When we have written one or more applications, we might want to + create a complete system consisting of these applications and a + subset of the Erlang/OTP applications. This is called a + release.

+

To do this, we create a release resource file which defines which applications + are included in the release.

+

The release resource file is used to generate + boot scripts and + release packages. A system + which is transfered to and installed at another site is called a + target system. How to use a release package to create a + target system is described in System Principles.

+
+ +
+ + Release Resource File +

To define a release, we create a release resource file, + or in short .rel file, where we specify the name and + version of the release, which ERTS version it is based on, and + which applications it consists of:

+ +{release, {Name,Vsn}, {erts, EVsn}, + [{Application1, AppVsn1}, + ... + {ApplicationN, AppVsnN}]}. +

The file must be named Rel.rel, where Rel is a + unique name.

+

Name, Vsn and Evsn are strings.

+

Each Application (atom) and AppVsn (string) is + the name and version of an application included in the release. + Note the the minimal release based on Erlang/OTP consists of + the kernel and stdlib applications, so these + applications must be included in the list.

+ +

Example: We want to make a release of ch_app from + the Applications + chapter. It has the following .app file:

+ +{application, ch_app, + [{description, "Channel allocator"}, + {vsn, "1"}, + {modules, [ch_app, ch_sup, ch3]}, + {registered, [ch3]}, + {applications, [kernel, stdlib, sasl]}, + {mod, {ch_app,[]}} + ]}. +

The .rel file must also contain kernel, + stdlib and sasl, since these applications are + required by ch_app. We call the file ch_rel-1.rel:

+ +{release, + {"ch_rel", "A"}, + {erts, "5.3"}, + [{kernel, "2.9"}, + {stdlib, "1.12"}, + {sasl, "1.10"}, + {ch_app, "1"}] +}. +
+ +
+ + Generating Boot Scripts +

There are tools in the SASL module systools available to + build and check releases. The functions read the .rel and + .app files and performs syntax and dependency checks. + The function systools:make_script/1,2 is used to generate + a boot script (see System Principles).

+
+1> systools:make_script("ch_rel-1", [local]).
+ok
+

This creates a boot script, both the readable version + ch_rel-1.script and the binary version used by the runtime + system, ch_rel-1.boot. "ch_rel-1" is the name of + the .rel file, minus the extension. local is an + option that means that the directories where the applications are + found are used in the boot script, instead of $ROOT/lib. + ($ROOT is the root directory of the installed release.) + This is a useful way to test a generated boot script locally.

+

When starting Erlang/OTP using the boot script, all applications + from the .rel file are automatically loaded and started:

+
+% erl -boot ch_rel-1
+Erlang (BEAM) emulator version 5.3
+
+Eshell V5.3  (abort with ^G)
+1> 
+=PROGRESS REPORT==== 13-Jun-2003::12:01:15 ===
+          supervisor: {local,sasl_safe_sup}
+             started: [{pid,<0.33.0>},
+                       {name,alarm_handler},
+                       {mfa,{alarm_handler,start_link,[]}},
+                       {restart_type,permanent},
+                       {shutdown,2000},
+                       {child_type,worker}]
+
+...
+
+=PROGRESS REPORT==== 13-Jun-2003::12:01:15 ===
+         application: sasl
+          started_at: nonode@nohost
+
+...
+=PROGRESS REPORT==== 13-Jun-2003::12:01:15 ===
+         application: ch_app
+          started_at: nonode@nohost
+
+ +
+ + Creating a Release Package +

There is a function systools:make_tar/1,2 which takes + a .rel file as input and creates a zipped tar-file with + the code for the specified applications, a release package.

+
+1> systools:make_script("ch_rel-1").
+ok
+2> systools:make_tar("ch_rel-1").
+ok
+

The release package by default contains the .app files and + object code for all applications, structured according to + the application directory structure, the binary boot script renamed to + start.boot, and the .rel file.

+
+% tar tf ch_rel-1.tar
+lib/kernel-2.9/ebin/kernel.app
+lib/kernel-2.9/ebin/application.beam
+...
+lib/stdlib-1.12/ebin/stdlib.app
+lib/stdlib-1.12/ebin/beam_lib.beam
+...
+lib/sasl-1.10/ebin/sasl.app
+lib/sasl-1.10/ebin/sasl.beam
+...
+lib/ch_app-1/ebin/ch_app.app
+lib/ch_app-1/ebin/ch_app.beam
+lib/ch_app-1/ebin/ch_sup.beam
+lib/ch_app-1/ebin/ch3.beam
+releases/A/start.boot
+releases/ch_rel-1.rel
+

Note that a new boot script was generated, without + the local option set, before the release package was made. + In the release package, all application directories are placed + under lib. Also, we do not know where the release package + will be installed, so we do not want any hardcoded absolute paths + in the boot script here.

+

If a relup file and/or a system configuration file called + sys.config is found, these files are included in + the release package as well. See + Release Handling.

+

Options can be set to make the release package include source + code and the ERTS binary as well.

+

Refer to System Principles for how to install the first target + system, using a release package, and to + Release Handling for + how to install a new release package in an existing system.

+
+ +
+ + Directory Structure +

Directory structure for the code installed by the release handler + from a release package:

+ +$ROOT/lib/App1-AVsn1/ebin + /priv + /App2-AVsn2/ebin + /priv + ... + /AppN-AVsnN/ebin + /priv + /erts-EVsn/bin + /releases/Vsn + /bin + + lib + Application directories. + erts-EVsn/bin + Erlang runtime system executables. + releases/Vsn + .rel file and boot script start.boot.

+ + If present in the release package,

+relup and/or sys.config.
+ bin + Top level Erlang runtime system executables. +
+

Applications are not required to be located under the + $ROOT/lib directory. Accordingly, several installation + directories may exist which contain different parts of a + system. For example, the previous example could be extended as + follows:

+
+$SECOND_ROOT/.../SApp1-SAVsn1/ebin
+                             /priv
+                /SApp2-SAVsn2/ebin
+                             /priv
+                ...
+                /SAppN-SAVsnN/ebin
+                             /priv
+
+$THIRD_ROOT/TApp1-TAVsn1/ebin
+                        /priv
+           /TApp2-TAVsn2/ebin
+                        /priv
+           ...
+           /TAppN-TAVsnN/ebin
+                        /priv
+

The $SECOND_ROOT and $THIRD_ROOT are introduced as + variables in the call to the systools:make_script/2 + function.

+ +
+ Disk-Less and/or Read-Only Clients +

If a complete system consists of some disk-less and/or + read-only client nodes, a clients directory should be + added to the $ROOT directory. By a read-only node we + mean a node with a read-only file system.

+

The clients directory should have one sub-directory + per supported client node. The name of each client directory + should be the name of the corresponding client node. As a + minimum, each client directory should contain the bin and + releases sub-directories. These directories are used to + store information about installed releases and to appoint the + current release to the client. Accordingly, the $ROOT + directory contains the following:

+ +$ROOT/... + /clients/ClientName1/bin + /releases/Vsn + /ClientName2/bin + /releases/Vsn + ... + /ClientNameN/bin + /releases/Vsn +

This structure should be used if all clients are running + the same type of Erlang machine. If there are clients running + different types of Erlang machines, or on different operating + systems, the clients directory could be divided into one + sub-directory per type of Erlang machine. Alternatively, you + can set up one $ROOT per type of machine. For each + type, some of the directories specified for the $ROOT + directory should be included:

+ +$ROOT/... + /clients/Type1/lib + /erts-EVsn + /bin + /ClientName1/bin + /releases/Vsn + /ClientName2/bin + /releases/Vsn + ... + /ClientNameN/bin + /releases/Vsn + ... + /TypeN/lib + /erts-EVsn + /bin + ... +

With this structure, the root directory for clients of + Type1 is $ROOT/clients/Type1.

+
+
+
+ diff --git a/system/doc/design_principles/spec_proc.xml b/system/doc/design_principles/spec_proc.xml new file mode 100644 index 0000000000..f0f62891b6 --- /dev/null +++ b/system/doc/design_principles/spec_proc.xml @@ -0,0 +1,460 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Sys and Proc_Lib + + + + + spec_proc.xml +
+

The module sys contains functions for simple debugging of + processes implemented using behaviours.

+

There are also functions that, together with functions in + the module proc_lib, can be used to implement a + special process, a process which comply to the OTP design + principles without making use of a standard behaviour. They can + also be used to implement user defined (non-standard) behaviours.

+

Both sys and proc_lib belong to the STDLIB + application.

+ +
+ Simple Debugging +

The module sys contains some functions for simple debugging + of processes implemented using behaviours. We use the + code_lock example from + the gen_event chapter to + illustrate this:

+
+% erl
+Erlang (BEAM) emulator version 5.2.3.6 [hipe] [threads:0]
+
+Eshell V5.2.3.6  (abort with ^G)
+1> code_lock:start_link([1,2,3,4]).
+{ok,<0.32.0>}
+2> sys:statistics(code_lock, true).
+ok
+3> sys:trace(code_lock, true).
+ok
+4> code_lock:button(4).
+*DBG* code_lock got event {button,4} in state closed
+ok
+*DBG* code_lock switched to state closed
+5> code_lock:button(3).
+*DBG* code_lock got event {button,3} in state closed
+ok
+*DBG* code_lock switched to state closed
+6> code_lock:button(2).
+*DBG* code_lock got event {button,2} in state closed
+ok
+*DBG* code_lock switched to state closed
+7> code_lock:button(1).
+*DBG* code_lock got event {button,1} in state closed
+ok
+OPEN DOOR
+*DBG* code_lock switched to state open
+*DBG* code_lock got event timeout in state open
+CLOSE DOOR
+*DBG* code_lock switched to state closed
+8> sys:statistics(code_lock, get). 
+{ok,[{start_time,{{2003,6,12},{14,11,40}}},
+     {current_time,{{2003,6,12},{14,12,14}}},
+     {reductions,333},
+     {messages_in,5},
+     {messages_out,0}]}
+9> sys:statistics(code_lock, false).
+ok
+10> sys:trace(code_lock, false).     
+ok
+11> sys:get_status(code_lock).
+{status,<0.32.0>,
+        {module,gen_fsm},
+        [[{'$ancestors',[<0.30.0>]},
+          {'$initial_call',{gen,init_it,
+                                [gen_fsm,<0.30.0>,<0.30.0>,
+                                 {local,code_lock},
+                                 code_lock,
+                                 [1,2,3,4],
+                                 []]}}],
+         running,<0.30.0>,[],
+         [code_lock,closed,{[],[1,2,3,4]},code_lock,infinity]]}
+
+ +
+ Special Processes +

This section describes how to write a process which comply to + the OTP design principles, without making use of a standard + behaviour. Such a process should:

+ + be started in a way that makes the process fit into a + supervision tree, + support the sysdebug facilities, and + take care of system messages. + +

System messages are messages with special meaning, used in + the supervision tree. Typical system messages are requests for + trace output, and requests to suspend or resume process execution + (used during release handling). Processes implemented using + standard behaviours automatically understand these messages.

+ +
+ Example +

The simple server from + the Overview chapter, + implemented using sys and proc_lib so it fits into + a supervision tree:

+ +
+-module(ch4).
+-export([start_link/0]).
+-export([alloc/0, free/1]).
+-export([init/1]).
+-export([system_continue/3, system_terminate/4,
+         write_debug/3]).
+
+start_link() ->
+    proc_lib:start_link(ch4, init, [self()]).
+
+alloc() ->
+    ch4 ! {self(), alloc},
+    receive
+        {ch4, Res} ->
+            Res
+    end.
+
+free(Ch) ->
+    ch4 ! {free, Ch},
+    ok.
+
+init(Parent) ->
+    register(ch4, self()),
+    Chs = channels(),
+    Deb = sys:debug_options([]),
+    proc_lib:init_ack(Parent, {ok, self()}),
+    loop(Chs, Parent, Deb).
+
+loop(Chs, Parent, Deb) ->
+    receive
+        {From, alloc} ->
+            Deb2 = sys:handle_debug(Deb, {ch4, write_debug},
+                                    ch4, {in, alloc, From}),
+            {Ch, Chs2} = alloc(Chs),
+            From ! {ch4, Ch},
+            Deb3 = sys:handle_debug(Deb2, {ch4, write_debug},
+                                    ch4, {out, {ch4, Ch}, From}),
+            loop(Chs2, Parent, Deb3);
+        {free, Ch} ->
+            Deb2 = sys:handle_debug(Deb, {ch4, write_debug},
+                                    ch4, {in, {free, Ch}}),
+            Chs2 = free(Ch, Chs),
+            loop(Chs2, Parent, Deb2);
+
+        {system, From, Request} ->
+            sys:handle_system_msg(Request, From, Parent,
+                                  ch4, Deb, Chs)
+    end.
+
+system_continue(Parent, Deb, Chs) ->
+    loop(Chs, Parent, Deb).
+
+system_terminate(Reason, Parent, Deb, Chs) ->
+    exit(Reason).
+
+write_debug(Dev, Event, Name) ->
+    io:format(Dev, "~p event = ~p~n", [Name, Event]).
+

Example on how the simple debugging functions in sys can + be used for ch4 as well:

+
+% erl
+Erlang (BEAM) emulator version 5.2.3.6 [hipe] [threads:0]
+
+Eshell V5.2.3.6  (abort with ^G)
+1> ch4:start_link().
+{ok,<0.30.0>}
+2> sys:statistics(ch4, true).
+ok
+3> sys:trace(ch4, true).
+ok
+4> ch4:alloc().
+ch4 event = {in,alloc,<0.25.0>}
+ch4 event = {out,{ch4,ch1},<0.25.0>}
+ch1
+5> ch4:free(ch1).
+ch4 event = {in,{free,ch1}}
+ok
+6> sys:statistics(ch4, get).
+{ok,[{start_time,{{2003,6,13},{9,47,5}}},
+     {current_time,{{2003,6,13},{9,47,56}}},
+     {reductions,109},
+     {messages_in,2},
+     {messages_out,1}]}
+7> sys:statistics(ch4, false).
+ok
+8> sys:trace(ch4, false).
+ok
+9> sys:get_status(ch4).
+{status,<0.30.0>,
+        {module,ch4},
+        [[{'$ancestors',[<0.25.0>]},{'$initial_call',{ch4,init,[<0.25.0>]}}],
+         running,<0.25.0>,[],
+         [ch1,ch2,ch3]]}
+
+ +
+ Starting the Process +

A function in the proc_lib module should be used to + start the process. There are several possible functions, for + example spawn_link/3,4 for asynchronous start and + start_link/3,4,5 for synchronous start.

+

A process started using one of these functions will store + information that is needed for a process in a supervision tree, + for example about the ancestors and initial call.

+

Also, if the process terminates with another reason than + normal or shutdown, a crash report (see SASL + User's Guide) is generated.

+

In the example, synchronous start is used. The process is + started by calling ch4:start_link():

+ +start_link() -> + proc_lib:start_link(ch4, init, [self()]). +

ch4:start_link calls the function + proc_lib:start_link. This function takes a module name, + a function name and an argument list as arguments and spawns + and links to a new process. The new process starts by executing + the given function, in this case ch4:init(Pid), where + Pid is the pid (self()) of the first process, that + is the parent process.

+

In init, all initialization including name registration + is done. The new process must also acknowledge that it has been + started to the parent:

+ +init(Parent) -> + ... + proc_lib:init_ack(Parent, {ok, self()}), + loop(...). +

proc_lib:start_link is synchronous and does not return + until proc_lib:init_ack has been called.

+
+ +
+ + Debugging +

To support the debug facilites in sys, we need a + debug structure, a term Deb which is + initialized using sys:debug_options/1:

+ +init(Parent) -> + ... + Deb = sys:debug_options([]), + ... + loop(Chs, Parent, Deb). +

sys:debug_options/1 takes a list of options as argument. + Here the list is empty, which means no debugging is enabled + initially. See sys(3) for information about possible + options.

+

Then for each system event that we want to be logged + or traced, the following function should be called.

+ +sys:handle_debug(Deb, Func, Info, Event) => Deb1 + + +

Deb is the debug structure.

+
+ +

Func is a tuple {Module, Name} (or a fun) and + should specify a (user defined) function used to format + trace output. For each system event, the format function is + called as Module:Name(Dev, Event, Info), where:

+ + +

Dev is the IO device to which the output should + be printed. See io(3).

+
+ +

Event and Info are passed as-is from + handle_debug.

+
+
+
+ +

Info is used to pass additional information to + Func, it can be any term and is passed as-is.

+
+ +

Event is the system event. It is up to the user to + define what a system event is and how it should be + represented, but typically at least incoming and outgoing + messages are considered system events and represented by + the tuples {in,Msg[,From]} and {out,Msg,To}, + respectively.

+
+
+

handle_debug returns an updated debug structure + Deb1.

+

In the example, handle_debug is called for each incoming + and outgoing message. The format function Func is + the function ch4:write_debug/3 which prints the message + using io:format/3.

+ +loop(Chs, Parent, Deb) -> + receive + {From, alloc} -> + Deb2 = sys:handle_debug(Deb, {ch4, write_debug}, + ch4, {in, alloc, From}), + {Ch, Chs2} = alloc(Chs), + From ! {ch4, Ch}, + Deb3 = sys:handle_debug(Deb2, {ch4, write_debug}, + ch4, {out, {ch4, Ch}, From}), + loop(Chs2, Parent, Deb3); + {free, Ch} -> + Deb2 = sys:handle_debug(Deb, {ch4, write_debug}, + ch4, {in, {free, Ch}}), + Chs2 = free(Ch, Chs), + loop(Chs2, Parent, Deb2); + ... + end. + +write_debug(Dev, Event, Name) -> + io:format(Dev, "~p event = ~p~n", [Name, Event]). +
+ +
+ + Handling System Messages +

System messages are received as:

+ +{system, From, Request} +

The content and meaning of these messages do not need to be + interpreted by the process. Instead the following function + should be called:

+ +sys:handle_system_msg(Request, From, Parent, Module, Deb, State) +

This function does not return. It will handle the system + message and then call:

+ +Module:system_continue(Parent, Deb, State) +

if process execution should continue, or:

+ +Module:system_terminate(Reason, Parent, Deb, State) +

if the process should terminate. Note that a process in a + supervision tree is expected to terminate with the same reason as + its parent.

+ + Request and From should be passed as-is from + the system message to the call to handle_system_msg. + Parent is the pid of the parent. + Module is the name of the module. + Deb is the debug structure. + State is a term describing the internal state and + is passed to system_continue/system_terminate. + +

In the example:

+ +loop(Chs, Parent, Deb) -> + receive + ... + + {system, From, Request} -> + sys:handle_system_msg(Request, From, Parent, + ch4, Deb, Chs) + end. + +system_continue(Parent, Deb, Chs) -> + loop(Chs, Parent, Deb). + +system_terminate(Reason, Parent, Deb, Chs) -> + exit(Reason). +

If the special process is set to trap exits, note that if + the parent process terminates, the expected behavior is to + terminate with the same reason:

+ +init(...) -> + ..., + process_flag(trap_exit, true), + ..., + loop(...). + +loop(...) -> + receive + ... + + {'EXIT', Parent, Reason} -> + ..maybe some cleaning up here.. + exit(Reason); + ... + end. +
+
+ +
+ User-Defined Behaviours +

To implement a user-defined behaviour, write code similar to + code for a special process but calling functions in a callback + module for handling specific tasks.

+

If it is desired that the compiler should warn for missing + callback functions, as it does for the OTP behaviours, implement + and export the function:

+ +behaviour_info(callbacks) -> + [{Name1,Arity1},...,{NameN,ArityN}]. +

where each {Name,Arity} specifies the name and arity of + a callback function.

+

When the compiler encounters the module attribute + -behaviour(Behaviour). in a module Mod, it will call + Behaviour:behaviour_info(callbacks) and compare the result + with the set of functions actually exported from Mod, and + issue a warning if any callback function is missing.

+

Example:

+ +%% User-defined behaviour module +-module(simple_server). +-export([start_link/2,...]). +-export([behaviour_info/1]). + +behaviour_info(callbacks) -> + [{init,1}, + {handle_req,1}, + {terminate,0}]. + +start_link(Name, Module) -> + proc_lib:start_link(?MODULE, init, [self(), Name, Module]). + +init(Parent, Name, Module) -> + register(Name, self()), + ..., + Dbg = sys:debug_options([]), + proc_lib:init_ack(Parent, {ok, self()}), + loop(Parent, Module, Deb, ...). + +... +

In a callback module:

+ +-module(db). +-behaviour(simple_server). + +-export([init/0, handle_req/1, terminate/0]). + +... +
+
+ diff --git a/system/doc/design_principles/sup4.fig b/system/doc/design_principles/sup4.fig new file mode 100644 index 0000000000..9127f9797c --- /dev/null +++ b/system/doc/design_principles/sup4.fig @@ -0,0 +1,32 @@ +#FIG 3.1 +Landscape +Center +Inches +1200 2 +6 2100 750 2550 1200 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 2100 750 2550 750 2550 1200 2100 1200 2100 750 +4 0 -1 0 0 2 14 0.0000 4 150 105 2250 1050 1\001 +-6 +1 4 0 1 -1 7 0 0 -1 0.000 1 0.0000 4762 2700 293 293 4575 2475 4950 2925 +1 4 0 1 -1 7 0 0 -1 0.000 1 0.0000 3112 2775 293 293 2925 2550 3300 3000 +1 4 0 1 -1 7 0 0 -1 0.000 1 0.0000 1987 2775 293 293 1800 2550 2175 3000 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 675 2550 1125 2550 1125 3000 675 3000 675 2550 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 900 2550 2250 1200 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 1950 2475 2325 1200 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2400 1200 3000 2475 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2475 1200 4500 2550 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2625 2325 3450 3150 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2625 3225 3525 2325 +4 0 -1 0 0 2 14 0.0000 4 150 240 1875 2850 P1\001 +4 0 -1 0 0 2 14 0.0000 4 150 240 3000 2850 P2\001 +4 0 -1 0 0 2 14 0.0000 4 150 255 4650 2775 Pn\001 +4 0 -1 0 0 0 14 0.0000 4 195 2025 3450 975 One for one supervision\001 +4 0 -1 0 0 0 14 0.0000 4 195 2490 3450 1200 If any child dies it is restarted\001 diff --git a/system/doc/design_principles/sup4.gif b/system/doc/design_principles/sup4.gif new file mode 100644 index 0000000000..fc099f9b06 Binary files /dev/null and b/system/doc/design_principles/sup4.gif differ diff --git a/system/doc/design_principles/sup4.ps b/system/doc/design_principles/sup4.ps new file mode 100644 index 0000000000..2507fcc36e --- /dev/null +++ b/system/doc/design_principles/sup4.ps @@ -0,0 +1,153 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: sup4.fig +%%Creator: fig2dev Version 3.1 Patchlevel 2 +%%CreationDate: Thu May 15 12:49:21 1997 +%%For: jocke@akvavit (Joakim Greben|,ETX/B/DUP) +%Magnification: 1.00 +%%Orientation: Portrait +%%BoundingBox: 0 0 322 151 +%%Pages: 0 +%%BeginSetup +%%IncludeFeature: *PageSize A4 +%%EndSetup +%%EndComments +/$F2psDict 200 dict def +$F2psDict begin +$F2psDict /mtrx matrix put +/col-1 {0 setgray} bind def +/col0 {0.000 0.000 0.000 srgb} bind def +/col1 {0.000 0.000 1.000 srgb} bind def +/col2 {0.000 1.000 0.000 srgb} bind def +/col3 {0.000 1.000 1.000 srgb} bind def +/col4 {1.000 0.000 0.000 srgb} bind def +/col5 {1.000 0.000 1.000 srgb} bind def +/col6 {1.000 1.000 0.000 srgb} bind def +/col7 {1.000 1.000 1.000 srgb} bind def +/col8 {0.000 0.000 0.560 srgb} bind def +/col9 {0.000 0.000 0.690 srgb} bind def +/col10 {0.000 0.000 0.820 srgb} bind def +/col11 {0.530 0.810 1.000 srgb} bind def +/col12 {0.000 0.560 0.000 srgb} bind def +/col13 {0.000 0.690 0.000 srgb} bind def +/col14 {0.000 0.820 0.000 srgb} bind def +/col15 {0.000 0.560 0.560 srgb} bind def +/col16 {0.000 0.690 0.690 srgb} bind def +/col17 {0.000 0.820 0.820 srgb} bind def +/col18 {0.560 0.000 0.000 srgb} bind def +/col19 {0.690 0.000 0.000 srgb} bind def +/col20 {0.820 0.000 0.000 srgb} bind def +/col21 {0.560 0.000 0.560 srgb} bind def +/col22 {0.690 0.000 0.690 srgb} bind def +/col23 {0.820 0.000 0.820 srgb} bind def +/col24 {0.500 0.190 0.000 srgb} bind def +/col25 {0.630 0.250 0.000 srgb} bind def +/col26 {0.750 0.380 0.000 srgb} bind def +/col27 {1.000 0.500 0.500 srgb} bind def +/col28 {1.000 0.630 0.630 srgb} bind def +/col29 {1.000 0.750 0.750 srgb} bind def +/col30 {1.000 0.880 0.880 srgb} bind def +/col31 {1.000 0.840 0.000 srgb} bind def + +end +save +-39.0 195.0 translate +1 -1 scale + +/cp {closepath} bind def +/ef {eofill} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth} bind def +/tr {translate} bind def +/tnt {dup dup currentrgbcolor + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} + bind def +/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul + 4 -2 roll mul srgb} bind def + /DrawEllipse { + /endangle exch def + /startangle exch def + /yrad exch def + /xrad exch def + /y exch def + /x exch def + /savematrix mtrx currentmatrix def + x y tr xrad yrad sc 0 0 1 startangle endangle arc + closepath + savematrix setmatrix + } def + +/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def +/$F2psEnd {$F2psEnteredState restore end} def +%%EndProlog + +$F2psBegin +10 setmiterlimit +n 0 842 m 0 0 l 595 0 l 595 842 l cp clip + 0.06000 0.06000 sc +7.500 slw +% Polyline +n 2100 750 m 2550 750 l 2550 1200 l 2100 1200 l cp gs col-1 s gr +/Times-Bold ff 210.00 scf sf +2250 1050 m +gs 1 -1 sc (1) col-1 sh gr +% Ellipse +n 4762 2700 293 293 0 360 DrawEllipse gs col-1 s gr + +% Ellipse +n 3112 2775 293 293 0 360 DrawEllipse gs col-1 s gr + +% Ellipse +n 1987 2775 293 293 0 360 DrawEllipse gs col-1 s gr + +% Polyline +n 675 2550 m 1125 2550 l 1125 3000 l 675 3000 l cp gs col-1 s gr +% Polyline +n 900 2550 m 2250 1200 l gs col-1 s gr +% Polyline +n 1950 2475 m 2325 1200 l gs col-1 s gr +% Polyline +n 2400 1200 m 3000 2475 l gs col-1 s gr +% Polyline +n 2475 1200 m 4500 2550 l gs col-1 s gr +% Polyline +n 2625 2325 m 3450 3150 l gs col-1 s gr +% Polyline +n 2625 3225 m 3525 2325 l gs col-1 s gr +/Times-Bold ff 210.00 scf sf +1875 2850 m +gs 1 -1 sc (P1) col-1 sh gr +/Times-Bold ff 210.00 scf sf +3000 2850 m +gs 1 -1 sc (P2) col-1 sh gr +/Times-Bold ff 210.00 scf sf +4650 2775 m +gs 1 -1 sc (Pn) col-1 sh gr +/Times-Roman ff 210.00 scf sf +3450 975 m +gs 1 -1 sc (One for one supervision) col-1 sh gr +/Times-Roman ff 210.00 scf sf +3450 1200 m +gs 1 -1 sc (If any child dies it is restarted) col-1 sh gr +$F2psEnd +rs diff --git a/system/doc/design_principles/sup5.fig b/system/doc/design_principles/sup5.fig new file mode 100644 index 0000000000..554ab28ba0 --- /dev/null +++ b/system/doc/design_principles/sup5.fig @@ -0,0 +1,43 @@ +#FIG 3.1 +Landscape +Center +Inches +1200 2 +1 4 0 1 -1 7 0 0 -1 0.000 1 0.0000 4762 2700 293 293 4575 2475 4950 2925 +1 4 0 1 -1 7 0 0 -1 0.000 1 0.0000 3112 2775 293 293 2925 2550 3300 3000 +1 4 0 1 -1 7 0 0 -1 0.000 1 0.0000 1987 2775 293 293 1800 2550 2175 3000 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 675 2550 1125 2550 1125 3000 675 3000 675 2550 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 900 2550 2250 1200 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 1950 2475 2325 1200 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2400 1200 3000 2475 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2475 1200 4500 2550 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 2100 750 2550 750 2550 1200 2100 1200 2100 750 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2775 2325 3450 3225 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2775 3150 3525 2400 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4350 3075 5100 2250 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4425 2175 5100 3150 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 1650 2325 2325 3150 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 1650 3150 2325 2400 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 525 2325 1350 3150 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 525 3150 1350 2325 +4 0 -1 0 0 2 14 0.0000 4 150 240 1875 2850 P1\001 +4 0 -1 0 0 2 14 0.0000 4 150 240 3000 2850 P2\001 +4 0 -1 0 0 2 14 0.0000 4 150 255 4650 2775 Pn\001 +4 0 -1 0 0 0 14 0.0000 4 195 2310 3525 1005 If any child dies all children\001 +4 0 -1 0 0 0 14 0.0000 4 150 3015 3525 1260 are terminated and all are restarted\001 +4 0 -1 0 0 2 14 0.0000 4 105 105 2250 1050 a\001 +4 0 -1 0 0 0 14 0.0000 4 195 2040 3525 750 all-for-one supervision\001 diff --git a/system/doc/design_principles/sup5.gif b/system/doc/design_principles/sup5.gif new file mode 100644 index 0000000000..1197278f63 Binary files /dev/null and b/system/doc/design_principles/sup5.gif differ diff --git a/system/doc/design_principles/sup5.ps b/system/doc/design_principles/sup5.ps new file mode 100644 index 0000000000..40eb07a132 --- /dev/null +++ b/system/doc/design_principles/sup5.ps @@ -0,0 +1,168 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: sup5.fig +%%Creator: fig2dev Version 3.1 Patchlevel 2 +%%CreationDate: Thu May 15 12:49:29 1997 +%%For: jocke@akvavit (Joakim Greben|,ETX/B/DUP) +%Magnification: 1.00 +%%Orientation: Portrait +%%BoundingBox: 0 0 368 160 +%%Pages: 0 +%%BeginSetup +%%IncludeFeature: *PageSize A4 +%%EndSetup +%%EndComments +/$F2psDict 200 dict def +$F2psDict begin +$F2psDict /mtrx matrix put +/col-1 {0 setgray} bind def +/col0 {0.000 0.000 0.000 srgb} bind def +/col1 {0.000 0.000 1.000 srgb} bind def +/col2 {0.000 1.000 0.000 srgb} bind def +/col3 {0.000 1.000 1.000 srgb} bind def +/col4 {1.000 0.000 0.000 srgb} bind def +/col5 {1.000 0.000 1.000 srgb} bind def +/col6 {1.000 1.000 0.000 srgb} bind def +/col7 {1.000 1.000 1.000 srgb} bind def +/col8 {0.000 0.000 0.560 srgb} bind def +/col9 {0.000 0.000 0.690 srgb} bind def +/col10 {0.000 0.000 0.820 srgb} bind def +/col11 {0.530 0.810 1.000 srgb} bind def +/col12 {0.000 0.560 0.000 srgb} bind def +/col13 {0.000 0.690 0.000 srgb} bind def +/col14 {0.000 0.820 0.000 srgb} bind def +/col15 {0.000 0.560 0.560 srgb} bind def +/col16 {0.000 0.690 0.690 srgb} bind def +/col17 {0.000 0.820 0.820 srgb} bind def +/col18 {0.560 0.000 0.000 srgb} bind def +/col19 {0.690 0.000 0.000 srgb} bind def +/col20 {0.820 0.000 0.000 srgb} bind def +/col21 {0.560 0.000 0.560 srgb} bind def +/col22 {0.690 0.000 0.690 srgb} bind def +/col23 {0.820 0.000 0.820 srgb} bind def +/col24 {0.500 0.190 0.000 srgb} bind def +/col25 {0.630 0.250 0.000 srgb} bind def +/col26 {0.750 0.380 0.000 srgb} bind def +/col27 {1.000 0.500 0.500 srgb} bind def +/col28 {1.000 0.630 0.630 srgb} bind def +/col29 {1.000 0.750 0.750 srgb} bind def +/col30 {1.000 0.880 0.880 srgb} bind def +/col31 {1.000 0.840 0.000 srgb} bind def + +end +save +-30.0 195.0 translate +1 -1 scale + +/cp {closepath} bind def +/ef {eofill} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth} bind def +/tr {translate} bind def +/tnt {dup dup currentrgbcolor + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} + bind def +/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul + 4 -2 roll mul srgb} bind def + /DrawEllipse { + /endangle exch def + /startangle exch def + /yrad exch def + /xrad exch def + /y exch def + /x exch def + /savematrix mtrx currentmatrix def + x y tr xrad yrad sc 0 0 1 startangle endangle arc + closepath + savematrix setmatrix + } def + +/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def +/$F2psEnd {$F2psEnteredState restore end} def +%%EndProlog + +$F2psBegin +10 setmiterlimit +n 0 842 m 0 0 l 595 0 l 595 842 l cp clip + 0.06000 0.06000 sc +7.500 slw +% Ellipse +n 4762 2700 293 293 0 360 DrawEllipse gs col-1 s gr + +% Ellipse +n 3112 2775 293 293 0 360 DrawEllipse gs col-1 s gr + +% Ellipse +n 1987 2775 293 293 0 360 DrawEllipse gs col-1 s gr + +% Polyline +n 675 2550 m 1125 2550 l 1125 3000 l 675 3000 l cp gs col-1 s gr +% Polyline +n 900 2550 m 2250 1200 l gs col-1 s gr +% Polyline +n 1950 2475 m 2325 1200 l gs col-1 s gr +% Polyline +n 2400 1200 m 3000 2475 l gs col-1 s gr +% Polyline +n 2475 1200 m 4500 2550 l gs col-1 s gr +% Polyline +n 2100 750 m 2550 750 l 2550 1200 l 2100 1200 l cp gs col-1 s gr +% Polyline +n 2775 2325 m 3450 3225 l gs col-1 s gr +% Polyline +n 2775 3150 m 3525 2400 l gs col-1 s gr +% Polyline +n 4350 3075 m 5100 2250 l gs col-1 s gr +% Polyline +n 4425 2175 m 5100 3150 l gs col-1 s gr +% Polyline +n 1650 2325 m 2325 3150 l gs col-1 s gr +% Polyline +n 1650 3150 m 2325 2400 l gs col-1 s gr +% Polyline +n 525 2325 m 1350 3150 l gs col-1 s gr +% Polyline +n 525 3150 m 1350 2325 l gs col-1 s gr +/Times-Bold ff 210.00 scf sf +1875 2850 m +gs 1 -1 sc (P1) col-1 sh gr +/Times-Bold ff 210.00 scf sf +3000 2850 m +gs 1 -1 sc (P2) col-1 sh gr +/Times-Bold ff 210.00 scf sf +4650 2775 m +gs 1 -1 sc (Pn) col-1 sh gr +/Times-Roman ff 210.00 scf sf +3525 1005 m +gs 1 -1 sc (If any child dies all children) col-1 sh gr +/Times-Roman ff 210.00 scf sf +3525 1260 m +gs 1 -1 sc (are terminated and all are restarted) col-1 sh gr +/Times-Bold ff 210.00 scf sf +2250 1050 m +gs 1 -1 sc (a) col-1 sh gr +/Times-Roman ff 210.00 scf sf +3525 750 m +gs 1 -1 sc (all-for-one supervision) col-1 sh gr +$F2psEnd +rs diff --git a/system/doc/design_principles/sup6.fig b/system/doc/design_principles/sup6.fig new file mode 100644 index 0000000000..9947cbb67c --- /dev/null +++ b/system/doc/design_principles/sup6.fig @@ -0,0 +1,46 @@ +#FIG 3.1 +Landscape +Center +Inches +1200 2 +6 2100 750 2550 1200 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 2100 750 2550 750 2550 1200 2100 1200 2100 750 +4 0 -1 0 0 2 14 0.0000 4 150 105 2250 1050 1\001 +-6 +6 1200 1650 1650 2100 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 1200 1650 1650 1650 1650 2100 1200 2100 1200 1650 +4 0 -1 0 0 2 14 0.0000 4 150 105 1350 1950 1\001 +-6 +6 3975 2850 4425 3300 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 3975 2850 4425 2850 4425 3300 3975 3300 3975 2850 +4 0 -1 0 0 2 14 0.0000 4 150 105 4125 3150 1\001 +-6 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 5025 4125 270 270 5025 4125 5175 4350 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 1425 3075 270 270 1425 3075 1575 3300 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 2250 4125 270 270 2250 4125 2400 4350 +1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 3900 4125 270 270 3900 4125 4050 4350 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2325 1200 1425 1650 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2400 1200 3300 1650 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 3300 2100 2550 2850 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 3375 2100 4125 2850 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2475 3300 2325 3825 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4200 3300 3900 3825 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4275 3300 4875 3900 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 1425 2775 1425 2100 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 3075 1650 3525 1650 3525 2100 3075 2100 3075 1650 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 2325 2850 2775 2850 2775 3300 2325 3300 2325 2850 +4 0 -1 0 0 2 14 0.0000 4 105 105 3225 1950 a\001 +4 0 -1 0 0 2 14 0.0000 4 105 105 2475 3150 a\001 diff --git a/system/doc/design_principles/sup6.gif b/system/doc/design_principles/sup6.gif new file mode 100644 index 0000000000..2016f5bf67 Binary files /dev/null and b/system/doc/design_principles/sup6.gif differ diff --git a/system/doc/design_principles/sup6.ps b/system/doc/design_principles/sup6.ps new file mode 100644 index 0000000000..3e8a8d2ed4 --- /dev/null +++ b/system/doc/design_principles/sup6.ps @@ -0,0 +1,163 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: sup6.fig +%%Creator: fig2dev Version 3.1 Patchlevel 2 +%%CreationDate: Thu May 15 12:49:34 1997 +%%For: jocke@akvavit (Joakim Greben|,ETX/B/DUP) +%Magnification: 1.00 +%%Orientation: Portrait +%%BoundingBox: 0 0 251 221 +%%Pages: 0 +%%BeginSetup +%%IncludeFeature: *PageSize A4 +%%EndSetup +%%EndComments +/$F2psDict 200 dict def +$F2psDict begin +$F2psDict /mtrx matrix put +/col-1 {0 setgray} bind def +/col0 {0.000 0.000 0.000 srgb} bind def +/col1 {0.000 0.000 1.000 srgb} bind def +/col2 {0.000 1.000 0.000 srgb} bind def +/col3 {0.000 1.000 1.000 srgb} bind def +/col4 {1.000 0.000 0.000 srgb} bind def +/col5 {1.000 0.000 1.000 srgb} bind def +/col6 {1.000 1.000 0.000 srgb} bind def +/col7 {1.000 1.000 1.000 srgb} bind def +/col8 {0.000 0.000 0.560 srgb} bind def +/col9 {0.000 0.000 0.690 srgb} bind def +/col10 {0.000 0.000 0.820 srgb} bind def +/col11 {0.530 0.810 1.000 srgb} bind def +/col12 {0.000 0.560 0.000 srgb} bind def +/col13 {0.000 0.690 0.000 srgb} bind def +/col14 {0.000 0.820 0.000 srgb} bind def +/col15 {0.000 0.560 0.560 srgb} bind def +/col16 {0.000 0.690 0.690 srgb} bind def +/col17 {0.000 0.820 0.820 srgb} bind def +/col18 {0.560 0.000 0.000 srgb} bind def +/col19 {0.690 0.000 0.000 srgb} bind def +/col20 {0.820 0.000 0.000 srgb} bind def +/col21 {0.560 0.000 0.560 srgb} bind def +/col22 {0.690 0.000 0.690 srgb} bind def +/col23 {0.820 0.000 0.820 srgb} bind def +/col24 {0.500 0.190 0.000 srgb} bind def +/col25 {0.630 0.250 0.000 srgb} bind def +/col26 {0.750 0.380 0.000 srgb} bind def +/col27 {1.000 0.500 0.500 srgb} bind def +/col28 {1.000 0.630 0.630 srgb} bind def +/col29 {1.000 0.750 0.750 srgb} bind def +/col30 {1.000 0.880 0.880 srgb} bind def +/col31 {1.000 0.840 0.000 srgb} bind def + +end +save +-68.0 265.0 translate +1 -1 scale + +/cp {closepath} bind def +/ef {eofill} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth} bind def +/tr {translate} bind def +/tnt {dup dup currentrgbcolor + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} + bind def +/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul + 4 -2 roll mul srgb} bind def + /DrawEllipse { + /endangle exch def + /startangle exch def + /yrad exch def + /xrad exch def + /y exch def + /x exch def + /savematrix mtrx currentmatrix def + x y tr xrad yrad sc 0 0 1 startangle endangle arc + closepath + savematrix setmatrix + } def + +/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def +/$F2psEnd {$F2psEnteredState restore end} def +%%EndProlog + +$F2psBegin +10 setmiterlimit +n 0 842 m 0 0 l 595 0 l 595 842 l cp clip + 0.06000 0.06000 sc +7.500 slw +% Polyline +n 2100 750 m 2550 750 l 2550 1200 l 2100 1200 l cp gs col-1 s gr +/Times-Bold ff 210.00 scf sf +2250 1050 m +gs 1 -1 sc (1) col-1 sh gr +% Polyline +n 1200 1650 m 1650 1650 l 1650 2100 l 1200 2100 l cp gs col-1 s gr +/Times-Bold ff 210.00 scf sf +1350 1950 m +gs 1 -1 sc (1) col-1 sh gr +% Polyline +n 3975 2850 m 4425 2850 l 4425 3300 l 3975 3300 l cp gs col-1 s gr +/Times-Bold ff 210.00 scf sf +4125 3150 m +gs 1 -1 sc (1) col-1 sh gr +% Ellipse +n 5025 4125 270 270 0 360 DrawEllipse gs col-1 s gr + +% Ellipse +n 1425 3075 270 270 0 360 DrawEllipse gs col-1 s gr + +% Ellipse +n 2250 4125 270 270 0 360 DrawEllipse gs col-1 s gr + +% Ellipse +n 3900 4125 270 270 0 360 DrawEllipse gs col-1 s gr + +% Polyline +n 2325 1200 m 1425 1650 l gs col-1 s gr +% Polyline +n 2400 1200 m 3300 1650 l gs col-1 s gr +% Polyline +n 3300 2100 m 2550 2850 l gs col-1 s gr +% Polyline +n 3375 2100 m 4125 2850 l gs col-1 s gr +% Polyline +n 2475 3300 m 2325 3825 l gs col-1 s gr +% Polyline +n 4200 3300 m 3900 3825 l gs col-1 s gr +% Polyline +n 4275 3300 m 4875 3900 l gs col-1 s gr +% Polyline +n 1425 2775 m 1425 2100 l gs col-1 s gr +% Polyline +n 3075 1650 m 3525 1650 l 3525 2100 l 3075 2100 l cp gs col-1 s gr +% Polyline +n 2325 2850 m 2775 2850 l 2775 3300 l 2325 3300 l cp gs col-1 s gr +/Times-Bold ff 210.00 scf sf +3225 1950 m +gs 1 -1 sc (a) col-1 sh gr +/Times-Bold ff 210.00 scf sf +2475 3150 m +gs 1 -1 sc (a) col-1 sh gr +$F2psEnd +rs diff --git a/system/doc/design_principles/sup_princ.xml b/system/doc/design_principles/sup_princ.xml new file mode 100644 index 0000000000..067fd31961 --- /dev/null +++ b/system/doc/design_principles/sup_princ.xml @@ -0,0 +1,349 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Supervisor Behaviour + + + + + sup_princ.xml +
+

This section should be read in conjunction with + supervisor(3), where all details about the supervisor + behaviour is given.

+ +
+ Supervision Principles +

A supervisor is responsible for starting, stopping and + monitoring its child processes. The basic idea of a supervisor is + that it should keep its child processes alive by restarting them + when necessary.

+

Which child processes to start and monitor is specified by a + list of child specifications. + The child processes are started in the order specified by this + list, and terminated in the reversed order.

+
+ +
+ Example +

The callback module for a supervisor starting the server from + the gen_server chapter + could look like this:

+ + +-module(ch_sup). +-behaviour(supervisor). + +-export([start_link/0]). +-export([init/1]). + +start_link() -> + supervisor:start_link(ch_sup, []). + +init(_Args) -> + {ok, {{one_for_one, 1, 60}, + [{ch3, {ch3, start_link, []}, + permanent, brutal_kill, worker, [ch3]}]}}. +

one_for_one is the restart strategy.

+

1 and 60 defines the maximum restart frequency.

+

The tuple {ch3, ...} is a child specification.

+
+ +
+ + Restart Strategy + +
+ one_for_one +

If a child process terminates, only that process is restarted.

+ + + One_For_One Supervision + +
+ +
+ one_for_all +

If a child process terminates, all other child processes are + terminated and then all child processes, including + the terminated one, are restarted.

+ + + One_For_All Supervision + +
+ +
+ rest_for_one +

If a child process terminates, the 'rest' of the child + processes -- i.e. the child processes after the terminated + process in start order -- are terminated. Then the terminated + child process and the rest of the child processes are restarted.

+
+
+ +
+ + Maximum Restart Frequency +

The supervisors have a built-in mechanism to limit the number of + restarts which can occur in a given time interval. This is + determined by the values of the two parameters MaxR and + MaxT in the start specification returned by the callback + function init:

+ +init(...) -> + {ok, {{RestartStrategy, MaxR, MaxT}, + [ChildSpec, ...]}}. +

If more than MaxR number of restarts occur in the last + MaxT seconds, then the supervisor terminates all the child + processes and then itself.

+

When the supervisor terminates, then the next higher level + supervisor takes some action. It either restarts the terminated + supervisor, or terminates itself.

+

The intention of the restart mechanism is to prevent a situation + where a process repeatedly dies for the same reason, only to be + restarted again.

+
+ +
+ + Child Specification +

This is the type definition for a child specification:

+ + + +

Id is a name that is used to identify the child + specification internally by the supervisor.

+
+ +

StartFunc defines the function call used to start + the child process. It is a module-function-arguments tuple + used as apply(M, F, A).

+

It should be (or result in) a call to + supervisor:start_link, gen_server:start_link, + gen_fsm:start_link or gen_event:start_link. + (Or a function compliant with these functions, see + supervisor(3) for details.

+
+ +

Restart defines when a terminated child process should + be restarted.

+ + A permanent child process is always restarted. + A temporary child process is never restarted. + A transient child process is restarted only if it + terminates abnormally, i.e. with another exit reason than + normal. + +
+ + +

Shutdown defines how a child process should be + terminated.

+ + brutal_kill means the child process is + unconditionally terminated using exit(Child, kill). + An integer timeout value means that the supervisor tells + the child process to terminate by calling + exit(Child, shutdown) and then waits for an exit + signal back. If no exit signal is received within + the specified time, the child process is unconditionally + terminated using exit(Child, kill). + If the child process is another supervisor, it should be + set to infinity to give the subtree enough time to + shutdown. + +
+ +

Type specifies if the child process is a supervisor or + a worker.

+
+ +

Modules should be a list with one element + [Module], where Module is the name of + the callback module, if the child process is a supervisor, + gen_server or gen_fsm. If the child process is a gen_event, + Modules should be dynamic.

+

This information is used by the release handler during + upgrades and downgrades, see + Release Handling.

+
+
+

Example: The child specification to start the server ch3 + in the example above looks like:

+ +{ch3, + {ch3, start_link, []}, + permanent, brutal_kill, worker, [ch3]} +

Example: A child specification to start the event manager from + the chapter about + gen_event:

+ +{error_man, + {gen_event, start_link, [{local, error_man}]}, + permanent, 5000, worker, dynamic} +

Both the server and event manager are registered processes which + can be expected to be accessible at all times, thus they are + specified to be permanent.

+

ch3 does not need to do any cleaning up before + termination, thus no shutdown time is needed but + brutal_kill should be sufficient. error_man may + need some time for the event handlers to clean up, thus + Shutdown is set to 5000 ms.

+

Example: A child specification to start another supervisor:

+ +{sup, + {sup, start_link, []}, + transient, infinity, supervisor, [sup]} +
+ +
+ + Starting a Supervisor +

In the example above, the supervisor is started by calling + ch_sup:start_link():

+ +start_link() -> + supervisor:start_link(ch_sup, []). +

ch_sup:start_link calls the function + supervisor:start_link/2. This function spawns and links to + a new process, a supervisor.

+ + The first argument, ch_sup, is the name of + the callback module, that is the module where the init + callback function is located. + The second argument, [], is a term which is passed as-is to + the callback function init. Here, init does not + need any indata and ignores the argument. + +

In this case, the supervisor is not registered. Instead its pid + must be used. A name can be specified by calling + supervisor:start_link({local, Name}, Module, Args) or + supervisor:start_link({global, Name}, Module, Args).

+

The new supervisor process calls the callback function + ch_sup:init([]). init is expected to return + {ok, StartSpec}:

+ +init(_Args) -> + {ok, {{one_for_one, 1, 60}, + [{ch3, {ch3, start_link, []}, + permanent, brutal_kill, worker, [ch3]}]}}. +

The supervisor then starts all its child processes according to + the child specifications in the start specification. In this case + there is one child process, ch3.

+

Note that supervisor:start_link is synchronous. It does + not return until all child processes have been started.

+
+ +
+ Adding a Child Process +

In addition to the static supervision tree, we can also add + dynamic child processes to an existing supervisor with + the following call:

+ +supervisor:start_child(Sup, ChildSpec) +

Sup is the pid, or name, of the supervisor. + ChildSpec is a child specification.

+

Child processes added using start_child/2 behave in + the same manner as the other child processes, with the following + important exception: If a supervisor dies and is re-created, then + all child processes which were dynamically added to the supervisor + will be lost.

+
+ +
+ Stopping a Child Process +

Any child process, static or dynamic, can be stopped in + accordance with the shutdown specification:

+ +supervisor:terminate_child(Sup, Id) +

The child specification for a stopped child process is deleted + with the following call:

+ +supervisor:delete_child(Sup, Id) +

Sup is the pid, or name, of the supervisor. + Id is the id specified in the child specification.

+

As with dynamically added child processes, the effects of + deleting a static child process is lost if the supervisor itself + restarts.

+
+ +
+ Simple-One-For-One Supervisors +

A supervisor with restart strategy simple_one_for_one is + a simplified one_for_one supervisor, where all child processes are + dynamically added instances of the same process.

+

Example of a callback module for a simple_one_for_one supervisor:

+ +-module(simple_sup). +-behaviour(supervisor). + +-export([start_link/0]). +-export([init/1]). + +start_link() -> + supervisor:start_link(simple_sup, []). + +init(_Args) -> + {ok, {{simple_one_for_one, 0, 1}, + [{call, {call, start_link, []}, + temporary, brutal_kill, worker, [call]}]}}. +

When started, the supervisor will not start any child processes. + Instead, all child processes are added dynamically by calling:

+ +supervisor:start_child(Sup, List) +

Sup is the pid, or name, of the supervisor. + List is an arbitrary list of terms which will be added to + the list of arguments specified in the child specification. If + the start function is specified as {M, F, A}, then + the child process is started by calling + apply(M, F, A++List).

+

For example, adding a child to simple_sup above:

+ +supervisor:start_child(Pid, [id1]) +

results in the child process being started by calling + apply(call, start_link, []++[id1]), or actually:

+ +call:start_link(id1) +
+ +
+ Stopping +

Since the supervisor is part of a supervision tree, it will + automatically be terminated by its supervisor. When asked to + shutdown, it will terminate all child processes in reversed start + order according to the respective shutdown specifications, and + then terminate itself.

+
+
+ diff --git a/system/doc/design_principles/warning.gif b/system/doc/design_principles/warning.gif new file mode 100644 index 0000000000..96af52360e Binary files /dev/null and b/system/doc/design_principles/warning.gif differ diff --git a/system/doc/design_principles/xmlfiles.mk b/system/doc/design_principles/xmlfiles.mk new file mode 100644 index 0000000000..f34d1c9a0f --- /dev/null +++ b/system/doc/design_principles/xmlfiles.mk @@ -0,0 +1,32 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# +DESIGN_PRINCIPLES_CHAPTER_FILES = \ + applications.xml \ + appup_cookbook.xml \ + des_princ.xml \ + distributed_applications.xml \ + events.xml \ + fsm.xml \ + gen_server_concepts.xml \ + included_applications.xml \ + release_handling.xml \ + release_structure.xml \ + spec_proc.xml \ + sup_princ.xml diff --git a/system/doc/efficiency_guide/Makefile b/system/doc/efficiency_guide/Makefile new file mode 100644 index 0000000000..f51313de84 --- /dev/null +++ b/system/doc/efficiency_guide/Makefile @@ -0,0 +1,117 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2001-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include $(ERL_TOP)/erts/vsn.mk +#VSN=$(SYSTEM_VSN) + +APPLICATION=otp-system-documentation +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/doc/efficiency_guide + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +XML_PART_FILES = part.xml + +include xmlfiles.mk + +XML_CHAPTER_FILES = $(EFF_GUIDE_CHAPTER_FILES) + +TOPDOCDIR=.. + +BOOK_FILES = book.xml + +PS_FILES = digger.ps + +XML_FILES = \ + $(BOOK_FILES) $(XML_CHAPTER_FILES) \ + $(XML_PART_FILES) + +# ---------------------------------------------------- + +C_FILES = \ + +ERL_FILES = all.erl\ + bench.erl\ + call_bm.erl + +HRL_FILES = bench.hrl + + +MISC_FILES = call_result.html\ + README + +HTML_FILES = \ + $(XML_PART_FILES:%.xml=%.html) + +HTMLDIR = ../html/efficiency_guide + +EXTRA_FILES = $(ERL_FILES) \ + $(HRL_FILES) \ + $(MISC_FILES) + +HTML_UG_FILE = $(HTMLDIR)/users_guide.html + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAGS += +DVIPS_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +docs: html + +local_docs: PDFDIR=../../pdf + +html: $(GIF_FILES) $(HTML_UG_FILE) + +debug opt: + +clean clean_docs: + rm -rf $(HTMLDIR) + rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f errs core *~ + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_docs_spec: docs +# $(INSTALL_DIR) $(RELEASE_PATH)/pdf +# $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELEASE_PATH)/pdf + $(INSTALL_DIR) $(RELSYSDIR) + $(INSTALL_DATA) $(GIF_FILES) $(EXTRA_FILES) $(HTMLDIR)/*.html \ + $(RELSYSDIR) + + +release_spec: + + + diff --git a/system/doc/efficiency_guide/README b/system/doc/efficiency_guide/README new file mode 100644 index 0000000000..6830a46d9e --- /dev/null +++ b/system/doc/efficiency_guide/README @@ -0,0 +1,122 @@ +Benchmark framework +------------------- + +This benchmark framework consists of the files: +bench.erl - see bench module below +bench.hrl - Defines some useful macros +all.erl - see all module below + +bench module +----------- + +The module bench is a generic module that measures execution time +of functions in callback modules and writes an html-report on the outcome. + +When you execute the function bench:run/0 it will compile and run all +benchmark modules in the current directory. + +all module +----------- + +In the all module there is a function called releases/0 that you can +edit to contain all your erlang installations and then you can +run your benchmarks on several erlang versions using only one command i.e. +all:run(). + +Requirements on callback modules +--------------------------------- + +* A callback module must be named _bm.erl + +* The module must export the function benchmarks/0 that must return: + {Iterations, [Name1,Name2...]} where Iterations is the number of + times each benchmark should be run. Name1, Name2 and so one are the + name of exported functions in the module. + +* The exported functions Name1 etc. must take one argument i.e. the number + of iterations and should return the atom ok. + +* The functions in a benchmark module should represent different + ways/different sequential algorithms for doing something. And the + result will be how fast they are compared to each other. + +Files created +-------------- + +Files that are created in the current directory are *.bmres and +index.html. The file(s) with the extension "bmres" are an intermediate +representation of the benchmark results and is only meant to be read +by the reporting mechanism defined in bench.erl. The index.html file +is the report telling you how good the benchmarks are in comparison to +each other. If you run your test on several erlang releases the +html-file will include the result for all versions. + + +Pitfalls +--------- +To get meaningful measurements, you should make sure that: + +* The total execution time is at least several seconds. + +* That any time spent in setup before entering the measurement loop is very + small compared to the total time. + +* That time spent by the loop itself is small compared to the total execution + time + +Consider the following example of a benchmark function that does +a local function call. + +local_call(0) -> ok; +local_call(Iter) -> + foo(), % Local function call + local_call(Iter-1). + +The problem is that both "foo()" and "local_call(Iter-1)" takes about +the same amount of time. To get meaningful figures you'll need to make +sure that the loop overhead will not be visible. In this case we can +take help of a macro in bench.hrl to repeat the local function call +many times, making sure that time spent calling the local function is +relatively much longer than the time spent iterating. Of course, all +benchmarks in the same module must be repeated the same number of +times; thus external_call will look like + +external_call(0) -> ok; +external_call(Iter) -> + ?rep20(?MODULE:foo()), + external_call(Iter-1). + +This technique is only necessary if the operation we are testing executes +really fast. + +If you for instance want to test a sort routine we can keep it simple: + +sorted(Iter) -> + do_sort(Iter, lists:seq(0, 63)). + +do_sort(0, List) -> ok; +do_sort(Iter, List) -> + lists:sort(List), + do_sort(Iter-1, List). + +The call to lists:seq/2 is only done once. The loop overhead in the +do_sort/2 function is small compared to the execution time of lists:sort/1. + +Error handling +--------------- + +Any error enforced by a callback module will result in exit of the benchmark +program and an errormessage that should give a good idea of what is wrong. + + + + + + + + + + + + + diff --git a/system/doc/efficiency_guide/advanced.xml b/system/doc/efficiency_guide/advanced.xml new file mode 100644 index 0000000000..0ec3afbd59 --- /dev/null +++ b/system/doc/efficiency_guide/advanced.xml @@ -0,0 +1,204 @@ + + + + +
+ + 20012009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Advanced + Kenneth Lundin + + 2001-08-21 + + advanced.xml +
+ +
+ Memory +

A good start when programming efficiently is to have knowledge about + how much memory different data types and operations require. It is + implementation-dependent how much memory the Erlang data types and + other items consume, but here are some figures for + erts-5.2 system (OTP release R9B). (There have been no significant + changes in R13.)

+ +

The unit of measurement is memory words. There exists both a 32-bit + and a 64-bit implementation, and a word is therefore, 4 bytes or + 8 bytes, respectively.

+ + + Data type + Memory size + + + Integer (-16#7FFFFFF < i <16#7FFFFFF) + 1 word + + + Integer (big numbers) + 3..N words + + + Atom + 1 word. Note: an atom refers into + an atom table which also consumes memory. + The atom text is stored once for each unique atom in this table. + The atom table is not garbage-collected. + + + Float + On 32-bit architectures: 4 words

+On 64-bit architectures: 3 words
+
+ + Binary + 3..6 + data (can be shared) + + + List + 1 word per element + the size of each element + + + String (is the same as a list of integers) + 2 words per character + + + Tuple + 2 words + the size of each element + + + Pid + 1 word for a process identifier from the current local node, and 5 words for a process identifier from another node. Note: a process identifier refers into a process table and a node table which also consumes memory. + + + Port + 1 word for a port identifier from the current local node, and 5 words for a port identifier from another node. Note: a port identifier refers into a port table and a node table which also consumes memory. + + + Reference + On 32-bit architectures: 5 words for a reference from the current local node, and 7 words for a reference from another node.

+On 64-bit architectures: 4 words for a reference from the current local node, and 6 words for a reference from another node. Note: a reference refers into a node table which also consumes memory.
+
+ + Fun + 9..13 words + size of environment. Note: a fun refers into a fun table which also consumes memory. + + + Ets table + Initially 768 words + the size of each element (6 words + size of Erlang data). The table will grow when necessary. + + + Erlang process + 327 words when spawned including a heap of 233 words. + + Memory size of different data types +
+
+ +
+ System limits +

The Erlang language specification puts no limits on number of processes, + length of atoms etc., but for performance and memory saving reasons, + there will always be limits in a practical implementation of the Erlang + language and execution environment.

+ + Processes + +

The maximum number of simultaneously alive Erlang processes is + by default 32768. This limit can be raised up to at most 268435456 + processes at startup (see documentation of the system flag + +P in the + erl(1) documentation). + The maximum limit of 268435456 processes will at least on a 32-bit + architecture be impossible to reach due to memory shortage.

+
+ Distributed nodes + + + Known nodes + +

A remote node Y has to be known to node X if there exist + any pids, ports, references, or funs (Erlang data types) from Y + on X, or if X and Y are connected. The maximum number of remote + nodes simultaneously/ever known to a node is limited by the + maximum number of atoms + available for node names. All data concerning remote nodes, + except for the node name atom, are garbage-collected.

+
+ Connected nodes + The maximum number of simultaneously connected nodes is limited by + either the maximum number of simultaneously known remote nodes, + the maximum number of (Erlang) ports + available, or + the maximum number of sockets + available. +
+
+ Characters in an atom + 255 + Atoms + +The maximum number of atoms is 1048576. + Ets-tables + The default is 1400, can be changed with the environment variable ERL_MAX_ETS_TABLES. + Elements in a tuple + The maximum number of elements in a tuple is 67108863 (26 bit unsigned integer). Other factors + such as the available memory can of course make it hard to create a tuple of that size. + Size of binary + In the 32-bit implementation of Erlang, 536870911 bytes is the + largest binary that can be constructed or matched using the bit syntax. + (In the 64-bit implementation, the maximum size is 2305843009213693951 bytes.) + If the limit is exceeded, bit syntax construction will fail with a + system_limit exception, while any attempt to match a binary that is + too large will fail. + This limit is enforced starting with the R11B-4 release; in earlier releases, + operations on too large binaries would in general either fail or give incorrect + results. + In future releases of Erlang/OTP, other operations that create binaries (such as + list_to_binary/1) will probably also enforce the same limit. + Total amount of data allocated by an Erlang node + The Erlang runtime system can use the complete 32 (or 64) bit address space, + but the operating system often limits a single process to use less than that. + length of a node name + An Erlang node name has the form host@shortname or host@longname. The node name is + used as an atom within the system so the maximum size of 255 holds for the node name too. + Open ports + + +

The maximum number of simultaneously open Erlang ports is + by default 1024. This limit can be raised up to at most 268435456 + at startup (see environment variable + ERL_MAX_PORTS + in erlang(3)) + The maximum limit of 268435456 open ports will at least on a 32-bit + architecture be impossible to reach due to memory shortage.

+
+ Open files, and sockets + + + The maximum number of simultaneously open files and sockets + depend on + the maximum number of Erlang ports + available, and operating system specific settings and limits. + Number of arguments to a function or fun + 256 +
+
+
+ diff --git a/system/doc/efficiency_guide/all.erl b/system/doc/efficiency_guide/all.erl new file mode 100644 index 0000000000..a0f7809422 --- /dev/null +++ b/system/doc/efficiency_guide/all.erl @@ -0,0 +1,106 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +%% AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(all). + +%% User interface +-export([run/0]). + +%% Interna constants +-define(NORMAL, 0). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Interface +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%--------------------------------------------------------------------------- +%% run() -> _ +%% +%% Runs all benchmark modules in the current directory on all erlang +%% installations specified by releases/0 +%%--------------------------------------------------------------------------- +run() -> + %% Delete previous intermediate test result files. + lists:foreach(fun(F) -> file:delete(F) end, filelib:wildcard("*.bmres")), + lists:foreach(fun run/1, releases()). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Internal functions +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%--------------------------------------------------------------------------- +%% run(Release) -> _ +%% Release = string() - Erlang release +%% Help functions to run/0 +%%--------------------------------------------------------------------------- +run(Release) -> + command(Release ++ " -noshell -compile bench -s erlang halt"), + command(Release ++ " -noshell -s bench run -s erlang halt"). +%%--------------------------------------------------------------------------- +%% command(Command) -> _ +%% Command = string() - is the name and arguments of the external +%% program which will be run +%%--------------------------------------------------------------------------- +command(Command) -> + io:format("~s\n", [Command]), % Progress info to user + Port = open_port({spawn,Command}, [exit_status, in]), + print_output(Port). +%%--------------------------------------------------------------------------- +%% print_output(Port) -> _ +%% Port = port() +%% Print data from the port i.e. output from external program, +%% on standard out. +%%--------------------------------------------------------------------------- +print_output(Port) -> + receive + {Port, {data,Bytes}} -> + io:put_chars(Bytes), + print_output(Port); + {Port, {exit_status, ?NORMAL}} -> + ok + end. +%%--------------------------------------------------------------------------- +%% run() -> Releases +%% Releases = [Release |_] +%% Release = string() - Erlang release +%% Defines which erlang releases to run on +%% --- Change this function to reflect your own erlang installations --- +%%--------------------------------------------------------------------------- +releases() -> + ["/usr/local/otp/releases/otp_beam_sunos5_r7b01_patched/bin/erl", + "/usr/local/otp/releases/otp_beam_sunos5_r8b_patched/bin/erl"]. + + + + + + + + + + + + + + + + + + + + + diff --git a/system/doc/efficiency_guide/appendix.xml b/system/doc/efficiency_guide/appendix.xml new file mode 100644 index 0000000000..631ef9bee7 --- /dev/null +++ b/system/doc/efficiency_guide/appendix.xml @@ -0,0 +1,72 @@ + + + + +
+ + 2002 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Appendix - Programs + Ingela Anderton + + 2002-09-23 + + appendix.sgml +
+

This appendix contains the programs referred to in the previous + chapters within the Efficiency Guide.

+ +
+ + bench.erl + +
+ +
+ + bench.hrl + +
+ +
+ + all.erl + +
+ +
+ + README + +
+ +
+ + call_bm.erl + +
+ +
+ + index.html + +
+
+ diff --git a/system/doc/efficiency_guide/bench.erl b/system/doc/efficiency_guide/bench.erl new file mode 100644 index 0000000000..8f26b8d0af --- /dev/null +++ b/system/doc/efficiency_guide/bench.erl @@ -0,0 +1,488 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +%% AB. All Rights Reserved.'' +%% +%% $Id$ +%% + +-module(bench). + +%% User interface +-export([run/0]). + +%% Exported to be used in spawn +-export([measure/4]). + +%% Internal constants +-define(MAX, 999999999999999). +-define(RANGE_MAX, 16#7ffffff). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Interface +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%--------------------------------------------------------------------------- +%% run() -> _ +%% +%% Compiles and runs all benchmarks in the current directory, +%% and creates a report +%%--------------------------------------------------------------------------- +run() -> + run(compiler_options()). + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Generic Benchmark functions +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%--------------------------------------------------------------------------- +%% compiler_options() -> OptionsList +%% OptionsList = list() - See Erlang/OTP module compile +%%--------------------------------------------------------------------------- +compiler_options() -> + [report_errors, report_warnings]. + +%%--------------------------------------------------------------------------- +%% run(OptionsList) -> +%% OptionsList = list() - See Erlang/OTP module compile +%% +%% Help function to run/0. +%%--------------------------------------------------------------------------- +run(OptionsList) -> + Bms = compile_benchmarks(OptionsList), + run_benchmarks(Bms), + report(). + +%%--------------------------------------------------------------------------- +%% compile_benchmarks(OptionsList) -> [BmInfo| _] +%% OptionsList = list() - See Erlang/OTP module compile +%% BmInfo = {Module, Iterations, [BmFunctionName| _]} +%% Module = atom() +%% Iterations = integer() +%% BmFunctionName = atom() +%% +%% Compiles all benchmark modules in the current directory and +%% returns info about the benchmarks. +%%--------------------------------------------------------------------------- +compile_benchmarks(OptionsList) -> + {ok, FilesInCurrentDir} = file:list_dir("."), + ErlFiles = [ErlFile || ErlFile <- lists:sort(FilesInCurrentDir), + lists:suffix(".erl", ErlFile)], + lists:foldr(fun(File, BmInfoAcc) -> + case lists:suffix("_bm.erl", File) of + true -> + BmInfo = bm_compile(File, OptionsList), + [BmInfo | BmInfoAcc]; + false -> + just_compile(File, OptionsList), + BmInfoAcc + end + end, [], ErlFiles). + +%%--------------------------------------------------------------------------- +%% just_compile(FileName, OptionsList) -> ok +%% FileName = string() +%% OptionsList = list() - See Erlang/OTP module compile +%% +%% Compiles a support module. +%%--------------------------------------------------------------------------- +just_compile(FileName, OptionsList) -> + io:format("Compiling ~s...\n", [FileName]), % Progress info to user + case c:c(FileName, OptionsList) of + {ok, _Mod} -> + ok; + %% If compilation fails there is no point in trying to continue + error -> + Reason = + lists:flatten( + io_lib:format("Could not compile file ~s", [FileName])), + exit(self(), Reason) + end. +%%--------------------------------------------------------------------------- +%% bm_compile(FileName, OptionsList) -> BmInfo +%% FileName = string() +%% OptionsList = list() - See Erlang/OTP module compile +%% BmInfo = {Module, Iterations, [BmFunctionName| _]} +%% Iterations = integer() +%% Module = atom() +%% BmFunctionName = atom() +%% +%% Compiles the benchmark module implemented in and returns +%% information about the benchmark tests. +%%--------------------------------------------------------------------------- +bm_compile(FileName, OptionsList) -> + io:format("Compiling ~s...\n", [FileName]), % Progress info to user + case c:c(FileName, OptionsList) of + {ok, Mod} -> + bm_cases(Mod); + %% If compilation fails there is no point in trying to continue + error -> + Reason = + lists:flatten( + io_lib:format("Could not compile file ~s", [FileName])), + exit(self(), Reason) + end. +%%--------------------------------------------------------------------------- +%% bm_cases(Module) -> {Module, Iter, [BmFunctionName |_]} +%% Module = atom() +%% Iter = integer() +%% BmFunctionName = atom() +%% +%% Fetches the number of iterations and the names of the benchmark +%% functions for the module . +%%--------------------------------------------------------------------------- +bm_cases(Module) -> + case catch Module:benchmarks() of + {Iter, BmList} when integer(Iter), list(BmList) -> + {Module, Iter, BmList}; + %% The benchmark is incorrect implemented there is no point in + %% trying to continue + Other -> + Reason = + lists:flatten( + io_lib:format("Incorrect return value: ~p " + "from ~p:benchmarks()", + [Other, Module])), + exit(self(), Reason) + end. +%%--------------------------------------------------------------------------- +%% run_benchmarks(Bms) -> +%% Bms = [{Module, Iter, [BmFunctionName |_]} | _] +%% Module = atom() +%% Iter = integer() +%% BmFunctionName = atom() +%% +%% Runs all the benchmark tests described in . +%%--------------------------------------------------------------------------- +run_benchmarks(Bms) -> + Ver = erlang:system_info(version), + Machine = erlang:system_info(machine), + SysInfo = {Ver,Machine}, + + Res = [bms_run(Mod, Tests, Iter, SysInfo) || {Mod,Iter,Tests} <- Bms], + + %% Create an intermediate file that is later used to generate a bench + %% mark report. + Name = Ver ++ [$.|Machine] ++ ".bmres", + {ok, IntermediatFile} = file:open(Name, [write]), + + %% Create mark that identifies version of the benchmark modules + io:format(IntermediatFile, "~p.\n", [erlang:phash(Bms, ?RANGE_MAX)]), + + io:format(IntermediatFile, "~p.\n", [Res]), + file:close(IntermediatFile). + +%%--------------------------------------------------------------------------- +%% bms_run(Module, BmTests, Iter, Info) -> +%% Module = atom(), +%% BmTests = [BmFunctionName|_], +%% BmFunctionName = atom() +%% Iter = integer(), +%% SysInfo = {Ver, Machine} +%% Ver = string() +%% Machine = string() +%% +%% Runs all benchmark tests in module . +%%--------------------------------------------------------------------------- +bms_run(Module, BmTests, Iter, SysInfo) -> + io:format("Running ~s:", [Module]), % Progress info to user + Res = + {Module,{SysInfo,[{Bm, bm_run(Module, Bm, Iter)} || Bm <- BmTests]}}, + io:nl(), + Res. +%%--------------------------------------------------------------------------- +%% bm_run(Module, BmTest, Iter) -> Elapsed +%% Module = atom(), +%% BmTest = atom(), +%% Iter = integer() +%% Elapsed = integer() - elapsed time in milliseconds. +%% +%% Runs the benchmark Module:BmTest(Iter) +%%--------------------------------------------------------------------------- +bm_run(Module, BmTest, Iter) -> + io:format(" ~s", [BmTest]), % Progress info to user + spawn_link(?MODULE, measure, [self(), Module, BmTest, Iter]), + receive + {Elapsed, ok} -> + Elapsed; + {_Elapsed, Fault} -> + io:nl(), + Reason = + lists:flatten( + io_lib:format("~w", [Fault])), + exit(self(), Reason) + end. +%%--------------------------------------------------------------------------- +%% measure(Parent, Module, BmTest, Iter) -> _ +%% Parent = pid(), +%% Module = atom(), +%% BmTest = atom(), +%% Iter = integer() +%% +%% Measures the time it take to execute Module:Bm(Iter) +%% and send the result to . +%%--------------------------------------------------------------------------- +measure(Parent, Module, BmTest, Iter) -> + statistics(runtime), + Res = (catch apply(Module, BmTest, [Iter])), + {_TotalRunTime, TimeSinceLastCall} = statistics(runtime), + Parent ! {TimeSinceLastCall, Res}. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Report functions +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%--------------------------------------------------------------------------- +%% report() -> _ +%% +%% Creates a report of the bench marking test that appeals to a human. +%% Currently this means creating a html-file. (Other formats could be added) +%%--------------------------------------------------------------------------- +report() -> + {ok, AllFiles} = file:list_dir("."), + BmResultFiles = [File || File <- AllFiles, lists:suffix(".bmres", File)], + + Results = fetch_bmres_data(BmResultFiles), + create_report(Results). + +%%--------------------------------------------------------------------------- +%% fetch_bmres_data(BmResultFiles) -> Results +%% BmResultFiles = [FileName | _] +%% FileName = string() +%% Results = [[{Bm, Res} | _]] +%% Bm = atom() - Name of benchmark module +%% Res = [{VersionInfo, [{Test, Time} | _]}] +%% VersionInfo = {Ver, Machine} +%% Ver = string() +%% Machine = string() +%% Test = atom() +%% Time = integer() +%% +%% Reads result data from intermediate files +%%--------------------------------------------------------------------------- +fetch_bmres_data(BmResultFiles) -> + fetch_bmres_data(BmResultFiles, [], undefined). + +%%--------------------------------------------------------------------------- +%% fetch_bmres_data(BmResultFiles, AccResData, Check) -> Results +%% BmResultFiles = [FileName | _] +%% FileName = string() +%% AccResData = see Results fetch_bmres_data/1 +%% Check = integer() | undefined (first time) +%% +%% Help function to fetch_bmres_data/1 +%%--------------------------------------------------------------------------- +fetch_bmres_data([], AccResData, _Check) -> + AccResData; + +fetch_bmres_data([Name | BmResultFiles], AccResData, Check) -> + {DataList, NewCheck} = read_bmres_file(Name, Check), + fetch_bmres_data(BmResultFiles, [DataList| AccResData], NewCheck). + +%%--------------------------------------------------------------------------- +%% read_bmres_file(Name, Check) -> +%% Name = string() +%% Check = integer() | undefined +%% +%% Reads the data from the result files. Checks that all result +%% files where created with the same set of tests. +%%--------------------------------------------------------------------------- +read_bmres_file(Name, Check) -> + case file:consult(Name) of + {ok, [Check1, List]} when Check =:= undefined, integer(Check1) -> + {List, Check1}; + {ok, [Check, List]} when integer(Check) -> + {List, Check}; + {ok, [Check1, _List]} when integer(Check1) -> + Reason = + lists:flatten( + io_lib:format("Different test setup, remove old setup " + "result by removing *.bmres files and " + "try again", [])), + exit(self(), Reason); + {error, Reason} when atom(Reason) -> + exit(self(), Reason); + {error, Reason} -> + exit(self(), file:format(Reason)) + end. + +%%--------------------------------------------------------------------------- +%% create_report(Results) -> +%% Results = see Results fetch_bmres_data/1 +%% +%% Organizes so it will be right for create_html_report/1 +%% i.e. group results for the same benchmark test, run on different versions +%% of erlang. +%%--------------------------------------------------------------------------- +create_report(Results) -> + Dictionary = + lists:foldl(fun(BmResultList, Dict0) -> + lists:foldl(fun({Bm, VerResult}, Dict1) -> + dict:append(Bm, VerResult, + Dict1) + end,Dict0, BmResultList) + end, + dict:new(), Results), + + create_html_report(dict:to_list(Dictionary)). +%%--------------------------------------------------------------------------- +%% create_html_report(ResultList) -> _ +%% ResultList = [{Bm, Res} | _] +%% Bm = atom() - Name of benchmark module +%% Res = [{VersionInfo, [{Test, Time} | _]} | _] +%% VersionInfo = {Ver, Machine} +%% Ver = string() +%% Machine = string() +%% Test = atom() +%% Time = integer() +%% +%% Writes the result to an html-file +%%--------------------------------------------------------------------------- +create_html_report(ResultList) -> + + {ok, OutputFile} = file:open("index.html", [write]), + + %% Create the begining of the result html-file. + Head = Title = "Benchmark Results", + io:put_chars(OutputFile, "\n"), + io:put_chars(OutputFile, "\n"), + io:format(OutputFile, "~s\n", [Title]), + io:put_chars(OutputFile, "\n"), + io:put_chars(OutputFile, "\n"), + io:format(OutputFile, "

~s

\n", [Head]), + + %% Add the result tables + lists:foreach(fun(Element) -> + create_html_table(OutputFile, Element) end, + ResultList), + + %% Put in the end-html tags + io:put_chars(OutputFile, "\n"), + io:put_chars(OutputFile, "\n"), + + file:close(OutputFile). + +%%--------------------------------------------------------------------------- +%% create_html_table(File, {Bm, Res}) -> _ +%% File = file() - html file to write data to. +%% Bm = atom() - Name of benchmark module +%% Res = [{VersionInfo, [{Test, Time} | _]}] +%% VersionInfo = {Ver, Machine} +%% Ver = string() +%% Machine = string() +%% Test = atom() +%% Time = integer() +%% +%% Creates a html table that displays the result of the benchmark . +%%--------------------------------------------------------------------------- +create_html_table(File, {Bm, Res}) -> + + {MinTime, Order} = min_time_and_sort(Res), + + io:format(File, "

~s

\n" , [Bm]), + + %% Fun that calculates relative measure values and puts them in + %% a dictionary + RelativeMesureFun = fun({TestName, Time}, Dict1) -> + dict:append(TestName, Time/MinTime, Dict1) + end, + + %% For all erlang versions that the benchmark tests has been run, + %% calculate the relative measure values and put them in a dictionary. + ResultDict = + lists:foldl(fun({_VerInfo, Bms}, Dict0) -> + lists:foldl(RelativeMesureFun, Dict0, Bms) end, + dict:new(), Res), + + %% Create the table and its headings + io:put_chars(File, "" + "
\n"), + io:put_chars(File, "\n"), + io:put_chars(File, ""), + io:put_chars(File, ""), + Heads = table_headers(Res), + lists:foreach(fun({Ver,Machine}) -> io:format(File, "", + [Ver,Machine]) end, Heads), + io:put_chars(File, "\n"), + + %% Create table rows + lists:foreach(fun(Name) -> + create_html_row(File, Name, ResultDict) + end, Order), + + %% Tabel end-tags + io:put_chars(File, "
Test~s
~s
\n"), + + %% Create link to benchmark source code + io:format(File, "

Source for ~s.erl\n", + [Bm,Bm]). + +%%--------------------------------------------------------------------------- +%% create_html_row(File, Name, Dict) -> _ +%% File = file() - html file to write data to. +%% Name = atom() - Name of benchmark test +%% Dict = dict() - Dictonary where the relative time measures for +%% the test can be found. +%% +%% Creates an actual html table-row. +%%--------------------------------------------------------------------------- +create_html_row(File, Name, Dict) -> + ReletiveTimes = dict:fetch(Name, Dict), + io:put_chars(File, "\n"), + io:format(File, "~s", [Name]), + lists:foreach(fun(Time) -> + io:format(File, "~-8.2f", [Time]) end, + ReletiveTimes), + io:put_chars(File, "\n"). + +%%--------------------------------------------------------------------------- +%% min_time_and_sort(ResultList) -> {MinTime, Order} +%% ResultList = [{VersionInfo, [{Test, Time} | _]}] +%% MinTime = integer() - The execution time of the fastes test +%% Order = [BmFunctionName|_] - the order of the testcases in +%% increasing execution time. +%% BmFunctionName = atom() +%%--------------------------------------------------------------------------- +min_time_and_sort(ResultList) -> + + %% Use the results from the run on the highest version + %% of Erlang as norm. + {_, TestRes} = + lists:foldl(fun ({{Ver, _}, ResList}, + {CurrentVer, _}) when Ver > CurrentVer -> + {Ver, ResList}; + (_, VerAndRes) -> + VerAndRes + end, {"0", []}, ResultList), + + {lists:foldl(fun ({_, Time0}, Min1) when Time0 < Min1 -> + Time0; + (_, Min1) -> + Min1 + end, ?MAX, TestRes), + [Name || {Name, _} <- lists:keysort(2, TestRes)]}. + +%%--------------------------------------------------------------------------- +%% table_headers(VerResultList) -> SysInfo +%% VerResultList = [{{Ver, Machine},[{BmFunctionName, Time}]} | _] +%% Ver = string() +%% Machine = string() +%% BmFunctionName = atom() +%% Time = integer() +%% SysInfo = {Ver, Machine} +%%--------------------------------------------------------------------------- +table_headers(VerResultList) -> + [SysInfo || {SysInfo, _} <- VerResultList]. diff --git a/system/doc/efficiency_guide/bench.hrl b/system/doc/efficiency_guide/bench.hrl new file mode 100644 index 0000000000..a98ca1c89e --- /dev/null +++ b/system/doc/efficiency_guide/bench.hrl @@ -0,0 +1,22 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +%% AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-define(rep5(X), X, X, X, X, X). +-define(rep10(X), ?rep5(X), ?rep5(X)). +-define(rep20(X), ?rep10(X), ?rep10(X)). +-define(rep40(X), ?rep20(X), ?rep20(X)). +-define(rep80(X), ?rep40(X), ?rep40(X)). diff --git a/system/doc/efficiency_guide/binaryhandling.xml b/system/doc/efficiency_guide/binaryhandling.xml new file mode 100644 index 0000000000..8746de4b60 --- /dev/null +++ b/system/doc/efficiency_guide/binaryhandling.xml @@ -0,0 +1,528 @@ + + + + +

+ + 2007 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Constructing and matching binaries + Bjorn Gustavsson + + 2007-10-12 + + binaryhandling.xml +
+ +

In R12B, the most natural way to write binary construction and matching is now + significantly faster than in earlier releases.

+ +

To construct at binary, you can simply write

+ +

DO (in R12B) / REALLY DO NOT (in earlier releases)

+ + my_list_to_binary(List, <<>>). + +my_list_to_binary([H|T], Acc) -> + my_list_to_binary(T, <>); +my_list_to_binary([], Acc) -> + Acc.]]> + +

In releases before R12B, Acc would be copied in every iteration. + In R12B, Acc will be copied only in the first iteration and extra + space will be allocated at the end of the copied binary. In the next iteration, + H will be written in to the extra space. When the extra space runs out, + the binary will be reallocated with more extra space.

+ +

The extra space allocated (or reallocated) will be twice the size of the + existing binary data, or 256, whichever is larger.

+ +

The most natural way to match binaries is now the fastest:

+ +

DO (in R12B)

+ >) -> + [H|my_binary_to_list(T)]; +my_binary_to_list(<<>>) -> [].]]> + +
+ How binaries are implemented + +

Internally, binaries and bitstrings are implemented in the same way. + In this section, we will call them binaries since that is what + they are called in the emulator source code.

+ +

There are four types of binary objects internally. Two of them are + containers for binary data and two of them are merely references to + a part of a binary.

+ +

The binary containers are called refc binaries + (short for reference-counted binaries) and heap binaries.

+ +

Refc binaries + consist of two parts: an object stored on + the process heap, called a ProcBin, and the binary object itself + stored outside all process heaps.

+ +

The binary object can be referenced by any number of ProcBins from any + number of processes; the object contains a reference counter to keep track + of the number of references, so that it can be removed when the last + reference disappears.

+ +

All ProcBin objects in a process are part of a linked list, so that + the garbage collector can keep track of them and decrement the reference + counters in the binary when a ProcBin disappears.

+ +

Heap binaries are small binaries, + up to 64 bytes, that are stored directly on the process heap. + They will be copied when the process + is garbage collected and when they are sent as a message. They don't + require any special handling by the garbage collector.

+ +

There are two types of reference objects that can reference part of + a refc binary or heap binary. They are called sub binaries and + match contexts.

+ +

A sub binary + is created by split_binary/2 and when + a binary is matched out in a binary pattern. A sub binary is a reference + into a part of another binary (refc or heap binary, never into a another + sub binary). Therefore, matching out a binary is relatively cheap because + the actual binary data is never copied.

+ +

A match context is + similar to a sub binary, but is optimized + for binary matching; for instance, it contains a direct pointer to the binary + data. For each field that is matched out of a binary, the position in the + match context will be incremented.

+ +

In R11B, a match context was only using during a binary matching + operation.

+ +

In R12B, the compiler tries to avoid generating code that + creates a sub binary, only to shortly afterwards create a new match + context and discard the sub binary. Instead of creating a sub binary, + the match context is kept.

+ +

The compiler can only do this optimization if it can know for sure + that the match context will not be shared. If it would be shared, the + functional properties (also called referential transparency) of Erlang + would break.

+
+ +
+ Constructing binaries + +

In R12B, appending to a binary or bitstring

+ + > +<>]]> + +

is specially optimized by the run-time system. + Because the run-time system handles the optimization (instead of + the compiler), there are very few circumstances in which the optimization + will not work.

+ +

To explain how it works, we will go through this code

+ + >, %% 1 +Bin1 = <>, %% 2 +Bin2 = <>, %% 3 +Bin3 = <>, %% 4 +Bin4 = <>, %% 5 !!! +{Bin4,Bin3} %% 6]]> + +

line by line.

+ +

The first line (marked with the %% 1 comment), assigns + a heap binary to + the variable Bin0.

+ +

The second line is an append operation. Since Bin0 + has not been involved in an append operation, + a new refc binary + will be created and the contents of Bin0 will be copied + into it. The ProcBin part of the refc binary will have + its size set to the size of the data stored in the binary, while + the binary object will have extra space allocated. + The size of the binary object will be either twice the + size of Bin0 or 256, whichever is larger. In this case + it will be 256.

+ +

It gets more interesting in the third line. + Bin1 has been used in an append operation, + and it has 255 bytes of unused storage at the end, so the three new bytes + will be stored there.

+ +

Same thing in the fourth line. There are 252 bytes left, + so there is no problem storing another three bytes.

+ +

But in the fifth line something interesting happens. + Note that we don't append to the previous result in Bin3, + but to Bin1. We expect that Bin4 will be assigned + the value <<0,1,2,3,17>>. We also expect that + Bin3 will retain its value + (<<0,1,2,3,4,5,6,7,8,9>>). + Clearly, the run-time system cannot write the byte 17 into the binary, + because that would change the value of Bin3 to + <<0,1,2,3,4,17,6,7,8,9>>.

+ +

What will happen?

+ +

The run-time system will see that Bin1 is the result + from a previous append operation (not from the latest append operation), + so it will copy the contents of Bin1 to a new binary + and reserve extra storage and so on. (We will not explain here how the + run-time system can know that it is not allowed to write into Bin1; + it is left as an exercise to the curious reader to figure out how it is + done by reading the emulator sources, primarily erl_bits.c.)

+ +
+ Circumstances that force copying + +

The optimization of the binary append operation requires that + there is a single ProcBin and a single reference to the + ProcBin for the binary. The reason is that the binary object can be + moved (reallocated) during an append operation, and when that happens + the pointer in the ProcBin must be updated. If there would be more than + on ProcBin pointing to the binary object, it would not be possible to + find and update all of them.

+ +

Therefore, certain operations on a binary will mark it so that + any future append operation will be forced to copy the binary. + In most cases, the binary object will be shrunk at the same time + to reclaim the extra space allocated for growing.

+ +

When appending to a binary

+ + >]]> + +

only the binary returned from the latest append operation will + support further cheap append operations. In the code fragment above, + appending to Bin will be cheap, while appending to Bin0 + will force the creation of a new binary and copying of the contents + of Bin0.

+ +

If a binary is sent as a message to a process or port, the binary + will be shrunk and any further append operation will copy the binary + data into a new binary. For instance, in the following code fragment

+ + >, +PortOrPid ! Bin1, +Bin = <> %% Bin1 will be COPIED +]]> + +

Bin1 will be copied in the third line.

+ +

The same thing happens if you insert a binary into an ets + table or send it to a port using erlang:port_command/2.

+ +

Matching a binary will also cause it to shrink and the next append + operation will copy the binary data:

+ + >, +<> = Bin1, +Bin = <> %% Bin1 will be COPIED +]]> + +

The reason is that a match context + contains a direct pointer to the binary data.

+ +

If a process simply keeps binaries (either in "loop data" or in the process + dictionary), the garbage collector may eventually shrink the binaries. + If only one such binary is kept, it will not be shrunk. If the process later + appends to a binary that has been shrunk, the binary object will be reallocated + to make place for the data to be appended.

+
+ +
+ +
+ Matching binaries + +

We will revisit the example shown earlier

+ +

DO (in R12B)

+ >) -> + [H|my_binary_to_list(T)]; +my_binary_to_list(<<>>) -> [].]]> + +

too see what is happening under the hood.

+ +

The very first time my_binary_to_list/1 is called, + a match context + will be created. The match context will point to the first + byte of the binary. One byte will be matched out and the match context + will be updated to point to the second byte in the binary.

+ +

In R11B, at this point a sub binary + would be created. In R12B, + the compiler sees that there is no point in creating a sub binary, + because there will soon be a call to a function (in this case, + to my_binary_to_list/1 itself) that will immediately + create a new match context and discard the sub binary.

+ +

Therefore, in R12B, my_binary_to_list/1 will call itself + with the match context instead of with a sub binary. The instruction + that initializes the matching operation will basically do nothing + when it sees that it was passed a match context instead of a binary.

+ +

When the end of the binary is reached and second clause matches, + the match context will simply be discarded (removed in the next + garbage collection, since there is no longer any reference to it).

+ +

To summarize, my_binary_to_list/1 in R12B only needs to create + one match context and no sub binaries. In R11B, if the binary + contains N bytes, N+1 match contexts and N + sub binaries will be created.

+ +

In R11B, the fastest way to match binaries is:

+ +

DO NOT (in R12B)

+ + my_complicated_binary_to_list(Bin, 0). + +my_complicated_binary_to_list(Bin, Skip) -> + case Bin of + <<_:Skip/binary,Byte,_/binary>> -> + [Byte|my_complicated_binary_to_list(Bin, Skip+1)]; + <<_:Skip/binary>> -> + [] + end.]]> + +

This function cleverly avoids building sub binaries, but it cannot + avoid building a match context in each recursion step. Therefore, in both R11B and R12B, + my_complicated_binary_to_list/1 builds N+1 match + contexts. (In a future release, the compiler might be able to generate code + that reuses the match context, but don't hold your breath.)

+ +

Returning to my_binary_to_list/1, note that the match context was + discarded when the entire binary had been traversed. What happens if + the iteration stops before it has reached the end of the binary? Will + the optimization still work?

+ + >) -> + T; +after_zero(<<_,T/binary>>) -> + after_zero(T); +after_zero(<<>>) -> + <<>>. + ]]> + +

Yes, it will. The compiler will remove the building of the sub binary in the + second clause

+ + >) -> + after_zero(T); +. +. +.]]> + +

but will generate code that builds a sub binary in the first clause

+ + >) -> + T; +. +. +.]]> + +

Therefore, after_zero/1 will build one match context and one sub binary + (assuming it is passed a binary that contains a zero byte).

+ +

Code like the following will also be optimized:

+ + + {lists:reverse(Acc),Buffer}; +all_but_zeroes_to_list(<<0,T/binary>>, Acc, Remaining) -> + all_but_zeroes_to_list(T, Acc, Remaining-1); +all_but_zeroes_to_list(<>, Acc, Remaining) -> + all_but_zeroes_to_list(T, [Byte|Acc], Remaining-1).]]> + +

The compiler will remove building of sub binaries in the second and third clauses, + and it will add an instruction to the first clause that will convert Buffer + from a match context to a sub binary (or do nothing if Buffer already is a binary).

+ +

Before you begin to think that the compiler can optimize any binary patterns, + here is a function that the compiler (currently, at least) is not able to optimize:

+ + >) -> + non_opt_eq(T1, T2); +non_opt_eq([_|_], <<_,_/binary>>) -> + false; +non_opt_eq([], <<>>) -> + true.]]> + +

It was briefly mentioned earlier that the compiler can only delay creation of + sub binaries if it can be sure that the binary will not be shared. In this case, + the compiler cannot be sure.

+ +

We will soon show how to rewrite non_opt_eq/2 so that the delayed sub binary + optimization can be applied, and more importantly, we will show how you can find out + whether your code can be optimized.

+ +
+ The bin_opt_info option + +

Use the bin_opt_info option to have the compiler print a lot of + information about binary optimizations. It can be given either to the compiler or + erlc

+ + + +

or passed via an environment variable

+ + + +

Note that the bin_opt_info is not meant to be a permanent option added + to your Makefiles, because it is not possible to eliminate all messages that + it generates. Therefore, passing the option through the environment is in most cases + the most practical approach.

+ +

The warnings will look like this:

+ + + +

To make it clearer exactly what code the warnings refer to, + in the examples that follow, the warnings are inserted as comments + after the clause they refer to:

+ + >) -> + %% NOT OPTIMIZED: sub binary is used or returned + T; +after_zero(<<_,T/binary>>) -> + %% OPTIMIZED: creation of sub binary delayed + after_zero(T); +after_zero(<<>>) -> + <<>>.]]> + +

The warning for the first clause tells us that it is not possible to + delay the creation of a sub binary, because it will be returned. + The warning for the second clause tells us that a sub binary will not be + created (yet).

+ +

It is time to revisit the earlier example of the code that could not + be optimized and find out why:

+ + >) -> + %% INFO: matching anything else but a plain variable to + %% the left of binary pattern will prevent delayed + %% sub binary optimization; + %% SUGGEST changing argument order + %% NOT OPTIMIZED: called function non_opt_eq/2 does not + %% begin with a suitable binary matching instruction + non_opt_eq(T1, T2); +non_opt_eq([_|_], <<_,_/binary>>) -> + false; +non_opt_eq([], <<>>) -> + true.]]> + +

The compiler emitted two warnings. The INFO warning refers to the function + non_opt_eq/2 as a callee, indicating that any functions that call non_opt_eq/2 + will not be able to make delayed sub binary optimization. + There is also a suggestion to change argument order. + The second warning (that happens to refer to the same line) refers to the construction of + the sub binary itself.

+ +

We will soon show another example that should make the distinction between INFO + and NOT OPTIMIZED warnings somewhat clearer, but first we will heed the suggestion + to change argument order:

+ + >, [H|T2]) -> + %% OPTIMIZED: creation of sub binary delayed + opt_eq(T1, T2); +opt_eq(<<_,_/binary>>, [_|_]) -> + false; +opt_eq(<<>>, []) -> + true.]]> + +

The compiler gives a warning for the following code fragment:

+ + >) -> + %% INFO: matching anything else but a plain variable to + %% the left of binary pattern will prevent delayed + %% sub binary optimization; + %% SUGGEST changing argument order + done; +. +. +.]]> + +

The warning means that if there is a call to match_body/2 + (from another clause in match_body/2 or another function), the + delayed sub binary optimization will not be possible. There will be additional + warnings for any place where a sub binary is matched out at the end of and + passed as the second argument to match_body/2. For instance:

+ + >) -> + %% NOT OPTIMIZED: called function match_body/2 does not + %% begin with a suitable binary matching instruction + match_body(List, Data).]]> + +
+ +
+ Unused variables + +

The compiler itself figures out if a variable is unused. The same + code is generated for each of the following functions

+ + >, Count) -> count1(T, Count+1); +count1(<<>>, Count) -> Count. + +count2(<>, Count) -> count2(T, Count+1); +count2(<<>>, Count) -> Count. + +count3(<<_H,T/binary>>, Count) -> count3(T, Count+1); +count3(<<>>, Count) -> Count.]]> + +

In each iteration, the first 8 bits in the binary will be skipped, not matched out.

+ +
+ +
+ + + diff --git a/system/doc/efficiency_guide/book.xml b/system/doc/efficiency_guide/book.xml new file mode 100644 index 0000000000..5df40695bb --- /dev/null +++ b/system/doc/efficiency_guide/book.xml @@ -0,0 +1,42 @@ + + + + +
+ + 20012009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Efficiency Guide + OTP Team + + 2001-08-07 + R8A +
+ + + Efficiency Guide + + + + + + + + +
+ diff --git a/system/doc/efficiency_guide/call_bm.erl b/system/doc/efficiency_guide/call_bm.erl new file mode 100644 index 0000000000..389814f11f --- /dev/null +++ b/system/doc/efficiency_guide/call_bm.erl @@ -0,0 +1,75 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +%% AB. All Rights Reserved.'' +%% +%% $Id$ +%% + +-module(call_bm). + +-include("bench.hrl"). + +-export([benchmarks/0]). +-export([local_call/1,external_call/1,fun_call/1,apply_fun/1, + apply_mfa_implicit/1, apply_mfa_explicit/1]). +-export([foo/0]). + +benchmarks() -> + {400000,[local_call,external_call,fun_call,apply_fun, + apply_mfa_implicit, apply_mfa_explicit]}. + +local_call(0) -> + ok; +local_call(Iter) -> + ?rep40(foo()), + local_call(Iter-1). + +external_call(0) -> + ok; +external_call(Iter) -> + ?rep40(?MODULE:foo()), + external_call(Iter-1). + +fun_call(Iter) -> + fun_call(Iter, fun() -> ok end). +fun_call(0, _) -> + ok; +fun_call(Iter, Fun) -> + ?rep40(Fun()), + fun_call(Iter-1, Fun). + +apply_fun(Iter) -> + apply_fun(Iter, fun() -> ok end). +apply_fun(0, _) -> + ok; +apply_fun(Iter, Fun) -> + ?rep40(apply(Fun, [])), + apply_fun(Iter-1, Fun). + +apply_mfa_explicit(0) -> + ok; +apply_mfa_explicit(Iter) -> + ?rep40(apply(?MODULE, foo, [])), + apply_mfa_explicit(Iter-1). + +apply_mfa_implicit(Iter) -> + apply_mfa_implicit(?MODULE, foo, Iter). + +apply_mfa_implicit(_, _, 0) -> + ok; +apply_mfa_implicit(Module, Function, Iter) -> + ?rep40(Module:Function()), + apply_mfa_implicit(Module, Function, Iter-1). + +foo() -> ok. diff --git a/system/doc/efficiency_guide/call_result.html b/system/doc/efficiency_guide/call_result.html new file mode 100644 index 0000000000..37b8931cdf --- /dev/null +++ b/system/doc/efficiency_guide/call_result.html @@ -0,0 +1,26 @@ + + +Benchmark Results + + +

Benchmark Results

+

call_bm

+
+ + + + + + + + + + + + + + +
Test5.4
BEAM
local_call1.00
external_call1.08
fun_call2.79
apply_fun3.54
apply_mfa_implicit7.76
apply_mfa_explicit8.21
+

Source for call_bm.erl + + diff --git a/system/doc/efficiency_guide/commoncaveats.xml b/system/doc/efficiency_guide/commoncaveats.xml new file mode 100644 index 0000000000..e18e5aa510 --- /dev/null +++ b/system/doc/efficiency_guide/commoncaveats.xml @@ -0,0 +1,239 @@ + + + + +

+ + 20012009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Common Caveats + Bjorn Gustavsson + + 2001-08-08 + + commoncaveats.xml +
+ +

Here we list a few modules and BIFs to watch out for, and not only + from a performance point of view.

+ +
+ The regexp module + +

The regular expression functions in the + regexp + module are written in Erlang, not in C, and were + meant for occasional use on small amounts of data, + for instance for validation of configuration files + when starting an application.

+ +

Use the re module + (introduced in R13A) instead, especially in time-critical code.

+
+ +
+ The timer module + +

Creating timers using erlang:send_after/3 + and erlang:start_timer/3 + is much more efficient than using the timers provided by the + timer module. The + timer module uses a separate process to manage the timers, + and that process can easily become overloaded if many processes + create and cancel timers frequently (especially when using the + SMP emulator).

+ +

The functions in the timer module that do not manage timers (such as + timer:tc/3 or timer:sleep/1), do not call the timer-server process + and are therefore harmless.

+
+ +
+ list_to_atom/1 + +

Atoms are not garbage-collected. Once an atom is created, it will never + be removed. The emulator will terminate if the limit for the number + of atoms (1048576) is reached.

+ +

Therefore, converting arbitrary input strings to atoms could be + dangerous in a system that will run continuously. + If only certain well-defined atoms are allowed as input, you can use + list_to_existing_atom/1 + to guard against a denial-of-service attack. (All atoms that are allowed + must have been created earlier, for instance by simply using all of them + in a module and loading that module.)

+ +

Using list_to_atom/1 to construct an atom that is passed to + apply/3 like this

+ + +apply(list_to_atom("some_prefix"++Var), foo, Args) + +

is quite expensive and is not recommended in time-critical code.

+
+ +
+ length/1 + +

The time for calculating the length of a list is proportional to the + length of the list, as opposed to tuple_size/1, byte_size/1, + and bit_size/1, which all execute in constant time.

+ +

Normally you don't have to worry about the speed of length/1, + because it is efficiently implemented in C. In time critical-code, though, + you might want to avoid it if the input list could potentially be very long.

+ +

Some uses of length/1 can be replaced by matching. + For instance, this code

+ + +foo(L) when length(L) >= 3 -> + ... + +

can be rewritten to

+ +foo([_,_,_|_]=L) -> + ... + +

(One slight difference is that length(L) will fail if the L + is an improper list, while the pattern in the second code fragment will + accept an improper list.)

+
+ +
+ setelement/3 + +

setelement/3 + copies the tuple it modifies. Therefore, updating a tuple in a loop + using setelement/3 will create a new copy of the tuple every time.

+ +

There is one exception to the rule that the tuple is copied. + If the compiler clearly can see that destructively updating the tuple would + give exactly the same result as if the tuple was copied, the call to + setelement/3 will be replaced with a special destructive setelement + instruction. In the following code sequence

+ + +multiple_setelement(T0) -> + T1 = setelement(9, T0, bar), + T2 = setelement(7, T1, foobar), + setelement(5, T2, new_value). + +

the first setelement/3 call will copy the tuple and modify the + ninth element. The two following setelement/3 calls will modify + the tuple in place.

+ +

For the optimization to be applied, all of the followings conditions + must be true:

+ + + The indices must be integer literals, not variables or expressions. + The indices must be given in descending order. + There must be no calls to other function in between the calls to + setelement/3. + The tuple returned from one setelement/3 call must only be used + in the subsequent call to setelement/3. + + +

If it is not possible to structure the code as in the multiple_setelement/1 + example, the best way to modify multiple elements in a large tuple is to + convert the tuple to a list, modify the list, and convert the list back to + a tuple.

+
+ +
+ size/1 + +

size/1 returns the size for both tuples and binary.

+ +

Using the new BIFs tuple_size/1 and byte_size/1 introduced + in R12B gives the compiler and run-time system more opportunities for + optimization. A further advantage is that the new BIFs could help Dialyzer + find more bugs in your program.

+
+ +
+ split_binary/2 +

It is usually more efficient to split a binary using matching + instead of calling the split_binary/2 function. + Furthermore, mixing bit syntax matching and split_binary/2 + may prevent some optimizations of bit syntax matching.

+ +

DO

+ > = Bin,]]> +

DO NOT

+ + {Bin1,Bin2} = split_binary(Bin, Num) + +
+ +
+ The '--' operator +

Note that the '--' operator has a complexity + proportional to the product of the length of its operands, + meaning that it will be very slow if both of its operands + are long lists:

+ +

DO NOT

+ + +

Instead use the ordsets + module:

+ +

DO

+ + HugeSet1 = ordsets:from_list(HugeList1), + HugeSet2 = ordsets:from_list(HugeList2), + ordsets:subtract(HugeSet1, HugeSet2) + + +

Obviously, that code will not work if the original order + of the list is important. If the order of the list must be + preserved, do like this:

+ +

DO

+ + +

Subtle note 1: This code behaves differently from '--' + if the lists contain duplicate elements. (One occurrence + of an element in HugeList2 will remove all + occurrences in HugeList1.)

+ +

Subtle note 2: This code compares lists elements using the + '==' operator, while '--' uses the '=:='. If + that difference is important, sets can be used instead of + gb_sets, but note that sets:from_list/1 is much + slower than gb_sets:from_list/1 for long lists.

+ +

Using the '--' operator to delete an element + from a list is not a performance problem:

+ +

OK

+ + HugeList1 -- [Element] + + +
+ + + diff --git a/system/doc/efficiency_guide/digger.ps b/system/doc/efficiency_guide/digger.ps new file mode 100644 index 0000000000..07ac8e2fa9 --- /dev/null +++ b/system/doc/efficiency_guide/digger.ps @@ -0,0 +1,197 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: /clearcase/otp/system/doc/efficiency_guide/digger.ps +%%Creator: XV Version 3.10a Rev: 12/29/94 - by John Bradley +%%BoundingBox: 290 380 322 412 +%%Pages: 1 +%%DocumentFonts: +%%EndComments +%%EndProlog + +%%Page: 1 1 + +% remember original state +/origstate save def + +% build a temporary dictionary +20 dict begin + +% define string to hold a scanline's worth of data +/pix 96 string def + +% define space for color conversions +/grays 32 string def % space for gray scale line +/npixls 0 def +/rgbindx 0 def + +% lower left corner +290 380 translate + +% size of image (on paper, in 1/72inch coords) +31.96800 31.96800 scale + +% define 'colorimage' if it isn't defined +% ('colortogray' and 'mergeprocs' come from xwd2ps +% via xgrab) +/colorimage where % do we know about 'colorimage'? + { pop } % yes: pop off the 'dict' returned + { % no: define one + /colortogray { % define an RGB->I function + /rgbdata exch store % call input 'rgbdata' + rgbdata length 3 idiv + /npixls exch store + /rgbindx 0 store + 0 1 npixls 1 sub { + grays exch + rgbdata rgbindx get 20 mul % Red + rgbdata rgbindx 1 add get 32 mul % Green + rgbdata rgbindx 2 add get 12 mul % Blue + add add 64 idiv % I = .5G + .31R + .18B + put + /rgbindx rgbindx 3 add store + } for + grays 0 npixls getinterval + } bind def + + % Utility procedure for colorimage operator. + % This procedure takes two procedures off the + % stack and merges them into a single procedure. + + /mergeprocs { % def + dup length + 3 -1 roll + dup + length + dup + 5 1 roll + 3 -1 roll + add + array cvx + dup + 3 -1 roll + 0 exch + putinterval + dup + 4 2 roll + putinterval + } bind def + + /colorimage { % def + pop pop % remove 'false 3' operands + {colortogray} mergeprocs + image + } bind def + } ifelse % end of 'false' case + + + +32 32 8 % dimensions of data +[32 0 0 -32 0 32] % mapping matrix +{currentfile pix readhexstring pop} +false 3 colorimage + +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00000000000000000000000000ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00000000000000000000000000000000000000ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00000000000000000000000000000000000000ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00000000000000000000000000000000000000ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00000000000000000000000000000000000000ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00000000000000000000000000000000000000 +000000000000ffff00000000000000000000000000ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00000000ffff00ffff00ffff00ffff00000000 +000000000000000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00000000ffff00ffff00ffff00000000000000 +000000000000000000000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00000000ffff00000000000000000000000000 +000000000000ffff00000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00000000ffff00000000000000000000000000 +000000ffff00ffff00000000ffff00ffff00ffff00ffff00ffff00000000000000000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00000000000000000000000000000000000000 +ffff00ffff00ffff00000000ffff00ffff00ffff00ffff00ffff00000000000000000000 +000000000000ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00000000000000ffff00000000000000000000000000000000 +ffff00ffff00ffff00000000ffff00ffff00ffff00ffff00ffff00000000000000000000 +000000000000ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00000000000000000000000000000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000000000000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00000000000000000000000000000000 +000000000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00000000000000ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00000000000000000000ffff00000000 +000000000000000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00000000000000ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00000000000000000000ffff00ffff00 +000000000000000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +000000ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00000000000000000000ffff00ffff00 +000000000000000000ffff00ffff00ffff00ffff00ffff00000000000000ffff00ffff00 +000000ffff00000000ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00000000000000000000ffff00ffff00 +000000000000000000ffff00ffff00ffff00ffff00000000000000000000000000ffff00 +ffff00ffff00000000ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00000000000000ffff00ffff00ffff00 +000000000000ffff00ffff00ffff00ffff00000000000000000000000000000000000000 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00000000000000000000ffff00ffff00 +000000000000000000ffff00ffff00000000000000000000000000000000000000000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00000000000000000000ffff00ffff00 +000000000000000000ffff00ffff00000000000000000000000000000000000000000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00 +ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000 + +showpage + +% stop using temporary dictionary +end + +% restore original state +origstate restore + +%%Trailer diff --git a/system/doc/efficiency_guide/drivers.xml b/system/doc/efficiency_guide/drivers.xml new file mode 100644 index 0000000000..9fe54fb19a --- /dev/null +++ b/system/doc/efficiency_guide/drivers.xml @@ -0,0 +1,148 @@ + + + + +
+ + 20092009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Drivers + Bjorn Gustavsson + + 2009-11-16 + + drivers.xml +
+ +

This chapter provides a (very) brief overview on how to write efficient + drivers. It is assumed that you already have a good understanding of + drivers.

+ +
+ Drivers and concurrency + +

The run-time system will always take a lock before running + any code in a driver.

+ +

By default, that lock will be at the driver level, meaning that + if several ports has been opened to the same driver, only code for + one port at the same time can be running.

+ +

A driver can be configured to instead have one lock for each port.

+ +

If a driver is used in a functional way (i.e. it holds no state, + but only does some heavy calculation and returns a result), several + ports with registered names can be opened beforehand and the port to + be used can be chosen based on the scheduler ID like this:

+ + +-define(PORT_NAMES(), + {some_driver_01, some_driver_02, some_driver_03, some_driver_04, + some_driver_05, some_driver_06, some_driver_07, some_driver_08, + some_driver_09, some_driver_10, some_driver_11, some_driver_12, + some_driver_13, some_driver_14, some_driver_15, some_driver_16}). + +client_port() -> + element(erlang:system_info(scheduler_id) rem tuple_size(?PORT_NAMES()) + 1, + ?PORT_NAMES()). + +

As long as there are no more than 16 schedulers, there will never + be any lock contention on the port lock for the driver.

+ +
+ +
+ Avoiding copying of binaries when calling a driver + +

There are basically two ways to avoid copying a binary that is + sent to a driver.

+ +

If the Data argument for + port_control/3 + is a binary, the driver will be passed a pointer to the contents of + the binary and the binary will not be copied. + If the Data argument is an iolist (list of binaries and lists), + all binaries in the iolist will be copied.

+ +

Therefore, if you want to send both a pre-existing binary and some + additional data to a driver without copying the binary, you must call + port_control/3 twice; once with the binary and once with the + additional data. However, that will only work if there is only one + process communicating with the port (because otherwise another process + could call the driver in-between the calls).

+ +

Another way to avoid copying binaries is to implement an outputv + callback (instead of an output callback) in the driver. + If a driver has an outputv callback, refc binaries passed + in an iolist in the Data argument for + port_command/2 + will be passed as references to the driver.

+
+ +
+ Returning small binaries from a driver + +

The run-time system can represent binaries up to 64 bytes as + heap binaries. They will always be copied when sent in a messages, + but they will require less memory if they are not sent to another + process and garbage collection is cheaper.

+ +

If you know that the binaries you return are always small, + you should use driver API calls that do not require a pre-allocated + binary, for instance + driver_output() + or + driver_output_term() + using the ERL_DRV_BUF2BINARY format, + to allow the run-time to construct a heap binary.

+ +
+ +
+ Returning big binaries without copying from a driver + +

To avoid copying data when a big binary is sent or returned from + the driver to an Erlang process, the driver must first allocate the + binary and then send it to an Erlang process in some way.

+ +

Use driver_alloc_binary() to allocate a binary.

+ +

There are several ways to send a binary created with + driver_alloc_binary().

+ + +

From the control callback, a binary can be returned provided + that + set_port_control() + has been called with the flag value PORT_CONTROL_FLAG_BINARY.

+
+ +

A single binary can be sent with + driver_output_binary().

+ +

Using + driver_output_term() + or + driver_send_term(), + a binary can be included in an Erlang term.

+
+
+ +
+ +
diff --git a/system/doc/efficiency_guide/efficiency_guide.erl b/system/doc/efficiency_guide/efficiency_guide.erl new file mode 100644 index 0000000000..e982bdae65 --- /dev/null +++ b/system/doc/efficiency_guide/efficiency_guide.erl @@ -0,0 +1,214 @@ +-module(efficiency_guide). +-compile(export_all). + +%% DO NOT +naive_reverse([H|T]) -> + naive_reverse(T)++[H]; +naive_reverse([]) -> + []. + +%% OK +naive_but_ok_reverse([H|T], Acc) -> + naive_but_ok_reverse(T, [H]++Acc); +naive_but_ok_reverse([], Acc) -> + Acc. + +%% DO +vanilla_reverse([H|T], Acc) -> + vanilla_reverse(T, [H|Acc]); +vanilla_reverse([], Acc) -> + Acc. + + +multiple_setelement(T0) -> + T1 = setelement(9, T0, bar), + T2 = setelement(7, T1, foobar), + setelement(5, T2, new_value). + + +my_list_to_binary(List) -> + my_list_to_binary(List, <<>>). + +my_list_to_binary([H|T], Acc) -> + my_list_to_binary(T, <>); +my_list_to_binary([], Acc) -> + Acc. + +my_old_list_to_binary(List) -> + my_old_list_to_binary(List, []). + +my_old_list_to_binary([H|T], Acc) -> + my_old_list_to_binary(T, [Acc,H]); +my_old_list_to_binary([], Acc) -> + list_to_binary(Acc). + +my_binary_to_list(<>) -> + [H|my_binary_to_list(T)]; +my_binary_to_list(<<>>) -> []. + +my_complicated_binary_to_list(Bin) -> + my_complicated_binary_to_list(Bin, 0). + +my_complicated_binary_to_list(Bin, Skip) -> + case Bin of + <<_:Skip/binary,Byte,_/binary>> -> + [Byte|my_complicated_binary_to_list(Bin, Skip+1)]; + <<_:Skip/binary>> -> + [] + end. + +after_zero(<<0,T/binary>>) -> + T; +after_zero(<<_,T/binary>>) -> + after_zero(T); +after_zero(<<>>) -> + <<>>. + +all_but_zeroes_to_list(Buffer, Acc, 0) -> + {lists:reverse(Acc),Buffer}; +all_but_zeroes_to_list(<<0,T/binary>>, Acc, Remaining) -> + all_but_zeroes_to_list(T, Acc, Remaining-1); +all_but_zeroes_to_list(<>, Acc, Remaining) -> + all_but_zeroes_to_list(T, [Byte|Acc], Remaining-1). + +non_opt_eq([H|T1], <>) -> + non_opt_eq(T1, T2); +non_opt_eq([_|_], <<_,_/binary>>) -> + false; +non_opt_eq([], <<>>) -> + true. + +opt_eq(<>, [H|T2]) -> + opt_eq(T1, T2); +opt_eq(<<_,_/binary>>, [_|_]) -> + false; +opt_eq(<<>>, []) -> + true. + +match_head(List, <<_:10,Data/binary>>) -> + match_body(List, Data). + +match_body([0|_], <>) -> + done; +match_body([H|T1], <>) -> + {T1,T2}. + +count1(<<_,T/binary>>, Count) -> count1(T, Count+1); +count1(<<>>, Count) -> Count. + +count2(<>, Count) -> count2(T, Count+1); +count2(<<>>, Count) -> Count. + +count3(<<_H,T/binary>>, Count) -> count3(T, Count+1); +count3(<<>>, Count) -> Count. + +fib(N) -> + fib(N, 0, 1, []). + +fib(0, _Current, _Next, Fibs) -> + lists:reverse(Fibs); +fib(N, Current, Next, Fibs) -> + fib(N - 1, Next, Current + Next, [Current|Fibs]). + +recursive_fib(N) -> + recursive_fib(N, 0, 1). + +recursive_fib(0, _Current, _Next) -> + []; +recursive_fib(N, Current, Next) -> + [Current|recursive_fib(N - 1, Next, Current + Next)]. + +bad_fib(N) -> + bad_fib(N, 0, 1, []). + +bad_fib(0, _Current, _Next, Fibs) -> + Fibs; +bad_fib(N, Current, Next, Fibs) -> + bad_fib(N - 1, Next, Current + Next, Fibs ++ [Current]). + +tail_recursive_fib(N) -> + tail_recursive_fib(N, 0, 1, []). + +tail_recursive_fib(0, _Current, _Next, Fibs) -> + lists:reverse(Fibs); +tail_recursive_fib(N, Current, Next, Fibs) -> + tail_recursive_fib(N - 1, Next, Current + Next, [Current|Fibs]). + +append([H|T], Tail) -> + [H|append(T, Tail)]; +append([], Tail) -> + Tail. + +kilo_byte() -> + kilo_byte(10, [42]). + +kilo_byte(0, Acc) -> + Acc; +kilo_byte(N, Acc) -> + kilo_byte(N-1, [Acc|Acc]). + +recursive_sum([H|T]) -> + H+recursive_sum(T); +recursive_sum([]) -> 0. + +sum(L) -> sum(L, 0). + +sum([H|T], Sum) -> sum(T, Sum + H); +sum([], Sum) -> Sum. + +days_in_month(M) -> + element(M, {31,28,31,30,31,30,31,31,30,31,30,31}). + +atom_map1(one) -> 1; +atom_map1(two) -> 2; +atom_map1(three) -> 3; +atom_map1(Int) when is_integer(Int) -> Int; +atom_map1(four) -> 4; +atom_map1(five) -> 5; +atom_map1(six) -> 6. + +atom_map2(one) -> 1; +atom_map2(two) -> 2; +atom_map2(three) -> 3; +atom_map2(four) -> 4; +atom_map2(five) -> 5; +atom_map2(six) -> 6; +atom_map2(Int) when is_integer(Int) -> Int. + +atom_map3(Int) when is_integer(Int) -> Int; +atom_map3(one) -> 1; +atom_map3(two) -> 2; +atom_map3(three) -> 3; +atom_map3(four) -> 4; +atom_map3(five) -> 5; +atom_map3(six) -> 6. + + +map_pairs1(_Map, [], Ys) -> + Ys; +map_pairs1(_Map, Xs, [] ) -> + Xs; +map_pairs1(Map, [X|Xs], [Y|Ys]) -> + [Map(X, Y)|map_pairs1(Map, Xs, Ys)]. + +map_pairs2(_Map, [], Ys) -> + Ys; +map_pairs2(_Map, [_|_]=Xs, [] ) -> + Xs; +map_pairs2(Map, [X|Xs], [Y|Ys]) -> + [Map(X, Y)|map_pairs2(Map, Xs, Ys)]. + +explicit_map_pairs(Map, Xs0, Ys0) -> + case Xs0 of + [X|Xs] -> + case Ys0 of + [Y|Ys] -> + [Map(X, Y)|explicit_map_pairs(Map, Xs, Ys)]; + [] -> + Xs0 + end; + [] -> + Ys0 + end. + + diff --git a/system/doc/efficiency_guide/functions.xml b/system/doc/efficiency_guide/functions.xml new file mode 100644 index 0000000000..d55b60e39c --- /dev/null +++ b/system/doc/efficiency_guide/functions.xml @@ -0,0 +1,234 @@ + + + + +
+ + 20012009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Functions + Bjorn Gustavsson + + 2007-11-22 + + functions.xml +
+ +
+ Pattern matching +

Pattern matching in function head and in case and receive + clauses are optimized by the compiler. With a few exceptions, there is nothing + to gain by rearranging clauses.

+ +

One exception is pattern matching of binaries. The compiler + will not rearrange clauses that match binaries. Placing the + clause that matches against the empty binary last will usually + be slightly faster than placing it first.

+ +

Here is a rather contrived example to show another exception:

+ +

DO NOT

+ +atom_map1(one) -> 1; +atom_map1(two) -> 2; +atom_map1(three) -> 3; +atom_map1(Int) when is_integer(Int) -> Int; +atom_map1(four) -> 4; +atom_map1(five) -> 5; +atom_map1(six) -> 6. + +

The problem is the clause with the variable Int. + Since a variable can match anything, including the atoms + four, five, and six that the following clauses + also will match, the compiler must generate sub-optimal code that will + execute as follows:

+ +

First the input value is compared to one, two, and + three (using a single instruction that does a binary search; + thus, quite efficient even if there are many values) to select which + one of the first three clauses to execute (if any).

+ +

If none of the first three clauses matched, the fourth clause + will match since a variable always matches. If the guard test + is_integer(Int) succeeds, the fourth clause will be + executed.

+ +

If the guard test failed, the input value is compared to + four, five, and six, and the appropriate clause + is selected. (There will be a function_clause exception if + none of the values matched.)

+ +

Rewriting to either

+ +

DO

+ 1; +atom_map2(two) -> 2; +atom_map2(three) -> 3; +atom_map2(four) -> 4; +atom_map2(five) -> 5; +atom_map2(six) -> 6; +atom_map2(Int) when is_integer(Int) -> Int.]]> + +

or

+ +

DO

+ Int; +atom_map3(one) -> 1; +atom_map3(two) -> 2; +atom_map3(three) -> 3; +atom_map3(four) -> 4; +atom_map3(five) -> 5; +atom_map3(six) -> 6.]]> + +

will give slightly more efficient matching code.

+ +

Here is a less contrived example:

+ +

DO NOT

+ + Ys; +map_pairs1(_Map, Xs, [] ) -> + Xs; +map_pairs1(Map, [X|Xs], [Y|Ys]) -> + [Map(X, Y)|map_pairs1(Map, Xs, Ys)].]]> + +

The first argument is not a problem. It is variable, but it + is a variable in all clauses. The problem is the variable in the second + argument, Xs, in the middle clause. Because the variable can + match anything, the compiler is not allowed to rearrange the clauses, + but must generate code that matches them in the order written.

+ +

If the function is rewritten like this

+ +

DO

+ + Ys; +map_pairs2(_Map, [_|_]=Xs, [] ) -> + Xs; +map_pairs2(Map, [X|Xs], [Y|Ys]) -> + [Map(X, Y)|map_pairs2(Map, Xs, Ys)].]]> + +

the compiler is free rearrange the clauses. It will generate code + similar to this

+ +

DO NOT (already done by the compiler)

+ + case Xs0 of + [X|Xs] -> + case Ys0 of + [Y|Ys] -> + [Map(X, Y)|explicit_map_pairs(Map, Xs, Ys)]; + [] -> + Xs0 + end; + [] -> + Ys0 + end.]]> + +

which should be slightly faster for presumably the most common case + that the input lists are not empty or very short. + (Another advantage is that Dialyzer is able to deduce a better type + for the variable Xs.)

+
+ +
+ Function Calls + +

Here is an intentionally rough guide to the relative costs of + different kinds of calls. It is based on benchmark figures run on + Solaris/Sparc:

+ + + Calls to local or external functions (foo(), m:foo()) + are the fastest kind of calls. + Calling or applying a fun (Fun(), apply(Fun, [])) + is about three times as expensive as calling a local function. + Applying an exported function (Mod:Name(), + apply(Mod, Name, [])) is about twice as expensive as calling a fun, + or about six times as expensive as calling a local function. + + +
+ Notes and implementation details + +

Calling and applying a fun does not involve any hash-table lookup. + A fun contains an (indirect) pointer to the function that implements + the fun.

+ +

Tuples are not fun(s). + A "tuple fun", {Module,Function}, is not a fun. + The cost for calling a "tuple fun" is similar to that + of apply/3 or worse. Using "tuple funs" is strongly discouraged, + as they may not be supported in a future release.

+ +

apply/3 must look up the code for the function to execute + in a hash table. Therefore, it will always be slower than a + direct call or a fun call.

+ +

It no longer matters (from a performance point of view) + whether you write

+ + +Module:Function(Arg1, Arg2) + +

or

+ + +apply(Module, Function, [Arg1,Arg2]) + +

(The compiler internally rewrites the latter code into the former.)

+ +

The following code

+ + +apply(Module, Function, Arguments) + +

is slightly slower because the shape of the list of arguments + is not known at compile time.

+
+
+ +
+ Memory usage in recursion +

When writing recursive functions it is preferable to make them + tail-recursive so that they can execute in constant memory space.

+

DO

+ +list_length(List) -> + list_length(List, 0). + +list_length([], AccLen) -> + AccLen; % Base case + +list_length([_|Tail], AccLen) -> + list_length(Tail, AccLen + 1). % Tail-recursive +

DO NOT

+ +list_length([]) -> + 0. % Base case +list_length([_ | Tail]) -> + list_length(Tail) + 1. % Not tail-recursive +
+ +
+ diff --git a/system/doc/efficiency_guide/introduction.xml b/system/doc/efficiency_guide/introduction.xml new file mode 100644 index 0000000000..ba942c75c2 --- /dev/null +++ b/system/doc/efficiency_guide/introduction.xml @@ -0,0 +1,69 @@ + + + + +
+ + 20012009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Introduction + Bjorn Gustavsson + + 2007-11-21 + + introduction.xml +
+ +
+ Purpose + +

Premature optimization is the root of all evil. -- D.E. Knuth

+ +

Efficient code can be well-structured and clean code, based on + on a sound overall architecture and sound algorithms. + Efficient code can be highly implementation-code that bypasses + documented interfaces and takes advantage of obscure quirks in + the current implementation.

+ +

Ideally, your code should only contain the first kind of efficient + code. If that turns out to be too slow, you should profile the application + to find out where the performance bottlenecks are and optimize only the + bottlenecks. Other code should stay as clean as possible.

+ +

Fortunately, compiler and run-time optimizations introduced in + R12B makes it easier to write code that is both clean and + efficient. For instance, the ugly workarounds needed in R11B and earlier + releases to get the most speed out of binary pattern matching are + no longer necessary. In fact, the ugly code is slower + than the clean code (because the clean code has become faster, not + because the uglier code has become slower).

+ +

This Efficiency Guide cannot really learn you how to write efficient + code. It can give you a few pointers about what to avoid and what to use, + and some understanding of how certain language features are implemented. + We have generally not included general tips about optimization that will + work in any language, such as moving common calculations out of loops.

+
+ +
+ Prerequisites +

It is assumed that the reader is familiar with the Erlang + programming language and concepts of OTP.

+
+
+ diff --git a/system/doc/efficiency_guide/listhandling.xml b/system/doc/efficiency_guide/listhandling.xml new file mode 100644 index 0000000000..e9d2dfe556 --- /dev/null +++ b/system/doc/efficiency_guide/listhandling.xml @@ -0,0 +1,241 @@ + + + + +
+ + 20012009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + List handling + Bjorn Gustavsson + + 2007-11-16 + + listHandling.xml +
+ +
+ Creating a list + +

Lists can only be built starting from the end and attaching + list elements at the beginning. If you use the ++ operator + like this

+ + +List1 ++ List2 + +

you will create a new list which is copy of the elements in List1, + followed by List2. Looking at how lists:append/1 or ++ would be + implemented in plain Erlang, it can be seen clearly that the first list + is copied:

+ + +append([H|T], Tail) -> + [H|append(T, Tail)]; +append([], Tail) -> + Tail. + +

So the important thing when recursing and building a list is to + make sure that you attach the new elements to the beginning of the list, + so that you build a list, and not hundreds or thousands of + copies of the growing result list.

+ +

Let us first look at how it should not be done:

+ +

DO NOT

+ + bad_fib(N, 0, 1, []). + +bad_fib(0, _Current, _Next, Fibs) -> + Fibs; +bad_fib(N, Current, Next, Fibs) -> + bad_fib(N - 1, Next, Current + Next, Fibs ++ [Current]).]]> + +

Here we are not a building a list; in each iteration step we + create a new list that is one element longer than the new previous list.

+ +

To avoid copying the result in each iteration, we must build the list in + reverse order and reverse the list when we are done:

+ +

DO

+ + tail_recursive_fib(N, 0, 1, []). + +tail_recursive_fib(0, _Current, _Next, Fibs) -> + lists:reverse(Fibs); +tail_recursive_fib(N, Current, Next, Fibs) -> + tail_recursive_fib(N - 1, Next, Current + Next, [Current|Fibs]).]]> + +
+ +
+ List comprehensions + +

Lists comprehensions still have a reputation for being slow. + They used to be implemented using funs, which used to be slow.

+ +

In recent Erlang/OTP releases (including R12B), a list comprehension

+ + + +

is basically translated to a local function

+ + +'lc^0'([E|Tail], Expr) -> + [Expr(E)|'lc^0'(Tail, Expr)]; +'lc^0'([], _Expr) -> []. + +

In R12B, if the result of the list comprehension will obviously not be used, + a list will not be constructed. For instance, in this code

+ + + +

or in this code

+ + + [io:put_chars(E) || E <- List]; + ... -> +end, +some_function(...), +. +. +.]]> + +

the value is neither assigned to a variable, nor passed to another function, + nor returned, so there is no need to construct a list and the compiler will simplify + the code for the list comprehension to

+ + +'lc^0'([E|Tail], Expr) -> + Expr(E), + 'lc^0'(Tail, Expr); +'lc^0'([], _Expr) -> []. + +
+ +
+ Deep and flat lists + +

lists:flatten/1 + builds an entirely new list. Therefore, it is expensive, and even + more expensive than the ++ (which copies its left argument, + but not its right argument).

+ +

In the following situations, you can easily avoid calling lists:flatten/1:

+ + + When sending data to a port. Ports understand deep lists + so there is no reason to flatten the list before sending it to + the port. + When calling BIFs that accept deep lists, such as + list_to_binary/1 or + iolist_to_binary/1. + When you know that your list is only one level deep, you can can use + lists:append/1. + + +

Port example

+

DO

+
+      ...
+      port_command(Port, DeepList)
+      ...
+

DO NOT

+
+      ...
+      port_command(Port, lists:flatten(DeepList))
+      ...
+ +

A common way to send a zero-terminated string to a port is the following:

+ +

DO NOT

+
+      ...
+      TerminatedStr = String ++ [0], % String="foo" => [$f, $o, $o, 0]
+      port_command(Port, TerminatedStr)
+      ...
+ +

Instead do like this:

+ +

DO

+
+      ...
+      TerminatedStr = [String, 0], % String="foo" => [[$f, $o, $o], 0]
+      port_command(Port, TerminatedStr) 
+      ...
+ +

Append example

+

DO

+
+      > lists:append([[1], [2], [3]]).
+      [1,2,3]
+      >
+

DO NOT

+
+      > lists:flatten([[1], [2], [3]]).
+      [1,2,3]
+      >
+
+ +
+ Why you should not worry about recursive lists functions + +

In the performance myth chapter, the following myth was exposed: + Tail-recursive functions + are MUCH faster than recursive functions.

+ +

To summarize, in R12B there is usually not much difference between + a body-recursive list function and tail-recursive function that reverses + the list at the end. Therefore, concentrate on writing beautiful code + and forget about the performance of your list functions. In the time-critical + parts of your code (and only there), measure before rewriting + your code.

+ +

Important note: This section talks about lists functions that + construct lists. A tail-recursive function that does not construct + a list runs in constant space, while the corresponding body-recursive + function uses stack space proportional to the length of the list. + For instance, a function that sums a list of integers, should not be + written like this

+ +

DO NOT

+ +recursive_sum([H|T]) -> H+recursive_sum(T); +recursive_sum([]) -> 0. + +

but like this

+ +

DO

+ +sum(L) -> sum(L, 0). + +sum([H|T], Sum) -> sum(T, Sum + H); +sum([], Sum) -> Sum. +
+
+ diff --git a/system/doc/efficiency_guide/make.dep b/system/doc/efficiency_guide/make.dep new file mode 100644 index 0000000000..afa3bd0516 --- /dev/null +++ b/system/doc/efficiency_guide/make.dep @@ -0,0 +1,16 @@ +# ---------------------------------------------------- +# >>>> Do not edit this file <<<< +# This file was automaticly generated by +# /home/otp/bin/docdepend +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# TeX files that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: advanced.tex binaryhandling.tex book.tex commoncaveats.tex \ + drivers.tex functions.tex introduction.tex listhandling.tex \ + myths.tex part.tex processes.tex profiling.tex \ + tablesDatabases.tex + diff --git a/system/doc/efficiency_guide/myths.xml b/system/doc/efficiency_guide/myths.xml new file mode 100644 index 0000000000..76a72368bb --- /dev/null +++ b/system/doc/efficiency_guide/myths.xml @@ -0,0 +1,203 @@ + + + + +
+ + 2007 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + The Eight Myths of Erlang Performance + Bjorn Gustavsson + + 2007-11-10 + + myths.xml +
+ +

Some truths seem to live on well beyond their best-before date, + perhaps because "information" spreads more rapidly from person-to-person + faster than a single release note that notes, for instance, that funs + have become faster.

+ +

Here we try to kill the old truths (or semi-truths) that have + become myths.

+ +
+ Myth: Funs are slow +

Yes, funs used to be slow. Very slow. Slower than apply/3. + Originally, funs were implemented using nothing more than + compiler trickery, ordinary tuples, apply/3, and a great + deal of ingenuity.

+ +

But that is ancient history. Funs was given its own data type + in the R6B release and was further optimized in the R7B release. + Now the cost for a fun call falls roughly between the cost for a call to + local function and apply/3.

+
+ +
+ Myth: List comprehensions are slow + +

List comprehensions used to be implemented using funs, and in the + bad old days funs were really slow.

+ +

Nowadays the compiler rewrites list comprehensions into an ordinary + recursive function. Of course, using a tail-recursive function with + a reverse at the end would be still faster. Or would it? + That leads us to the next myth.

+
+ +
+ Myth: Tail-recursive functions are MUCH faster + than recursive functions + +

According to the myth, + recursive functions leave references + to dead terms on the stack and the garbage collector will have to + copy all those dead terms, while tail-recursive functions immediately + discard those terms.

+ +

That used to be true before R7B. In R7B, the compiler started + to generate code that overwrites references to terms that will never + be used with an empty list, so that the garbage collector would not + keep dead values any longer than necessary.

+ +

Even after that optimization, a tail-recursive function would + still most of the time be faster than a body-recursive function. Why?

+ +

It has to do with how many words of stack that are used in each + recursive call. In most cases, a recursive function would use more words + on the stack for each recursion than the number of words a tail-recursive + would allocate on the heap. Since more memory is used, the garbage + collector will be invoked more frequently, and it will have more work traversing + the stack.

+ +

In R12B and later releases, there is an optimization that will + in many cases reduces the number of words used on the stack in + body-recursive calls, so that a body-recursive list function and + tail-recursive function that calls lists:reverse/1 at the + end will use exactly the same amount of memory. + lists:map/2, lists:filter/2, list comprehensions, + and many other recursive functions now use the same amount of space + as their tail-recursive equivalents.

+ +

So which is faster?

+ +

It depends. On Solaris/Sparc, the body-recursive function seems to + be slightly faster, even for lists with very many elements. On the x86 + architecture, tail-recursion was up to about 30 percent faster.

+ +

So the choice is now mostly a matter of taste. If you really do need + the utmost speed, you must measure. You can no longer be + absolutely sure that the tail-recursive list function will be the fastest + in all circumstances.

+ +

Note: A tail-recursive function that does not need to reverse the + list at the end is, of course, faster than a body-recursive function, + as are tail-recursive functions that do not construct any terms at all + (for instance, a function that sums all integers in a list).

+
+ +
+ Myth: '++' is always bad + +

The ++ operator has, somewhat undeservedly, got a very bad reputation. + It probably has something to do with code like

+ +

DO NOT

+ +naive_reverse([H|T]) -> + naive_reverse(T)++[H]; +naive_reverse([]) -> + []. + +

which is the most inefficient way there is to reverse a list. + Since the ++ operator copies its left operand, the result + will be copied again and again and again... leading to quadratic + complexity.

+ +

On the other hand, using ++ like this

+ +

OK

+ +naive_but_ok_reverse([H|T], Acc) -> + naive_but_ok_reverse(T, [H]++Acc); +naive_but_ok_reverse([], Acc) -> + Acc. + +

is not bad. Each list element will only be copied once. + The growing result Acc is the right operand + for the ++ operator, and it will not be copied.

+ +

Of course, experienced Erlang programmers would actually write

+ +

DO

+ +vanilla_reverse([H|T], Acc) -> + vanilla_reverse(T, [H|Acc]); +vanilla_reverse([], Acc) -> + Acc. + +

which is slightly more efficient because you don't build a + list element only to directly copy it. (Or it would be more efficient + if the the compiler did not automatically rewrite [H]++Acc + to [H|Acc].)

+
+ +
+ Myth: Strings are slow + +

Actually, string handling could be slow if done improperly. + In Erlang, you'll have to think a little more about how the strings + are used and choose an appropriate representation and use + the re instead of the obsolete + regexp module if you are going to use regualr expressions.

+
+ +
+ Myth: Repairing a Dets file is very slow + +

The repair time is still proportional to the number of records + in the file, but Dets repairs used to be much, much slower in the past. + Dets has been massively rewritten and improved.

+
+ +
+ Myth: BEAM is a stack-based byte-code virtual machine (and therefore slow) + +

BEAM is a register-based virtual machine. It has 1024 virtual registers + that are used for holding temporary values and for passing arguments when + calling functions. Variables that need to survive a function call are saved + to the stack.

+ +

BEAM is a threaded-code interpreter. Each instruction is word pointing + directly to executable C-code, making instruction dispatching very fast.

+
+ +
+ Myth: Use '_' to speed up your program when a variable is not used + +

That was once true, but since R6B the BEAM compiler is quite capable of seeing itself + that a variable is not used.

+
+ +
+ diff --git a/system/doc/efficiency_guide/part.xml b/system/doc/efficiency_guide/part.xml new file mode 100644 index 0000000000..2b78f35e2a --- /dev/null +++ b/system/doc/efficiency_guide/part.xml @@ -0,0 +1,42 @@ + + + + +
+ + 20012009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Efficiency Guide + Ingela Anderton + + 2002-09-23 + +
+ + + + + + + + + + + +
+ diff --git a/system/doc/efficiency_guide/processes.xml b/system/doc/efficiency_guide/processes.xml new file mode 100644 index 0000000000..a25ec53370 --- /dev/null +++ b/system/doc/efficiency_guide/processes.xml @@ -0,0 +1,264 @@ + + + + +
+ + 20012009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Processes + Bjorn Gustavsson + + 2007-11-21 + + processes.xml +
+ +
+ Creation of an Erlang process + +

An Erlang process is lightweight compared to operating + systems threads and processes.

+ +

A newly spawned Erlang process uses 309 words of memory + in the non-SMP emulator without HiPE support. (SMP support + and HiPE support will both add to this size.) The size can + be found out like this:

+ +
+Erlang (BEAM) emulator version 5.6 [async-threads:0] [kernel-poll:false]
+
+Eshell V5.6  (abort with ^G)
+1> Fun = fun() -> receive after infinity -> ok end end.
+#Fun<...>
+2> {_,Bytes} = process_info(spawn(Fun), memory).
+{memory,1232}
+3> Bytes div erlang:system_info(wordsize).
+309
+ +

The size includes 233 words for the heap area (which includes the stack). + The garbage collector will increase the heap as needed.

+ +

The main (outer) loop for a process must be tail-recursive. + If not, the stack will grow until the process terminates.

+ +

DO NOT

+ +loop() -> + receive + {sys, Msg} -> + handle_sys_msg(Msg), + loop(); + {From, Msg} -> + Reply = handle_msg(Msg), + From ! Reply, + loop() + end, + io:format("Message is processed~n", []). + +

The call to io:format/2 will never be executed, but a + return address will still be pushed to the stack each time + loop/0 is called recursively. The correct tail-recursive + version of the function looks like this:

+ +

DO

+ + loop() -> + receive + {sys, Msg} -> + handle_sys_msg(Msg), + loop(); + {From, Msg} -> + Reply = handle_msg(Msg), + From ! Reply, + loop() + end. + +
+ Initial heap size + +

The default initial heap size of 233 words is quite conservative + in order to support Erlang systems with hundreds of thousands or + even millions of processes. The garbage collector will grow and + shrink the heap as needed.

+ +

In a system that use comparatively few processes, performance + might be improved by increasing the minimum heap size using either + the +h option for + erl or on a process-per-process + basis using the min_heap_size option for + spawn_opt/4.

+ +

The gain is twofold: Firstly, although the garbage collector will + grow the heap, it will it grow it step by step, which will be more + costly than directly establishing a larger heap when the process + is spawned. Secondly, the garbage collector may also shrink the + heap if it is much larger than the amount of data stored on it; + setting the minimum heap size will prevent that.

+ +

The emulator will probably use more memory, and because garbage + collections occur less frequently, huge binaries could be + kept much longer.

+ +

In systems with many processes, computation tasks that run + for a short time could be spawned off into a new process with + a higher minimum heap size. When the process is done, it will + send the result of the computation to another process and terminate. + If the minimum heap size is calculated properly, the process may not + have to do any garbage collections at all. + This optimization should not be attempted + without proper measurements.

+
+ +
+ +
+ Process messages + +

All data in messages between Erlang processes is copied, with + the exception of + refc binaries + on the same Erlang node.

+ +

When a message is sent to a process on another Erlang node, + it will first be encoded to the Erlang External Format before + being sent via an TCP/IP socket. The receiving Erlang node decodes + the message and distributes it to the right process.

+ +
+ The constant pool + +

Constant Erlang terms (also called literals) are now + kept in constant pools; each loaded module has its own pool. + The following function

+ +

DO (in R12B and later)

+ +days_in_month(M) -> + element(M, {31,28,31,30,31,30,31,31,30,31,30,31}). + +

will no longer build the tuple every time it is called (only + to have it discarded the next time the garbage collector was run), but + the tuple will be located in the module's constant pool.

+ +

But if a constant is sent to another process (or stored in + an ETS table), it will be copied. + The reason is that the run-time system must be able + to keep track of all references to constants in order to properly + unload code containing constants. (When the code is unloaded, + the constants will be copied to the heap of the processes that refer + to them.) The copying of constants might be eliminated in a future + release.

+
+ +
+ Loss of sharing + +

Shared sub-terms are not preserved when a term is sent + to another process, passed as the initial process arguments in + the spawn call, or stored in an ETS table. + That is an optimization. Most applications do not send message + with shared sub-terms.

+ +

Here is an example of how a shared sub-term can be created:

+ + +kilo_byte() -> + kilo_byte(10, [42]). + +kilo_byte(0, Acc) -> + Acc; +kilo_byte(N, Acc) -> + kilo_byte(N-1, [Acc|Acc]). + +

kilo_byte/1 creates a deep list. If we call + list_to_binary/1, we can convert the deep list to a binary + of 1024 bytes:

+ +
+1> byte_size(list_to_binary(efficiency_guide:kilo_byte())).
+1024
+ +

Using the erts_debug:size/1 BIF we can see that the + deep list only requires 22 words of heap space:

+ +
+2> erts_debug:size(efficiency_guide:kilo_byte()).
+22
+ +

Using the erts_debug:flat_size/1 BIF, we can calculate + the size of the deep list if sharing is ignored. It will be + the size of the list when it has been sent to another process + or stored in an ETS table:

+ +
+3> erts_debug:flat_size(efficiency_guide:kilo_byte()).
+4094
+ +

We can verify that sharing will be lost if we insert the + data into an ETS table:

+ +
+4> T = ets:new(tab, []).
+17
+5> ets:insert(T, {key,efficiency_guide:kilo_byte()}).
+true
+6> erts_debug:size(element(2, hd(ets:lookup(T, key)))).
+4094
+7> erts_debug:flat_size(element(2, hd(ets:lookup(T, key)))).
+4094
+ +

When the data has passed through an ETS table, + erts_debug:size/1 and erts_debug:flat_size/1 + return the same value. Sharing has been lost.

+ +

In a future release of Erlang/OTP, we might implement a + way to (optionally) preserve sharing. We have no plans to make + preserving of sharing the default behaviour, since that would + penalize the vast majority of Erlang applications.

+
+
+ +
+ The SMP emulator + +

The SMP emulator (introduced in R11B) will take advantage of + multi-core or multi-CPU computer by running several Erlang schedulers + threads (typically, the same as the number of cores). Each scheduler + thread schedules Erlang processes in the same way as the Erlang scheduler + in the non-SMP emulator.

+ +

To gain performance by using the SMP emulator, your application + must have more than one runnable Erlang process most of the time. + Otherwise, the Erlang emulator can still only run one Erlang process + at the time, but you must still pay the overhead for locking. Although + we try to reduce the locking overhead as much as possible, it will never + become exactly zero.

+ +

Benchmarks that may seem to be concurrent are often sequential. + The estone benchmark, for instance, is entirely sequential. So is also + the most common implementation of the "ring benchmark"; usually one process + is active, while the others wait in a receive statement.

+ +

The percept application + can be used to profile your application to see how much potential (or lack + thereof) it has for concurrency.

+
+ +
+ diff --git a/system/doc/efficiency_guide/profiling.xml b/system/doc/efficiency_guide/profiling.xml new file mode 100644 index 0000000000..65d13408bc --- /dev/null +++ b/system/doc/efficiency_guide/profiling.xml @@ -0,0 +1,258 @@ + + + + +
+ + 20012009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Profiling + Ingela Anderton + + 2001-11-02 + + profiling.xml +
+ +
+ Do not guess about performance - profile + +

Even experienced software developers often guess wrong about where + the performance bottlenecks are in their programs.

+ +

Therefore, profile your program to see where the performance + bottlenecks are and concentrate on optimizing them.

+ +

Erlang/OTP contains several tools to help finding bottlenecks.

+ +

fprof and eprof provide the most detailed information + about where the time is spent, but they significantly slow downs the + programs they profile.

+ +

If the program is too big to be profiled by fprof or eprof, + cover and cprof could be used to locate parts of the + code that should be more thoroughly profiled using fprof or + eprof.

+ +

cover provides execution counts per line per process, + with less overhead than fprof/eprof. Execution counts can + with some caution be used to locate potential performance bottlenecks. + The most lightweight tool is cprof, but it only provides execution + counts on a function basis (for all processes, not per process).

+
+ +
+ Big systems +

If you have a big system it might be interesting to run profiling + on a simulated and limited scenario to start with. But bottlenecks + have a tendency to only appear or cause problems when + there are many things going on at the same time, and when there + are many nodes involved. Therefore it is desirable to also run + profiling in a system test plant on a real target system.

+

When your system is big you do not want to run the profiling + tools on the whole system. You want to concentrate on processes + and modules that you know are central and stand for a big part of the + execution.

+
+ +
+ What to look for +

When analyzing the result file from the profiling activity + you should look for functions that are called many + times and have a long "own" execution time (time excluded calls + to other functions). Functions that just are called very + many times can also be interesting, as even small things can add + up to quite a bit if they are repeated often. Then you need to + ask yourself what can I do to reduce this time. Appropriate + types of questions to ask yourself are:

+ + Can I reduce the number of times the function is called? + Are there tests that can be run less often if I change + the order of tests? + Are there redundant tests that can be removed? + Is there some expression calculated giving the same result + each time? + Is there other ways of doing this that are equivalent and + more efficient? + Can I use another internal data representation to make + things more efficient? + +

These questions are not always trivial to answer. You might + need to do some benchmarks to back up your theory, to avoid + making things slower if your theory is wrong. See benchmarking.

+
+ +
+ Tools + +
+ fprof +

fprof measures the execution time for each function, + both own time i.e how much time a function has used for its + own execution, and accumulated time i.e. including called + functions. The values are displayed per process. You also get + to know how many times each function has been + called. fprof is based on trace to file in order to + minimize runtime performance impact. Using fprof is just a + matter of calling a few library functions, see fprof manual + page under the application tools.

+

fprof was introduced in version R8 of Erlang/OTP. Its + predecessor eprof that is based on the Erlang trace BIFs, + is still available, see eprof manual page under the + application tools. Eprof shows how much time has been used by + each process, and in which function calls this time has been + spent. Time is shown as percentage of total time, not as + absolute time.

+
+ +
+ cover +

cover's primary use is coverage analysis to verify + test cases, making sure all relevant code is covered. + cover counts how many times each executable line of + code is executed when a program is run. This is done on a per + module basis. Of course this information can be used to + determine what code is run very frequently and could therefore + be subject for optimization. Using cover is just a matter of + calling a few library functions, see cover manual + page under the application tools.

+
+ +
+ cprof +

cprof is something in between fprof and + cover regarding features. It counts how many times each + function is called when the program is run, on a per module + basis. cprof has a low performance degradation (versus + fprof and eprof) and does not need to recompile + any modules to profile (versus cover).

+
+ +
+ Tool summarization + + + Tool + Results + Size of result + Effects on program execution time + Records number of calls + Records Execution time + Records called by + Records garbage collection + + + fprof + per process to screen/file + large + significant slowdown + yes + total and own + yes + yes + + + eprof + per process/function to screen/file + medium + significant slowdown + yes + only total + no + no + + + cover + per module to screen/file + small + moderate slowdown + yes, per line + no + no + no + + + cprof + per module to caller + small + small slowdown + yes + no + no + no + + +
+
+
+ +
+ + Benchmarking + +

The main purpose of benchmarking is to find out which + implementation of a given algorithm or function is the fastest. + Benchmarking is far from an exact science. Today's operating systems + generally run background tasks that are difficult to turn off. + Caches and multiple CPU cores doesn't make it any easier. + It would be best to run Unix-computers in single-user mode when + benchmarking, but that is inconvenient to say the least for casual + testing.

+ +

Benchmarks can measure wall-clock time or CPU time.

+ +

timer:tc/3 measures + wall-clock time. The advantage with wall-clock time is that I/O, + swapping, and other activities in the operating-system kernel are + included in the measurements. The disadvantage is that the + the measurements will vary wildly. Usually it is best to run the + benchmark several times and note the shortest time - that time should + be the minimum time that is possible to achieve under the best of + circumstances.

+ +

statistics/1 + with the argument runtime measures CPU time spent in the Erlang + virtual machine. The advantage is that the results are more + consistent from run to run. The disadvantage is that the time + spent in the operating system kernel (such as swapping and I/O) + are not included. Therefore, measuring CPU time is misleading if + any I/O (file or sockets) are involved.

+ +

It is probably a good idea to do both wall-clock measurements and + CPU time measurements.

+ +

Some additional advice:

+ + + The granularity of both types measurement could be quite + high so you should make sure that each individual measurement + lasts for at least several seconds. + + To make the test fair, each new test run should run in its own, + newly created Erlang process. Otherwise, if all tests runs in the + same process, the later tests would start out with larger heap sizes + and therefore probably does less garbage collections. You could + also consider restarting the Erlang emulator between each test. + + Do not assume that the fastest implementation of a given algorithm + on computer architecture X also is the fast on computer architecture Y. + + +
+
+ diff --git a/system/doc/efficiency_guide/tablesDatabases.xml b/system/doc/efficiency_guide/tablesDatabases.xml new file mode 100644 index 0000000000..4b53348c4c --- /dev/null +++ b/system/doc/efficiency_guide/tablesDatabases.xml @@ -0,0 +1,379 @@ + + + + +
+ + 20012009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Tables and databases + Ingela Anderton + + 2001-08-07 + + tablesDatabases.xml +
+ +
+ Ets, Dets and Mnesia +

Every example using Ets has a corresponding example in + Mnesia. In general all Ets examples also apply to Dets tables.

+ +
+ Select/Match operations +

Select/Match operations on Ets and Mnesia tables can become + very expensive operations. They usually need to scan the complete + table. You should try to structure your + data so that you minimize the need for select/match + operations. However, if you really need a select/match operation, + it will still be more efficient than using tab2list. + Examples of this and also of ways to avoid select/match will be provided in + some of the following sections. The functions + ets:select/2 and mnesia:select/3 should be preferred over + ets:match/2,ets:match_object/2, and mnesia:match_object/3.

+ +

There are exceptions when the complete table is not + scanned, for instance if part of the key is bound when searching an + ordered_set table, or if it is a Mnesia + table and there is a secondary index on the field that is + selected/matched. If the key is fully bound there will, of course, be + no point in doing a select/match, unless you have a bag table and + you are only interested in a sub-set of the elements with + the specific key.

+
+

When creating a record to be used in a select/match operation you + want most of the fields to have the value '_'. The easiest and fastest way + to do that is as follows:

+
+#person{age = 42, _ = '_'}. 
+
+ +
+ Deleting an element +

The delete operation is considered + successful if the element was not present in the table. Hence + all attempts to check that the element is present in the + Ets/Mnesia table before deletion are unnecessary. Here follows + an example for Ets tables.

+

DO

+
+...
+ets:delete(Tab, Key),
+...
+

DO NOT

+
+...
+case ets:lookup(Tab, Key) of
+    [] ->
+        ok;
+    [_|_] ->
+        ets:delete(Tab, Key)
+end,
+...
+
+ +
+ Data fetching +

Do not fetch data that you already have! Consider that you + have a module that handles the abstract data type Person. You + export the interface function print_person/1 that uses the internal functions + print_name/1, print_age/1, print_occupation/1.

+ +

If the functions print_name/1 and so on, had been interface + functions the matter comes in to a whole new light, as you + do not want the user of the interface to know about the + internal data representation.

+
+

DO

+ +%%% Interface function +print_person(PersonId) -> + %% Look up the person in the named table person, + case ets:lookup(person, PersonId) of + [Person] -> + print_name(Person), + print_age(Person), + print_occupation(Person); + [] -> + io:format("No person with ID = ~p~n", [PersonID]) + end. + +%%% Internal functions +print_name(Person) -> + io:format("No person ~p~n", [Person#person.name]). + +print_age(Person) -> + io:format("No person ~p~n", [Person#person.age]). + +print_occupation(Person) -> + io:format("No person ~p~n", [Person#person.occupation]). +

DO NOT

+ +%%% Interface function +print_person(PersonId) -> + %% Look up the person in the named table person, + case ets:lookup(person, PersonId) of + [Person] -> + print_name(PersonID), + print_age(PersonID), + print_occupation(PersonID); + [] -> + io:format("No person with ID = ~p~n", [PersonID]) + end. + +%%% Internal functionss +print_name(PersonID) -> + [Person] = ets:lookup(person, PersonId), + io:format("No person ~p~n", [Person#person.name]). + +print_age(PersonID) -> + [Person] = ets:lookup(person, PersonId), + io:format("No person ~p~n", [Person#person.age]). + +print_occupation(PersonID) -> + [Person] = ets:lookup(person, PersonId), + io:format("No person ~p~n", [Person#person.occupation]). +
+ +
+ Non-persistent data storage +

For non-persistent database storage, prefer Ets tables over + Mnesia local_content tables. Even the Mnesia dirty_write + operations carry a fixed overhead compared to Ets writes. + Mnesia must check if the table is replicated or has indices, + this involves at least one Ets lookup for each + dirty_write. Thus, Ets writes will always be faster than + Mnesia writes.

+
+ +
+ tab2list +

Assume we have an Ets-table, which uses idno as key, + and contains:

+
+[#person{idno = 1, name = "Adam",  age = 31, occupation = "mailman"},
+ #person{idno = 2, name = "Bryan", age = 31, occupation = "cashier"},
+ #person{idno = 3, name = "Bryan", age = 35, occupation = "banker"},
+ #person{idno = 4, name = "Carl",  age = 25, occupation = "mailman"}]
+

If we must return all data stored in the Ets-table we + can use ets:tab2list/1. However, usually we are only + interested in a subset of the information in which case + ets:tab2list/1 is expensive. If we only want to extract + one field from each record, e.g., the age of every person, we + should use:

+

DO

+
+...
+ets:select(Tab,[{ #person{idno='_', 
+                          name='_', 
+                          age='$1', 
+                          occupation = '_'},
+                [],
+                ['$1']}]),
+...
+

DO NOT

+
+...
+TabList = ets:tab2list(Tab),
+lists:map(fun(X) -> X#person.age end, TabList),
+...
+

If we are only interested in the age of all persons named + Bryan, we should:

+

DO

+
+...
+ets:select(Tab,[{ #person{idno='_', 
+                          name="Bryan", 
+                          age='$1', 
+                          occupation = '_'},
+                [],
+                ['$1']}]),
+...
+

DO NOT

+
+...
+TabList = ets:tab2list(Tab),
+lists:foldl(fun(X, Acc) -> case X#person.name of
+                                "Bryan" ->
+                                    [X#person.age|Acc];
+                                 _ ->
+                                     Acc
+                           end
+             end, [], TabList),
+...
+

REALLY DO NOT

+
+...
+TabList = ets:tab2list(Tab),
+BryanList = lists:filter(fun(X) -> X#person.name == "Bryan" end,
+                         TabList),
+lists:map(fun(X) -> X#person.age end, BryanList),
+...
+

If we need all information stored in the Ets table about + persons named Bryan we should:

+

DO

+
+...
+ets:select(Tab, [{#person{idno='_', 
+                          name="Bryan", 
+                          age='_', 
+                          occupation = '_'}, [], ['$_']}]),
+...
+

DO NOT

+
+...
+TabList = ets:tab2list(Tab),
+lists:filter(fun(X) -> X#person.name == "Bryan" end, TabList),
+...
+
+ +
+ Ordered_set tables +

If the data in the table should be accessed so that the order + of the keys in the table is significant, the table type + ordered_set could be used instead of the more usual + set table type. An ordered_set is always + traversed in Erlang term order with regard to the key field + so that return values from functions such as select, + match_object, and foldl are ordered by the key + values. Traversing an ordered_set with the first and + next operations also returns the keys ordered.

+ +

An ordered_set only guarantees that + objects are processed in key order. Results from functions as + ets:select/2 appear in the key order even if + the key is not included in the result.

+
+
+
+ +
+ Ets specific + +
+ Utilizing the keys of the Ets table +

An Ets table is a single key table (either a hash table or a + tree ordered by the key) and should be used as one. In other + words, use the key to look up things whenever possible. A + lookup by a known key in a set Ets table is constant and for a + ordered_set Ets table it is O(logN). A key lookup is always + preferable to a call where the whole table has to be + scanned. In the examples above, the field idno is the + key of the table and all lookups where only the name is known + will result in a complete scan of the (possibly large) table + for a matching result.

+

A simple solution would be to use the name field as + the key instead of the idno field, but that would cause + problems if the names were not unique. A more general solution + would be create a second table with name as key and idno as + data, i.e. to index (invert) the table with regards to the + name field. The second table would of course have to be + kept consistent with the master table. Mnesia could do this + for you, but a home brew index table could be very efficient + compared to the overhead involved in using Mnesia.

+

An index table for the table in the previous examples would + have to be a bag (as keys would appear more than once) and could + have the following contents:

+
+ 
+[#index_entry{name="Adam", idno=1},
+ #index_entry{name="Bryan", idno=2},
+ #index_entry{name="Bryan", idno=3},
+ #index_entry{name="Carl", idno=4}]
+

Given this index table a lookup of the age fields for + all persons named "Bryan" could be done like this:

+
+...
+MatchingIDs = ets:lookup(IndexTable,"Bryan"),
+lists:map(fun(#index_entry{idno = ID}) ->
+                 [#person{age = Age}] = ets:lookup(PersonTable, ID),
+                 Age
+          end,
+          MatchingIDs),
+...
+

Note that the code above never uses ets:match/2 but + instead utilizes the ets:lookup/2 call. The + lists:map/2 call is only used to traverse the idnos + matching the name "Bryan" in the table; therefore the number of lookups + in the master table is minimized.

+

Keeping an index table introduces some overhead when + inserting records in the table, therefore the number of operations + gained from the table has to be weighted against the number of + operations inserting objects in the table. However, note that the gain when + the key can be used to lookup elements is significant.

+
+
+ +
+ Mnesia specific + +
+ Secondary index +

If you frequently do a lookup on a field that is not the + key of the table, you will lose performance using + "mnesia:select/match_object" as this function will traverse the + whole table. You may create a secondary index instead and + use "mnesia:index_read" to get faster access, however this + will require more memory. Example:

+
+-record(person, {idno, name, age, occupation}).
+        ...
+{atomic, ok} = 
+mnesia:create_table(person, [{index,[#person.age]},
+                              {attributes,
+                                    record_info(fields, person)}]),
+{atomic, ok} = mnesia:add_table_index(person, age), 
+...
+
+PersonsAge42 =
+     mnesia:dirty_index_read(person, 42, #person.age),
+...
+
+ +
+ Transactions +

Transactions is a way to guarantee that the distributed + Mnesia database remains consistent, even when many different + processes update it in parallel. However if you have + real time requirements it is recommended to use dirty + operations instead of transactions. When using the dirty + operations you lose the consistency guarantee, this is usually + solved by only letting one process update the table. Other + processes have to send update requests to that process.

+
+...
+% Using transaction
+
+Fun = fun() ->
+          [mnesia:read({Table, Key}),
+           mnesia:read({Table2, Key2})]
+      end, 
+
+{atomic, [Result1, Result2]}  = mnesia:transaction(Fun),
+...
+
+% Same thing using dirty operations
+...
+
+Result1 = mnesia:dirty_read({Table, Key}),
+Result2 = mnesia:dirty_read({Table2, Key2}),
+...
+
+
+
+ diff --git a/system/doc/efficiency_guide/xmlfiles.mk b/system/doc/efficiency_guide/xmlfiles.mk new file mode 100644 index 0000000000..fa2fe44eec --- /dev/null +++ b/system/doc/efficiency_guide/xmlfiles.mk @@ -0,0 +1,32 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +EFF_GUIDE_CHAPTER_FILES = \ + advanced.xml \ + commoncaveats.xml \ + binaryhandling.xml \ + functions.xml \ + introduction.xml \ + listhandling.xml \ + myths.xml \ + part.xml \ + processes.xml \ + profiling.xml \ + tablesDatabases.xml \ + drivers.xml + diff --git a/system/doc/embedded/Makefile b/system/doc/embedded/Makefile new file mode 100644 index 0000000000..5e68917fc2 --- /dev/null +++ b/system/doc/embedded/Makefile @@ -0,0 +1,103 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include $(ERL_TOP)/erts/vsn.mk +#VSN=$(SYSTEM_VSN) + +APPLICATION=otp-system-documentation +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/doc/embedded + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +XML_PART_FILES = part.xml + +include xmlfiles.mk + +XML_CHAPTER_FILES=$(EMBEDDED_CHAPTER_FILES) + +TOPDOCDIR=.. + +BOOK_FILES = book.xml + +GIF_FILES = + +PS_FILES = + +XML_FILES = \ + $(BOOK_FILES) $(XML_CHAPTER_FILES) \ + $(XML_PART_FILES) + +# ---------------------------------------------------- + +HTML_FILES = \ + $(XML_PART_FILES:%.xml=%.html) + +HTMLDIR = ../html/embedded + + +HTML_UG_FILE = $(HTMLDIR)/users_guide.html + + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAGS += +DVIPS_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +docs: html + +local_docs: PDFDIR=../../pdf + +html: $(GIF_FILES) $(HTML_UG_FILE) + +debug opt: + +clean clean_docs: + rm -rf $(HTMLDIR) + rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f errs core *~ + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_docs_spec: docs +# $(INSTALL_DIR) $(RELEASE_PATH)/pdf +# $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELEASE_PATH)/pdf + $(INSTALL_DIR) $(RELSYSDIR) + $(INSTALL_DATA) $(GIF_FILES) $(HTMLDIR)/*.html \ + $(RELSYSDIR) + +release_spec: + + diff --git a/system/doc/embedded/book.xml b/system/doc/embedded/book.xml new file mode 100644 index 0000000000..7dc43e36bf --- /dev/null +++ b/system/doc/embedded/book.xml @@ -0,0 +1,43 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Embedded Systems + Kenneth Lundin + + + + +
+ + + Embedded Systems + + + + + + + + +
+ diff --git a/system/doc/embedded/embedded_nt.xml b/system/doc/embedded/embedded_nt.xml new file mode 100644 index 0000000000..8e594b1951 --- /dev/null +++ b/system/doc/embedded/embedded_nt.xml @@ -0,0 +1,84 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Windows NT + Kenneth Lundin + Kenneth Lundin + + + + 1997-11-25 + PA2 + embedded_nt.xml +
+

This chapter describes the OS specific parts of OTP which relate + to Windows NT. +

+ +
+ Introduction +

A normal installation of NT 4.0, with service pack 4 or later, + is required for an embedded Windows NT running OTP.

+
+ +
+ Memory Usage +

RAM memory of 96 MBytes is recommended to run OTP on NT. + A system with less than 64 Mbytes of RAM is not recommended.

+
+ +
+ Disk Space Usage +

A minimum NT installation with networking needs 250 MB, and + an additional 130 MB for the swap file.

+
+ +
+ Installation +

Normal NT installation is performed. No additional application + programs are needed, such as Internet explorer or web server. Networking + with TCP/IP is required.

+ + Service pack 4 or later must be installed.

+ +
+ Hardware Watchdog +

For Windows NT running on standard PCs with ISA and/or PCI bus + there is a possibility to install an extension card with a hardware + watchdog. +

+

See also the heart(3) reference manual page in + Kernel. +

+
+
+ +
+ Starting Erlang +

On an embedded system, the erlsrv module should be used, + to install the erlang process as a Windows system service. + This service can start + after NT has booted. See documentation for erlsrv.

+
+
+ diff --git a/system/doc/embedded/embedded_solaris.xml b/system/doc/embedded/embedded_solaris.xml new file mode 100644 index 0000000000..93532da8e6 --- /dev/null +++ b/system/doc/embedded/embedded_solaris.xml @@ -0,0 +1,734 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Embedded Solaris + Fredrik Tillman + + ETX/B/SFP/TILLMAN:96-001 + + + 2000-10-17 + B + embedded_solaris.xml +
+

This chapter describes the OS specific parts of OTP which relate + to Solaris. +

+ +
+ Memory Usage +

Solaris takes about 17 Mbyte of RAM on a system with 64 Mbyte of + total RAM. This leaves about 47 Mbyte for the applications. If + the system utilizes swapping, these figures cannot be improved + because unnecessary daemon processes are swapped out. However, + if swapping is disabled, or if the swap space is of limited + resource in the system, it becomes necessary to kill off + unnecessary daemon processes. +

+
+ +
+ Disk Space Usage +

The disk space required by Solaris can be minimized by using the + Core User support installation. It requires about 80 Mbyte of + disk space. This installs only the minimum software required to + boot and run Solaris. The disk space can be further reduced by + deleting unnecessary individual files. However, unless disk + space is a critical resource the effort required and the risks + involved may not be justified.

+
+ +
+ Installation +

This section is about installing an embedded system. + The following topics are considered, +

+ + +

Creation of user and installation directory,

+
+ +

Installation of embedded system,

+
+ +

Configuration for automatic start at reboot,

+
+ +

Making a hardware watchdog available,

+
+ +

Changing permission for reboot,

+
+ +

Patches,

+
+ +

Configuration of the OS_Mon application.

+
+
+

Several of the procedures described below require expert + knowledge of the Solaris 2 operating system. For most of them + super user privilege is needed. +

+ +
+ Creation of User and Installation Directory +

It is recommended that the Embedded Environment is run by an + ordinary user, i.e. a user who does not have super user + privileges. +

+

Throughout this section we assume that the user name is + otpuser, and that the home directory of that user is, +

+
+        /export/home/otpuser
+

Furthermore, we assume that in the home directory of + otpuser, there is a directory named otp, the + full path of which is, +

+
+        /export/home/otpuser/otp
+

This directory is the installation directory of the + Embedded Environment. +

+
+ +
+ Installation of an Embedded System +

The procedure for installation of an embedded system does + not differ from that of an ordinary system (see the + Installation Guide), + except for the following: +

+ + +

the (compressed) tape archive file should be + extracted in the installation directory as defined above, + and,

+
+ +

there is no need to link the start script to a + standard directory like /usr/local/bin.

+
+
+
+ +
+ Configuration for Automatic Start at Boot +

A true embedded system has to start when the system + boots. This section accounts for the necessary configurations + needed to achieve that. +

+

The embedded system and all the applications will start + automatically if the script file shown below is added to the + /etc/rc3.d directory. The file must be owned and + readable by root, and its name cannot be arbitrarily + assigned. The following name is recommended, +

+
+        S75otp.system
+

For further details on initialization (and termination) + scripts, and naming thereof, see the Solaris documentation. +

+
+#!/bin/sh
+#  
+#  File name:  S75otp.system
+#  Purpose:    Automatically starts Erlang and applications when the 
+#              system starts
+#  Author:     janne@erlang.ericsson.se
+#  Resides in: /etc/rc3.d
+#
+
+if [ ! -d /usr/bin ]
+then                    # /usr not mounted
+        exit
+fi
+
+killproc() {            # kill the named process(es)
+        pid=`/usr/bin/ps -e |
+             /usr/bin/grep -w $1 |
+             /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
+        [ "$pid" != "" ] && kill $pid
+}
+
+# Start/stop processes required for Erlang
+
+case "$1" in
+'start')
+        # Start the Erlang emulator
+        #
+        su - otpuser -c "/export/home/otpuser/otp/bin/start" &
+        ;;
+'stop')
+        killproc beam
+        ;;
+*)
+        echo "Usage: $0 { start | stop }"
+        ;;
+esac
+

The file /export/home/otpuser/otp/bin/start referred to + in the above script, is precisely the script start + described in the section Starting Erlang below. The + script variable OTP_ROOT in that start script + corresponds to the example path +

+
+        /export/home/otpuser/otp
+

used in this section. The start script should be edited + accordingly. +

+

Use of the killproc procedure in the above script could + be combined with a call to erl_call, e.g. +

+
+        $SOME_PATH/erl_call -n Node init stop
+

In order to take Erlang down gracefully see the + erl_call(1) reference manual page for further details + on the use of erl_call. That however requires that + Erlang runs as a distributed node which is not always the + case. +

+

The killproc procedure should not be removed: the + purpose is here to move from run level 3 (multi-user mode with + networking resources) to run level 2 (multi-user mode without + such resources), in which Erlang should not run. +

+
+ +
+ Hardware Watchdog +

For Solaris running on VME boards from Force Computers, + there is a possibility to activate the onboard hardware + watchdog, provided a VME bus driver is added to the operating + system (see also Installation Problems below). +

+

See also the heart(3) reference manual page in + Kernel. +

+
+ +
+ Changing Permissions for Reboot +

If the HEART_COMMAND environment variable is to be set + in the start script in the section, Starting Erlang, and if the value shall be set to the + path of the Solaris reboot command, i.e. +

+
+        HEART_COMMAND=/usr/sbin/reboot
+

the ownership and file permissions for /usr/sbin/reboot + must be changed as follows, +

+
+        chown 0 /usr/sbin/reboot
+        chmod 4755 /usr/sbin/reboot
+

See also the heart(3) reference manual page in + Kernel. +

+
+ +
+ The TERM Environment Variable +

When the Erlang runtime system is automatically started from the + S75otp.system script the TERM environment + variable has to be set. The following is a minimal setting, +

+
+        TERM=sun
+

which should be added to the start script described in + the section. +

+
+ +
+ Patches +

For proper functioning of flushing file system data to disk on + Solaris 2.5.1, the version specific patch with number + 103640-02 must be added to the operating system. There may be + other patches needed, see the release README file + /README]]>. +

+
+ +
+ Installation of Module os_sup in Application OS_Mon +

The following four installation procedures require super user + privilege. +

+ +
+ Installation + + +

Make a copy the Solaris standard configuration file for syslogd.

+ + +

Make a copy the Solaris standard configuration + file for syslogd. This file is usually named + syslog.conf and found in the /etc + directory.

+
+ +

The file name of the copy must be + syslog.conf.ORIG but the directory location + is optional. Usually it is /etc. +

+

A simple way to do this is to issue the command

+ +cp /etc/syslog.conf /etc/syslog.conf.ORIG +
+
+
+ +

Make an Erlang specific configuration file for syslogd.

+ + +

Make an edited copy of the back-up copy previously + made.

+
+ +

The file name must be syslog.conf.OTP and the + path must be the same as the back-up copy.

+
+ +

The format of the configuration file is found in the + man page for syslog.conf(5), by issuing the + command man syslog.conf.

+
+ +

Usually a line is added which should state:

+ + +

which types of information that will be + supervised by Erlang,

+
+ +

the name of the file (actually a named pipe) + that should receive the information.

+
+
+
+ +

If e.g. only information originating from the + unix-kernel should be supervised, the line should + begin with kern.LEVEL (for the possible + values of LEVEL see syslog.conf(5)).

+
+ +

After at least one tab-character, the line added + should contain the full name of the named pipe where + syslogd writes its information. The path must be the + same as for the syslog.conf.ORIG and + syslog.conf.OTP files. The file name must be + syslog.otp.

+
+ +

If the directory for the syslog.conf.ORIG and + syslog.conf.OTP files is /etc the line + in syslog.conf.OTP will look like:

+ +kern.LEVEL /etc/syslog.otp +
+
+
+ +

Check the file privileges of the configuration files.

+ + +

The configuration files should have rw-r--r-- + file privileges and be owned by root.

+
+ +

A simple way to do this is to issue the commands

+ +chmod 644 /etc/syslog.conf +chmod 644 /etc/syslog.conf.ORIG +chmod 644 /etc/syslog.conf.OTP +
+ +

Note: If the syslog.conf.ORIG and + syslog.conf.OTP files are not in the + /etc directory, the file path in the second + and third command must be modified.

+
+
+
+ +

Modify file privileges and ownership of the mod_syslog utility.

+ + +

The file privileges and ownership of the + mod_syslog utility must be modified.

+
+ +

The full name of the binary executable file is + derived from the position of the os_mon + application if the file system by adding + /priv/bin/mod_syslog. The generic full name + of the binary executable file is thus

+ /lib/os_mon-/priv/bin/mod_syslog]]> +

Example: If the path to the otp-root is + /usr/otp, thus the path to the os_mon + application is /usr/otp/lib/os_mon-1.0 + (assuming revision 1.0) and the full name of the + binary executable file is + /usr/otp/lib/os_mon-1.0/priv/bin/mod_syslog.

+
+ +

The binary executable file must be owned by root, + have rwsr-xr-x file privileges, in particular + the setuid bit of user must be set. +

+
+ +

A simple way to do this is to issue the commands

+ /lib/os_mon-/priv/bin/mod_syslog +chmod 4755 mod_syslog +chown root mod_syslog]]> +
+
+
+
+
+ +
+ Testing the Application Configuration File +

The following procedure does not require root privilege. +

+ + +

Ensure that the configuration parameters for the + os_sup module in the os_mon application + are correct.

+
+ +

Browse the application configuration file (do + not edit it). The full name of the application + configuration file is derived from the position of the + OS_Mon application if the file system by adding + /ebin/os_mon.app. +

+

The generic full name of the file is thus

+ /lib/os_mon-/ebin/os_mon.app.]]> +

Example: If the path to the otp-root is + /usr/otp, thus the path to the os_mon + application is /usr/otp/lib/os_mon-1.0 (assuming + revision 1.0) and the full name of the binary executable + file is /usr/otp/lib/os_mon-1.0/ebin/os_mon.app.

+
+ +

Ensure that the following configuration parameters are + bound to the correct values.

+
+
+ + + Parameter + Function + Standard value + + + start_os_sup + Specifies if os_sup will be started or not. + truefor the first instance on the hardware; falsefor the other instances. + + + os_sup_own + The directory for (1)the back-up copy, (2) the Erlang specific configuration file for syslogd. + "/etc" + + + os_sup_syslogconf + The full name for the Solaris standard configuration file for syslogd + "/etc/syslog.conf" + + + error_tag + The tag for the messages that are sent to the error logger in the Erlang runtime system. + std_error + + Configuration Parameters +
+

If the values listed in the os_mon.app do not suit + your needs, you should not edit that file. Instead + you should override values in a system configuration file, the full pathname of which is given + on the command line to erl. +

+

Example: The following is an example of the + contents of an application configuration file.

+

+
+          [{os_mon, [{start_os_sup, true}, {os_sup_own, "/etc"}, 
+          {os_sup_syslogconf, "/etc/syslog.conf"}, {os_sup_errortag, std_error}]}].
+
+ +
+ Related Documents +

See also the os_mon(3), application(3) and + erl(1) reference manual pages.

+
+
+ +
+ Installation Problems +

The hardware watchdog timer which is controlled by the + heart port program requires the FORCEvme + package, which contains the VME bus driver, to be + installed. This driver, however, may clash with the Sun + mcp driver and cause the system to completely refuse to + boot. To cure this problem, the following lines should be + added to /etc/system: +

+ + exclude: drv/mcp + exclude: drv/mcpzsa + exclude: drv/mcpp + + +

It is recommended that these lines be added to avoid the + clash described, which may make it completely impossible to + boot the system.

+
+
+
+ +
+ Starting Erlang +

This section describes how an embedded system is started. There + are four programs involved, and they all normally reside in the + directory /bin]]>. The only exception is + the program start, which may be located anywhere, and + also is the only program that must be modified by the user. +

+

In an embedded system there usually is no interactive shell. + However, it is possible for an operator to attach to the Erlang + system by giving the command to_erl. He is then + connected to the Erlang shell, and may give ordinary Erlang + commands. All interaction with the system through this shell is + logged in a special directory. +

+

Basically, the procedure is as follows. The program + start is called when the machine is started. It calls + run_erl, which sets things up so the operator can attach + to the system. It calls start_erl which calls the + correct version of erlexec (which is located in + /erts-EVsn/bin]]>) with the correct + boot and config files. +

+
+ +
+ Programs + +
+ start +

This program is called when the machine is started. It may + be modified or re-written to suit a special system. By + default, it must be called start and reside in + /bin]]>. Another start program can be + used, by using the configuration parameter start_prg in + the application sasl.

+

The start program must call run_erl as shown below. + It must also take an optional parameter which defaults to + /releases/start_erl.data]]>. +

+

This program should set static parameters and environment + variables such as -sname Name and HEART_COMMAND + to reboot the machine. +

+

The ]]> directory is where new release packets + are installed, and where the release handler keeps information + about releases. See release_handler(3) in the + application sasl for further information. +

+

The following script illustrates the default behaviour of the + program. +

+ /dev/null 2>&1 &]]> +

The following script illustrates a modification where the node + is given the name cp1, and the environment variables + HEART_COMMAND and TERM have been added to the + above script. +

+ /dev/null 2>&1 &]]> +

If a diskless and/or read-only client node is about to start the + start_erl.data file is located in the client directory at + the master node. Thus, the START_ERL_DATA line should look + like: +

+ +CLIENTDIR=$ROOTDIR/clients/clientname +START_ERL_DATA=${1:-$CLIENTDIR/bin/start_erl.data} +
+ +
+ run_erl +

This program is used to start the emulator, but you will not + be connected to the shell. to_erl is used to connect to + the Erlang shell. +

+ +Usage: run_erl pipe_dir/ log_dir "exec command [parameters ...]" +

Where pipe_dir/ should be /tmp/ (to_erl + uses this name by default) and log_dir is where the log + files are written. command [parameters] is executed, + and everything written to stdin and stdout is logged in the + log_dir. +

+

In the log_dir, log files are written. Each logfile + has a name of the form: erlang.log.N where N is a + generation number, ranging from 1 to 5. Each logfile holds up + to 100kB text. As time goes by the following logfiles will be + found in the logfile directory

+ +erlang.log.1 +erlang.log.1, erlang.log.2 +erlang.log.1, erlang.log.2, erlang.log.3 +erlang.log.1, erlang.log.2, erlang.log.3, erlang.log.4 +erlang.log.2, erlang.log.3, erlang.log.4, erlang.log.5 +erlang.log.3, erlang.log.4, erlang.log.5, erlang.log.1 +... +

with the most recent logfile being the right most in each row + of the above list. That is, the most recent file is the one + with the highest number, or if there are already four files, + the one before the skip. +

+

When a logfile is opened (for appending or created) a time + stamp is written to the file. If nothing has been written to + the log files for 15 minutes, a record is inserted that says + that we're still alive. +

+
+ +
+ to_erl +

This program is used to attach to a running Erlang runtime + system, started with run_erl. +

+ +Usage: to_erl [pipe_name | pipe_dir] +

Where pipe_name defaults to /tmp/erlang.pipe.N. +

+

To disconnect from the shell without exiting the Erlang + system, type Ctrl-D. +

+
+ +
+ start_erl +

This program starts the Erlang emulator with parameters + -boot and -config set. It reads data about + where these files are located from a file called + start_erl.data which is located in the ]]>. + Each new release introduces a new data file. This file is + automatically generated by the release handler in Erlang. +

+

The following script illustrates the behaviour of the + program. +

+ +#!/bin/sh +# +# This program is called by run_erl. It starts +# the Erlang emulator and sets -boot and -config parameters. +# It should only be used at an embedded target system. +# +# Usage: start_erl RootDir RelDir DataFile [ErlFlags ...] +# +ROOTDIR=$1 +shift +RELDIR=$1 +shift +DataFile=$1 +shift + +ERTS_VSN=`awk '{print $1}' $DataFile` +VSN=`awk '{print $2}' $DataFile` + +BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin +EMU=beam +PROGNAME=`echo $0 | sed 's/.*\\///'` +export EMU +export ROOTDIR +export BINDIR +export PROGNAME +export RELDIR + +exec $BINDIR/erlexec -boot $RELDIR/$VSN/start -config $RELDIR/$VSN/sys $* +

If a diskless and/or read-only client node with the + sasl configuration parameter static_emulator set + to true is about to start the -boot and + -config flags must be changed. As such a client cannot + read a new start_erl.data file (the file is not + possible to change dynamically) the boot and config files are + always fetched from the same place (but with new contents if + a new release has been installed). The release_handler + copies this files to the bin directory in the client + directory at the master nodes whenever a new release is made + permanent. +

+

Assuming the same CLIENTDIR as above the last line + should look like: +

+ +exec $BINDIR/erlexec -boot $CLIENTDIR/bin/start \\ + -config $CLIENTDIR/bin/sys $* +
+
+
+ diff --git a/system/doc/embedded/intro.xml b/system/doc/embedded/intro.xml new file mode 100644 index 0000000000..3eafffd6fa --- /dev/null +++ b/system/doc/embedded/intro.xml @@ -0,0 +1,95 @@ + + + + +
+ + 1997 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Erlang on embedded systems + Fredrik Tillman + + ETX/B/SFP/TILLMAN:96-001 + + + 1997-11-12 + PA1 + intro.sgml +
+

This manual is a complement to the other manuals and describes how + to install, run and maintain Erlang on an embedded system. +

+

For more informaton about how to install and start Erlang read + XXXXXXXX. +

+ +
+ Memory Usage +

Solaris takes about 17 Mbyte of RAM on a system with 64 Mbyte of + total RAM. This leaves about 47 Mbyte for the applications. If + the system utilizes swapping, these figures cannot be improved + because unnecessary daemon processes are swapped out. However, + if swapping is disabled, or if the swap space is a precious + resource in the system, it becomes necessary to kill off + unnecessary daemon processes. +

+

The following start-scripts can be deleted to + prevent unnecessary daemons from starting: +

+ + /etc/rc2.d/S72autoinstall + /etc/rc2.d/S74autofs + /etc/rc2.d/S76nscd + /etc/rc2.d/S80PRESERVE + /etc/rc2.d/S80lp + /etc/rc2.d/S88sendmail + /etc/rc2.d/S92volmgt + /etc/rc2.d/S93cacheos.finish + /etc/rc3.d/S15nfs.server + +

More information is expected from Sun on how to modify the + kernel in order to reduce the memory consumption. This will be + performed by modifying the /etc/system file.

+
+ +
+ Disk Space Usage +

The disk space required by Solaris can be minimized by using the + Core User support installation. It requires about 80 Mbyte of + disk space. This installs only the minimum software required to + boot and run Solaris. The disk space can be further reduced by + deleting unnecessary individual files. However, unless disk + space is a critical resource the effort required and the risks + involved may not be justified.

+
+ +
+ Other Issues +

Future releases of OTP will include more information on how + Solaris can be configured for use with embedded systems to get + maximum performance. Issues which will be investigated include: +

+ + how disabling swapping affects the system + how locking processes in memory may yield performance benefits. + +
+
+ diff --git a/system/doc/embedded/make.dep b/system/doc/embedded/make.dep new file mode 100644 index 0000000000..9949a3ac96 --- /dev/null +++ b/system/doc/embedded/make.dep @@ -0,0 +1,14 @@ +# ---------------------------------------------------- +# >>>> Do not edit this file <<<< +# This file was automaticly generated by +# /home/otp/bin/docdepend +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# TeX files that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: book.tex embedded_nt.tex embedded_solaris.tex \ + part.tex vxworks.tex + diff --git a/system/doc/embedded/note.gif b/system/doc/embedded/note.gif new file mode 100644 index 0000000000..6fffe30419 Binary files /dev/null and b/system/doc/embedded/note.gif differ diff --git a/system/doc/embedded/part.xml b/system/doc/embedded/part.xml new file mode 100644 index 0000000000..abedce46d6 --- /dev/null +++ b/system/doc/embedded/part.xml @@ -0,0 +1,50 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Embedded Systems User's Guide + Kenneth Lundin, Fredrik Tillman + UAB/F (Kenneth Lundin) + + UAB/F (Kenneth Lundin) + + 2000-10-17 + C + +
+ +

This manual describes the issues that are specific + for running Erlang on an embedded system. + It describes the differences in installing and starting + Erlang compared to how it is done for a non-embedded system. +

+

Note that this is a supplementary document. You still need to + read the Installation Guide. +

+

There is also target architecture specific information in + the top level README file of the Erlang distribution.

+
+ + + +
+ diff --git a/system/doc/embedded/starting.xml b/system/doc/embedded/starting.xml new file mode 100644 index 0000000000..ddeaeb8bdf --- /dev/null +++ b/system/doc/embedded/starting.xml @@ -0,0 +1,249 @@ + + + + +
+ + 19962009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Starting an Embedded System + Martin Björklund + Bjarne Däcker + + Bjarne Däcker + + 1997-10-17 + D + starting.sgml +
+ +
+ Introduction +

This chapter describes how an embedded system is started. + There are four programs involved, and they all normally reside + in the directory /bin]]>. The only + exception is the program start, which may be located + anywhere, and also is the only program that must be modified by + the user. +

+

In an embedded system there usually is no interactive shell. + However, it is possible for an operator to attach to the + Erlang runtime system by giving the command to_erl. He is + then connected to the Erlang shell, and may give ordinary Erlang + commands. All interaction with the system through this shell is + logged in a special directory. +

+

Basically, the procedure is as follows. The program + start is called when the machine is started. It calls + run_erl, which sets things up so the operator can attach + to the system. It calls start_erl which calls the + correct version of erlexec (which is located in + /erts-EVsn/bin]]>) with the correct + boot and config files. +

+
+ +
+ Programs + +
+ start +

This program is called when the machine is started. It may + be modified or re-written to suit a special system. By + default, it must be called start and reside in + /bin]]>. Another start program can be + used, by using the configuration parameter start_prg in + the application sasl.

+

The start program must call run_erl as shown below. + It must also take an optional parameter which defaults to + /bin/start_erl.data]]>. +

+

This program should set static parameters and environment + variables such as -sname Name and HEART_COMMAND + to reboot the machine. +

+

The ]]> directory is where new release packets + are installed, and where the release handler keeps information + about releases. See release_handler(3) in the + application sasl for further information. +

+

The following script illustrates the default behaviour of the + program. +

+ /dev/null 2>&1 &]]> +

The following script illustrates a modification where the + node is given the name cp1, and the environment variables + HEART_COMMAND and TERM have been added to the + above script. +

+ /dev/null 2>&1 &]]> +

If a diskless and/or read-only client node is about to start the + start_erl.data file is located in the client directory at + the master node. Thus, the START_ERL_DATA line should look + like: +

+ +CLIENTDIR=$ROOTDIR/clients/clientname +START_ERL_DATA=${1:-$CLIENTDIR/bin/start_erl.data} +
+ +
+ run_erl +

This program is used to start the emulator, but you will not + be connected to the shell. to_erl is used to connect to the + Erlang shell. +

+ +Usage: run_erl pipe_dir/ log_dir "exec command [parameters ...]" +

Where pipe_dir/ should be /tmp/ + (to_erl uses this name by default) and log_dir is + where the log files are written. command [parameters] is + executed, and everything written to stdin and stdout is logged in + the log_dir. +

+

In the log_dir, log files are written. Each logfile + has a name of the form: erlang.log.N where N is a + generation number, ranging from 1 to 5. Each logfile holds up to + 100kB text. As time goes by the following logfiles will be found + in the logfile directory

+ +erlang.log.1 +erlang.log.1, erlang.log.2 +erlang.log.1, erlang.log.2, erlang.log.3 +erlang.log.1, erlang.log.2, erlang.log.3, erlang.log.4 +erlang.log.2, erlang.log.3, erlang.log.4, erlang.log.5 +erlang.log.3, erlang.log.4, erlang.log.5, erlang.log.1 +... +

with the most recent logfile being the right most in each row + of the above list. That is, the most recent file is the one with + the highest number, or if there are already four files, the one + before the skip. +

+

When a logfile is opened (for appending or created) a time + stamp is written to the file. If nothing has been written to + the log files for 15 minutes, a record is inserted that says + that we're still alive. +

+
+ +
+ to_erl +

This program is used to attach to a running Erlang runtime system, + started with run_erl. +

+ +Usage: to_erl [pipe_name | pipe_dir] +

Where pipe_name defaults to /tmp/erlang.pipe.N. +

+

To disconnect from the shell without exiting the Erlang + runtime system, type Ctrl-D. +

+
+ +
+ start_erl +

This program starts the Erlang emulator with parameters + -boot and -config set. It reads data about where + these files are located from a file called start_erl.data + which is located in the ]]>. Each new release + introduces a new data file. This file is automatically + generated by the release handler in Erlang. +

+

The following script illustrates the behaviour of the + program.

+ +#!/bin/sh +# +# This program is called by run_erl. It starts +# the Erlang emulator and sets -boot and -config parameters. +# It should only be used at an embedded target system. +# +# Usage: start_erl RootDir RelDir DataFile [ErlFlags ...] +# +ROOTDIR=$1 +shift +RELDIR=$1 +shift +DataFile=$1 +shift + +ERTS_VSN=`awk '{print $1}' $DataFile` +VSN=`awk '{print $2}' $DataFile` + +BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin +EMU=beam +PROGNAME=`echo $0 | sed 's/.*\\///'` +export EMU +export ROOTDIR +export BINDIR +export PROGNAME +export RELDIR + +exec $BINDIR/erlexec -boot $RELDIR/$VSN/start -config $RELDIR/$VSN/sys $* +

If a diskless and/or read-only client node with the sasl + configuration parameter static_emulator set to true + is about to start the -boot and -config flags must be + changed. As such a client can not read a new start_erl.data + file (the file is not possible to change dynamically) the boot and + config files is always fetched from the same place (but with a new + contents if a new release has been installed). The + release_handler copies this files to the bin directory + in the client directory at the master nodes whenever a new release + is made permanent. +

+

Assuming the same CLIENTDIR as above the last line should + look like:

+ +exec $BINDIR/erlexec -boot $CLIENTDIR/bin/start @@@ + -config $CLIENTDIR/bin/sys $* +
+
+
+ diff --git a/system/doc/embedded/target.xml b/system/doc/embedded/target.xml new file mode 100644 index 0000000000..4408e6ee48 --- /dev/null +++ b/system/doc/embedded/target.xml @@ -0,0 +1,414 @@ + + + + +
+ + 19962009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Installation of Embedded Environment + Peter Högfeldt + Peter Högfeldt + + (Peter Högfeldt + + 1997-05-26 + C + target.sgml +
+

This chapter is about installing a Embedded Environment. Solaris + 2.5.1 is the only UNIX operating system supported for embedded systems. + The following topics are considered,

+ + +

Creation of user and installation directory,

+
+ +

Installation of Embedded Environment,

+
+ +

Configuration for automatic start at reboot,

+
+ +

Making a hardware watchdog available,

+
+ +

Changing permission for reboot,

+
+ +

Patches for Solaris 2.5.1,

+
+ +

Configuration of the os_mon application.

+
+
+

Several of the procedures described below require expert knowledge of + the Solaris 2 operating system. For most of them super user privilege is + needed.

+ +
+ Creation of user and installation directory +

It is recommended that the Embedded Environment is run by an ordinary + user, i.e. a user which does not have super user privileges.

+

Throughout this chapter we assume that the user name is otpuser, + and that the home directory of that user is,

+
+/export/home/otpuser    
+

Furthermore, we assume that in the home directory of otpuser, + there is a directory named otp, the full path of which is,

+
+/export/home/otpuser/otp    
+

This directory is the installation directory of the Embedded + Environment.

+
+ +
+ Installation of Embedded Environment +

The procedure for installation of a Embedded Environment does not differ + from that of a Development Environment (see the chapter Installation of Development Environment), except for the following,

+ + +

the (compressed) tape archive file should be extracted in + the installation directory as defined above, and,

+
+ +

there is no need to link the start script to a standard directory + like /usr/local/bin.

+
+
+

The details for extracting the tape archive file is not repeated here.

+
+ +
+ Configuration for Automatic Start at Boot +

A true Embedded Environment has to start when the system boots. This + section accounts for the necessary configurations needed to achieve + that.

+

The embedded environment and all the applications will start automatically + if the script file shown below is added to the /etc/rc3.d directory. + The file must be owned and readable by root, and its name cannot + be arbitrarily assigned. The following name is recommended,

+
+S75otp.system    
+

For further details on initialization (and termination) scripts, and + naming thereof, see the file /etc/init.d/README on a Solaris + 2.5.1 system.

+
+#!/bin/sh
+#  
+#  File name:  S75otp.system
+#  Purpose:    Automatically starts Erlang and applications when the 
+#              system starts
+#  Author:     janne@erlang.ericsson.se
+#  Resides in: /etc/rc3.d
+#
+
+if [ ! -d /usr/bin ]
+then                    # /usr not mounted
+        exit
+fi
+
+killproc() {            # kill the named process(es)
+        pid=`/usr/bin/ps -e |
+             /usr/bin/grep -w $1 |
+             /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
+        [ "$pid" != "" ] && kill $pid
+}
+
+# Start/stop processes required for Erlang
+
+case "$1" in
+'start')
+        # Start the Erlang emulator
+        #
+        su - otpuser -c "/export/home/otpuser/otp/bin/start" &
+        ;;
+'stop')
+        killproc beam
+        ;;
+*)
+        echo "Usage: $0 { start | stop }"
+        ;;
+esac    
+

The file /export/home/otpuser/otp/bin/start referred to in the + above script, is precisely the script start described in the next + chapter of this guide, Starting an Embedded System. The script + variable OTP_ROOT in that start script corresponds to + the example path

+
+/export/home/otpuser/otp    
+

used in this section. The start script should be edited + accordingly.

+

Use of the killproc procedure in the above script could + be combined with a call to erl_call, e.g.

+
+  $SOME_PATH/erl_call -n Node init stop    
+

in order to take Erlang down gracefully (see the erl_call(1) + reference manual page for further details on the use of erl_call). + That however requires that Erlang runs as a distributed node which is + not always the case.

+

The killproc procedure should not be removed: the purpose is + here to move from run level 3 (multi-user mode with networking resources) + to run level 2 (multi-user mode without such resources), in which Erlang + should not run.

+
+ +
+ Hardware Watchdog +

For Solaris 2.5.1 running on VME boards from Force Computers, there + is a possibility to activate the onboard hardware watchdog, provided a + VME bus driver is added to the operating system. For further details + see the Embedded Systems documentation.

+

See also the heart(3) reference manual page in Kernel.

+
+ +
+ Changing permissions for reboot +

If the HEART_COMMAND environment variable is to be set in + the start script of the next chapter, Starting an Embedded System, and if the value shall be set to the path of the Solaris + reboot command, i.e.

+
+HEART_COMMAND=/usr/sbin/reboot    
+

the ownership and file permissions for /usr/sbin/reboot must + be changed as follows,

+
+chown 0 /usr/sbin/reboot
+chmod 4755 /usr/sbin/reboot    
+

See also the heart(3) reference manual page in Kernel.

+
+ +
+ The TERM environment variable +

When the Erlang runtime system is automatically started from the + S75otp.system script the TERM environment variable + has to be set. The following is a minimal setting,

+
+TERM=sun    
+

which should be added to the start script described in the + next chapter.

+
+ +
+ Patches for Solaris 2.5.1 +

For proper functioning of flushing file system data to disk, the + Solaris 2.5.1 specific patch with number 103640-02 must be added + to the operating system.

+
+ +
+ Installation of module os_sup in application os_mon +

The following four installation procedures requires superuser privilege.

+ +
+ Installation + + +

Make a copy the Solaris standard configuration file for syslogd.

+ + +

Make a copy the Solaris standard configuration file for syslogd. + This file is usually named syslog.conf and found in the /etc + directory.

+
+ +

The file name of the copy must be syslog.conf.ORIG but the + directory location is optional. Usually it is /etc. +

+

A simple way to do this is to issue the command

+ + cp /etc/syslog.conf /etc/syslog.conf.ORIG +
+
+
+ +

Make an Erlang specific configuration file for syslogd.

+ + +

Make an edited copy of the back-up copy previously made.

+
+ +

The file name must be syslog.conf.OTP and the path + must be the same as the back-up copy.

+
+ +

The format of the configuration file is found in the man page for + syslog.conf(5), by issuing the command man syslog.conf.

+
+ +

Usually a line is added which should state:

+ + +

which types of information that will be supervised by Erlang,

+
+ +

the name of the file (actually a named pipe) that should receive + the information.

+
+
+
+ +

If e.g. only information originating from the unix-kernel should + be supervised, the line should begin with kern.LEVEL (for the + possible values of LEVEL see syslog.conf(5)).

+
+ +

After at least one tab-character, the line added should contain + the full name of the named pipe where syslogd writes its information. The + path must be the same as for the syslog.conf.ORIG and + syslog.conf.OTP files. The file name must be syslog.otp.

+
+ +

If the directory for the syslog.conf.ORIG and + syslog.conf.OTP files is /etc the line in + syslog.conf.OTP will look like:

+ + kern.LEVEL /etc/syslog.otp +
+
+
+ +

Check the file privileges of the configuration files.

+ + +

The configuration files should have rw-r--r-- file + privileges and be owned by root.

+
+ +

A simple way to do this is to issue the commands

+ + chmod 644 /etc/syslog.conf + chmod 644 /etc/syslog.conf.ORIG + chmod 644 /etc/syslog.conf.OTP +
+ +

Note: If the syslog.conf.ORIG and + syslog.conf.OTP files are not in the /etc directory, + the file path in the second and third command must be modified.

+
+
+
+ +

Modify file privileges and ownership of the mod_syslog utility.

+ + +

The file privileges and ownership of the mod_syslog utility + must be modified.

+
+ +

The full name of the binary executable file is derived from the + position of the os_mon application if the file system by adding + /priv/bin/mod_syslog. The generic full name of the binary executable + file is thus

+ /lib/os_mon-/priv/bin/mod_syslog ]]> +

Example: If the path to the otp-root is + /usr/otp, thus the path to the os_mon application is + /usr/otp/lib/os_mon-1.0 (assuming revision 1.0) and the full name + of the binary executable file is + /usr/otp/lib/os_mon-1.0/priv/bin/mod_syslog.

+
+ +

The binary executable file must be owned by root, have + rwsr-xr-x file privileges, in particular the setuid bit of + user must be set.

+
+ +

A simple way to do this is to issue the commands

+ /lib/os_mon-/priv/bin/mod_syslog + chmod 4755 mod_syslog + chown root mod_syslog ]]> +
+
+
+
+
+ +
+ Testing the application configuration file +

The following procedure does not require root privilege.

+ + +

Ensure that the configuration parameters for the os_sup + module in the os_mon application are correct.

+
+ +

Browse the application configuration file (do not edit + it). The full name of the application configuration file is derived + from the position of the os_mon-application if the file system by adding + /ebin/os_mon.app.

+

The generic full name of the file is thus

+ /lib/os_mon-/ebin/os_mon.app. ]]> +

Example: If the path to the otp-root is /usr/otp, + thus the path to the os_mon application is /usr/otp/lib/os_mon-1.0 (assuming revision 1.0) and the full name of the binary executable file + is /usr/otp/lib/os_mon-1.0/ebin/os_mon.app.

+
+ +

Ensure that the following configuration parameters are bound to + the correct values.

+
+
+ + + Parameter + Function + Standard value + + + start_os_sup + Specifies if os_sup will be started or not. + truefor the first instance on the hardware; falsefor the other instances. + + + os_sup_own + The directory for (1)the back-up copy, (2) the Erlang specific configuration file for syslogd. + "/etc" + + + os_sup_syslogconf + The full name for the Solaris standard configuration file for syslogd + "/etc/syslog.conf" + + + error_tag + The tag for the messages that are sent to the error logger in the Erlang runtime system. + std_error + + Configuration Parameters +
+

If the values listed in the os_mon.app does not suite your + needs, you should not edit that file. Instead you should + override values in a system configuration file, the + full pathname of which is given on the command line to erl.

+

Example: The following is an example of the contents of an + application configuration file.

+

+
+[{os_mon, [{start_os_sup, true}, {os_sup_own, "/etc"}, 
+ {os_sup_syslogconf, "/etc/syslog.conf"}, {os_sup_errortag, std_error}]}].      
+
+ +
+ Related documents +

See also the os_mon(3), application(3) and erl(1) + reference manual pages.

+
+
+
+ diff --git a/system/doc/embedded/vme_problems.xml b/system/doc/embedded/vme_problems.xml new file mode 100644 index 0000000000..7f9b929875 --- /dev/null +++ b/system/doc/embedded/vme_problems.xml @@ -0,0 +1,61 @@ + + + + +
+ + 1997 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + VME Bus Driver + Fredrik Tillman + + ETX/B/SFP/TILLMAN:96-002 + + + 1996-10-29 + PA1 + vme_problems.sgml +
+

This chapter describes the OS specific parts of OTP which relate to + the VME Bus Driver. +

+ +
+ Installation Problems +

The hardware watchdog timer which is controlled by the + heart port program requires the FORCEvme package, + which contains the VME bus driver, to be installed. This driver, + however, might clash with the Sun mcp driver and cause + the system to completely refuse to boot. To cure this problem, + the following lines should be added to /etc/system: +

+ + exclude: drv/mcp + exclude: drv/mcpzsa + exclude: drv/mcpp + + +

It is recommended that these lines be added to avoid the + clash described, which may make it completely impossible to boot + the system.

+
+
+
+ diff --git a/system/doc/embedded/vxworks.xml b/system/doc/embedded/vxworks.xml new file mode 100644 index 0000000000..52143a42e3 --- /dev/null +++ b/system/doc/embedded/vxworks.xml @@ -0,0 +1,193 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + VxWorks + Patrik Winroth + + + + + 2000-10-17 + + vxworks.xml +
+

This chapter describes the OS specific parts of OTP which relate + to VxWorks. +

+ +
+ Introduction +

The Erlang/OTP distribution for VxWorks is limited to what + Switchboard requires (Switchboard is a general purpose + switching hardware developed by Ericsson). +

+

Please consult the README file, included at root level in the + installation, for latest information on the distribution. +

+
+ +
+ Memory Usage +

Memory required is 32 Mbyte. +

+
+ +
+ Disk Usage +

The disk space required is 22 Mbyte, the documentation included. +

+
+ +
+ Installation +

OTP/VxWorks is supplied in a distribution file named + .tar.gz]]>; i.e. a tar archive that is + compressed with gzip. ]]> represents the + name of the release, + e.g. otp_LXA12345_vxworks_cpu32_R42A. Assuming you are + installing to a Solaris file system, the installation is + performed by following these steps: < +

+

+ + Change to the directory where you want to install + OTP/VxWorks (]]>): ]]> + Make a directory to put OTP/VxWorks in: mkdir otp_vxworks_cpu32 (or whatever you want to call it) + Change directory to the newly created one: cd otp_vxworks_cpu32 + Copy the distribution file there from where it is located + (]]>): /.tar.gz .]]> + Unzip the distribution file: .tar.gz]]> + Untar .tar]]>: .tar]]> + Create a bin directory: mkdir bin + Copy the VxWorks Erlang/OTP start-up script to the bin directory: + cp erts-Vsn/bin/erl bin/. + Copy the example start scripts to the bin directory: + cp releases/R42A/*.boot bin/. + +

If you use VxWorks nfs mounting facility to mount the Solaris + file system, this installation may be directly used. An other + possibility is to copy the installation to a local VxWorks DOS + file system, from where it is used. +

+
+ +
+ OS Specific Functionality/Information +

There are a couple of files that are unique to the VxWorks + distribution of Erlang/OTP, these files are described here. +

+ + README - this files has some information on VxWorks + specifics that you are advised to consult. This includes the + latest information on what parts of OTP are included in the + VxWorks distribution of Erlang/OTP. If you want us to + include more parts, please contact us to discuss + this. + erts-Vsn/bin/resolv.conf - A resolver configuration EXAMPLE file. + You have to edit this file. + erts-Vsn/bin/erl - This is an EXAMPLE start script for VxWorks. + You have to edit this file to suit your needs. + erts-Vsn/bin/erl_io - One possible solution to the problem + of competing Erlang and VxWorks shell. Contains the function + 'start_erl' called by the erl script. Also contains the + function 'to_erl' to be used when connecting to the Erlang + shell from VxWorks' shell. + erts-Vsn/bin/erl_exec - Rearranges command line arguments + and starts Erlang. + erts-Vsn/bin/vxcall - Allows spawning of standard VxWorks + shell functions (which is just about any function in the + system...) from open_port/2. E.g. open_port({spawn, 'vxcall + func arg1 arg2'}, []) will cause the output that 'func arg1, + arg2' would have given in the shell to be received from the + port. + erts-Vsn/bin/rdate - Set the time from a networked host, + like the SunOS command. Nothing Erlang-specific, but nice + if you want date/0 and time/0 to give meaningful values (you + also need a TIMEZONE environment setting if GMT isn't + acceptable). For example: putenv "TIMEZONE=CET::-60:033002:102603" sets central european + time. + erts-Vsn/src - Contains source for the above files, and + additionally config.c, driver.h, preload.c and + reclaim.h. Reclaim.h defines the interface to a simple + mechanism for "resource reclamation" that is part of the + Erlang runtime system - may be useful to "port program" writers (and + possibly others). Take careful note of the caveats listed in + the file! + +
+ +
+ Starting Erlang +

Start (and restart) of the system depends on what file system + is used. To be able to start the system from a nfs mounted + file system you can use VxWorks start script facility to run a + start script similar to the example below. Note that the + Erlang/OTP start-up script is run at the end of this script. +

+ ") + +# +# Set default gateway +# +hostAdd "router-20","150.236.20.251" +routeAdd "0","router-20" + +# +# Mount /home from gandalf +# +hostAdd "gandalf","150.236.20.16" +usergroup=10 +nfsAuthUnixSet("gandalf", 452, 10, 1, &usergroup) +nfsMount("gandalf", "/export/home", "/home") + +# +# Load and run rdate.o to set correct date on the target +# +ld < /home/gandalf/tornado/wind/target/config/ads360/rdate.o +rdate("gandalf") + +# +# Setup timezone information (Central European time) +# +putenv "TIMEZONE=CET::-60:033002:102603" + +# +# Run the Erlang/OTP start script +# +cd "/home/gandalf/tornado/wind/target/erlang_cpu32_R42A/bin" + +
+
+ diff --git a/system/doc/embedded/warning.gif b/system/doc/embedded/warning.gif new file mode 100644 index 0000000000..96af52360e Binary files /dev/null and b/system/doc/embedded/warning.gif differ diff --git a/system/doc/embedded/xmlfiles.mk b/system/doc/embedded/xmlfiles.mk new file mode 100644 index 0000000000..2bdc34ae28 --- /dev/null +++ b/system/doc/embedded/xmlfiles.mk @@ -0,0 +1,22 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +EMBEDDED_CHAPTER_FILES = \ + embedded_solaris.xml \ + embedded_nt.xml \ + vxworks.xml diff --git a/system/doc/embedded/xntp.xml b/system/doc/embedded/xntp.xml new file mode 100644 index 0000000000..564b63fc7d --- /dev/null +++ b/system/doc/embedded/xntp.xml @@ -0,0 +1,75 @@ + + + + +
+ + 1997 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + XNTP (Network Time Protocol) + ETX/B/SFP Kenneth Lundin + + 1 + ETX/B/SFP (Kenneth Lundin) + + 1996-11-20 + A + xntp.sgml +
+

This chapter describes the OS specific part of OTP that relates + to the Network Time Protocol (XNTP). +

+ +
+ XNTP for Sunos5 +

XNTP maintains a Unix system time-of-day which conforms with + the Internet standard time servers. XNTP is a complete + implementation of the Network Time Protocol, version 3 + specification as defined in RFC 1305. +

+

XNTP for use in an embedded system running Sunos5 is + delivered with OTP. The XNTP is delivered as a separate + tar file which also includes extensive documentation and + installation instructions. +

+

The following section of the introductory documentation is + included in the distribution: +

+ +

The Network Time Protocol (NTP) is used to synchronize the + time of a computer client or server to another server or + reference time source, such as a radio or satellite receiver + or modem. It provides client accuracies typically within a + millisecond on LANs and up to a few tens of milliseconds on + WANs relative to a primary server synchronized to Coordinated + Universal Time (UTC) via a Global Positioning Service (GPS) + receiver, for example. Typical NTP configurations utilize + multiple redundant servers and diverse network paths, in order + to achieve high accuracy and reliability. ...

+
+

The XNTP software is supplied without charge under the + conditions set forth in the Copyright Notice provided within the + distribution. +

+

(© David L. Mills 1992, 1993, 1994, 1995, 1996) +

+
+
+ diff --git a/system/doc/extensions/Makefile b/system/doc/extensions/Makefile new file mode 100644 index 0000000000..cfc506f7e8 --- /dev/null +++ b/system/doc/extensions/Makefile @@ -0,0 +1,142 @@ +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# The Initial Developer of the Original Code is Ericsson Utvecklings AB. +# Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +# AB. All Rights Reserved.'' +# +# $Id$ +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include $(ERL_TOP)/erts/vsn.mk +#VSN=$(SYSTEM_VSN) + +# ---------------------------------------------------- +# Include dependency +# ---------------------------------------------------- + +include make.dep + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/doc/extensions + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +XML_PART_FILES = part.xml +XML_CHAPTER_FILES = \ + funs.xml \ + macros.xml \ + misc.xml \ + include.xml \ + records.xml \ + list_comprehensions.xml \ + bit_syntax.xml + +BOOK_FILES = book.xml + +GIF_FILES = note.gif + +PS_FILES = + +# ---------------------------------------------------- + +HTML_FILES = \ + $(XML_PART_FILES:%.xml=%.html) + +HTMLDIR = . +EXTRA_FILES = $(DEFAULT_GIF_FILES) \ + $(DEFAULT_HTML_FILES) \ + $(XML_CHAPTER_FILES:%.xml=%.html) + +TEX_FILES_BOOK = \ + $(BOOK_FILES:%.xml=%.tex) +TEX_FILES_USERS_GUIDE = \ + $(XML_CHAPTER_FILES:%.xml=%.tex) + +TOP_PDF_FILE = extensions-$(VSN).pdf +TOP_PS_FILE = extensions-$(VSN).ps + +$(TOP_PDF_FILE): book.dvi $(ERL_TOP)/erts/vsn.mk + $(DVI2PS) $(DVIPS_FLAGS) -f $< | $(DISTILL) $(DISTILL_FLAGS) > $@ + +$(TOP_PS_FILE): book.dvi $(ERL_TOP)/erts/vsn.mk + $(DVI2PS) $(DVIPS_FLAGS) -f $< > $@ + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAGS += +DVIPS_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + +ifeq ($(DOCTYPE),pdf) +docs: pdf +else +ifeq ($(DOCTYPE),ps) +docs: ps +else +docs: html +endif +endif + +pdf: $(TOP_PDF_FILE) + +ps: $(TOP_PS_FILE) + +html: $(HTML_FILES) $(GIF_FILES) + +debug opt: + +clean_tex: + -rm -f $(TEX_FILES_USERS_GUIDE) $(TEX_FILES_BOOK) + +clean: + rm -f *.html $(TEX_FILES_USERS_GUIDE) + rm -f $(TOP_PS_FILES) + rm -f errs core *~ $(LATEX_CLEAN) + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +ifeq ($(DOCTYPE),pdf) +release_docs_spec: pdf + $(INSTALL_DIR) $(RELEASE_PATH)/pdf + $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELEASE_PATH)/pdf +else +ifeq ($(DOCTYPE),ps) +release_docs_spec: ps + $(INSTALL_DIR) $(RELEASE_PATH)/ps + $(INSTALL_DATA) $(TOP_PS_FILE) $(RELEASE_PATH)/ps +else +release_docs_spec: docs + $(INSTALL_DIR) $(RELSYSDIR) + $(INSTALL_DATA) $(GIF_FILES) $(EXTRA_FILES) $(HTML_FILES) \ + $(RELSYSDIR) +endif +endif + +release_spec: + + + diff --git a/system/doc/extensions/bit_syntax.xml b/system/doc/extensions/bit_syntax.xml new file mode 100644 index 0000000000..d86f73cd9a --- /dev/null +++ b/system/doc/extensions/bit_syntax.xml @@ -0,0 +1,403 @@ + + + + +
+ + 20002009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + The Bit Syntax + Björn Gustavsson + Bjarne Däcker + 1 + Bjarne DäKer + + 00-06-21 + PA1 + bit_syntax.sgml +
+

This section describes the "bit syntax" which was added to + the Erlang language in release 5.0 (R7). + Compared to the original bit syntax prototype + by Claes Wikström and Tony Rogvall (presented on the + Erlang User's Conference 1999), this implementation differs + primarily in the following respects, +

+ + +

the character pairs '<<' and '>>' are used to delimit + a binary patterns and constructor (not '<' and '>' as in + the prototype), +

+
+ +

the tail syntax ('|Variable') has been eliminated, +

+
+ +

all size expressions must be bound, +

+
+ +

a type unit:U has been added, +

+
+ +

lists and tuples cannot be generated +

+
+ +

there are no paddings whatsoever. +

+
+
+ +
+ Introduction +

In Erlang a Bin is used for constructing binaries and + matching binary patterns. A Bin is written with the + following syntax:

+ > + ]]> +

A Bin is a low-level sequence of bytes. The purpose of a + Bin is to be able to, from a high level, + construct a binary, +

+ > + ]]> +

in which case all elements must be bound, or to + match a binary, +

+ > = Bin + ]]> +

where Bin is bound, and where the elements are bound or unbound, + as in any match. +

+

Each element specifies a certain segment of the binary. + A segment is is a set of contiguous bits of the binary (not + necessarily on a byte boundary). The first element specifies + the initial segment, the second element specifies the following + segment etc. +

+

The following examples illustrate how binaries are constructed + or matched, and how elements and tails are specified. +

+ +
+ Examples +

Example 1: A binary can be constructed from a set of + constants or a string literal:

+ >, + Bin12 = <<"abc">> + ]]> +

yields binaries of size 3; binary_to_list(Bin11) + evaluates to [1, 17, 42], and + binary_to_list(Bin12) evaluates to [97, 98, 99]. +

+

Example 2: Similarly, a binary can be constructed + from a set of bound variables:

+ > + ]]> +

yields a binary of size 4, and binary_to_list(Bin2) + evaluates to [1, 17, 00, 42] too. Here we used a + size expression for the variable C in order to + specify a 16-bits segment of Bin2. +

+

Example 3: A Bin can also be used for matching: if + D, E, and F are unbound variables, and + Bin2 is bound as in the former example,

+ > = Bin2 + ]]> +

yields D = 273, E = 00, and F binds to a binary + of size 1: binary_to_list(F) = [42]. +

+

Example 4: The following is a more elaborate example + of matching, where Dgram is bound to the consecutive + bytes of an IP datagram of IP protocol version 4, and where we + want to extract the header and the data of the datagram:

+ > when HLen >= 5, 4*HLen =< DgramSize -> + OptsLen = 4*(HLen - ?IP_MIN_HDR_LEN), + <> = RestDgram, + ... + end. + ]]> +

Here the segment corresponding to the Opts variable + has a type modifier specifying that Opts should + bind to a binary. All other variables have the default type + equal to unsigned integer. +

+

An IP datagram header is of variable length, and its length - + measured in the number of 32-bit words - is given in the segment + corresponding to HLen, the minimum value of which is + 5. It is the segment corresponding to Opts that is + variable: if HLen is equal to 5, Opts will be an + empty binary. +

+

The tail variables RestDgram and Data bind to + binaries, as all tail variables do. Both may bind to empty + binaries. +

+

If the first 4-bits segment of Dgram is not equal to + 4, or if HLen is less than 5, or if the size of + Dgram is less than 4*HLen, the match of + Dgram fails. +

+
+
+ +
+ A Lexical Note +

Note that ">]]>" will be interpreted as + ">]]>", which is a syntax error. + The correct way to write the expression is ">]]>".

+
+ +
+ Segments +

Each segment has the following general syntax:

+

Value:Size/TypeSpecifierList

+

Both the Size and the TypeSpecifier or both may be + omitted; thus the following variations are allowed: +

+

Value

+

Value:Size

+

Value/TypeSpecifierList

+

Default values will be used for missing specifications. The default + values are described in the section "Defaults" below. +

+

Used in binary construction, the Value part is any expression. + Used in binary matching, the Value part must be a literal or + variable. You can read more about the Value part in the + sections about constructing binaries and matching binaries. +

+

The Size part of the segment multiplied by the unit in the + TypeSpecifierList (described below) gives the number of bits + for the segment. In construction, Size is any expression that + evaluates to an integer. In matching, Size must be a constant + expression or a variable. +

+

The TypeSpecifierList is a list of type specifiers separated by + hyphens. +

+ + Type + The type can be integer, float, or binary. + Signedness + The signedness specification can be either signed + or unsigned. Note that signedness only matters for matching. + Endianness + The endianness specification can be either big, + little, or native. Native-endian means that + the endian will be resolved at load time to be either + big-endian or little-endian, depending on what is "native" + for the CPU that the Erlang machine is run on. + Unit + The unit size is given as unit:IntegerLiteral. + The allowed range is 1-256. It will be multiplied by the Size + specifier to give the effective size of the segment. + +

Example: +

+ +X:4/little-signed-integer-unit:8 + +

This element has a total size of 4*8 = 32 bits, and it contains a + signed integer in little-endian order.

+
+ +
+ Defaults +

The default type for a segment is integer. The default type + does not depend on the value, even if the value is a literal. + For instance, the default type in '>]]>' is integer, + not float. +

+

The default Size depends on the type. + For integer it is 8. For float it is 64. + For binary it is all of the binary. In matching, this default + value is only valid for the very last element. All other binary elements + in matching must have a size specification. +

+

The default unit depends on the the type. + For integer and float it is 1. + For binary it is 8. +

+

The default signedness is unsigned. +

+

The default endianness is big.

+
+ +
+ Constructing Binaries +

This section describes the rules for constructing binaries using + the bit syntax. Unlike when constructing lists or tuples, the construction + of a binary can fail with a badarg exception. +

+

There can be zero or more segments in a binary to be constructed. + The expression '>]]>' constructs a zero length binary. +

+

Each segment in a binary can consist of zero or more bits. + There are no alignment rules for individual segments, but the total + number of bits in all segments must be evenly divisible by 8, + or in other words, the resulting binary must consist of a whole number + of bytes. An badarg exception will be thrown if the resulting + binary is not byte-aligned. Example: +

+ > + ]]> +

The total number of bits is 7, which is not evenly divisible by 8; + thus, there will be badarg exception (and a compiler warning + as well). The following example +

+ > + ]]> +

will successfully construct a binary of 8 bits, or one byte. (Provided + that all of X, Y and Z are integers.) +

+

As noted earlier, segments have the following general syntax: +

+

Value:Size/TypeSpecifierList

+

When constructing binaries, Value and Size can be + any Erlang expression. However, for syntactical reasons, + both Value and Size must be enclosed in parenthesis + if the expression consists of anything more than a single literal + or variable. The following gives a compiler syntax error: +

+ > + ]]> +

This expression must be rewritten to +

+ > + ]]> +

in order to be accepted by the compiler. +

+ +
+ Including Literal Strings +

As syntactic sugar, an literal string may be written instead of a + element.

+ > ]]> +

which is syntactic sugar for

+ > ]]> +
+
+ +
+ Matching Binaries +

This section describes the rules for matching binaries using the + bit syntax. +

+

There can be zero or more segments in a binary binary pattern. + A binary pattern can occur in every place patterns are allowed, also + inside other patterns. Binary patterns cannot be nested. +

+

The pattern '>]]>' matches a zero length binary. +

+

Each segment in a binary can consist of zero or more bits. +

+

A segment of type binary must have a size evenly divisible by 8. +

+

This means that the following head will never match:

+ >) -> ]]> +

As noted earlier, segments have the following general syntax: +

+

Value:Size/TypeSpecifierList

+

When matching Value value must be either a variable or an integer + or floating point literal. Expressions are not allowed. +

+

Size must be an integer literal, or a previously bound variable. + Note that the following is not allowed:

+ >) -> + {X,T}. ]]> +

The two occurrences of N are not related. The compiler + will complain that the N in the size field is unbound. +

+

The correct way to write this example is like this:

+ + <> = Bin, + {X,T}. ]]> + +
+ Getting the Rest of the Binary +

To match out the rest of binary, specify a binary field without size:

+ >) -> ]]> +

As always, the size of the tail must be evenly divisible by 8. +

+
+
+ +
+ Traps and Pitfalls +

Assume that we need a function that creates a binary out of a + list of triples of integers. A first (inefficient) version of such + a function could look like this:

+ + triples_to_bin(T, <<>>). + +triples_to_bin([{X,Y,Z} | T], Acc) -> + triples_to_bin(T, <>); % inefficient +triples_to_bin([], Acc) -> + Acc. ]]> +

The reason for the inefficiency of this function is that for + each triple, the binary constructed so far (Acc) is copied. + (Note: The original bit syntax prototype avoided the copy operation + by using segmented binaries, which are not implemented in R7.) +

+

The efficient way to write this function in R7 is:

+ + triples_to_bin(T, []). + +triples_to_bin([{X,Y,Z} | T], Acc) -> + triples_to_bin(T, [<> | Acc]); +triples_to_bin([], Acc) -> + list_to_binary(lists:reverse(Acc)). ]]> +

Note that list_to_binary/1 handles deep lists of binaries + and small integers. (This fact was previously undocumented.) +

+
+
+ diff --git a/system/doc/extensions/book.xml b/system/doc/extensions/book.xml new file mode 100644 index 0000000000..ffdbe6cb44 --- /dev/null +++ b/system/doc/extensions/book.xml @@ -0,0 +1,45 @@ + + + + +
+ + 1997 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Erlang Extensions Since 4.4 + OTP Team + + 1997-05-21 + + book.sgml +
+ + + Erlang Extensions Since 4.4 + + + + + + + + +
+ diff --git a/system/doc/extensions/fun_test.erl b/system/doc/extensions/fun_test.erl new file mode 100644 index 0000000000..8472fd87f8 --- /dev/null +++ b/system/doc/extensions/fun_test.erl @@ -0,0 +1,17 @@ +%1 +-module(fun_test). +-export([t1/0, t2/0, t3/0, t4/0, double/1]). +-import(lists, [map/2]). + +t1() -> map(fun(X) -> 2 * X end, [1,2,3,4,5]). + +t2() -> map(fun double/1, [1,2,3,4,5]). + +t3() -> map({?MODULE, double}, [1,2,3,4,5]). + +double(X) -> X * 2. +%1 + + +t4() -> + "hello world". diff --git a/system/doc/extensions/funparse.erl b/system/doc/extensions/funparse.erl new file mode 100644 index 0000000000..5e23c90df9 --- /dev/null +++ b/system/doc/extensions/funparse.erl @@ -0,0 +1,74 @@ +-module(funparse). +-compile(export_all). +-import(lists, [reverse/1]). + +%17 +%% > hof:parse([a,c]). +%% {ok,{'and',{'or',1,{const,a}},{'or',1,{const,c}}}} +%% > hof:parse([a,d]). +%% {ok,{'and',{'or',1,{const,a}},{'or',2,{const,d}}}} +%% > hof:parse([b,c]). +%% {ok,{'and',{'or',2,{const,b}},{'or',1,{const,c}}}} +%% > hof:parse([b,d]). +%% {ok,{'and',{'or',2,{const,b}},{'or',2,{const,d}}}} +%% > hof:parse([a,b]). +%% fail +%17 + +%% Grammar = (a | b) & (c | d) + +%12 +parse(List) -> + (grammar())(List). +%12 + +%13 +grammar() -> + pand( + por(pconst(a), pconst(b)), + por(pconst(c), pconst(d))). +%13 + +%14 +pconst(X) -> + fun (T) -> + case T of + [X|T1] -> {ok, {const, X}, T1}; + _ -> fail + end + end. +%14 + +%15 +por(P1, P2) -> + fun (T) -> + case P1(T) of + {ok, R, T1} -> + {ok, {'or',1,R}, T1}; + fail -> + case P2(T) of + {ok, R1, T1} -> + {ok, {'or',2,R1}, T1}; + fail -> + fail + end + end + end. +%15 + +%16 +pand(P1, P2) -> + fun (T) -> + case P1(T) of + {ok, R1, T1} -> + case P2(T1) of + {ok, R2, T2} -> + {ok, {'and', R1, R2}}; + fail -> + fail + end; + fail -> + fail + end + end. +%16 diff --git a/system/doc/extensions/funs.xml b/system/doc/extensions/funs.xml new file mode 100644 index 0000000000..f9c003c8ee --- /dev/null +++ b/system/doc/extensions/funs.xml @@ -0,0 +1,486 @@ + + + + +
+ + 1997 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Programming with Funs + Joe Armstrong + Bjarne Däcker + 1 + Bjarne DäKer + + 96-01-16 + PA1 + funs.sgml +
+

This section introduces functional objects (Funs). That is a new data type introduced in Erlang 4.4. Functions which takes Funs as arguments, or which return Funs are called higher order functions.

+ + Funs can be passed as arguments to other functions, just like lists or tuples + functions can be written which return Funs, just like any other data object. + + +
+ Higher Order Functions +

Funs encourages us to encapsulate common patterns of design into functional forms called higher order functions. These functions not only shortens programs, but also produce clearer programs because the intended meaning of the program is explicitly rather than implicitly stated.

+

The concepts of higher order functions and procedural abstraction are introduced with two brief examples.

+ +
+ Example 1 - map +

If we want to double every element in a list, we could write a function named double:

+ + +double([H|T]) -> [2*H|double(T)]; +double([]) -> [] +

This function obviously doubles the argument entered as input as follows:

+
+
+> double([1,2,3,4]).
+[2,4,6,8]      
+

We now add the function add_one, which adds one to every element in a list:

+ + +add_one([H|T]) -> [H+1|add_one(T)]; +add_one([]) -> []. +

These functions, double and add_one, have a very similar structure. We can exploit this fact and write a function map which expresses this similarity:

+ +

We can now express the functions double and add_one in terms of map as follows:

+ + +double(L) -> map(fun(X) -> 2*X end, L). +add_one(L) -> map(fun(X) -> 1 + X end, L). +

map(F, List) is a function which takes a function F and a list L as arguments and + returns the new list which is obtained by applying F to each of the elements in L.

+

The process of abstracting out the common features of a number of different programs is called procedural abstraction. Procedural abstraction can be used in order to write several different functions which have a similar structure, but differ only in some minor detail. This is done as follows:

+ + write one function which represents the common features of these functions + parameterize the difference in terms of functions which are passed as arguments to the common function. + +
+ +
+ Example 2 - foreach +

This example illustrates procedural abstraction. Initially, we show the following two examples written as conventional functions:

+ + all elements of a list are printed onto a stream + a message is broadcast to a list of processes. + + + +print_list(Stream, [H|T]) -> + io:format(Stream, "~p~n", [H]), + print_list(Stream, T); +print_on_list(Stream, []) -> + true. + + +broadcast(Msg, [Pid|Pids]) -> + Pid ! Msg, + broadcast(Msg, Pids); +broadcast(_, []) -> + true. +

Both these functions have a very similar structure. They both iterate over a list doing something to each element in the list. The "something" has to be carried round as an extra argument to the function which does this.

+

The function foreach expresses this similarity:

+ +

Using foreach, print_on_list becomes:

+ + +foreach(fun(H) -> io:format(S, "~p~n~,[H]) end, L) +

broadcast becomes:

+ + +foreach(fun(Pid) -> Pid ! M end, L) +

foreach is evaluated for its side-effect and not its value. foreach(Fun ,L) calls Fun(X) for each element X in L and the processing occurs in the order in which the elements were defined in L. map does not define the order in which its elements are processed.

+
+
+ +
+ Advantages of Higher Order Functions +

Programming with higher order functions, such as map and foreach, has a number of advantages:

+ + It is much easier to understand the program and the intention of the programmer is clearly expressed in the code. The statement foreach(fun(X) -> clearly indicates that the intention of this program is to do something to each element in the list L. We also know that the function which is passed as the first argument of foreach takes one argument X, which will be successively bound to each of the elements in L. + Functions which take Funs as arguments are much easier to re-use than other functions. + +
+ +
+ The Syntax of Funs +

Funs are written with the syntax:

+ + +F = fun (Arg1, Arg2, ... ArgN) -> + ... + end +

This creates an anonymous function of N arguments and binds it to the variable F.

+

If we have already written a function in the same module and wish to pass this function as an argument, we can use the following syntax:

+ + +F = fun FunctionName/Arity +

With this form of function reference, the function which is referred to does not need to be exported from the module.

+

We can also refer to a function defined in a different module with the following syntax:

+ + +F = {Module, FunctionName} +

In this case, the function must be exported from the module in question.

+

The follow program illustrates the different ways of creating Funs:

+ +

We can evaluate the fun F with the syntax:

+ + +F(Arg1, Arg2, ..., Argn) +

To check whether a term is a Fun, use the test function/1 + in a guard. Example:

+ +f(F, Args) when function(F) -> + apply(F, Args); +f(N, _) when integer(N) -> + N. +

Funs are a distinct type. The BIFs erlang:fun_info/1,2 can + be used to retrieve information about a fun, and the BIF + erlang:fun_to_list/1 returns a textual representation of a fun. + The check_process_code/2 BIF returns true if the + process contains funs that depend on the old version of + a module.

+ +

In OTP R5 and earlier releases, funs were represented + using tuples.

+
+
+ +
+ Variable Bindings within a Fun +

The scope rules for variables which occur in Funs are as follows:

+ + All variables which occur in the head of a Fun are assumed to be "fresh" variables. + Variables which are defined before the Fun, and which occur in function calls or guard tests within the Fun, have the values they had outside the Fun. + No variables may be exported from a Fun. + +

The following examples illustrate these rules:

+ + +print_list(File, List) -> + {ok, Stream} = file:open(File, write), + foreach(fun(X) -> io:format(Stream,"~p~n",[X]) end, List), + file:close(Stream). +

In the above example, the variable X which is defined in the head of the Fun is a new variable. The value of the variable Stream which is used within within the Fun gets its value from the + file:open line.

+

Since any variable which occurs in the head of a Fun is considered a new variable it would be equally valid to write:

+ + +print_list(File, List) -> + {ok, Stream} = file:open(File, write), + foreach(fun(File) -> + io:format(Stream,"~p~n",[File]) + end, List), + file:close(Stream). +

In this example, File is used as the new variable instead of X. This is rather silly since code in the body of the Fun cannot refer to the variable File which is defined outside the Fun. Compiling this example will yield the diagnostic:

+ + +./FileName.erl:Line: Warning: variable 'File' + shadowed in 'lambda head' +

This reminds us that the variable File which is defined inside the Fun collides with the variable File which is defined outside the Fun.

+

The rules for importing variables into a Fun has the consequence that certain pattern matching operations have to be moved into guard expressions and cannot be written in the head of the Fun. For example, we might write the following code if we intend the first clause of F to be evaluated when the value of its argument is Y:

+ + +f(...) -> + Y = ... + map(fun(X) when X == Y -> + ; + (_) -> + ... + end, ...) + ... +

instead of

+ + +f(...) -> + Y = ... + map(fun(Y) -> + ; + (_) -> + ... + end, ...) + ... +
+ +
+ Funs and the Module Lists +

The following examples show a dialogue with the Erlang shell. All the higher order functions discussed are exported from the module lists.

+ +
+ map + +

map takes a function of one argument and a list of terms. It returns the list obtained by applying the function to every argument in the list.

+
+
+1> Double = fun(X) -> 2 * X end.
+#Fun<erl_eval>
+2>lists:map(Double, [1,2,3,4,5]).
+[2,4,6,8,10]      
+

When a new Fun is defined in the shell, the value of the Fun is printed as ]]>

+
+ +
+ any + +

any takes a predicate P of one argument and a list of terms. A predicate is a function which returns true or false. any is true if there is a term X in the list such that P(X) is true.

+

We define a predicate Big(X) which is true if its argument is greater that 10.

+
+
+3> Big =  fun(X) -> if X > 10 -> true; true -> false end end.
+#Fun<erl_eval>
+4>lists:any(Big, [1,2,3,4]).
+false.
+5> lists:any(Big, [1,2,3,12,5]).
+true.      
+
+ +
+ all + +

all has the same arguments as any. It is true if the predicate applied to all elements in the list is true.

+
+
+6>lists:all(Big, [1,2,3,4,12,6]).   
+false
+7>lists:all(Big, [12,13,14,15]).       
+true      
+
+ +
+ foreach + +

foreach takes a function of one argument and a list of terms. The function is applied to each argument in the list. foreach returns ok. It is used for its side-effect only.

+
+
+8> lists:foreach(fun(X) -> io:format("~w~n",[X]) end, [1,2,3,4]). 
+1
+2
+3
+4
+true      
+
+ +
+ foldl + +

foldl takes a function of two arguments, an accumulator and a list. The function is called with two arguments. The first argument is the successive elements in the list, the second argument is the accumulator. The function must return a new accumulator which is used the next time the function is called.

+

If we have a list of lists L = ["I","like","Erlang"], then we can sum the lengths of all the strings in L as follows:

+
+
+9> L = ["I","like","Erlang"].
+["I","like","Erlang"]
+10> lists:foldl(fun(X, Sum) -> length(X) + Sum end, 0, L).                    
+11      
+

foldl works like a while loop in an imperative language:

+ + + L = ["I","like","Erlang"], + Sum = 0, + while( L != []){ + Sum += length(head(L)), + L = tail(L) + end +
+ +
+ mapfoldl + +

mapfoldl simultaneously maps and folds over a list. The following example shows how to change all letters in L to upper case and count them.

+

First upcase:

+
+
+11> Upcase =  fun(X) when $a =< X,  X =< $z -> X + $A - $a;
+(X) -> X 
+end.
+#Fun<erl_eval>
+12> Upcase_word = 
+fun(X) -> 
+lists:map(Upcase, X) 
+end.
+#Fun<erl_eval>
+13>Upcase_word("Erlang").
+"ERLANG"
+14>lists:map(Upcase_word, L).
+["I","LIKE","ERLANG"]      
+

Now we can do the fold and the map at the same time:

+
+
+14> lists:mapfoldl(fun(Word, Sum) ->
+14>    {Upcase_word(Word), Sum + length(Word)}
+14>              end, 0, L).
+{["I","LIKE","ERLANG"],11}      
+
+ +
+ filter + +

filter takes a predicate of one argument and a list and returns all element in the list which satisfy the predicate.

+
+
+15>lists:filter(Big, [500,12,2,45,6,7]).
+[500,12,45]      
+

When we combine maps and filters we can write very succinct and obviously correct code. For example, suppose we want to define a set difference function. We want to define diff(L1, L2) to be the difference between the lists L1 and L2. + This is the list of all elements in L1 which are not contained in L2. This code can be written as follows:

+ + +diff(L1, L2) -> + filter(fun(X) -> not member(X, L2) end, L1). +

The AND intersection of the list L1 and L2 is also easily defined:

+ + +intersection(L1,L2) -> filter(fun(X) -> member(X,L1) end, L2). +
+ +
+ takewhile + +

takewhile(P, L) takes elements X from a list L as long as the predicate P(X) is true.

+
+
+16>lists:takewhile(Big, [200,500,45,5,3,45,6]).  
+[200,500,45]      
+
+ +
+ dropwhile + +

dropwhile is the complement of takewhile.

+
+
+17> lists:dropwhile(Big, [200,500,45,5,3,45,6]).
+[5,3,45,6]      
+
+ +
+ splitlist + +

splitlist(P, L) splits the list L into the two sub-lists {L1, L2}, where L = takewhile(P, L) and L2 = dropwhile(P, L).

+
+
+18>lists:splitlist(Big, [200,500,45,5,3,45,6]).          
+{[200,500,45],[5,3,45,6]}      
+
+ +
+ first + +

first returns {true, R}, where R is the first element in a list satisfying a predicate or false:

+
+
+19>lists:first(Big, [1,2,45,6,123]).
+{true,45}
+20>lists:first(Big, [1,2,4,5]).        
+false      
+
+
+ +
+ Funs which Return Funs +

So far, this section has only described functions which take Funs as arguments. It is also possible to write more powerful functions which themselves return Funs. The following examples illustrate these type of functions.

+ +
+ Simple Higher Order Functions +

Adder(X) is a function which, given X, returns a new function G such that G(K) returns K + X.

+
+
+21> Adder = fun(X) -> fun(Y) -> X + Y end end.
+#Fun<erl_eval>
+22> Add6 = Adder(6).
+#Fun<erl_eval>
+23>Add6(10).
+16      
+
+ +
+ Infinite Lists +

The idea is to write something like:

+ + +-module(lazy). +-export([ints_from/1]). +ints_from(N) -> + fun() -> + [N|ints_from(N+1)] + end. +

Then we can proceed as follows:

+ XX = lazy:ints_from(1). +#Fun +25> XX(). +[1|#Fun] +26> hd(XX()). +1 +27> Y = tl(XX()). +#Fun +28> hd(Y()). +2 ]]> +

etc. - this is an example of "lazy embedding"

+
+ +
+ Parsing +

The following examples show parsers of the following type:

+
+Parser(Toks) -> {ok, Tree, Toks1} | fail      
+

Toks is the list of tokens to be parsed. A successful parse returns {ok, Tree, Toks1}, where Tree is a parse tree and Toks1 is a tail of Tree which contains symbols encountered after the structure which was correctly parsed. Otherwise fail is returned.

+

The example which follows illustrates a simple, functional parser which parses the grammar:

+
+(a | b) & (c | d)      
+

The following code defines a function pconst(X) in the module funparse, which returns a Fun which parses a list of tokens.

+ +

This function can be used as follows:

+
+29>P1 = funparse:pconst(a).
+#Fun<hof>
+30> P1([a,b,c]).
+{ok,{const,a},[b,c]}
+31> P1([x,y,z]).     
+fail      
+

Next, we define the two higher order functions pand and por which combine primitive parsers to produce more complex parsers. Firstly pand:

+ +

Given a parser P1 for grammar G1, and a parser P2 for grammar G2, pand(P1, P2) + returns a parser for the grammar which consists of sequences of tokens which satisfy G1 followed by sequences of tokens which satisfy G2.

+

por(P1, P2) returns a parser for the language described by the grammar G1 or G2.

+ +

The original problem was to parse the grammar . The following code addresses this problem:

+ +

The following code adds a parser interface to the grammar:

+ +

We can test this parser as follows:

+
+
+32> funparse:parse([a,c]).
+{ok,{'and',{'or',1,{const,a}},{'or',1,{const,c}}}}
+33> funparse:parse([a,d]). 
+{ok,{'and',{'or',1,{const,a}},{'or',2,{const,d}}}}
+34> funparse:parse([b,c]).   
+{ok,{'and',{'or',2,{const,b}},{'or',1,{const,c}}}}
+35> funparse:parse([b,d]). 
+{ok,{'and',{'or',2,{const,b}},{'or',2,{const,d}}}}
+36> funparse:parse([a,b]).   
+fail      
+
+
+
+ diff --git a/system/doc/extensions/funs1.erl b/system/doc/extensions/funs1.erl new file mode 100644 index 0000000000..b1a3e21525 --- /dev/null +++ b/system/doc/extensions/funs1.erl @@ -0,0 +1,125 @@ +-module(funs1). +-compile(export_all). +-import(lists, [reverse/1]). + +%1 +map(F, [H|T]) -> [F(H)|map(F, T)]; +map(F, []) -> []. +%1 + +%2 +foreach(F, [H|T]) -> + F(H), + foreach(F, T); +foreach(F, []) -> + ok. +%2 +% +%3 +all(Pred, [H|T]) -> + case Pred(H) of + true -> all(Pred, T); + false -> false + end; +all(Pred, []) -> + true. +%3 +%4 +any(Pred, [H|T]) -> + case Pred(H) of + true -> true; + false -> any(Pred, T) + end; +any(Pred, []) -> + false. +%4 +%5 +takewhile(Pred, [H|T]) -> + case Pred(H) of + true -> [H|takewhile(Pred, T)]; + false -> [] + end; +takewhile(Pred, []) -> + []. +%5 +%6 +dropwhile(Pred, [H|T]) -> + case Pred(H) of + true -> dropwhile(Pred, T); + false -> [H|T] + end; +dropwhile(Pred, []) -> + []. +%6 +%7 +splitlist(Pred, L) -> + splitlist(Pred, L, []). + +splitlist(Pred, [H|T], L) -> + case Pred(H) of + true -> splitlist(Pred, T, [H|L]); + false -> {reverse(L), [H|T]} + end; +splitlist(Pred, [], L) -> + {reverse(L), []}. +%7 + +flatmap(F, [Hd|Tail]) -> + F(Hd) ++ flatmap(F, Tail); +flatmap(F, []) -> []. + +%8 +foldl(F, Accu, [Hd|Tail]) -> + foldl(F, F(Hd, Accu), Tail); +foldl(F, Accu, []) -> Accu. +%8 +% +foldr(F, Accu, [Hd|Tail]) -> + F(Hd, foldr(F, Accu, Tail)); +foldr(F, Accu, []) -> Accu. +%9 +filter(F, [H|T]) -> + case F(H) of + true -> [H|filter(F, T)]; + false -> filter(F, T) + end; +filter(F, []) -> []. +%9 +%10 +mapfoldl(F, Accu0, [Hd|Tail]) -> + {R,Accu1} = F(Hd, Accu0), + {Rs,Accu2} = mapfoldl(F, Accu1, Tail), + {[R|Rs], Accu2}; +mapfoldl(F, Accu, []) -> {[], Accu}. +%10 +mapfoldr(F, Accu0, [Hd|Tail]) -> + {Rs,Accu1} = mapfoldr(F, Accu0, Tail), + {R,Accu2} = F(Hd, Accu1), + {[R|Rs],Accu2}; +mapfoldr(F, Accu, []) -> {[], Accu}. +%11 +first(Pred, [H|T]) -> + case Pred(H) of + true -> + {true, H}; + false -> + first(Pred, T) + end; +first(Pred, []) -> + false. +%11 +% +compose(F, G) -> + fun(X) -> + F(G(X)) + end. + +%20 +iterate(N, F) -> + iterate(N, N+1, F). + +iterate(Stop, Stop, _) -> + []; +iterate(N, Stop, Fun) -> + [Fun(N)|iterate(N+1, Stop, Fun)]. +%20 diff --git a/system/doc/extensions/include.xml b/system/doc/extensions/include.xml new file mode 100644 index 0000000000..cd78644b95 --- /dev/null +++ b/system/doc/extensions/include.xml @@ -0,0 +1,81 @@ + + + + +
+ + 19992009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Includes + Arndt Jonasson + 1 + 99-01-25 + PA1 + include.sgml +
+

There are two directives which can be used in Erlang source + files to cause the compiler to temporarily read input from another + source. They are typically used to provide macro definitions and + record definitions from header files. It is recommended to use the + file name extension ".hrl" for files which are meant to be + included (the 'h' can be read as "header").

+

When locating header files a list of directory names, the + compiler include path, is used. In short the list contains the current + working directory of the file server, the base name of the compiled + file, and the directories given by the include option, in that order. + See erlc(1) and compile(3) for the details of the + compiler include path.

+ +
+ The -include Directive +

The first action taken by the -include directive is to + check if the format of the first path component of the specified + filename is $VAR, for some string VAR. If that is the + case, the value of the environment variable VAR as returned by + os:getenv(VAR) is substituted for the first path component. If + os:getenv/1 returns false, the first path component is + left as is. If the filename is absolute (possibly after variable + substitution), the header file with that name is included. Otherwise, + the specified header file is searched for in the directories in the + compiler include path, starting with the first directory in the list. + The first file found while traversing the list is included. Examples:

+ + -include("my_records.hrl"). + -include("incdir/more_records.hrl"). + -include("/home/users/proj/recs.hrl"). + -include("$PROJ_ROOT/app1/defs.hrl"). +
+ +
+ The -include_lib Directive +

The -include_lib directive first tries to find the + specified header file using the procedure employed for the + -include directive. If no header file can be found by searching + the compiler include path, the first path component of the specified + filename (possibly after variable substitution) is regarded as the + name of an application, and the directory of the current version of + the application is searched. Example:

+ + -include_lib("mnesia/include/mnemosyne.hrl"). +

The compiler is instructed to look for the directory where the + current version of the mnesia application is installed, that is + code:lib_dir(mnesia), and then search the subdirectory + include for the file mnemosyne.hrl.

+
+
+ diff --git a/system/doc/extensions/list_comprehensions.erl b/system/doc/extensions/list_comprehensions.erl new file mode 100644 index 0000000000..21ac562aa5 --- /dev/null +++ b/system/doc/extensions/list_comprehensions.erl @@ -0,0 +1,118 @@ +-module(t). +-author('tobbe@erix.ericsson.se'). + +%%-export([test/2]). +-compile(export_all). + +%% Odd numbers. + +%%foo(L) -> [ X || X <- L, (X > X-1) == (X /= X-1) ]. + +bar(L) -> [ X || X <- L, integer(X), gt(X, 3) ]. + +bar(L, M) -> [ Y || X <- L, integer(X), gt(X, 3), + Y <- M, float(Y), gt(X, Y) + ]. + +baz(L) -> [ X || X <- L, atom(X) ]. + +buz(L, Min) -> [ X || Min > 3, X <- L, X >= Min ]. + +gt(X, Y) when X > Y -> true; +gt(X, Y) -> false. + +%% Turn a list into a set. +make_set([]) -> []; +make_set([H|T]) -> + [H|[ + Y || Y <- make_set(T), + Y =/= H + ]]. + +%% Return the Pythagorean triangles with sides +%% of total length less than N +pyth(N) -> + [ {A,B,C} || + A <- lists:seq(1,N), + B <- lists:seq(1,N), + C <- lists:seq(1,N), + A+B+C =< N, + A*A+B*B == C*C + ]. + +%% Cut the search space a bit.. +pyth2(N) -> + [ {A,B,C} || + A <- lists:seq(1,N), + B <- lists:seq(1,N-A+1), + C <- lists:seq(1,N-A-B+2), + A+B+C =< N, + A*A+B*B == C*C ]. + +%% Return the Cartesian product +cp() -> + [ {X,Y} || + X <- a(), + Y <- b() + ]. + +cp(A,B) when list(A),list(B) -> + [ {X,Y} || + X <- A, + Y <- B + ]. + +%a() -> 1/0. +a() -> [a,b]. +b() -> [1,2,3]. + +%% Return all permutations of a list +perms([]) -> [[]]; +perms(L) -> [ [H|T] || H <- L, T <- perms(L--[H]) ]. + +%% Quick sort +sort([X|Xs]) -> + sort([ Y || Y <- Xs, Y < X ]) ++ + [X] ++ + sort([ Y || Y <- Xs, Y >= X ]); +sort([]) -> []. + +%% Vector addition +vecAdd(Xs,Ys) -> + [ X+Y || {X,Y} <- zip(Xs,Ys) ]. + +zip([X|Xs],[Y|Ys]) -> [{X,Y}|zip(Xs,Ys)]; +zip([],[]) -> []. + +qsort([X|Xs]) -> + qsort(lt(X,Xs)) + ++ [X] ++ + qsort(ge(X,Xs)); +qsort([]) -> []. + +lt(X,[H|T]) when X>H -> [H|lt(X,T)]; +lt(X,[_|T]) -> lt(X,T); +lt(_,[]) -> []. + +ge(X,[H|T]) when X= [H|ge(X,T)]; +ge(X,[_|T]) -> ge(X,T); +ge(_,[]) -> []. + +test(1,N) -> statistics(runtime),test1(N),statistics(runtime); +test(2,N) -> statistics(runtime),test2(N),statistics(runtime); +test(3,N) -> statistics(runtime),test3(N),statistics(runtime). + +test1(0) -> true; +test1(N) -> + sort([21,12,45,1,3,87,55,77,11,20,6,99,91,13,14,15,66,62,69,71,67,82,83,84,87,86,85]), + test1(N-1). + +test2(0) -> true; +test2(N) -> + qsort([21,12,45,1,3,87,55,77,11,20,6,99,91,13,14,15,66,62,69,71,67,82,83,84,87,86,85]), + test2(N-1). + +test3(0) -> true; +test3(N) -> + lists:sort([21,12,45,1,3,87,55,77,11,20,6,99,91,13,14,15,66,62,69,71,67,82,83,84,87,86,85]), + test3(N-1). diff --git a/system/doc/extensions/list_comprehensions.xml b/system/doc/extensions/list_comprehensions.xml new file mode 100644 index 0000000000..30e32da79c --- /dev/null +++ b/system/doc/extensions/list_comprehensions.xml @@ -0,0 +1,205 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + List Comprehensions + Joe Armstrong + Bjarne Däcker + 1 + Bjarne DäKer + + 96-09-10 + PA1 + list_comprehensions.sgml +
+

List comprehensions are a feature of many modern functional programming languages. Subject to certain rules, they provide a succinct notation for generating elements in a list.

+

List comprehensions are analogous to set comprehensions + in Zermelo-Frankel set theory and are called ZF expressions in + Miranda. They are analogous to the setof and + findall predicates in Prolog.

+

List comprehensions are written with the following syntax: +

+ + +[Expression || Qualifier1, Qualifier2, ...] +

Expression is an arbitrary expression, and each Qualifier is either a generator or a filter.

+ + A generator written as . ListExpr must be an expression which evaluates to a list of terms. + A filter is either a predicate or a boolean expression. A predicate is a function which returns true or false. + + +
+ Examples of List Comprehensions +

We start with a simple example:

+ [X || X <- [1,2,a,3,4,b,5,6], X > 3]. +[a,4,b,5,6] ]]> +

This should be read as follows:

+ +

The list of X such that X is taken from the list [1,2,a,...] and X is greater than 3.

+
+

The notation is a generator and the expression X > 3 is a filter.

+

An additional filter can be added in order to restrict the result to integers:

+ [X || X <- [1,2,a,3,4,b,5,6], integer(X), X > 3]. +[4,5,6] ]]> +

Generators can be combined. For example, the Cartesian product of two lists can be written as follows:

+ [{X, Y} || X <- [1,2,3], Y <- [a,b]]. +[{1,a},{1,b},{2,a},{2,b},{3,a},{3,b}] ]]> + +
+ Quick Sort +

The well known quick sort routine can be written as follows:

+ + sort([ X || X <- T, X < Pivot]) ++ + [Pivot] ++ + sort([ X || X <- T, X >= Pivot]); +sort([]) -> []. ]]> +

The expression is the list of all elements in T, which are less than Pivot.

+

= Pivot]]]> is the list of all elements in T, which are greater or equal to Pivot.

+

To sort a list, we isolate the first element in the list and split the list into two sub-lists. The first sub-list contains all elements which are smaller than the first element in the list, the second contains all elements which are greater than or equal to the first element in the list. We then sort the sub-lists and combine the results.

+
+ +
+ Permutations +

The following example generates all permutations of the elements in a list:

+ [[]]; +perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])]. ]]> +

We take take H from L in all possible ways. The result is the set of all lists [H|T], where T is the set of all possible permutations of L with H removed.

+ + +> perms([b,u,g]). +[[b,u,g],[b,g,u],[u,b,g],[u,g,b],[g,b,u],[g,u,b]] +
+ +
+ Pythagorean Triplets +

Pythagorean triplets are sets of integers {A,B,C} such that A**2 + B**2 = C**2.

+

The function pyth(N) generates a list of all integers {A,B,C} such that A**2 + B**2 = C**2 and where the sum of the sides is less than N.

+ + [ {A,B,C} || + A <- lists:seq(1,N), + B <- lists:seq(1,N), + C <- lists:seq(1,N), + A+B+C =< N, + A*A+B*B == C*C + ]. ]]> +
+
+> pyth(3).
+[].
+> pyth(11).
+[].
+>pyth(12).
+[{3,4,5},{4,3,5}]
+> pyth(50).
+[{3,4,5},
+ {4,3,5},
+ {5,12,13},
+ {6,8,10},
+ {8,6,10},
+ {8,15,17},
+ {9,12,15},
+ {12,5,13},
+ {12,9,15},
+ {12,16,20},
+ {15,8,17},
+ {16,12,20}]
+

The following code reduces the search space and is more efficient:

+ + [{A,B,C} || + A <- lists:seq(1,N), + B <- lists:seq(1,N-A+1), + C <- lists:seq(1,N-A-B+2), + A+B+C =< N, + A*A+B*B == C*C ]. ]]> +
+ +
+ Simplifications with List Comprehensions +

As an example, list comprehensions can be used to simplify some of the functions in lists.erl:

+ [X || L1 <- L, X <- L1]. +map(Fun, L) -> [Fun(X) || X <- L]. +filter(Pred, L) -> [X || X <- L, Pred(X)]. ]]> +
+
+ +
+ Variable Bindings in List Comprehensions +

The scope rules for variables which occur in list comprehensions are as follows:

+ + all variables which occur in a generator pattern are assumed to be "fresh" variables + any variables which are defined before the list comprehension and which are used in filters have the values they had before the list comprehension + no variables may be exported from a list comprehension. + +

As an example of these rules, suppose we want to write the function select, which selects certain elements from a list of tuples. We might write [Y || {X, Y} <- L].]]> with the intention of extracting all tuples from L where the first item is X.

+

Compiling this yields the following diagnostic:

+ + +./FileName.erl:Line: Warning: variable 'X' shadowed in generate +

This diagnostic warns us that the variable X in the pattern is not the same variable as the variable X which occurs in the function head.

+

Evaluating select yields the following result:

+
+
+> select(b,[{a,1},{b,2},{c,3},{b,7}]).
+[1,2,3,7]    
+

This result is not what we wanted. To achieve the desired effect we must write select as follows:

+ [Y || {X1, Y} <- L, X == X1]. ]]> +

The generator now contains unbound variables and the test has been moved into the filter. This now works as expected:

+
+
+> select(b,[{a,1},{b,2},{c,3},{b,7}]).
+[2,7]    
+

One consequence of the rules for importing variables into a list comprehensions is that certain pattern matching operations have to be moved into the filters and cannot be written directly in the generators. To illustrate this, do not write as follows:

+ + Y = ... + [ Expression || PatternInvolving Y <- Expr, ...] + ... ]]> +

Instead, write as follows:

+ + Y = ... + [ Expression || PatternInvolving Y1 <- Expr, Y == Y1, ...] + ... + ]]> +
+
+ diff --git a/system/doc/extensions/list_comrehensions.erl b/system/doc/extensions/list_comrehensions.erl new file mode 100644 index 0000000000..f6a23b5dca --- /dev/null +++ b/system/doc/extensions/list_comrehensions.erl @@ -0,0 +1,75 @@ +-module(zf). + +-compile(export_all). + + +%% Odd numbers. + +%%foo(L) -> [ X || X <- L, (X > X-1) == (X /= X-1) ]. + +boo() -> [X||X <- [1,2,a,3,4,b,5,6], X > 3]. +boo1() -> [X||X <- [1,2,a,3,4,b,5,6], integer(X),X > 3]. +boo2() -> [{X,Y} || X <- [1,2,3], Y <- [a,b]]. + +bar(L) -> [ X || X <- L, integer(X), gt(X, 3) ]. + +bar(L, M) -> [ Y || X <- L, integer(X), gt(X, 3), + Y <- M, float(Y), gt(X, Y) + ]. + +baz(L) -> [ X || X <- L, atom(X) ]. + +buz(L, Min) -> [ X || Min > 3, X <- L, X >= Min ]. + +gt(X, Y) when X > Y -> true; +gt(X, Y) -> false. + + +%% Return the Pythagorean triangles with sides +%% of total length less than N +pyth(N) -> + [ {A,B,C} || + A <- lists:seq(1,N), + B <- lists:seq(1,N), + C <- lists:seq(1,N), + A+B+C =< N, + A*A+B*B == C*C + ]. + +%% Cut the search space a bit.. +pyth2(N) -> + [ {A,B,C} || + A <- lists:seq(1,N), + B <- lists:seq(1,N-A+1), + C <- lists:seq(1,N-A-B+2), + A+B+C =< N, + A*A+B*B == C*C ]. + +%% Return the Cartesian product + +cp(A,B) -> + [ {X,Y} || + X <- A, + Y <- B + ]. + +%% Return all permutations of a list +perms([]) -> [[]]; +perms(L) -> [ [H|T] || H <- L, T <- perms(L--[H]) ]. + +%% Quick sort +sort([X|Xs]) -> + sort([ Y || Y <- Xs, Y < X ]) ++ + [X] ++ + sort([ Y || Y <- Xs, Y >= X ]); +sort([]) -> []. + +%% append + +append(L) -> [X||L1<-L,X<-L1]. + +map(Fun, L) -> [Fun(X)||X<-L]. + +filter(Pred, L) -> [X||X<-L,Pred(X)]. + +select(X, L) -> [Y || {X1,Y} <- L, X == X1]. diff --git a/system/doc/extensions/macros.xml b/system/doc/extensions/macros.xml new file mode 100644 index 0000000000..feb3de6102 --- /dev/null +++ b/system/doc/extensions/macros.xml @@ -0,0 +1,177 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Macros + Joe Armstrong + Bjarne Däcker + 1 + Bjarne DäKer + + 96-09-10 + PA1 + macros.sgml +
+

Macros in Erlang are written with the following syntax:

+ + +-define(Const, Replacement). +-define(Fun(Var1, Var2,.., Var), Replacement). +

Macros are expanded when the syntax ?MacroName is encountered.

+

Consider the macro definition:

+ + +-define(timeout, 200). +

The expression ?timeout, which can occur anywhere in the code which follows the macro definition, will be replaced by 200.

+

Macros with arguments are written as follows:

+ + + -define(macro1(X, Y), {a, X, b, Y}). +

This type of macro can be used as follows:

+ + +bar(X) -> + ?macro1(a, b), + ?macro1(X, 123) +

This expands to:

+ + +bar(X) -> + {a,a,b,b}, + {a,X,b,123}. + +
+ Macros and Tokens +

Macro expansion works at a token level. We might define a macro as follows:

+ + +-define(macro2(X, Y), {a,X,b,Y). +

The replacement value of the macro is not a valid Erlang term because the closing right curly bracket is missing. macro2 expands into a sequence of tokens {, a, X which are then pasted into the place where the macro is used.

+

We might use this macro as follows:

+ + +bar() -> + ?macro2(x,y)}. +

This will expand into the valid sequence of tokens {a,x,y,b} before being parsed and compiled.

+ +

It is good programming practise to ensure that the replacement text of a macro is a valid Erlang syntactic form.

+
+
+ +
+ Pre-Defined Macros +

The following macros are pre-defined:

+ + ?MODULE. + This macro returns the name of the current module. + + ?MODULE_STRING. + This macro returns the name of the current module, as a string. + ?FILE. + This macro returns the current file name. + ?LINE. + This macro returns the current line number. + ?MACHINE. + This macro returns the current machine name, + 'BEAM', + +
+ +
+ Stringifying Macro Arguments +

The construction ??Arg for an argument to a macro expands to a + string containing the tokens of the argument, similar to the + #arg stringifying construction in C. This was added in Erlang + 5.0 (OTP R7A).

+

Example:

+ +-define(TESTCALL(Call), io:format("Call ~s: ~w~n", [??Call, Call])). + +?TESTCALL(myfunction(1,2)), +?TESTCALL(you:function(2,1)). +

results in

+ +io:format("Call ~s: ~w~n",["myfunction ( 1 , 2 )",m:myfunction(1,2)]), +io:format("Call ~s: ~w~n",["you : function ( 2 , 1 )",you:function(2,1)]). +
+ +
+ Flow Control in Macros +

The following macro directives are supplied:

+ + -undef(Macro). + Causes the macro to behave as if it had never been defined. + -ifdef(Macro). + Do the following lines if Macro is defined. + -ifndef(Macro). + Do the following lines if Macro is not defined. + -else. + "else" macro + -endif. + "endif" macro. + +

The conditional macros must be properly nested. They are usually grouped as follows:

+ + +-ifdef(debug) +-define(....) +-else +-define(...) +-endif +

The following example illustrates this grouping:

+ + +-define(debug, true). +-ifdef(debug). +-define(trace(Str, X), io:format("Mod:~w line:~w ~p ~p~n", + [?MODULE,?LINE, Str, X])). +-else. +-define(trace(X, Y), true). +-endif. +

Given these definitions, the expression ?trace("X=", X). in line 10 of the module foo expands to:

+ + +io:format("Mod:~w line:~w ~p ~p~n",[foo,100,"X=",[X]]), +

If we remove the -define(debug, true). line, then the same expression expands to true.

+
+ +
+ A Macro Expansion Utility +

The following code can be used to expand a macro and display the result:

+ + +-module(mexpand). +-export([file/1]). +-import(lists, [foreach/2]). +file(File) -> + case epp:parse_file(File ++ ".erl", [],[]) of + {ok, L} -> + {ok, Stream} = file:open(File ++ ".out", write), + foreach(fun(X) -> + io:format(Stream,"~s~n",[erl_pp:form(X)]) + end, L), + file:close(Stream) + end. +

Alternatively, we can compile the file with the 'P' option. compile:file(File, ['P']) produces a list file File.P, in which the result of any macro expansions can be seen.

+
+
+ diff --git a/system/doc/extensions/make.dep b/system/doc/extensions/make.dep new file mode 100644 index 0000000000..fdac959667 --- /dev/null +++ b/system/doc/extensions/make.dep @@ -0,0 +1,21 @@ +# ---------------------------------------------------- +# >>>> Do not edit this file <<<< +# This file was automaticly generated by +# /home/otp/bin/docdepend +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# TeX files that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: bit_syntax.tex book.tex funs.tex include.tex \ + list_comprehensions.tex macros.tex misc.tex \ + part.tex records.tex + +# ---------------------------------------------------- +# Source inlined when transforming from source to LaTeX +# ---------------------------------------------------- + +funs.tex: fun_test.erl funparse.erl funs1.erl + diff --git a/system/doc/extensions/mexpand.erl b/system/doc/extensions/mexpand.erl new file mode 100644 index 0000000000..261f99da46 --- /dev/null +++ b/system/doc/extensions/mexpand.erl @@ -0,0 +1,16 @@ +-module(mexpand). + +-export([file/1]). + +-import(lists, [foreach/2]). + +file(File) -> + case epp:parse_file(File ++ ".erl", [],[]) of + {ok, L} -> + {ok, Stream} = file:open(File ++ ".out", write), + foreach(fun(X) -> + io:format(Stream,"~s~n", + [erl_pp:form(X)]) + end, L), + file:close(Stream) + end. diff --git a/system/doc/extensions/misc.xml b/system/doc/extensions/misc.xml new file mode 100644 index 0000000000..576f705278 --- /dev/null +++ b/system/doc/extensions/misc.xml @@ -0,0 +1,310 @@ + + + + +
+ + 19992009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Miscellaneous + Arndt Jonasson + 1 + 99-01-25 + PA1 + misc.sgml +
+

In this chapter, a number of miscellaneous features of Erlang + are described.

+ +
+ Token Syntax +

In Erlang 4.8 (OTP R5A) the syntax of Erlang tokens have been + extended to allow the use of the full ISO-8859-1 (Latin-1) character + set. This is noticeable in the following ways:

+ + All the Latin-1 printable characters can be used and are shown without + the escape backslash convention. + Atoms and variables can use all Latin-1 letters. + +

The new characters from Latin-1 have the following + classifications in Erlang:

+ + + Octal + Decimal +   + Class + + + 200 - 237 + 128 - 159 +   + Control characters + + + 240 - 277 + 160 - 191 + - ¿ + Punctuation characters + + + 300 - 326 + 192 - 214 + À - Ö + Uppercase letters + + + 327 + 215 + × + Punctuation character + + + 330 - 336 + 216 - 222 + Ø - Þ + Uppercase letters + + + 337 - 366 + 223 - 246 + ß - ö + Lowercase letters + + + 367 + 247 + ÷ + Punctuation character + + + 370 - 377 + 248 - 255 + ø - ÿ + Lowercase letters + + Character classes +
+
+ +
+ String Concatenation +

Two adjacent string literals are concatenated into one. This is done already + at compile-time, and doesn't incur any runtime overhead. Example:

+ + "string" "42" +

is equivalent to

+ + "string42" +

This feature is convenient in at least two situations:

+ + when one of the + strings is the result of a macro expansion; + when a string is very + long, and would otherwise either have to wrap, making the source code + harder to read, or force the use of some runtime append operation. + +
+ +
+ The ++ list Concatenation Operator +

Since list concatenation is a very common operation, it is convenient + to have a terse way of expressing it. The ++ operator appends its second + argument to its first. Example: +

+ + X = [1,2,3], + Y = [4,5], + X ++ Y. +

results in [1,2,3,4,5].

+

The ++ operator has precedence between the binary '+' operator and + the comparison operators. +

+
+ +
+ The - - list Subtraction Operator +

The - - operator produces a list which is a copy of the first + argument, subjected to the following procedure: for each element in + the second argument, its first occurrence in the first argument is + removed.

+ + X = [1,2,3,2,1,2], + Y = [2,1,2], + X -- Y. +

results in [3,1,2].

+

The - - operator has precedence between the binary '+' operator and + the comparison operators. +

+
+ +
+ Bitwise Operator bnot +

Apart from the binary bitwise operators band, bor + and bxor, there is a unary operator bnot with the same + precedence as the other unary operators + and -, i.e., higher than + the binary operators. Example:

+ + bnot 7. +

returns -8. +

+
+ +
+ Logical Operators +

The atoms true and false are usually used for representing + Boolean values. With the binary operators and, or and + xor, and the unary operator not, Boolean values can be + combined. Example:

+ + + M1 = lists:member(A, List1), + M2 = lists:member(A, List2), + M1 and M2. +

Note that the operators are strict, i.e., they always evaluate both + their arguments.

+

not has the same priority as the other unary operators. The + binary logical operators have precedence between the = operator + and the comparison operators, the and operator having higher + precedence than or and xor. +

+
+ +
+ Match Operator = In Patterns +

This extension was added in Erlang 4.8 (OTP R5A).

+

The = operator is also called the `match' operator. The match operator + can now be used in a pattern, so that P1 = P2 is a valid pattern, + where both P1 and P2 are patterns. This compound pattern + when matched against a term causes the term to be matched against both + P1 and P2.

+

One use for this construction is to avoid reconstructing a term which + was part of an argument to a function. Example:

+ + f({'+',X,Y}=T) -> {X+Y,T}. +

It also makes it possible to rewrite the construction

+ + f(X) when X == #rec{x=1, y=a} -> ... +

as

+ + f(#rec{x=1, y=a} = X) -> ... +

In the absence of optimization for the former case, the + latter case is more efficient. +

+
+ +
+ Literal String Prefix in Patterns +

This extension was added in Erlang 4.8 (OTP R5A).

+

A new construction is allowed in patterns, namely a literal + string as the first operand of the ++ operator. Example:

+ + f("prefix" ++ L) -> ... +

This is syntactic sugar for the equivalent, but harder to read

+ + f([$p,$r,$e,$f,$i,$x | L]) -> ... +
+ +
+ Disjunctions in Guards +

This extension was added in Erlang 4.9 (OTP R6A).

+

A new construction is allowed in guards, the disjunction operator + ';'. The construction is syntactic sugar which removes the bother of + writing the same body after several guards.

+ + f(X) when xxx ; yyy ; zzz -> + pop(X). +

This is syntactic sugar for the equivalent

+ + f(X) when xxx -> + pop(X); + f(X) when yyy -> + pop(X); + f(X) when zzz -> + pop(X). +

The abstract format has been changed accordingly to contain a list of + (conjunctive) guards where there was previously only one guard. +

+
+ +
+ Expressions in Patterns +

This extension was added in Erlang 5.0 (OTP R7A).

+

An arithmetic expression can be used within a pattern, if it uses + only numeric or bitwise operators, and if its value can be evaluated + to a constant at compile-time. This is especially useful when the + expression is defined by a macro. +

+

Example:

+ + case X of + {1+2, T} -> T + end. +
+ +
+ Boolean expresions in guards +

This extension was added in Erlang 5.1 (OTP R8).

+

In guards, the use of and, or and not is + now allowed. Guard expressions can combine these with + parenthesis. This allows for more elaborate guards than what + may be given with , and ;.

+ +

The guard expressions written with these operators are boolean + expressions, and the boolean functions is_list, + is_integer etc. should be used, rather than + list, integer etc.

+
+

Example 1:

+ + f(X) when not (is_tuple(X) or is_list(X)) -> + ... +

Example 2:

+ 0) and (B > 0) and not (A*A < B*B) -> + ... ]]> +
+ +
+ Short-circuit boolean expressions +

This extension was added in Erlang 5.1 (OTP R8).

+

In a boolean expression it is unnecessary to always evaluate all + terms. If the first term gives a result that determines the + result, the second term is not needed. In Erlang two new + keywords handles boolean expressions without evaluating both + terms, if it's unnecessary. (This is called short-curcuit + boolean evaluation.)

+

The keyword andalso is a short-curcuit version of + and. The keyword orelse is a short-curcuit version + of or. They can be used in boolean expressions (not + guards) instead of and and or.

+

Example 1:

+ + case A >= -1.0 andalso math:sqrt(A+1) > B of +

This will work even if A is less than -1.0, since + in that case, the second term (after andalso) is never + evaluated. (Of course, the same effects could have been done + using guards. In guards, evaluation is always short-circuited, + since guard tests are known to be free of side-effects.)

+

Example 2:

+ + OnlyOne = is_atom(L) orelse + (is_list(L) andalso length(L) == 1), +
+
+ diff --git a/system/doc/extensions/part.xml b/system/doc/extensions/part.xml new file mode 100644 index 0000000000..56fd2c09a6 --- /dev/null +++ b/system/doc/extensions/part.xml @@ -0,0 +1,57 @@ + + + + +
+ + 1997 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Erlang Extensions Since 4.4 + OTP Team + + 1997-02-21 + E + part.sgml +
+ +

This chapter describes extensions made to the Erlang language + since version 4.4 (where nothing is said to the contrary, an extension + was added in version 4.4). + The chapter contains the following sections: +

+ + Records + Functional Objects (Funs) + List Comprehensions + Macros + File inclusion + Bit syntax + Miscellaneous + +
+ + + + + + + +
+ diff --git a/system/doc/extensions/records.xml b/system/doc/extensions/records.xml new file mode 100644 index 0000000000..21ec73ab77 --- /dev/null +++ b/system/doc/extensions/records.xml @@ -0,0 +1,284 @@ + + + + +
+ + 1997 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Records + Joe Armstrong + Bjarne Däcker + 1 + Bjarne DäKer + + 96-09-10 + PA1 + records.sgml +
+

A record is a data structure intended for storing a fixed number of related data items. It is + similar to a struct in C, or a record in Pascal.

+

The main advantage of using records instead of tuples is that fields in a record are accessed by name, whereas fields in a tuple are accessed by position. To illustrate these differences, suppose that we want to represent a person with the tuple{Name, Address, Phone}.

+

We must remember that the Name field is the first element of the tuple, the Address field is the second element, and so on, in order to write functions which manipulate this data. For example, to extract data from a variable P which contains such a tuple we might write the following code and then use pattern matching to extract the relevant fields.

+ + +Name = element(1, P), +Address = element(2, P), +... +

Code like this is difficult to read and understand and errors occur if we get the numbering of the elements in the tuple wrong. If we change the data representation by re-ordering the fields, or by adding or removing a field, then all references to the person tuple, wherever they occur, must be checked and possibly modified.

+

Records allow us to refer to the fields by name and not position. We use a record instead of a tuple to store the data . If we write a record definition of the type shown below, we can then refer to the fields of the record by name.

+ + +-record(person, {name, phone, address}). +

For example, if P is now a variable whose value is a person record, we can code as follows in order to access the name and address fields of the records.

+ + +Name = P#person.name, +Address = P#person.address, +... +

In the following sections we describe the different operations which can be performed on records:

+ +
+ Defining a Record +

A record is defined with the following syntax:

+ + +-record(RecordName, {Field1 [= DefaultValue1], + Field2 [= DefaultValue2], + ..., + FieldN [= DefaultValueN]}). +

The record name and field names must be atoms. The optional default values, which are terms, are used if no value is supplied for a field when a new instance of the record is created. If the default value is not supplied, then the atom undefined is assumed.

+

For example, in the following record definition, the address field is undefined.

+
+-record(person, {name = "", phone = [], address}).    
+

This definition of a person will be used in many of the examples which follow.

+
+ +
+ Including a Record Definition +

If the record is used in several modules, its definition should be placed in a .hrl header file. Each module which uses the record definition should have a -include(FileName). statement. For example:

+ + +-include("my_data_structures.hrl"). + +

The definition of the record must come before it is used.

+
+
+ +
+ Creating a Record +

A new record is created with the following syntax:

+ + +#RecordName{Field1=Expr1, + ..., + FieldM=ExprM}. +

If any of the fields is omitted, then the default value supplied in the record definition is used. For example:

+
+> #person{phone = [0,8,2,3,4,3,1,2], name = "Robert"}.
+{person, "Robert", [0,8,2,3,4,3,1,2], undefined}.          
+

There is a new feature introduced in Erlang 5.1 (OTP release + R8), with which you can set a value to all fields in a record, + overriding the defaults in the record specification. The special + field _, means "all fields not explicitly specified".

+
+> #person{name = "Jakob", _ = '_'}
+{person, "Jakob", '_', '_'}    
+

It is primarily intended to be used in ets:match/2 and + mnesia:match_object/3, to set record fields to the atom + '_'. (This is a wildcard in ets:match/2.)

+
+ +
+ Selectors +

The following syntax is used to select an individual field from a record:

+ + +Variable#RecordName.Field + +

The values contained in record names and fields must be constants, not variables.

+
+ +

For the purposes of illustration, we will demonstrate the use of records using an imaginary dialogue with the Erlang shell. Currently the Erlang evaluator does not support records so you may not be able to reproduce this dialogue.

+
+
+
+> P = #person{name = "Joe", phone = [0,8,2,3,4,3,1,2]}.
+{person, "Joe", [0,8,2,3,4,3,1,2], undefined}
+> P#person.name.
+"Joe"    
+ +

Selectors for records are allowed in guards.

+
+
+ +
+ Updating a Record +

The following syntax is used to create a new copy of the record with some of the fields changed. Only the fields to be changed need to be referred to, all other fields retain their old values.

+ + +OldVariable#RecordName{Field1 = NewValue1, + ..., + FieldM = NewValueM} +

For example:

+
+> P1 = #person{name="Joe", phone=[1,2,3], address="A street"}.
+{person, "Joe", [1,2,3], "A street"}
+> P2 = P1#person{name="Robert"}.
+{person, "Robert", [1,2,3], "A street"}    
+
+ +
+ Type Testing +

The following guard test is used to test the type of a record:

+ + +record(Variable, RecordName) +

The following example shows that the guard succeeds if P is record of type person.

+
+foo(P) when record(P, person) -> a_person;
+foo(_) -> not_a_person.    
+ +

This test checks that P is a tuple of arity N + 1, where N is the number + of fields in the record, and the first element in the tuple is the atom person.

+
+
+ +
+ Pattern Matching +

Matching can be used in combination with records as shown in the following example:

+
+> P = #person{name="Joe", phone=[0,0,7], address="A street"}.
+{person, "Joe", [0,0,7], "A street"}
+> #person{name = Name} = P, Name.
+"Joe"    
+

The following function takes a list of person records and searches for the phone number of a person with a particular name:

+ + +find_phone([#person{name=Name, phone=Phone} | _], Name) -> + {found, Phone}; +find_phone([_| T], Name) -> + find_phone(T, Name); +find_phone([], Name) -> + not_found. + +

The fields referred to in the pattern can be given in any order.

+
+
+ +
+ Nested Records +

The value of a field in a record might be an instance of a record. Retrieval of nested data can be done stepwise, or in a single step, as shown in the following example:

+
+-record(name, {first = "Robert", last = "Ericsson"}).
+-record(person, {name = #name{}, phone}).
+
+demo() ->
+  P = #person{name= #name{first="Robert",last="Virding"}, phone=123},
+  First = (P#person.name)#name.first.    
+ +

In this example, demo() evaluates to "Robert".

+
+
+ +
+ Internal Representation of Records +

It is often desirable to write generic functions which will work on any record, not just a record of a particular type. For this reason, records are represented internally as tuples and the ordering of the fields in the tuple is strictly defined.

+

For example, the record -record(person, {name, phone, address}). is represented internally by the tuple {person, X, Y, Z}.

+

The arity of the tuple is one more than the number of fields in the tuple. The first element of the tuple is the name of the record, and the elements of the tuple are the fields in the record. The variables X, Y and Z will store the data contained in the record fields.

+

The following two functions determine the indices in the tuple which refer to the named fields in the record:

+ + record_info(fields, Rec) -> [Names]. This function returns the names of the fields in the record Rec. For example, record_info(fields, person) evaluates to [name, address, phone]. + record_info(size, Rec) -> Size. This function returns the size of the record Rec when represented as a tuple, which is one more than the number of fields. For example, record_info(size, person) returns 4. + +

In addition, #Rec.Name returns the index in the tuple representation of Name of the record Rec.

+ +

Name must be an atom.

+
+

For example, the following test function test() might return the result shown:

+
+test() ->
+    {record_info(fields, person),
+     record_info(size, person),
+     #person.name}.    
+
+> Mod:test().
+{[name,address,phone],4,2}    
+

The order in which records map onto tuples is implementation dependent.

+ +

record_info is a pseudo-function which cannot be exported from the module where it occurs.

+
+
+ +
+ Example +
+%% File: person.hrl
+
+%%-----------------------------------------------------------
+%% Data Type: person
+%% where:
+%%    name:  A string (default is undefined).
+%%    age:   An integer (default is undefined).
+%%    phone: A list of integers (default is []).
+%%    dict:  A dictionary containing various information 
+%%           about the person. 
+%%           A {Key, Value} list (default is the empty list).
+%%------------------------------------------------------------
+-record(person, {name, age, phone = [], dict = []}).
+    
+
+-module(person).
+-include("person.hrl").
+-compile(export_all). % For test purposes only.
+
+%% This creates an instance of a person.
+%%   Note: The phone number is not supplied so the
+%%         default value [] will be used.
+
+make_hacker_without_phone(Name, Age) ->
+   #person{name = Name, age = Age, 
+           dict = [{computer_knowledge, excellent}, 
+                   {drinks, coke}]}.
+
+%% This demonstrates matching in arguments
+
+print(#person{name = Name, age = Age,
+              phone = Phone, dict = Dict}) ->
+  io:format("Name: ~s, Age: ~w, Phone: ~w ~n" 
+            "Dictionary: ~w.~n", [Name, Age, Phone, Dict]).
+
+%% Demonstrates type testing, selector, updating.
+
+birthday(P) when record(P, person) -> 
+   P#person{age = P#person.age + 1}.
+
+register_two_hackers() ->
+   Hacker1 = make_hacker_without_phone("Joe", 29),
+   OldHacker = birthday(Hacker1),
+   % The central_register_server should have 
+   % an interface function for this.
+   central_register_server ! {register_person, Hacker1},
+   central_register_server ! {register_person, 
+             OldHacker#person{name = "Robert", 
+                              phone = [0,8,3,2,4,5,3,1]}}.    
+
+
+ diff --git a/system/doc/extensions/warning.gif b/system/doc/extensions/warning.gif new file mode 100644 index 0000000000..96af52360e Binary files /dev/null and b/system/doc/extensions/warning.gif differ diff --git a/system/doc/getting_started/Makefile b/system/doc/getting_started/Makefile new file mode 100644 index 0000000000..5ca885d56e --- /dev/null +++ b/system/doc/getting_started/Makefile @@ -0,0 +1,100 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 1996-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include $(ERL_TOP)/erts/vsn.mk +#VSN=$(SYSTEM_VSN) + +APPLICATION=otp-system-documentation +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/doc/getting_started + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +XML_PART_FILES = part.xml + +include xmlfiles.mk + +XML_CHAPTER_FILES = $(GETTING_STARTED_CHAPTER_FILES) + +TOPDOCDIR=.. + +BOOK_FILES = book.xml + +GIF_FILES = + +PS_FILES = $(GIF_FILES:%.gif=%.ps) + +XML_FILES = \ + $(BOOK_FILES) $(XML_CHAPTER_FILES) \ + $(XML_PART_FILES) +# ---------------------------------------------------- + +HTML_FILES = \ + $(XML_PART_FILES:%.xml=%.html) + +HTMLDIR = ../html/getting_started + + +HTML_UG_FILE = $(HTMLDIR)/users_guide.html + + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAGS += +DVIPS_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +docs: html + +local_docs: PDFDIR=../../pdf + +html: $(GIF_FILES) $(HTML_UG_FILE) + +debug opt: + +clean clean_docs: + rm -rf $(HTMLDIR) + rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f errs core *~ + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_docs_spec: docs +# $(INSTALL_DIR) $(RELEASE_PATH)/pdf +# $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELEASE_PATH)/pdf + $(INSTALL_DIR) $(RELSYSDIR) + $(INSTALL_DATA) $(GIF_FILES) $(HTMLDIR)/*.html \ + $(RELSYSDIR) + +release_spec: diff --git a/system/doc/getting_started/book.xml b/system/doc/getting_started/book.xml new file mode 100644 index 0000000000..c256dc1317 --- /dev/null +++ b/system/doc/getting_started/book.xml @@ -0,0 +1,43 @@ + + + + +
+ + 19962009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Getting Started with Erlang + Mike Williams + + + + book.sgml +
+ + + Getting Started with Erlang + + + + + + + + +
+ diff --git a/system/doc/getting_started/conc_prog.xml b/system/doc/getting_started/conc_prog.xml new file mode 100644 index 0000000000..34ae428b2c --- /dev/null +++ b/system/doc/getting_started/conc_prog.xml @@ -0,0 +1,894 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Concurrent Programming + + + + + conc_prog.xml +
+ +
+ Processes +

One of the main reasons for using Erlang instead of other + functional languages is Erlang's ability to handle concurrency + and distributed programming. By concurrency we mean programs + which can handle several threads of execution at the same time. + For example, modern operating systems would allow you to use a + word processor, a spreadsheet, a mail client and a print job all + running at the same time. Of course each processor (CPU) in + the system is probably only handling one thread (or job) at a + time, but it swaps between the jobs a such a rate that it gives + the illusion of running them all at the same time. It is easy to + create parallel threads of execution in an Erlang program and it + is easy to allow these threads to communicate with each other. In + Erlang we call each thread of execution a process.

+

(Aside: the term "process" is usually used when the threads of + execution share no data with each other and the term "thread" + when they share data in some way. Threads of execution in Erlang + share no data, that's why we call them processes).

+

The Erlang BIF spawn is used to create a new process: + spawn(Module, Exported_Function, List of Arguments). + Consider the following module:

+ +-module(tut14). + +-export([start/0, say_something/2]). + +say_something(What, 0) -> + done; +say_something(What, Times) -> + io:format("~p~n", [What]), + say_something(What, Times - 1). + +start() -> + spawn(tut14, say_something, [hello, 3]), + spawn(tut14, say_something, [goodbye, 3]). +
+5> c(tut14).
+{ok,tut14}
+6> tut14:say_something(hello, 3).
+hello
+hello
+hello
+done
+

We can see that function say_something writes its first + argument the number of times specified by second argument. Now + look at the function start. It starts two Erlang processes, + one which writes "hello" three times and one which writes + "goodbye" three times. Both of these processes use the function + say_something. Note that a function used in this way by + spawn to start a process must be exported from the module + (i.e. in the -export at the start of the module).

+
+9> tut14:start().
+hello
+goodbye
+<0.63.0>
+hello
+goodbye
+hello
+goodbye
+

Notice that it didn't write "hello" three times and then + "goodbye" three times, but the first process wrote a "hello", + the second a "goodbye", the first another "hello" and so forth. + But where did the <0.63.0> come from? The return value of a + function is of course the return value of the last "thing" in + the function. The last thing in the function start is

+ +spawn(tut14, say_something, [goodbye, 3]). +

spawn returns a process identifier, or + pid, which uniquely identifies the process. So <0.63.0> + is the pid of the spawn function call above. We will see + how to use pids in the next example.

+

Note as well that we have used ~p instead of ~w in + io:format. To quote the manual: "~p Writes the data with + standard syntax in the same way as ~w, but breaks terms whose + printed representation is longer than one line into many lines + and indents each line sensibly. It also tries to detect lists of + printable characters and to output these as strings".

+
+ +
+ Message Passing +

In the following example we create two processes which send + messages to each other a number of times.

+ +-module(tut15). + +-export([start/0, ping/2, pong/0]). + +ping(0, Pong_PID) -> + Pong_PID ! finished, + io:format("ping finished~n", []); + +ping(N, Pong_PID) -> + Pong_PID ! {ping, self()}, + receive + pong -> + io:format("Ping received pong~n", []) + end, + ping(N - 1, Pong_PID). + +pong() -> + receive + finished -> + io:format("Pong finished~n", []); + {ping, Ping_PID} -> + io:format("Pong received ping~n", []), + Ping_PID ! pong, + pong() + end. + +start() -> + Pong_PID = spawn(tut15, pong, []), + spawn(tut15, ping, [3, Pong_PID]). +
+1> c(tut15).
+{ok,tut15}
+2> tut15: start().
+<0.36.0>
+Pong received ping
+Ping received pong
+Pong received ping
+Ping received pong
+Pong received ping
+Ping received pong
+ping finished
+Pong finished
+

The function start first creates a process, let's call it + "pong":

+ +Pong_PID = spawn(tut15, pong, []) +

This process executes tut15:pong(). Pong_PID is + the process identity of the "pong" process. The function + start now creates another process "ping".

+ +spawn(tut15, ping, [3, Pong_PID]), +

this process executes

+ +tut15:ping(3, Pong_PID) +

<0.36.0> is the return value from the start function.

+

The process "pong" now does:

+ +receive + finished -> + io:format("Pong finished~n", []); + {ping, Ping_PID} -> + io:format("Pong received ping~n", []), + Ping_PID ! pong, + pong() +end. +

The receive construct is used to allow processes to wait + for messages from other processes. It has the format:

+ +receive + pattern1 -> + actions1; + pattern2 -> + actions2; + .... + patternN + actionsN +end. +

Note: no ";" before the end.

+

Messages between Erlang processes are simply valid Erlang terms. + I.e. they can be lists, tuples, integers, atoms, pids etc.

+

Each process has its own input queue for messages it receives. + New messages received are put at the end of the queue. When a + process executes a receive, the first message in the queue + is matched against the first pattern in the receive, if + this matches, the message is removed from the queue and + the actions corresponding to the the pattern are executed.

+

However, if the first pattern does not match, the second pattern + is tested, if this matches the message is removed from the queue + and the actions corresponding to the second pattern are executed. + If the second pattern does not match the third is tried and so on + until there are no more pattern to test. If there are no more + patterns to test, the first message is kept in the queue and we + try the second message instead. If this matches any pattern, + the appropriate actions are executed and the second message is + removed from the queue (keeping the first message and any other + messages in the queue). If the second message does not match we + try the third message and so on until we reach the end of + the queue. If we reach the end of the queue, the process blocks + (stops execution) and waits until a new message is received and + this procedure is repeated.

+

Of course the Erlang implementation is "clever" and minimizes + the number of times each message is tested against the patterns + in each receive.

+

Now back to the ping pong example.

+

"Pong" is waiting for messages. If the atom finished is + received, "pong" writes "Pong finished" to the output and as it + has nothing more to do, terminates. If it receives a message with + the format:

+ +{ping, Ping_PID} +

it writes "Pong received ping" to the output and sends the atom + pong to the process "ping":

+ +Ping_PID ! pong +

Note how the operator "!" is used to send messages. The syntax + of "!" is:

+ +Pid ! Message +

I.e. Message (any Erlang term) is sent to the process + with identity Pid.

+

After sending the message pong, to the process "ping", + "pong" calls the pong function again, which causes it to + get back to the receive again and wait for another message. + Now let's look at the process "ping". Recall that it was started + by executing:

+ +tut15:ping(3, Pong_PID) +

Looking at the function ping/2 we see that the second + clause of ping/2 is executed since the value of the first + argument is 3 (not 0) (first clause head is + ping(0,Pong_PID), second clause head is + ping(N,Pong_PID), so N becomes 3).

+

The second clause sends a message to "pong":

+ +Pong_PID ! {ping, self()}, +

self() returns the pid of the process which executes + self(), in this case the pid of "ping". (Recall the code + for "pong", this will land up in the variable Ping_PID in + the receive previously explained).

+

"Ping" now waits for a reply from "pong":

+ +receive + pong -> + io:format("Ping received pong~n", []) +end, +

and writes "Ping received pong" when this reply arrives, after + which "ping" calls the ping function again.

+ +ping(N - 1, Pong_PID) +

N-1 causes the first argument to be decremented until it + becomes 0. When this occurs, the first clause of ping/2 + will be executed:

+ +ping(0, Pong_PID) -> + Pong_PID ! finished, + io:format("ping finished~n", []); +

The atom finished is sent to "pong" (causing it to + terminate as described above) and "ping finished" is written to + the output. "Ping" then itself terminates as it has nothing left + to do.

+
+ +
+ Registered Process Names +

In the above example, we first created "pong" so as to be able + to give the identity of "pong" when we started "ping". I.e. in + some way "ping" must be able to know the identity of "pong" in + order to be able to send a message to it. Sometimes processes + which need to know each others identities are started completely + independently of each other. Erlang thus provides a mechanism for + processes to be given names so that these names can be used as + identities instead of pids. This is done by using + the register BIF:

+ +register(some_atom, Pid) +

We will now re-write the ping pong example using this and giving + the name pong to the "pong" process:

+ +-module(tut16). + +-export([start/0, ping/1, pong/0]). + +ping(0) -> + pong ! finished, + io:format("ping finished~n", []); + +ping(N) -> + pong ! {ping, self()}, + receive + pong -> + io:format("Ping received pong~n", []) + end, + ping(N - 1). + +pong() -> + receive + finished -> + io:format("Pong finished~n", []); + {ping, Ping_PID} -> + io:format("Pong received ping~n", []), + Ping_PID ! pong, + pong() + end. + +start() -> + register(pong, spawn(tut16, pong, [])), + spawn(tut16, ping, [3]). +
+2> c(tut16).
+{ok, tut16}
+3> tut16:start().
+<0.38.0>
+Pong received ping
+Ping received pong
+Pong received ping
+Ping received pong
+Pong received ping
+Ping received pong
+ping finished
+Pong finished
+

In the start/0 function,

+ +register(pong, spawn(tut16, pong, [])), +

both spawns the "pong" process and gives it the name pong. + In the "ping" process we can now send messages to pong by:

+ +pong ! {ping, self()}, +

so that ping/2 now becomes ping/1 as we don't have + to use the argument Pong_PID.

+
+ +
+ Distributed Programming +

Now let's re-write the ping pong program with "ping" and "pong" + on different computers. Before we do this, there are a few things + we need to set up to get this to work. The distributed Erlang + implementation provides a basic security mechanism to prevent + unauthorized access to an Erlang system on another computer + (*manual*). Erlang systems which talk to each other must have + the same magic cookie. The easiest way to achieve this + is by having a file called .erlang.cookie in your home + directory on all machines which on which you are going to run + Erlang systems communicating with each other (on Windows systems + the home directory is the directory where pointed to by the $HOME + environment variable - you may need to set this. On Linux or Unix + you can safely ignore this and simply create a file called + .erlang.cookie in the directory you get to after executing + the command cd without any argument). + The .erlang.cookie file should contain on line with + the same atom. For example on Linux or Unix in the OS shell:

+
+$ cd
+$ cat > .erlang.cookie
+this_is_very_secret
+$ chmod 400 .erlang.cookie
+

The chmod above make the .erlang.cookie file + accessible only by the owner of the file. This is a requirement.

+

When you start an Erlang system which is going to talk to other + Erlang systems, you must give it a name, eg:

+
+$ erl -sname my_name
+

We will see more details of this later (*manual*). If you want to + experiment with distributed Erlang, but you only have one + computer to work on, you can start two separate Erlang systems on + the same computer but give them different names. Each Erlang + system running on a computer is called an Erlang node.

+

(Note: erl -sname assumes that all nodes are in the same + IP domain and we can use only the first component of the IP + address, if we want to use nodes in different domains we use + -name instead, but then all IP address must be given in + full (*manual*).

+

Here is the ping pong example modified to run on two separate + nodes:

+ +-module(tut17). + +-export([start_ping/1, start_pong/0, ping/2, pong/0]). + +ping(0, Pong_Node) -> + {pong, Pong_Node} ! finished, + io:format("ping finished~n", []); + +ping(N, Pong_Node) -> + {pong, Pong_Node} ! {ping, self()}, + receive + pong -> + io:format("Ping received pong~n", []) + end, + ping(N - 1, Pong_Node). + +pong() -> + receive + finished -> + io:format("Pong finished~n", []); + {ping, Ping_PID} -> + io:format("Pong received ping~n", []), + Ping_PID ! pong, + pong() + end. + +start_pong() -> + register(pong, spawn(tut17, pong, [])). + +start_ping(Pong_Node) -> + spawn(tut17, ping, [3, Pong_Node]). +

Let us assume we have two computers called gollum and kosken. We + will start a node on kosken called ping and then a node on gollum + called pong.

+

On kosken (on a Linux/Unix system):

+
+kosken> erl -sname ping
+Erlang (BEAM) emulator version 5.2.3.7 [hipe] [threads:0]
+
+Eshell V5.2.3.7  (abort with ^G)
+(ping@kosken)1>
+

On gollum:

+
+gollum> erl -sname pong
+Erlang (BEAM) emulator version 5.2.3.7 [hipe] [threads:0]
+
+Eshell V5.2.3.7  (abort with ^G)
+(pong@gollum)1>
+

Now we start the "pong" process on gollum:

+
+(pong@gollum)1> tut17:start_pong().
+true
+

and start the "ping" process on kosken (from the code above you + will see that a parameter of the start_ping function is + the node name of the Erlang system where "pong" is running):

+
+(ping@kosken)1> tut17:start_ping(pong@gollum).
+<0.37.0>
+Ping received pong
+Ping received pong 
+Ping received pong
+ping finished
+

Here we see that the ping pong program has run, on the "pong" + side we see:

+
+(pong@gollum)2>
+Pong received ping                 
+Pong received ping                 
+Pong received ping                 
+Pong finished                      
+(pong@gollum)2>
+

Looking at the tut17 code we see that the pong + function itself is unchanged, the lines:

+ +{ping, Ping_PID} -> + io:format("Pong received ping~n", []), + Ping_PID ! pong, +

work in the same way irrespective of on which node the "ping" + process is executing. Thus Erlang pids contain information about + where the process executes so if you know the pid of a process, + the "!" operator can be used to send it a message if the process + is on the same node or on a different node.

+

A difference is how we send messages to a registered process on + another node:

+ +{pong, Pong_Node} ! {ping, self()}, +

We use a tuple {registered_name,node_name} instead of + just the registered_name.

+

In the previous example, we started "ping" and "pong" from + the shells of two separate Erlang nodes. spawn can also be + used to start processes in other nodes. The next example is + the ping pong program, yet again, but this time we will start + "ping" in another node:

+ +-module(tut18). + +-export([start/1, ping/2, pong/0]). + +ping(0, Pong_Node) -> + {pong, Pong_Node} ! finished, + io:format("ping finished~n", []); + +ping(N, Pong_Node) -> + {pong, Pong_Node} ! {ping, self()}, + receive + pong -> + io:format("Ping received pong~n", []) + end, + ping(N - 1, Pong_Node). + +pong() -> + receive + finished -> + io:format("Pong finished~n", []); + {ping, Ping_PID} -> + io:format("Pong received ping~n", []), + Ping_PID ! pong, + pong() + end. + +start(Ping_Node) -> + register(pong, spawn(tut18, pong, [])), + spawn(Ping_Node, tut18, ping, [3, node()]). +

Assuming an Erlang system called ping (but not the "ping" + process) has already been started on kosken, then on gollum we do:

+
+(pong@gollum)1> tut18:start(ping@kosken).
+<3934.39.0>
+Pong received ping
+Ping received pong
+Pong received ping
+Ping received pong
+Pong received ping
+Ping received pong
+Pong finished
+ping finished
+

Notice we get all the output on gollum. This is because the io + system finds out where the process is spawned from and sends all + output there.

+
+ +
+ A Larger Example +

Now for a larger example. We will make an extremely simple + "messenger". The messenger is a program which allows users to log + in on different nodes and send simple messages to each other.

+

Before we start, let's note the following:

+ + +

This example will just show the message passing logic no + attempt at all has been made to provide a nice graphical user + interface - this can of course also be done in Erlang - but + that's another tutorial.

+
+ +

This sort of problem can be solved more easily if you use + the facilities in OTP, which will also provide methods for + updating code on the fly etc. But again, that's another + tutorial.

+
+ +

The first program we write will contain some inadequacies as + regards handling of nodes which disappear, we will correct + these in a later version of the program.

+
+
+

We will set up the messenger by allowing "clients" to connect to + a central server and say who and where they are. I.e. a user + won't need to know the name of the Erlang node where another user + is located to send a message.

+

File messenger.erl:

+ + +%%% Message passing utility. +%%% User interface: +%%% logon(Name) +%%% One user at a time can log in from each Erlang node in the +%%% system messenger: and choose a suitable Name. If the Name +%%% is already logged in at another node or if someone else is +%%% already logged in at the same node, login will be rejected +%%% with a suitable error message. +%%% logoff() +%%% Logs off anybody at at node +%%% message(ToName, Message) +%%% sends Message to ToName. Error messages if the user of this +%%% function is not logged on or if ToName is not logged on at +%%% any node. +%%% +%%% One node in the network of Erlang nodes runs a server which maintains +%%% data about the logged on users. The server is registered as "messenger" +%%% Each node where there is a user logged on runs a client process registered +%%% as "mess_client" +%%% +%%% Protocol between the client processes and the server +%%% ---------------------------------------------------- +%%% +%%% To server: {ClientPid, logon, UserName} +%%% Reply {messenger, stop, user_exists_at_other_node} stops the client +%%% Reply {messenger, logged_on} logon was successful +%%% +%%% To server: {ClientPid, logoff} +%%% Reply: {messenger, logged_off} +%%% +%%% To server: {ClientPid, logoff} +%%% Reply: no reply +%%% +%%% To server: {ClientPid, message_to, ToName, Message} send a message +%%% Reply: {messenger, stop, you_are_not_logged_on} stops the client +%%% Reply: {messenger, receiver_not_found} no user with this name logged on +%%% Reply: {messenger, sent} Message has been sent (but no guarantee) +%%% +%%% To client: {message_from, Name, Message}, +%%% +%%% Protocol between the "commands" and the client +%%% ---------------------------------------------- +%%% +%%% Started: messenger:client(Server_Node, Name) +%%% To client: logoff +%%% To client: {message_to, ToName, Message} +%%% +%%% Configuration: change the server_node() function to return the +%%% name of the node where the messenger server runs + +-module(messenger). +-export([start_server/0, server/1, logon/1, logoff/0, message/2, client/2]). + +%%% Change the function below to return the name of the node where the +%%% messenger server runs +server_node() -> + messenger@bill. + +%%% This is the server process for the "messenger" +%%% the user list has the format [{ClientPid1, Name1},{ClientPid22, Name2},...] +server(User_List) -> + receive + {From, logon, Name} -> + New_User_List = server_logon(From, Name, User_List), + server(New_User_List); + {From, logoff} -> + New_User_List = server_logoff(From, User_List), + server(New_User_List); + {From, message_to, To, Message} -> + server_transfer(From, To, Message, User_List), + io:format("list is now: ~p~n", [User_List]), + server(User_List) + end. + +%%% Start the server +start_server() -> + register(messenger, spawn(messenger, server, [[]])). + + +%%% Server adds a new user to the user list +server_logon(From, Name, User_List) -> + %% check if logged on anywhere else + case lists:keymember(Name, 2, User_List) of + true -> + From ! {messenger, stop, user_exists_at_other_node}, %reject logon + User_List; + false -> + From ! {messenger, logged_on}, + [{From, Name} | User_List] %add user to the list + end. + +%%% Server deletes a user from the user list +server_logoff(From, User_List) -> + lists:keydelete(From, 1, User_List). + + +%%% Server transfers a message between user +server_transfer(From, To, Message, User_List) -> + %% check that the user is logged on and who he is + case lists:keysearch(From, 1, User_List) of + false -> + From ! {messenger, stop, you_are_not_logged_on}; + {value, {From, Name}} -> + server_transfer(From, Name, To, Message, User_List) + end. +%%% If the user exists, send the message +server_transfer(From, Name, To, Message, User_List) -> + %% Find the receiver and send the message + case lists:keysearch(To, 2, User_List) of + false -> + From ! {messenger, receiver_not_found}; + {value, {ToPid, To}} -> + ToPid ! {message_from, Name, Message}, + From ! {messenger, sent} + end. + + +%%% User Commands +logon(Name) -> + case whereis(mess_client) of + undefined -> + register(mess_client, + spawn(messenger, client, [server_node(), Name])); + _ -> already_logged_on + end. + +logoff() -> + mess_client ! logoff. + +message(ToName, Message) -> + case whereis(mess_client) of % Test if the client is running + undefined -> + not_logged_on; + _ -> mess_client ! {message_to, ToName, Message}, + ok +end. + + +%%% The client process which runs on each server node +client(Server_Node, Name) -> + {messenger, Server_Node} ! {self(), logon, Name}, + await_result(), + client(Server_Node). + +client(Server_Node) -> + receive + logoff -> + {messenger, Server_Node} ! {self(), logoff}, + exit(normal); + {message_to, ToName, Message} -> + {messenger, Server_Node} ! {self(), message_to, ToName, Message}, + await_result(); + {message_from, FromName, Message} -> + io:format("Message from ~p: ~p~n", [FromName, Message]) + end, + client(Server_Node). + +%%% wait for a response from the server +await_result() -> + receive + {messenger, stop, Why} -> % Stop the client + io:format("~p~n", [Why]), + exit(normal); + {messenger, What} -> % Normal response + io:format("~p~n", [What]) + end. +

To use this program you need to:

+ + configure the server_node() function + copy the compiled code (messenger.beam) to + the directory on each computer where you start Erlang. + +

In the following example of use of this program, I have started + nodes on four different computers, but if you don't have that + many machines available on your network, you could start up + several nodes on the same machine.

+

We start up four Erlang nodes, messenger@super, c1@bilbo, + c2@kosken, c3@gollum.

+

First we start up a the server at messenger@super:

+
+(messenger@super)1> messenger:start_server().
+true
+

Now Peter logs on at c1@bilbo:

+
+(c1@bilbo)1> messenger:logon(peter).
+true
+logged_on
+

James logs on at c2@kosken:

+
+(c2@kosken)1> messenger:logon(james).
+true
+logged_on
+

and Fred logs on at c3@gollum:

+
+(c3@gollum)1> messenger:logon(fred).
+true
+logged_on
+

Now Peter sends Fred a message:

+
+(c1@bilbo)2> messenger:message(fred, "hello").
+ok
+sent
+

And Fred receives the message and sends a message to Peter and + logs off:

+
+Message from peter: "hello"
+(c3@gollum)2> messenger:message(peter, "go away, I'm busy").
+ok
+sent
+(c3@gollum)3> messenger:logoff().
+logoff
+

James now tries to send a message to Fred:

+
+(c2@kosken)2> messenger:message(fred, "peter doesn't like you").
+ok
+receiver_not_found
+

But this fails as Fred has already logged off.

+

First let's look at some of the new concepts we have introduced.

+

There are two versions of the server_transfer function, + one with four arguments (server_transfer/4) and one with + five (server_transfer/5). These are regarded by Erlang as + two separate functions.

+

Note how we write the server function so that it calls + itself, server(User_List) and thus creates a loop. + The Erlang compiler is "clever" and optimizes the code so that + this really is a sort of loop and not a proper function call. But + this only works if there is no code after the call, otherwise + the compiler will expect the call to return and make a proper + function call. This would result in the process getting bigger + and bigger for every loop.

+

We use functions in the lists module. This is a very + useful module and a study of the manual page is recommended + (erl -man lists). + lists:keymember(Key,Position,Lists) looks through a list + of tuples and looks at Position in each tuple to see if it + is the same as Key. The first element is position 1. If it + finds a tuple where the element at Position is the same as + Key, it returns true, otherwise false.

+
+3> lists:keymember(a, 2, [{x,y,z},{b,b,b},{b,a,c},{q,r,s}]).
+true
+4> lists:keymember(p, 2, [{x,y,z},{b,b,b},{b,a,c},{q,r,s}]).
+false
+

lists:keydelete works in the same way but deletes + the first tuple found (if any) and returns the remaining list:

+
+5> lists:keydelete(a, 2, [{x,y,z},{b,b,b},{b,a,c},{q,r,s}]).
+[{x,y,z},{b,b,b},{q,r,s}]
+

lists:keysearch is like lists:keymember, but it + returns {value,Tuple_Found} or the atom false.

+

There are a lot more very useful functions in the lists + module.

+

An Erlang process will (conceptually) run until it does a + receive and there is no message which it wants to receive + in the message queue. I say "conceptually" because the Erlang + system shares the CPU time between the active processes in + the system.

+

A process terminates when there is nothing more for it to do, + i.e. the last function it calls simply returns and doesn't call + another function. Another way for a process to terminate is for + it to call exit/1. The argument to exit/1 has a + special meaning which we will look at later. In this example we + will do exit(normal) which has the same effect as a + process running out of functions to call.

+

The BIF whereis(RegisteredName) checks if a registered + process of name RegisteredName exists and return the pid + of the process if it does exist or the atom undefined if + it does not.

+

You should by now be able to understand most of the code above + so I'll just go through one case: a message is sent from one user + to another.

+

The first user "sends" the message in the example above by:

+ +messenger:message(fred, "hello") +

After testing that the client process exists:

+ +whereis(mess_client) +

and a message is sent to mess_client:

+ +mess_client ! {message_to, fred, "hello"} +

The client sends the message to the server by:

+ +{messenger, messenger@super} ! {self(), message_to, fred, "hello"}, +

and waits for a reply from the server.

+

The server receives this message and calls:

+ +server_transfer(From, fred, "hello", User_List), +

which checks that the pid From is in the User_List:

+ +lists:keysearch(From, 1, User_List) +

If keysearch returns the atom false, some sort of + error has occurred and the server sends back the message:

+ +From ! {messenger, stop, you_are_not_logged_on} +

which is received by the client which in turn does + exit(normal) and terminates. If keysearch returns + {value,{From,Name}} we know that the user is logged on and + is his name (peter) is in variable Name. We now call:

+ +server_transfer(From, peter, fred, "hello", User_List) +

Note that as this is server_transfer/5 it is not the same + as the previous function server_transfer/4. We do another + keysearch on User_List to find the pid of the client + corresponding to fred:

+ +lists:keysearch(fred, 2, User_List) +

This time we use argument 2 which is the second element in + the tuple. If this returns the atom false we know that + fred is not logged on and we send the message:

+ +From ! {messenger, receiver_not_found}; +

which is received by the client, if keysearch returns:

+ +{value, {ToPid, fred}} +

we send the message:

+ +ToPid ! {message_from, peter, "hello"}, +

to fred's client and the message:

+ +From ! {messenger, sent} +

to peter's client.

+

Fred's client receives the message and prints it:

+ +{message_from, peter, "hello"} -> + io:format("Message from ~p: ~p~n", [peter, "hello"]) +

and peter's client receives the message in + the await_result function.

+
+
+ diff --git a/system/doc/getting_started/intro.xml b/system/doc/getting_started/intro.xml new file mode 100644 index 0000000000..7b42080723 --- /dev/null +++ b/system/doc/getting_started/intro.xml @@ -0,0 +1,66 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Introduction + + + + + intro.xml +
+ +
+ Introduction +

This is a "kick start" tutorial to get you started with Erlang. + Everything here is true, but only part of the truth. For example, + I'll only tell you the simplest form of the syntax, not all + esoteric forms. Where I've greatly oversimplified things I'll + write *manual* which means there is lots more information to be + found in the Erlang book or in the Erlang Reference Manual.

+

I also assume that this isn't the first time you have touched a + computer and you have a basic idea about how they are programmed. + Don't worry, I won't assume you're a wizard programmer.

+
+ +
+ Things Left Out +

In particular the following has been omitted:

+ + References + Local error handling (catch/throw) + Single direction links (monitor) + Handling of binary data (binaries / bit syntax) + List comprehensions + How to communicate with the outside world and/or software + written in other languages (ports). There is however a separate + tutorial for this, Interoperability Tutorial + Very few of the Erlang libraries have been touched on (for + example file handling) + OTP has been totally skipped and in consequence the Mnesia + database has been skipped. + Hash tables for Erlang terms (ETS) + Changing code in running systems + +
+
+ diff --git a/system/doc/getting_started/make.dep b/system/doc/getting_started/make.dep new file mode 100644 index 0000000000..69b177f77c --- /dev/null +++ b/system/doc/getting_started/make.dep @@ -0,0 +1,14 @@ +# ---------------------------------------------------- +# >>>> Do not edit this file <<<< +# This file was automaticly generated by +# /home/otp/bin/docdepend +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# TeX files that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: book.tex conc_prog.tex intro.tex part.tex \ + records_macros.tex robustness.tex seq_prog.tex + diff --git a/system/doc/getting_started/part.xml b/system/doc/getting_started/part.xml new file mode 100644 index 0000000000..4c277419a4 --- /dev/null +++ b/system/doc/getting_started/part.xml @@ -0,0 +1,36 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Getting Started With Erlang + + + + +
+ + + + + +
+ diff --git a/system/doc/getting_started/records_macros.xml b/system/doc/getting_started/records_macros.xml new file mode 100644 index 0000000000..45617f0183 --- /dev/null +++ b/system/doc/getting_started/records_macros.xml @@ -0,0 +1,328 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Records and Macros + + + + + record_macros.xml +
+

Larger programs are usually written as a collection of files with + a well defined interface between the various parts.

+ +
+ The Larger Example Divided into Several Files +

To illustrate this, we will divide the messenger example from + the previous chapter into five files.

+ + mess_config.hrl + header file for configuration data + mess_interface.hrl + interface definitions between the client and the messenger + user_interface.erl + functions for the user interface + mess_client.erl + functions for the client side of the messenger + mess_server.erl + functions for the server side of the messenger + +

While doing this we will also clean up the message passing + interface between the shell, the client and the server and define + it using records, we will also introduce macros.

+ +%%%----FILE mess_config.hrl---- + +%%% Configure the location of the server node, +-define(server_node, messenger@super). + +%%%----END FILE---- + +%%%----FILE mess_interface.hrl---- + +%%% Message interface between client and server and client shell for +%%% messenger program + +%%%Messages from Client to server received in server/1 function. +-record(logon,{client_pid, username}). +-record(message,{client_pid, to_name, message}). +%%% {'EXIT', ClientPid, Reason} (client terminated or unreachable. + +%%% Messages from Server to Client, received in await_result/0 function +-record(abort_client,{message}). +%%% Messages are: user_exists_at_other_node, +%%% you_are_not_logged_on +-record(server_reply,{message}). +%%% Messages are: logged_on +%%% receiver_not_found +%%% sent (Message has been sent (no guarantee) +%%% Messages from Server to Client received in client/1 function +-record(message_from,{from_name, message}). + +%%% Messages from shell to Client received in client/1 function +%%% spawn(mess_client, client, [server_node(), Name]) +-record(message_to,{to_name, message}). +%%% logoff + +%%%----END FILE---- + +%%%----FILE user_interface.erl---- + +%%% User interface to the messenger program +%%% login(Name) +%%% One user at a time can log in from each Erlang node in the +%%% system messenger: and choose a suitable Name. If the Name +%%% is already logged in at another node or if someone else is +%%% already logged in at the same node, login will be rejected +%%% with a suitable error message. + +%%% logoff() +%%% Logs off anybody at at node + +%%% message(ToName, Message) +%%% sends Message to ToName. Error messages if the user of this +%%% function is not logged on or if ToName is not logged on at +%%% any node. + +-module(user_interface). +-export([logon/1, logoff/0, message/2]). +-include("mess_interface.hrl"). +-include("mess_config.hrl"). + +logon(Name) -> + case whereis(mess_client) of + undefined -> + register(mess_client, + spawn(mess_client, client, [?server_node, Name])); + _ -> already_logged_on + end. + +logoff() -> + mess_client ! logoff. + +message(ToName, Message) -> + case whereis(mess_client) of % Test if the client is running + undefined -> + not_logged_on; + _ -> mess_client ! #message_to{to_name=ToName, message=Message}, + ok +end. + +%%%----END FILE---- + +%%%----FILE mess_client.erl---- + +%%% The client process which runs on each user node + +-module(mess_client). +-export([client/2]). +-include("mess_interface.hrl"). + +client(Server_Node, Name) -> + {messenger, Server_Node} ! #logon{client_pid=self(), username=Name}, + await_result(), + client(Server_Node). + +client(Server_Node) -> + receive + logoff -> + exit(normal); + #message_to{to_name=ToName, message=Message} -> + {messenger, Server_Node} ! + #message{client_pid=self(), to_name=ToName, message=Message}, + await_result(); + {message_from, FromName, Message} -> + io:format("Message from ~p: ~p~n", [FromName, Message]) + end, + client(Server_Node). + +%%% wait for a response from the server +await_result() -> + receive + #abort_client{message=Why} -> + io:format("~p~n", [Why]), + exit(normal); + #server_reply{message=What} -> + io:format("~p~n", [What]) + after 5000 -> + io:format("No response from server~n", []), + exit(timeout) + end. + +%%%----END FILE--- + +%%%----FILE mess_server.erl---- + +%%% This is the server process of the messenger service + +-module(mess_server). +-export([start_server/0, server/0]). +-include("mess_interface.hrl"). + +server() -> + process_flag(trap_exit, true), + server([]). + +%%% the user list has the format [{ClientPid1, Name1},{ClientPid22, Name2},...] +server(User_List) -> + io:format("User list = ~p~n", [User_List]), + receive + #logon{client_pid=From, username=Name} -> + New_User_List = server_logon(From, Name, User_List), + server(New_User_List); + {'EXIT', From, _} -> + New_User_List = server_logoff(From, User_List), + server(New_User_List); + #message{client_pid=From, to_name=To, message=Message} -> + server_transfer(From, To, Message, User_List), + server(User_List) + end. + +%%% Start the server +start_server() -> + register(messenger, spawn(?MODULE, server, [])). + +%%% Server adds a new user to the user list +server_logon(From, Name, User_List) -> + %% check if logged on anywhere else + case lists:keymember(Name, 2, User_List) of + true -> + From ! #abort_client{message=user_exists_at_other_node}, + User_List; + false -> + From ! #server_reply{message=logged_on}, + link(From), + [{From, Name} | User_List] %add user to the list + end. + +%%% Server deletes a user from the user list +server_logoff(From, User_List) -> + lists:keydelete(From, 1, User_List). + +%%% Server transfers a message between user +server_transfer(From, To, Message, User_List) -> + %% check that the user is logged on and who he is + case lists:keysearch(From, 1, User_List) of + false -> + From ! #abort_client{message=you_are_not_logged_on}; + {value, {_, Name}} -> + server_transfer(From, Name, To, Message, User_List) + end. +%%% If the user exists, send the message +server_transfer(From, Name, To, Message, User_List) -> + %% Find the receiver and send the message + case lists:keysearch(To, 2, User_List) of + false -> + From ! #server_reply{message=receiver_not_found}; + {value, {ToPid, To}} -> + ToPid ! #message_from{from_name=Name, message=Message}, + From ! #server_reply{message=sent} + end. + +%%%----END FILE--- +
+ +
+ Header Files +

You will see some files above with extension .hrl. These + are header files which are included in the .erl files by:

+ +-include("File_Name"). +

for example:

+ +-include("mess_interface.hrl"). +

In our case above the file is fetched from the same directory as + all the other files in the messenger example. (*manual*).

+

.hrl files can contain any valid Erlang code but are most often + used for record and macro definitions.

+
+ +
+ Records +

A record is defined as:

+ +-record(name_of_record,{field_name1, field_name2, field_name3, ......}). +

For example:

+ +-record(message_to,{to_name, message}). +

This is exactly equivalent to:

+ +{message_to, To_Name, Message} +

Creating record, is best illustrated by an example:

+ +#message_to{message="hello", to_name=fred) +

This will create:

+ +{message_to, fred, "hello"} +

Note that you don't have to worry about the order you assign + values to the various parts of the records when you create it. + The advantage of using records is that by placing their + definitions in header files you can conveniently define + interfaces which are easy to change. For example, if you want to + add a new field to the record, you will only have to change + the code where the new field is used and not at every place + the record is referred to. If you leave out a field when creating + a record, it will get the value of the atom undefined. (*manual*)

+

Pattern matching with records is very similar to creating + records. For example inside a case or receive:

+ +#message_to{to_name=ToName, message=Message} -> +

is the same as:

+ +{message_to, ToName, Message} +
+ +
+ Macros +

The other thing we have added to the messenger is a macro. + The file mess_config.hrl contains the definition:

+ +%%% Configure the location of the server node, +-define(server_node, messenger@super). +

We include this file in mess_server.erl:

+ +-include("mess_config.hrl"). +

Every occurrence of ?server_node in mess_server.erl + will now be replaced by messenger@super.

+

The other place a macro is used is when we spawn the server + process:

+ +spawn(?MODULE, server, []) +

This is a standard macro (i.e. defined by the system, not + the user). ?MODULE is always replaced by the name of + current module (i.e. the -module definition near the start + of the file). There are more advanced ways of using macros with, + for example parameters (*manual*).

+

The three Erlang (.erl) files in the messenger example are + individually compiled into object code file (.beam). + The Erlang system loads and links these files into the system + when they are referred to during execution of the code. In our + case we simply have put them in the same directory which is our + current working directory (i.e. the place we have done "cd" to). + There are ways of putting the .beam files in other + directories.

+

In the messenger example, no assumptions have been made about + what the message being sent is. It could be any valid Erlang term.

+
+
+ diff --git a/system/doc/getting_started/robustness.xml b/system/doc/getting_started/robustness.xml new file mode 100644 index 0000000000..227da4c027 --- /dev/null +++ b/system/doc/getting_started/robustness.xml @@ -0,0 +1,483 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Robustness + + + + + robustness.xml +
+

There are several things which are wrong with + the messenger example from + the previous chapter. For example if a node where a user is logged + on goes down without doing a log off, the user will remain in + the server's User_List but the client will disappear thus + making it impossible for the user to log on again as the server + thinks the user already logged on.

+

Or what happens if the server goes down in the middle of sending a + message leaving the sending client hanging for ever in + the await_result function?

+ +
+ Timeouts +

Before improving the messenger program we will look into some + general principles, using the ping pong program as an example. + Recall that when "ping" finishes, it tells "pong" that it has + done so by sending the atom finished as a message to "pong" + so that "pong" could also finish. Another way to let "pong" + finish, is to make "pong" exit if it does not receive a message + from ping within a certain time, this can be done by adding a + timeout to pong as shown in the following example:

+ +-module(tut19). + +-export([start_ping/1, start_pong/0, ping/2, pong/0]). + +ping(0, Pong_Node) -> + io:format("ping finished~n", []); + +ping(N, Pong_Node) -> + {pong, Pong_Node} ! {ping, self()}, + receive + pong -> + io:format("Ping received pong~n", []) + end, + ping(N - 1, Pong_Node). + +pong() -> + receive + {ping, Ping_PID} -> + io:format("Pong received ping~n", []), + Ping_PID ! pong, + pong() + after 5000 -> + io:format("Pong timed out~n", []) + end. + +start_pong() -> + register(pong, spawn(tut19, pong, [])). + +start_ping(Pong_Node) -> + spawn(tut19, ping, [3, Pong_Node]). +

After we have compiled this and copied the tut19.beam + file to the necessary directories:

+

On (pong@kosken):

+
+(pong@kosken)1> tut19:start_pong().
+true
+Pong received ping
+Pong received ping
+Pong received ping
+Pong timed out
+

On (ping@gollum):

+
+(ping@gollum)1> tut19:start_ping(pong@kosken).
+<0.36.0>
+Ping received pong
+Ping received pong
+Ping received pong
+ping finished   
+

(The timeout is set in:

+ +pong() -> + receive + {ping, Ping_PID} -> + io:format("Pong received ping~n", []), + Ping_PID ! pong, + pong() + after 5000 -> + io:format("Pong timed out~n", []) + end. +

We start the timeout (after 5000) when we enter + receive. The timeout is canceled if {ping,Ping_PID} + is received. If {ping,Ping_PID} is not received, + the actions following the timeout will be done after 5000 + milliseconds. after must be last in the receive, + i.e. preceded by all other message reception specifications in + the receive. Of course we could also call a function which + returned an integer for the timeout:

+ +after pong_timeout() -> +

In general, there are better ways than using timeouts to + supervise parts of a distributed Erlang system. Timeouts are + usually appropriate to supervise external events, for example if + you have expected a message from some external system within a + specified time. For example, we could use a timeout to log a user + out of the messenger system if they have not accessed it, for + example, in ten minutes.

+
+ +
+ Error Handling +

Before we go into details of the supervision and error handling + in an Erlang system, we need see how Erlang processes terminate, + or in Erlang terminology, exit.

+

A process which executes exit(normal) or simply runs out + of things to do has a normal exit.

+

A process which encounters a runtime error (e.g. divide by zero, + bad match, trying to call a function which doesn't exist etc) + exits with an error, i.e. has an abnormal exit. A + process which executes + exit(Reason) + where Reason is any Erlang term except the atom + normal, also has an abnormal exit.

+

An Erlang process can set up links to other Erlang processes. If + a process calls + link(Other_Pid) + it sets up a bidirectional link between itself and the process + called Other_Pid. When a process terminates its sends + something called a signal to all the processes it has + links to.

+

The signal carries information about the pid it was sent from and + the exit reason.

+

The default behaviour of a process which receives a normal exit + is to ignore the signal.

+

The default behaviour in the two other cases (i.e. abnormal exit) + above is to bypass all messages to the receiving process and to + kill it and to propagate the same error signal to the killed + process' links. In this way you can connect all processes in a + transaction together using links and if one of the processes + exits abnormally, all the processes in the transaction will be + killed. As we often want to create a process and link to it at + the same time, there is a special BIF, + spawn_link + which does the same as spawn, but also creates a link to + the spawned process.

+

Now an example of the ping pong example using links to terminate + "pong":

+ +-module(tut20). + +-export([start/1, ping/2, pong/0]). + +ping(N, Pong_Pid) -> + link(Pong_Pid), + ping1(N, Pong_Pid). + +ping1(0, _) -> + exit(ping); + +ping1(N, Pong_Pid) -> + Pong_Pid ! {ping, self()}, + receive + pong -> + io:format("Ping received pong~n", []) + end, + ping1(N - 1, Pong_Pid). + +pong() -> + receive + {ping, Ping_PID} -> + io:format("Pong received ping~n", []), + Ping_PID ! pong, + pong() + end. + +start(Ping_Node) -> + PongPID = spawn(tut20, pong, []), + spawn(Ping_Node, tut20, ping, [3, PongPID]). +
+(s1@bill)3> tut20:start(s2@kosken).
+Pong received ping
+<3820.41.0>
+Ping received pong
+Pong received ping
+Ping received pong
+Pong received ping
+Ping received pong
+

This is a slight modification of the ping pong program where both + processes are spawned from the same start/1 function, + where the "ping" process can be spawned on a separate node. Note + the use of the link BIF. "Ping" calls + exit(ping) when it finishes and this will cause an exit + signal to be sent to "pong" which will also terminate.

+

It is possible to modify the default behaviour of a process so + that it does not get killed when it receives abnormal exit + signals, but all signals will be turned into normal messages on + the format {'EXIT',FromPID,Reason} and added to the end of + the receiving processes message queue. This behaviour is set by:

+ +process_flag(trap_exit, true) +

There are several other process flags, see + erlang(3). + Changing the default behaviour of a process in this way is + usually not done in standard user programs, but is left to + the supervisory programs in OTP (but that's another tutorial). + However we will modify the ping pong program to illustrate exit + trapping.

+ +-module(tut21). + +-export([start/1, ping/2, pong/0]). + +ping(N, Pong_Pid) -> + link(Pong_Pid), + ping1(N, Pong_Pid). + +ping1(0, _) -> + exit(ping); + +ping1(N, Pong_Pid) -> + Pong_Pid ! {ping, self()}, + receive + pong -> + io:format("Ping received pong~n", []) + end, + ping1(N - 1, Pong_Pid). + +pong() -> + process_flag(trap_exit, true), + pong1(). + +pong1() -> + receive + {ping, Ping_PID} -> + io:format("Pong received ping~n", []), + Ping_PID ! pong, + pong1(); + {'EXIT', From, Reason} -> + io:format("pong exiting, got ~p~n", [{'EXIT', From, Reason}]) + end. + +start(Ping_Node) -> + PongPID = spawn(tut21, pong, []), + spawn(Ping_Node, tut21, ping, [3, PongPID]). +
+(s1@bill)1> tut21:start(s2@gollum).
+<3820.39.0>
+Pong received ping
+Ping received pong
+Pong received ping
+Ping received pong
+Pong received ping
+Ping received pong
+pong exiting, got {'EXIT',<3820.39.0>,ping}
+
+ +
+ The Larger Example with Robustness Added +

Now we return to the messenger program and add changes which + make it more robust:

+ +%%% Message passing utility. +%%% User interface: +%%% login(Name) +%%% One user at a time can log in from each Erlang node in the +%%% system messenger: and choose a suitable Name. If the Name +%%% is already logged in at another node or if someone else is +%%% already logged in at the same node, login will be rejected +%%% with a suitable error message. +%%% logoff() +%%% Logs off anybody at at node +%%% message(ToName, Message) +%%% sends Message to ToName. Error messages if the user of this +%%% function is not logged on or if ToName is not logged on at +%%% any node. +%%% +%%% One node in the network of Erlang nodes runs a server which maintains +%%% data about the logged on users. The server is registered as "messenger" +%%% Each node where there is a user logged on runs a client process registered +%%% as "mess_client" +%%% +%%% Protocol between the client processes and the server +%%% ---------------------------------------------------- +%%% +%%% To server: {ClientPid, logon, UserName} +%%% Reply {messenger, stop, user_exists_at_other_node} stops the client +%%% Reply {messenger, logged_on} logon was successful +%%% +%%% When the client terminates for some reason +%%% To server: {'EXIT', ClientPid, Reason} +%%% +%%% To server: {ClientPid, message_to, ToName, Message} send a message +%%% Reply: {messenger, stop, you_are_not_logged_on} stops the client +%%% Reply: {messenger, receiver_not_found} no user with this name logged on +%%% Reply: {messenger, sent} Message has been sent (but no guarantee) +%%% +%%% To client: {message_from, Name, Message}, +%%% +%%% Protocol between the "commands" and the client +%%% ---------------------------------------------- +%%% +%%% Started: messenger:client(Server_Node, Name) +%%% To client: logoff +%%% To client: {message_to, ToName, Message} +%%% +%%% Configuration: change the server_node() function to return the +%%% name of the node where the messenger server runs + +-module(messenger). +-export([start_server/0, server/0, + logon/1, logoff/0, message/2, client/2]). + +%%% Change the function below to return the name of the node where the +%%% messenger server runs +server_node() -> + messenger@super. + +%%% This is the server process for the "messenger" +%%% the user list has the format [{ClientPid1, Name1},{ClientPid22, Name2},...] +server() -> + process_flag(trap_exit, true), + server([]). + +server(User_List) -> + receive + {From, logon, Name} -> + New_User_List = server_logon(From, Name, User_List), + server(New_User_List); + {'EXIT', From, _} -> + New_User_List = server_logoff(From, User_List), + server(New_User_List); + {From, message_to, To, Message} -> + server_transfer(From, To, Message, User_List), + io:format("list is now: ~p~n", [User_List]), + server(User_List) + end. + +%%% Start the server +start_server() -> + register(messenger, spawn(messenger, server, [])). + +%%% Server adds a new user to the user list +server_logon(From, Name, User_List) -> + %% check if logged on anywhere else + case lists:keymember(Name, 2, User_List) of + true -> + From ! {messenger, stop, user_exists_at_other_node}, %reject logon + User_List; + false -> + From ! {messenger, logged_on}, + link(From), + [{From, Name} | User_List] %add user to the list + end. + +%%% Server deletes a user from the user list +server_logoff(From, User_List) -> + lists:keydelete(From, 1, User_List). + + +%%% Server transfers a message between user +server_transfer(From, To, Message, User_List) -> + %% check that the user is logged on and who he is + case lists:keysearch(From, 1, User_List) of + false -> + From ! {messenger, stop, you_are_not_logged_on}; + {value, {_, Name}} -> + server_transfer(From, Name, To, Message, User_List) + end. + +%%% If the user exists, send the message +server_transfer(From, Name, To, Message, User_List) -> + %% Find the receiver and send the message + case lists:keysearch(To, 2, User_List) of + false -> + From ! {messenger, receiver_not_found}; + {value, {ToPid, To}} -> + ToPid ! {message_from, Name, Message}, + From ! {messenger, sent} + end. + +%%% User Commands +logon(Name) -> + case whereis(mess_client) of + undefined -> + register(mess_client, + spawn(messenger, client, [server_node(), Name])); + _ -> already_logged_on + end. + +logoff() -> + mess_client ! logoff. + +message(ToName, Message) -> + case whereis(mess_client) of % Test if the client is running + undefined -> + not_logged_on; + _ -> mess_client ! {message_to, ToName, Message}, + ok +end. + +%%% The client process which runs on each user node +client(Server_Node, Name) -> + {messenger, Server_Node} ! {self(), logon, Name}, + await_result(), + client(Server_Node). + +client(Server_Node) -> + receive + logoff -> + exit(normal); + {message_to, ToName, Message} -> + {messenger, Server_Node} ! {self(), message_to, ToName, Message}, + await_result(); + {message_from, FromName, Message} -> + io:format("Message from ~p: ~p~n", [FromName, Message]) + end, + client(Server_Node). + +%%% wait for a response from the server +await_result() -> + receive + {messenger, stop, Why} -> % Stop the client + io:format("~p~n", [Why]), + exit(normal); + {messenger, What} -> % Normal response + io:format("~p~n", [What]) + after 5000 -> + io:format("No response from server~n", []), + exit(timeout) + end. +

We have added the following changes:

+

The messenger server traps exits. If it receives an exit signal, + {'EXIT',From,Reason} this means that a client process has + terminated or is unreachable because:

+ + the user has logged off (we have removed the "logoff" + message), + the network connection to the client is broken, + the node on which the client process resides has gone down, + or + the client processes has done some illegal operation. + +

If we receive an exit signal as above, we delete the tuple, + {From,Name} from the servers User_List using + the server_logoff function. If the node on which the server + runs goes down, an exit signal (automatically generated by + the system), will be sent to all of the client processes: + {'EXIT',MessengerPID,noconnection} causing all the client + processes to terminate.

+

We have also introduced a timeout of five seconds in + the await_result function. I.e. if the server does not + reply within five seconds (5000 ms), the client terminates. This + is really only needed in the logon sequence before the client and + server are linked.

+

An interesting case is if the client was to terminate before + the server links to it. This is taken care of because linking to a + non-existent process causes an exit signal, + {'EXIT',From,noproc}, to be automatically generated as if + the process terminated immediately after the link operation.

+
+
+ diff --git a/system/doc/getting_started/seq_prog.xml b/system/doc/getting_started/seq_prog.xml new file mode 100644 index 0000000000..bc1758d855 --- /dev/null +++ b/system/doc/getting_started/seq_prog.xml @@ -0,0 +1,1231 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Sequential Programming + + + + + seq_prog.xml +
+ +
+ The Erlang Shell +

Most operating systems have a command interpreter or shell, Unix + and Linux have many, Windows has the Command Prompt. Erlang has + its own shell where you can directly write bits of Erlang code + and evaluate (run) them to see what happens (see + shell(3)). Start + the Erlang shell (in Linux or UNIX) by starting a shell or + command interpreter in your operating system and typing + erl, you will see something like this.

+
+% erl
+Erlang (BEAM) emulator version 5.2 [source] [hipe]
+
+Eshell V5.2  (abort with ^G)
+1>
+

Now type in "2 + 5." as shown below.

+
+1> 2 + 5.
+7
+2>
+

In Windows, the shell is started by double-clicking on the Erlang + shell icon.

+

You'll notice that the Erlang shell has numbered the lines that + can be entered, (as 1> 2>) and that it has correctly told you + that 2 + 5 is 7! Also notice that you have to tell it you are + done entering code by finishing with a full stop "." and a + carriage return. If you make mistakes writing things in the shell, + you can delete things by using the backspace key as in most + shells. There are many more editing commands in the shell + (See the chapter "tty - A command line interface" in ERTS User's Guide).

+

(Note: you will find a lot of line numbers given by the shell + out of sequence in this tutorial as it was written and the code + tested in several sessions).

+

Now let's try a more complex calculation.

+
+2> (42 + 77) * 66 / 3.
+2618.0
+

Here you can see the use of brackets and the multiplication + operator "*" and division operator "/", just as in normal + arithmetic (see the chapter + "Arithmetic Expressions" in the Erlang Reference Manual).

+

To shutdown the Erlang system and the Erlang shell type + Control-C. You will see the following output:

+
+BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
+       (v)ersion (k)ill (D)b-tables (d)istribution
+a
+%
+

Type "a" to leave the Erlang system.

+

Another way to shutdown the Erlang system is by entering + halt():

+
+3> halt().
+% 
+
+ +
+ Modules and Functions +

A programming language isn't much use if you can just run code + from the shell. So here is a small Erlang program. Enter it into + a file called tut.erl (the file name tut.erl is + important, also make sure that it is in the same directory as + the one where you started erl) using a suitable + text editor. If you are lucky your editor will have an Erlang + mode which will make it easier for you to enter and format your + code nicely (see the chapter + "The Erlang mode for Emacs" in Tools User's Guide), but you can manage + perfectly well without. Here's the code to enter:

+ +-module(tut). +-export([double/1]). + +double(X) -> + 2 * X. +

It's not hard to guess that this "program" doubles the value of + numbers. I'll get back to the first two lines later. Let's compile + the program. This can be done in your Erlang shell as shown below:

+
+3> c(tut).
+{ok,tut}
+

The {ok,tut} tells you that the compilation was OK. If it + said "error" instead, you have made some mistake in the text you + entered and there will also be error messages to give you some + idea as to what has gone wrong so you can change what you have + written and try again.

+

Now lets run the program.

+
+4> tut:double(10).
+20
+

As expected double of 10 is 20.

+

Now let's get back to the first two lines. Erlang programs are + written in files. Each file contains what we call an Erlang + module. The first line of code in the module tells us + the name of the module (see the chapter + "Modules" + in the Erlang Reference Manual).

+ +-module(tut). +

This tells us that the module is called tut. Note + the "." at the end of the line. The files which are used to store + the module must have the same name as the module but with + the extension ".erl". In our case the file name is tut.erl. + When we use a function in another module, we use the syntax, + module_name:function_name(arguments). So

+
+4> tut:double(10).
+

means call function double in module tut with + argument "10".

+

The second line:

+ +-export([double/1]). +

says that the module tut contains a function called + double which takes one argument (X in our example) + and that this function can be called from outside the module + tut. More about this later. Again note the "." at the end + of the line.

+

Now for a more complicated example, the factorial of a number + (e.g. factorial of 4 is 4 * 3 * 2 * 1). Enter the following code + in a file called tut1.erl.

+ +-module(tut1). +-export([fac/1]). + +fac(1) -> + 1; +fac(N) -> + N * fac(N - 1). +

Compile the file

+
+5> c(tut1).
+{ok,tut1}
+

And now calculate the factorial of 4.

+
+6> tut1:fac(4).
+24
+

The first part:

+ +fac(1) -> + 1; +

says that the factorial of 1 is 1. Note that we end this part + with a ";" which indicates that there is more of this function to + come. The second part:

+ +fac(N) -> + N * fac(N - 1). +

says that the factorial of N is N multiplied by the factorial of + N - 1. Note that this part ends with a "." saying that there are + no more parts of this function.

+

A function can have many arguments. Let's expand the module + tut1 with the rather stupid function to multiply two + numbers:

+ +-module(tut1). +-export([fac/1, mult/2]). + +fac(1) -> + 1; +fac(N) -> + N * fac(N - 1). + +mult(X, Y) -> + X * Y. +

Note that we have also had to expand the -export line + with the information that there is another function mult + with two arguments.

+

Compile:

+
+7> c(tut1).
+{ok,tut1}
+

and try it out:

+
+8> tut1:mult(3,4).
+12
+

In the example above the numbers are integers and the arguments + in the functions in the code, N, X, Y are + called variables. Variables must start with a capital letter + (see the chapter + "Variables" + in the Erlang Reference Manual). Examples of variable could be + Number, ShoeSize, Age etc.

+
+ +
+ Atoms +

Atoms are another data type in Erlang. Atoms start with a small + letter ((see the chapter + "Atom" + in the Erlang Reference Manual)), for example: charles, + centimeter, inch. Atoms are simply names, nothing + else. They are not like variables which can have a value.

+

Enter the next program (file: tut2.erl) which could be + useful for converting from inches to centimeters and vice versa:

+ +-module(tut2). +-export([convert/2]). + +convert(M, inch) -> + M / 2.54; + +convert(N, centimeter) -> + N * 2.54. +

Compile and test:

+
+9> c(tut2).
+{ok,tut2}
+10> tut2:convert(3, inch).
+1.1811023622047243
+11> tut2:convert(7, centimeter).
+17.78
+

Notice that I have introduced decimals (floating point numbers) + without any explanation, but I guess you can cope with that.

+

See what happens if I enter something other than centimeter or + inch in the convert function:

+
+12> tut2:convert(3, miles).
+** exception error: no function clause matching tut2:convert(3,miles)
+

The two parts of the convert function are called its + clauses. Here we see that "miles" is not part of either of + the clauses. The Erlang system can't match either of + the clauses so we get an error message function_clause. + The shell formats the error message nicely, but the error tuple + is saved in the shell's history list and can be output by the shell + command v/1:

+
+13> v(12).
+{'EXIT',{function_clause,[{tut2,convert,[3,miles]},
+                          {erl_eval,do_apply,5},
+                          {shell,exprs,6},
+                          {shell,eval_exprs,6},
+                          {shell,eval_loop,3}]}}
+ +
+ +
+ Tuples +

Now the tut2 program is hardly good programming style. + Consider:

+ +tut2:convert(3, inch). +

Does this mean that 3 is in inches? or that 3 is in centimeters + and we want to convert it to inches? So Erlang has a way to group + things together to make things more understandable. We call these + tuples. Tuples are surrounded by "{" and "}".

+

So we can write {inch,3} to denote 3 inches and + {centimeter,5} to denote 5 centimeters. Now let's write a + new program which converts centimeters to inches and vice versa. + (file tut3.erl).

+ +-module(tut3). +-export([convert_length/1]). + +convert_length({centimeter, X}) -> + {inch, X / 2.54}; +convert_length({inch, Y}) -> + {centimeter, Y * 2.54}. +

Compile and test:

+
+14> c(tut3).
+{ok,tut3}
+15> tut3:convert_length({inch, 5}).
+{centimeter,12.7}
+16> tut3:convert_length(tut3:convert_length({inch, 5})).
+{inch,5.0}
+

Note on line 16 we convert 5 inches to centimeters and back + again and reassuringly get back to the original value. I.e + the argument to a function can be the result of another function. + Pause for a moment and consider how line 16 (above) works. + The argument we have given the function {inch,5} is first + matched against the first head clause of convert_length + i.e. convert_length({centimeter,X}) where it can be seen + that {centimeter,X} does not match {inch,5} + (the head is the bit before the "->"). This having failed, we try + the head of the next clause i.e. convert_length({inch,Y}), + this matches and Y get the value 5.

+

We have shown tuples with two parts above, but tuples can have + as many parts as we want and contain any valid Erlang + term. For example, to represent the temperature of + various cities of the world we could write

+ +{moscow, {c, -10}} +{cape_town, {f, 70}} +{paris, {f, 28}} +

Tuples have a fixed number of things in them. We call each thing + in a tuple an element. So in the tuple {moscow,{c,-10}}, + element 1 is moscow and element 2 is {c,-10}. I + have chosen c meaning Centigrade (or Celsius) and f + meaning Fahrenheit.

+
+ +
+ Lists +

Whereas tuples group things together, we also want to be able to + represent lists of things. Lists in Erlang are surrounded by "[" + and "]". For example a list of the temperatures of various cities + in the world could be:

+ +[{moscow, {c, -10}}, {cape_town, {f, 70}}, {stockholm, {c, -4}}, + {paris, {f, 28}}, {london, {f, 36}}] +

Note that this list was so long that it didn't fit on one line. + This doesn't matter, Erlang allows line breaks at all "sensible + places" but not, for example, in the middle of atoms, integers + etc.

+

A very useful way of looking at parts of lists, is by using "|". + This is best explained by an example using the shell.

+
+17> [First |TheRest] = [1,2,3,4,5].
+[1,2,3,4,5]
+18> First.
+1
+19> TheRest.
+[2,3,4,5]
+

We use | to separate the first elements of the list from + the rest of the list. (First has got value 1 and + TheRest value [2,3,4,5]).

+

Another example:

+
+20> [E1, E2 | R] = [1,2,3,4,5,6,7].
+[1,2,3,4,5,6,7]
+21> E1.
+1
+22> E2.
+2
+23> R.
+[3,4,5,6,7]
+

Here we see the use of | to get the first two elements from + the list. Of course if we try to get more elements from the list + than there are elements in the list we will get an error. Note + also the special case of the list with no elements [].

+
+24> [A, B | C] = [1, 2].
+[1,2]
+25> A.
+1
+26> B.
+2
+27> C.
+[]
+

In all the examples above, I have been using new variable names, + not reusing the old ones: First, TheRest, E1, + E2, R, A, B, C. The reason + for this is that a variable can only be given a value once in its + context (scope). I'll get back to this later, it isn't so + peculiar as it sounds!

+

The following example shows how we find the length of a list:

+ +-module(tut4). + +-export([list_length/1]). + +list_length([]) -> + 0; +list_length([First | Rest]) -> + 1 + list_length(Rest). +

Compile (file tut4.erl) and test:

+
+28> c(tut4).
+{ok,tut4}
+29> tut4:list_length([1,2,3,4,5,6,7]).
+7
+

Explanation:

+ +list_length([]) -> + 0; +

The length of an empty list is obviously 0.

+ +list_length([First | Rest]) -> + 1 + list_length(Rest). +

The length of a list with the first element First and + the remaining elements Rest is 1 + the length of + Rest.

+

(Advanced readers only: This is not tail recursive, there is a + better way to write this function).

+

In general we can say we use tuples where we would use "records" + or "structs" in other languages and we use lists when we want to + represent things which have varying sizes, (i.e. where we would + use linked lists in other languages).

+

Erlang does not have a string date type, instead strings can be + represented by lists of ASCII characters. So the list + [97,98,99] is equivalent to "abc". The Erlang shell is + "clever" and guesses the what sort of list we mean and outputs it + in what it thinks is the most appropriate form, for example:

+
+30> [97,98,99].
+"abc"
+
+ +
+ Standard Modules and Manual Pages +

Erlang has a lot of standard modules to help you do things. For + example, the module io contains a lot of functions to help + you do formatted input/output. To look up information about + standard modules, the command erl -man can be used at + the operating shell or command prompt (i.e. at the same place as + that where you started erl). Try the operating system + shell command:

+
+% erl -man io
+ERLANG MODULE DEFINITION                                    io(3)
+
+MODULE
+     io - Standard I/O Server Interface Functions
+
+DESCRIPTION
+     This module provides an  interface  to  standard  Erlang  IO
+     servers. The output functions all return ok if they are suc-
+     ...
+

If this doesn't work on your system, the documentation is + included as HTML in the Erlang/OTP release, or you can read + the documentation as HTML or download it as PDF from either of + the sites www.erlang.se (commercial Erlang) or www.erlang.org + (open source), for example for release R9B:

+ +http://www.erlang.org/doc/r9b/doc/index.html +
+ +
+ Writing Output to a Terminal +

It's nice to be able to do formatted output in these example, so + the next example shows a simple way to use to use + the io:format function. Of course, just like all other + exported functions, you can test the io:format function in + the shell:

+
+31> io:format("hello world~n", []).
+hello world
+ok
+32> io:format("this outputs one Erlang term: ~w~n", [hello]).
+this outputs one Erlang term: hello
+ok
+33> io:format("this outputs two Erlang terms: ~w~w~n", [hello, world]).
+this outputs two Erlang terms: helloworld
+ok
+34> io:format("this outputs two Erlang terms: ~w ~w~n", [hello, world]).
+this outputs two Erlang terms: hello world
+ok
+

The function format/2 (i.e. format with two + arguments) takes two lists. The first one is nearly always a list + written between " ". This list is printed out as it stands, + except that each ~w is replaced by a term taken in order from + the second list. Each ~n is replaced by a new line. + The io:format/2 function itself returns the atom ok + if everything goes as planned. Like other functions in Erlang, it + crashes if an error occurs. This is not a fault in Erlang, it is + a deliberate policy. Erlang has sophisticated mechanisms to + handle errors which we will show later. As an exercise, try to + make io:format crash, it shouldn't be difficult. But + notice that although io:format crashes, the Erlang shell + itself does not crash.

+
+ +
+ A Larger Example +

Now for a larger example to consolidate what we have learnt so + far. Assume we have a list of temperature readings from a number + of cities in the world. Some of them are in Celsius (Centigrade) + and some in Fahrenheit (as in the previous list). First let's + convert them all to Celsius, then let's print out the data neatly.

+ +%% This module is in file tut5.erl + +-module(tut5). +-export([format_temps/1]). + +%% Only this function is exported +format_temps([])-> % No output for an empty list + ok; +format_temps([City | Rest]) -> + print_temp(convert_to_celsius(City)), + format_temps(Rest). + +convert_to_celsius({Name, {c, Temp}}) -> % No conversion needed + {Name, {c, Temp}}; +convert_to_celsius({Name, {f, Temp}}) -> % Do the conversion + {Name, {c, (Temp - 32) * 5 / 9}}. + +print_temp({Name, {c, Temp}}) -> + io:format("~-15w ~w c~n", [Name, Temp]). +
+35> c(tut5).
+{ok,tut5}
+36> tut5:format_temps([{moscow, {c, -10}}, {cape_town, {f, 70}},
+{stockholm, {c, -4}}, {paris, {f, 28}}, {london, {f, 36}}]).
+moscow          -10 c
+cape_town       21.11111111111111 c
+stockholm       -4 c
+paris           -2.2222222222222223 c
+london          2.2222222222222223 c
+ok
+

Before we look at how this program works, notice that we have + added a few comments to the code. A comment starts with a % + character and goes on to the end of the line. Note as well that + the -export([format_temps/1]). line only includes + the function format_temps/1, the other functions are + local functions, i.e. they are not visible from outside + the module tut5.

+

Note as well that when testing the program from the shell, I had + to spread the input over two lines as the line was too long.

+

When we call format_temps the first time, City + gets the value {moscow,{c,-10}} and Rest is + the rest of the list. So we call the function + print_temp(convert_to_celsius({moscow,{c,-10}})).

+

Here we see a function call as + convert_to_celsius({moscow,{c,-10}}) as the argument to + the function print_temp. When we nest function + calls like this we execute (evaluate) them from the inside out. + I.e. we first evaluate convert_to_celsius({moscow,{c,-10}}) + which gives the value {moscow,{c,-10}} as the temperature + is already in Celsius and then we evaluate + print_temp({moscow,{c,-10}}). The function + convert_to_celsius works in a similar way to + the convert_length function in the previous example.

+

print_temp simply calls io:format in a similar way + to what has been described above. Note that ~-15w says to print + the "term" with a field length (width) of 15 and left justify it. + (io(3)).

+

Now we call format_temps(Rest) with the rest of the list + as an argument. This way of doing things is similar to the loop + constructs in other languages. (Yes, this is recursion, but don't + let that worry you). So the same format_temps function is + called again, this time City gets the value + {cape_town,{f,70}} and we repeat the same procedure as + before. We go on doing this until the list becomes empty, i.e. [], + which causes the first clause format_temps([]) to match. + This simply returns (results in) the atom ok, so + the program ends.

+
+ +
+ Matching, Guards and Scope of Variables +

It could be useful to find the maximum and minimum temperature + in lists like this. Before extending the program to do this, + let's look at functions for finding the maximum value of + the elements in a list:

+ +-module(tut6). +-export([list_max/1]). + +list_max([Head|Rest]) -> + list_max(Rest, Head). + +list_max([], Res) -> + Res; +list_max([Head|Rest], Result_so_far) when Head > Result_so_far -> + list_max(Rest, Head); +list_max([Head|Rest], Result_so_far) -> + list_max(Rest, Result_so_far). +
+37> c(tut6).
+{ok,tut6}
+38> tut6:list_max([1,2,3,4,5,7,4,3,2,1]).
+7
+

First note that we have two functions here with the same name + list_max. However each of these takes a different number + of arguments (parameters). In Erlang these are regarded as + completely different functions. Where we need to distinguish + between these functions we write name/arity, where + name is the name of the function and arity is + the number of arguments, in this case list_max/1 and + list_max/2.

+

This is an example where we walk through a list "carrying" a + value with us, in this case Result_so_far. + list_max/1 simply assumes that the max value of the list + is the head of the list and calls list_max/2 with the rest + of the list and the value of the head of the list, in the above + this would be list_max([2,3,4,5,7,4,3,2,1],1). If we tried + to use list_max/1 with an empty list or tried to use it + with something which isn't a list at all, we would cause an error. + Note that the Erlang philosophy is not to handle errors of this + type in the function they occur, but to do so elsewhere. More + about this later.

+

In list_max/2 we walk down the list and use Head + instead of Result_so_far when Head > + Result_so_far. when is a special word we use before + the -> in the function to say that we should only use this part + of the function if the test which follows is true. We call tests + of this type a guard. If the guard isn't true (we say + the guard fails), we try the next part of the function. In this + case if Head isn't greater than Result_so_far then + it must be smaller or equal to is, so we don't need a guard on + the next part of the function.

+

Some useful operators in guards are, < less than, > + greater than, == equal, >= greater or equal, =< less or + equal, /= not equal. (see the chapter + "Guard Sequences" in the Erlang Reference Manual).

+

To change the above program to one which works out the minimum + value of the element in a list, all we would need to do is to + write < instead of >. (But it would be wise to change + the name of the function to list_min :-).

+

Remember that I mentioned earlier that a variable could only be + given a value once in its scope? In the above we see, for example, + that Result_so_far has been given several values. This is + OK since every time we call list_max/2 we create a new + scope and one can regard the Result_so_far as a completely + different variable in each scope.

+

Another way of creating and giving a variable a value is by using + the match operator = . So if I write M = 5, a variable + called M will be created and given the value 5. If, in + the same scope I then write M = 6, I'll get an error. Try + this out in the shell:

+
+39> M = 5.
+5
+40> M = 6.
+** exception error: no match of right hand side value 6
+41> M = M + 1.
+** exception error: no match of right hand side value 6
+42> N = M + 1.
+6
+

The use of the match operator is particularly useful for pulling + apart Erlang terms and creating new ones.

+
+43> {X, Y} = {paris, {f, 28}}.
+{paris,{f,28}}
+44> X.
+paris
+45> Y.
+{f,28}
+

Here we see that X gets the value paris and + Y{f,28}.

+

Of course if we try to do the same again with another city, we + get an error:

+
+46> {X, Y} = {london, {f, 36}}.
+** exception error: no match of right hand side value {london,{f,36}}
+

Variables can also be used to improve the readability of + programs, for example, in the list_max/2 function above, + we could write:

+ +list_max([Head|Rest], Result_so_far) when Head > Result_so_far -> + New_result_far = Head, + list_max(Rest, New_result_far); +

which is possibly a little clearer.

+
+ +
+ More About Lists +

Remember that the | operator can be used to get the head of a + list:

+
+47> [M1|T1] = [paris, london, rome].
+[paris,london,rome]
+48> M1.
+paris
+49> T1.
+[london,rome]
+

The | operator can also be used to add a head to a list:

+
+50> L1 = [madrid | T1].
+[madrid,london,rome]
+51> L1.
+[madrid,london,rome]
+

Now an example of this when working with lists - reversing + the order of a list:

+ +-module(tut8). + +-export([reverse/1]). + +reverse(List) -> + reverse(List, []). + +reverse([Head | Rest], Reversed_List) -> + reverse(Rest, [Head | Reversed_List]); +reverse([], Reversed_List) -> + Reversed_List. +
+52> c(tut8).
+{ok,tut8}
+53> tut8:reverse([1,2,3]).
+[3,2,1]
+

Consider how Reversed_List is built. It starts as [], we + then successively take off the heads of the list to be reversed + and add them to the the Reversed_List, as shown in + the following:

+ +reverse([1|2,3], []) => + reverse([2,3], [1|[]]) + +reverse([2|3], [1]) => + reverse([3], [2|[1]) + +reverse([3|[]], [2,1]) => + reverse([], [3|[2,1]]) + +reverse([], [3,2,1]) => + [3,2,1] +

The module lists contains a lot of functions for + manipulating lists, for example for reversing them, so before you + write a list manipulating function it is a good idea to check + that one isn't already written for you. (see + lists(3)).

+

Now lets get back to the cities and temperatures, but take a more + structured approach this time. First let's convert the whole list + to Celsius as follows and test the function:

+ +-module(tut7). +-export([format_temps/1]). + +format_temps(List_of_cities) -> + convert_list_to_c(List_of_cities). + +convert_list_to_c([{Name, {f, F}} | Rest]) -> + Converted_City = {Name, {c, (F -32)* 5 / 9}}, + [Converted_City | convert_list_to_c(Rest)]; + +convert_list_to_c([City | Rest]) -> + [City | convert_list_to_c(Rest)]; + +convert_list_to_c([]) -> + []. +
+54> c(tut7).
+{ok, tut7}.
+55> tut7:format_temps([{moscow, {c, -10}}, {cape_town, {f, 70}},
+{stockholm, {c, -4}}, {paris, {f, 28}}, {london, {f, 36}}]).
+[{moscow,{c,-10}},
+ {cape_town,{c,21.11111111111111}},
+ {stockholm,{c,-4}},
+ {paris,{c,-2.2222222222222223}},
+ {london,{c,2.2222222222222223}}]
+

Looking at this bit by bit:

+ +format_temps(List_of_cities) -> + convert_list_to_c(List_of_cities). +

Here we see that format_temps/1 calls + convert_list_to_c/1. convert_list_to_c/1 takes off + the head of the List_of_cities, converts it to Celsius if + needed. The | operator is used to add the (maybe) converted + to the converted rest of the list:

+ +[Converted_City | convert_list_to_c(Rest)]; +

or

+ +[City | convert_list_to_c(Rest)]; +

We go on doing this until we get to the end of the list (i.e. + the list is empty:

+ +convert_list_to_c([]) -> + []. +

Now we have converted the list, we add a function to print it:

+ +-module(tut7). +-export([format_temps/1]). + +format_temps(List_of_cities) -> + Converted_List = convert_list_to_c(List_of_cities), + print_temp(Converted_List). + +convert_list_to_c([{Name, {f, F}} | Rest]) -> + Converted_City = {Name, {c, (F -32)* 5 / 9}}, + [Converted_City | convert_list_to_c(Rest)]; + +convert_list_to_c([City | Rest]) -> + [City | convert_list_to_c(Rest)]; + +convert_list_to_c([]) -> + []. + +print_temp([{Name, {c, Temp}} | Rest]) -> + io:format("~-15w ~w c~n", [Name, Temp]), + print_temp(Rest); +print_temp([]) -> + ok. +
+56> c(tut7).
+{ok,tut7}
+57> tut7:format_temps([{moscow, {c, -10}}, {cape_town, {f, 70}},
+{stockholm, {c, -4}}, {paris, {f, 28}}, {london, {f, 36}}]).
+moscow          -10 c
+cape_town       21.11111111111111 c
+stockholm       -4 c
+paris           -2.2222222222222223 c
+london          2.2222222222222223 c
+ok
+

We now have to add a function to find the cities with + the maximum and minimum temperatures. The program below isn't + the most efficient way of doing this as we walk through the list + of cities four times. But it is better to first strive for + clarity and correctness and to make programs efficient only if + really needed.

+ + Converted_List = convert_list_to_c(List_of_cities), + print_temp(Converted_List), + {Max_city, Min_city} = find_max_and_min(Converted_List), + print_max_and_min(Max_city, Min_city). + +convert_list_to_c([{Name, {f, Temp}} | Rest]) -> + Converted_City = {Name, {c, (Temp -32)* 5 / 9}}, + [Converted_City | convert_list_to_c(Rest)]; + +convert_list_to_c([City | Rest]) -> + [City | convert_list_to_c(Rest)]; + +convert_list_to_c([]) -> + []. + +print_temp([{Name, {c, Temp}} | Rest]) -> + io:format("~-15w ~w c~n", [Name, Temp]), + print_temp(Rest); +print_temp([]) -> + ok. + +find_max_and_min([City | Rest]) -> + find_max_and_min(Rest, City, City). + +find_max_and_min([{Name, {c, Temp}} | Rest], + {Max_Name, {c, Max_Temp}}, + {Min_Name, {c, Min_Temp}}) -> + if + Temp > Max_Temp -> + Max_City = {Name, {c, Temp}}; % Change + true -> + Max_City = {Max_Name, {c, Max_Temp}} % Unchanged + end, + if + Temp < Min_Temp -> + Min_City = {Name, {c, Temp}}; % Change + true -> + Min_City = {Min_Name, {c, Min_Temp}} % Unchanged + end, + find_max_and_min(Rest, Max_City, Min_City); + +find_max_and_min([], Max_City, Min_City) -> + {Max_City, Min_City}. + +print_max_and_min({Max_name, {c, Max_temp}}, {Min_name, {c, Min_temp}}) -> + io:format("Max temperature was ~w c in ~w~n", [Max_temp, Max_name]), + io:format("Min temperature was ~w c in ~w~n", [Min_temp, Min_name]).]]>
+58> c(tut7).
+{ok, tut7}
+59> tut7:format_temps([{moscow, {c, -10}}, {cape_town, {f, 70}},
+{stockholm, {c, -4}}, {paris, {f, 28}}, {london, {f, 36}}]).
+moscow          -10 c
+cape_town       21.11111111111111 c
+stockholm       -4 c
+paris           -2.2222222222222223 c
+london          2.2222222222222223 c
+Max temperature was 21.11111111111111 c in cape_town
+Min temperature was -10 c in moscow
+ok
+
+ +
+ If and Case +

The function find_max_and_min works out the maximum and + minimum temperature. We have introduced a new construct here + if. If works as follows:

+ +if + Condition 1 -> + Action 1; + Condition 2 -> + Action 2; + Condition 3 -> + Action 3; + Condition 4 -> + Action 4 +end +

Note there is no ";" before end! Conditions are the same + as guards, tests which succeed or fail. Erlang starts at the top + until it finds a condition which succeeds and then it evaluates + (performs) the action following the condition and ignores all + other conditions and action before the end. If no + condition matches, there will be a run-time failure. A condition + which always is succeeds is the atom, true and this is + often used last in an if meaning do the action following + the true if all other conditions have failed.

+

The following is a short program to show the workings of + if.

+ +-module(tut9). +-export([test_if/2]). + +test_if(A, B) -> + if + A == 5 -> + io:format("A == 5~n", []), + a_equals_5; + B == 6 -> + io:format("B == 6~n", []), + b_equals_6; + A == 2, B == 3 -> %i.e. A equals 2 and B equals 3 + io:format("A == 2, B == 3~n", []), + a_equals_2_b_equals_3; + A == 1 ; B == 7 -> %i.e. A equals 1 or B equals 7 + io:format("A == 1 ; B == 7~n", []), + a_equals_1_or_b_equals_7 + end. +

Testing this program gives:

+
+60> c(tut9).
+{ok,tut9}
+61> tut9:test_if(5,33).
+A == 5
+a_equals_5
+62> tut9:test_if(33,6).
+B == 6
+b_equals_6
+63> tut9:test_if(2, 3).
+A == 2, B == 3
+a_equals_2_b_equals_3
+64> tut9:test_if(1, 33).
+A == 1 ; B == 7
+a_equals_1_or_b_equals_7
+65> tut9:test_if(33, 7).
+A == 1 ; B == 7
+a_equals_1_or_b_equals_7
+66> tut9:test_if(33, 33).
+** exception error: no true branch found when evaluating an if expression
+     in function  tut9:test_if/2
+

Notice that tut9:test_if(33,33) did not cause any + condition to succeed so we got the run time error + if_clause, here nicely formatted by the shell. See the chapter + "Guard Sequences" in the Erlang Reference Manual for details + of the many guard tests available. case is another + construct in Erlang. Recall that we wrote the + convert_length function as:

+ +convert_length({centimeter, X}) -> + {inch, X / 2.54}; +convert_length({inch, Y}) -> + {centimeter, Y * 2.54}. +

We could also write the same program as:

+ +-module(tut10). +-export([convert_length/1]). + +convert_length(Length) -> + case Length of + {centimeter, X} -> + {inch, X / 2.54}; + {inch, Y} -> + {centimeter, Y * 2.54} + end. +
+67> c(tut10).
+{ok,tut10}
+68> tut10:convert_length({inch, 6}).
+{centimeter,15.24}
+69> tut10:convert_length({centimeter, 2.5}).
+{inch,0.984251968503937}
+

Notice that both case and if have return values, i.e. in the above example case returned + either {inch,X/2.54} or {centimeter,Y*2.54}. + The behaviour of case can also be modified by using guards. + An example should hopefully clarify this. The following example + tells us the length of a month, given the year. We need to know + the year of course, since February has 29 days in a leap year.

+ +-module(tut11). +-export([month_length/2]). + +month_length(Year, Month) -> + %% All years divisible by 400 are leap + %% Years divisible by 100 are not leap (except the 400 rule above) + %% Years divisible by 4 are leap (except the 100 rule above) + Leap = if + trunc(Year / 400) * 400 == Year -> + leap; + trunc(Year / 100) * 100 == Year -> + not_leap; + trunc(Year / 4) * 4 == Year -> + leap; + true -> + not_leap + end, + case Month of + sep -> 30; + apr -> 30; + jun -> 30; + nov -> 30; + feb when Leap == leap -> 29; + feb -> 28; + jan -> 31; + mar -> 31; + may -> 31; + jul -> 31; + aug -> 31; + oct -> 31; + dec -> 31 + end. +
+70> c(tut11).
+{ok,tut11}
+71> tut11:month_length(2004, feb).
+29
+72> tut11:month_length(2003, feb).
+28
+73> tut11:month_length(1947, aug).
+31
+
+ +
+ Built In Functions (BIFs) +

Built in functions BIFs are functions which for some reason is + built in to the Erlang virtual machine. BIFs often implement + functionality that is impossible to implement in Erlang or is to + inefficient to implement in Erlang. Some BIFs can be called + by use of the function name only but they are by default belonging + to the erlang module so for example the call to the BIF trunc + below is equivalent with a call to erlang:trunc.

+

As you can see, we first find out if a year is leap or not. If a + year is divisible by 400, it is a leap year. To find this out we + first divide the year by 400 and use the built in function + trunc (more later) to cut off any decimals. We then + multiply by 400 again and see if we get back the same value. For + example, year 2004:

+ +2004 / 400 = 5.01 +trunc(5.01) = 5 +5 * 400 = 2000 +

and we can see that we got back 2000 which is not the same as + 2004, so 2004 isn't divisible by 400. Year 2000:

+ +2000 / 400 = 5.0 +trunc(5.0) = 5 +5 * 400 = 2000 +

so we have a leap year. The next two tests if the year is + divisible by 100 or 4 are done in the same way. The first + if returns leap or not_leap which lands up + in the variable Leap. We use this variable in the guard + for feb in the following case which tells us how + long the month is.

+

This example showed the use of trunc, an easier way would + be to use the Erlang operator rem which gives the remainder + after division. For example:

+
+74> 2004 rem 400.
+4
+

so instead of writing

+ +trunc(Year / 400) * 400 == Year -> + leap; +

we could write

+ +Year rem 400 == 0 -> + leap; +

There are many other built in functions (BIF) such as + trunc. Only a few built in functions can be used in guards, + and you cannot use functions you have defined yourself in guards. + (see the chapter + "Guard Sequences" in the Erlang Reference Manual) (Aside for + advanced readers: This is to ensure that guards don't have side + effects). Let's play with a few of these functions in the shell:

+
+75> trunc(5.6).
+5
+76> round(5.6).
+6
+77> length([a,b,c,d]).
+4
+78> float(5).
+5.0
+79> is_atom(hello).
+true
+80> is_atom("hello").
+false
+81> is_tuple({paris, {c, 30}}).
+true
+82> is_tuple([paris, {c, 30}]).
+false
+

All the above can be used in guards. Now for some which can't be + used in guards:

+
+83> atom_to_list(hello).
+"hello"
+84> list_to_atom("goodbye").
+goodbye
+85> integer_to_list(22).
+"22"
+

The 3 BIFs above do conversions which would be difficult (or + impossible) to do in Erlang.

+
+ +
+ Higher Order Functions (Funs) +

Erlang, like most modern functional programming languages, has + higher order functions. We start with an example using the shell:

+
+86> Xf = fun(X) -> X * 2 end.
+#Fun<erl_eval.5.123085357>
+87> Xf(5).
+10
+

What we have done here is to define a function which doubles + the value of number and assign this function to a variable. Thus + Xf(5) returned the value 10. Two useful functions when + working with lists are foreach and map, which are + defined as follows:

+ +foreach(Fun, [First|Rest]) -> + Fun(First), + foreach(Fun, Rest); +foreach(Fun, []) -> + ok. + +map(Fun, [First|Rest]) -> + [Fun(First)|map(Fun,Rest)]; +map(Fun, []) -> + []. +

These two functions are provided in the standard module + lists. foreach takes a list and applies a fun to + every element in the list, map creates a new list by + applying a fun to every element in a list. Going back to + the shell, we start by using map and a fun to add 3 to + every element of a list:

+
+88> Add_3 = fun(X) -> X + 3 end.
+#Fun<erl_eval.5.123085357>
+89> lists:map(Add_3, [1,2,3]).
+[4,5,6]
+

Now lets print out the temperatures in a list of cities (yet + again):

+
+90> Print_City = fun({City, {X, Temp}}) -> io:format("~-15w ~w ~w~n",
+[City, X, Temp]) end.
+#Fun<erl_eval.5.123085357>
+91> lists:foreach(Print_City, [{moscow, {c, -10}}, {cape_town, {f, 70}},
+{stockholm, {c, -4}}, {paris, {f, 28}}, {london, {f, 36}}]).
+moscow          c -10
+cape_town       f 70
+stockholm       c -4
+paris           f 28
+london          f 36
+ok
+

We will now define a fun which can be used to go through a list + of cities and temperatures and transform them all to Celsius.

+ +-module(tut13). + +-export([convert_list_to_c/1]). + +convert_to_c({Name, {f, Temp}}) -> + {Name, {c, trunc((Temp - 32) * 5 / 9)}}; +convert_to_c({Name, {c, Temp}}) -> + {Name, {c, Temp}}. + +convert_list_to_c(List) -> + lists:map(fun convert_to_c/1, List). +
+92> tut13:convert_list_to_c([{moscow, {c, -10}}, {cape_town, {f, 70}},
+{stockholm, {c, -4}}, {paris, {f, 28}}, {london, {f, 36}}]).
+[{moscow,{c,-10}},
+ {cape_town,{c,21}},
+ {stockholm,{c,-4}},
+ {paris,{c,-2}},
+ {london,{c,2}}]
+

The convert_to_c function is the same as before, but we + use it as a fun:

+ +lists:map(fun convert_to_c/1, List) +

When we use a function defined elsewhere as a fun we can refer + to it as Function/Arity (remember that Arity = + number of arguments). So in the map call we write + lists:map(fun convert_to_c/1, List). As you can see + convert_list_to_c becomes much shorter and easier to + understand.

+

The standard module lists also contains a function + sort(Fun, List) where Fun is a fun with two + arguments. This fun should return true if the the first + argument is less than the second argument, or else false. + We add sorting to the convert_list_to_c:

+ + {Name, {c, trunc((Temp - 32) * 5 / 9)}}; +convert_to_c({Name, {c, Temp}}) -> + {Name, {c, Temp}}. + +convert_list_to_c(List) -> + New_list = lists:map(fun convert_to_c/1, List), + lists:sort(fun({_, {c, Temp1}}, {_, {c, Temp2}}) -> + Temp1 < Temp2 end, New_list).]]> +
+93> c(tut13).
+{ok,tut13}
+94> tut13:convert_list_to_c([{moscow, {c, -10}}, {cape_town, {f, 70}},
+{stockholm, {c, -4}}, {paris, {f, 28}}, {london, {f, 36}}]).
+[{moscow,{c,-10}},
+ {stockholm,{c,-4}},
+ {paris,{c,-2}},
+ {london,{c,2}},
+ {cape_town,{c,21}}]
+

In sort we use the fun:

+ Temp1 < Temp2 end,]]> +

Here we introduce the concept of an anonymous variable + "_". This is simply shorthand for a variable which is going to + get a value, but we will ignore the value. This can be used + anywhere suitable, not just in fun's. + returns true if Temp1 is less than Temp2.

+
+
+ diff --git a/system/doc/getting_started/xmlfiles.mk b/system/doc/getting_started/xmlfiles.mk new file mode 100644 index 0000000000..c784d79dc3 --- /dev/null +++ b/system/doc/getting_started/xmlfiles.mk @@ -0,0 +1,24 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +GETTING_STARTED_CHAPTER_FILES = \ + conc_prog.xml \ + intro.xml \ + records_macros.xml \ + robustness.xml \ + seq_prog.xml diff --git a/system/doc/html/.gitignore b/system/doc/html/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/system/doc/images/.gitignore b/system/doc/images/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/system/doc/installation_guide/Makefile b/system/doc/installation_guide/Makefile new file mode 100644 index 0000000000..c51f0ee5f3 --- /dev/null +++ b/system/doc/installation_guide/Makefile @@ -0,0 +1,100 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 1996-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include $(ERL_TOP)/erts/vsn.mk +#VSN=$(SYSTEM_VSN) + +APPLICATION=otp-system-documentation +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/doc/installation_guide + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +XML_PART_FILES = part.xml + +include xmlfiles.mk + +XML_CHAPTER_FILES=$(INST_GUIDE_CHAPTER_FILES) + +TOPDOCDIR=.. + +BOOK_FILES = book.xml + +GIF_FILES = + +PS_FILES = + +XML_FILES = \ + $(BOOK_FILES) $(XML_CHAPTER_FILES) \ + $(XML_PART_FILES) + +# ---------------------------------------------------- + +HTML_FILES = \ + $(XML_PART_FILES:%.xml=%.html) + +HTMLDIR = ../html/installation_guide + +HTML_UG_FILE = $(HTMLDIR)/users_guide.html + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAGS += +DVIPS_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +docs: html + +local_docs: PDFDIR=../../pdf + +html: $(GIF_FILES) $(HTML_UG_FILE) + +debug opt: + +clean clean_docs: + rm -rf $(HTMLDIR) + rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f errs core *~ + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + + +release_docs_spec: docs + $(INSTALL_DIR) $(RELSYSDIR) + $(INSTALL_DATA) $(GIF_FILES) $(HTMLDIR)/*.html \ + $(RELSYSDIR) + +release_spec: + + diff --git a/system/doc/installation_guide/book.xml b/system/doc/installation_guide/book.xml new file mode 100644 index 0000000000..7d8001f2b3 --- /dev/null +++ b/system/doc/installation_guide/book.xml @@ -0,0 +1,43 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Installation Guide + Peter Högfeldt + + 1997-11-06 + D + book.xml +
+ + + Installation Guide + + + + + + + + +
+ diff --git a/system/doc/installation_guide/install.xml b/system/doc/installation_guide/install.xml new file mode 100644 index 0000000000..2e37ff35e9 --- /dev/null +++ b/system/doc/installation_guide/install.xml @@ -0,0 +1,148 @@ + + + + +
+ + 20002009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Installation + Peter Högfeldt + Peter Högfeldt + + (Peter Högfeldt + + 1997-05-26 + C + install.xml +
+ +
+ UNIX + +
+ Introduction +

The system is delivered as a single compressed tar file.

+

To browse the on-line HTML documentation, Netscape or an equivalent + browser supporting frames is needed.

+
+ +
+ Installation Procedure +

When installed, the entire system, except for a small start-up + script, resides in a single directory tree. The location of this + directory tree can be chosen arbitrarily by the installer, and it + does not need to be in the user's $PATH. The only requirements + are that the file system where it is placed has enough free space, + and that the users who run Erlang/OTP have read access to it. In the + example below, the directory tree is assumed to be located at + /usr/local/erlang, which is here called the top-level directory.

+

It is assumed that you have the compressed tar file, the name of + which is .tar.gz]]>, where ]]> is a string + denoting the particular Erlang/OTP release, e.g. + otp_LXA_11930_sunos5_R9B.

+

Wherever the string ]]> is used below, it should + be replaced by the actual name prefix of the compressed tar file.

+

The tape archive file does not have one single directory in which + all other files are rooted. Therefore the tape archive file must be + extracted into an empty (newly created) directory.

+ + +

If the top-level directory does not already exist, + create it:

+
+mkdir /usr/local/erlang
+
+ +

Change the current directory to the top level directory:

+
+cd /usr/local/erlang
+
+ +

Create the installation directory with an appropriate + name. For example:

+
+mkdir otp_r7b
+
+ +

Change to the installation directory, e.g.

+
+cd otp_r7b
+
+ +

Assuming the compressed tar file resides in the directory + ]]>,. extract the compressed tar file into the + current directory:

+
+gunzip -c <SOME-DIR>/<PREFIX>.tar.gz | tar xfp -
+
+ +

Read the README file in the installation directory for + last minute updates, before proceeding.

+
+ +

Run the Install script in the installation directory, + with the absolute path of the installation directory as argument,

+
+./Install /usr/local/erlang/otp_r7b
+

and supply answers to the prompts.

+

In most cases, there is a default answer in square brackets + ([]). If the default is satisfactory, just press + ]]>. In general you are only prompted for one thing:

+ + +

"Do you want to use a minimal system startup instead of the + SASL startup?"

+ + In a minimal system, only the Kernel and STDLIB applications + are loaded and started. If the SASL startup is used, the SASL + application is included as well. Normally, the minimal system + is enough.

+
+
+
+ +

Make Erlang/OTP available for users, either by putting the path + /usr/local/erlang/otp_r7b/bin in users $PATH + variable, or link the executable + /usr/local/erlang/otp_r7b/bin/erl accordingly, e.g.:

+
+ln -s /usr/local/erlang/otp_r7b/bin/erl /usr/local/bin/erl 
+
+
+
+
+ +
+ Windows + +
+ Introduction +

The system is delivered as a single .exe file.

+

To browse the on-line HTML documentation, Netscape or an equivalent + browser supporting frames is needed.

+
+ +
+ Installation Procedure +

The installation procedure is is automated. Double-click the + .exe file icon and follow the instructions.

+
+
+
+ diff --git a/system/doc/installation_guide/make.dep b/system/doc/installation_guide/make.dep new file mode 100644 index 0000000000..3d1477935d --- /dev/null +++ b/system/doc/installation_guide/make.dep @@ -0,0 +1,13 @@ +# ---------------------------------------------------- +# >>>> Do not edit this file <<<< +# This file was automaticly generated by +# /home/otp/bin/docdepend +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# TeX files that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: book.tex install.tex part.tex verification.tex + diff --git a/system/doc/installation_guide/note.gif b/system/doc/installation_guide/note.gif new file mode 100644 index 0000000000..6fffe30419 Binary files /dev/null and b/system/doc/installation_guide/note.gif differ diff --git a/system/doc/installation_guide/part.xml b/system/doc/installation_guide/part.xml new file mode 100644 index 0000000000..3019d2e118 --- /dev/null +++ b/system/doc/installation_guide/part.xml @@ -0,0 +1,37 @@ + + + + +
+ + 20002009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Installation Guide + + + + + part.xml +
+ +

How to install Erlang/OTP on UNIX or Windows.

+
+ + +
+ diff --git a/system/doc/installation_guide/verification.xml b/system/doc/installation_guide/verification.xml new file mode 100644 index 0000000000..814c252dca --- /dev/null +++ b/system/doc/installation_guide/verification.xml @@ -0,0 +1,102 @@ + + + + +
+ + 20002009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Installation Verification + Peter Högfeldt + Peter Högfeldt + + (Peter Högfeldt + + 1997-05-26 + C + verification.xml +
+

This chapter is about verifying your installation by performing + a few simple tests to see that your system is properly installed.

+ +
+ UNIX + + +

Start Erlang/OTP from the command line,

+
+  unix> erl
+

Expect the following output:

+
+  Erlang (BEAM) emulator version 5.0.1 [threads]
+
+  Eshell V5.0.1  (abort with ^G)
+  1>
+
+ +

Start the GS-based toolbar from the Erlang shell,

+
+  1> toolbar:start().
+

and check that the toolbar window pops up. +

+

Note: The trailing full stop (".") is an end marker + for all commands in the Erlang shell, and must be entered for a + command to begin execution.

+
+ +

Exit by entering the command halt(),

+
+  2> halt().
+

which should end both the toolbar window and the command line window.

+
+
+
+ +
+ Windows + + +

Start Erlang/OTP by double-clicking on the Erlang shortcut icon on the + desktop.

+

Expect a command line window to pop up with the following output,

+
+  Erlang (BEAM) emulator version 5.0.1 [threads]
+
+  Eshell V5.0.1  (abort with ^G)
+  1>
+
+ +

Start the GS-based toolbar from the Erlang shell,

+
+  1> toolbar:start().
+

and check that the toolbar window pops up. +

+

Note: The trailing full stop (".") is an end marker + for all commands in the Erlang shell, and must be entered for a + command to begin execution.

+
+ +

Exit by entering the command halt(),

+
+  2> halt().
+

which should end both the toolbar window and the command line window.

+
+
+
+
+ diff --git a/system/doc/installation_guide/warning.gif b/system/doc/installation_guide/warning.gif new file mode 100644 index 0000000000..96af52360e Binary files /dev/null and b/system/doc/installation_guide/warning.gif differ diff --git a/system/doc/installation_guide/xmlfiles.mk b/system/doc/installation_guide/xmlfiles.mk new file mode 100644 index 0000000000..7e1235b64d --- /dev/null +++ b/system/doc/installation_guide/xmlfiles.mk @@ -0,0 +1,21 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +INST_GUIDE_CHAPTER_FILES = \ + install.xml \ + verification.xml diff --git a/system/doc/oam/Makefile b/system/doc/oam/Makefile new file mode 100644 index 0000000000..e3288c9182 --- /dev/null +++ b/system/doc/oam/Makefile @@ -0,0 +1,102 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include $(ERL_TOP)/erts/vsn.mk +#VSN=$(SYSTEM_VSN) + +APPLICATION=otp-system-documentation +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/doc/oam + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +XML_PART_FILES = part.xml + +include xmlfiles.mk + +XML_CHAPTER_FILES=$(OAM_CHAPTER_FILES) + +TOPDOCDIR=.. + +BOOK_FILES = book.xml + +GIF_FILES = \ + snmp_model_1.gif \ + snmp_model_2.gif \ + snmp_model_3.gif \ + terminology.gif + +XML_FILES = \ + $(BOOK_FILES) $(XML_CHAPTER_FILES) \ + $(XML_PART_FILES) +# ---------------------------------------------------- + +HTMLDIR = ../html/oam + +HTML_UG_FILE = $(HTMLDIR)/users_guide.html + + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAGS += +DVIPS_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +$(HTMLDIR)/%.gif: %.gif + $(INSTALL_DATA) $< $@ + +docs: html + +local_docs: PDFDIR=../../pdf + +html: $(HTML_UG_FILE) gifs + +gifs: $(GIF_FILES:%=$(HTMLDIR)/%) + +debug opt: + +clean clean_docs: + rm -rf $(HTMLDIR) + rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f errs core *~ + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_docs_spec: docs + $(INSTALL_DIR) $(RELSYSDIR) + $(INSTALL_DATA) $(GIF_FILES) $(HTMLDIR)/*.html \ + $(RELSYSDIR) + +release_spec: + + diff --git a/system/doc/oam/book.xml b/system/doc/oam/book.xml new file mode 100644 index 0000000000..a2596b7fbe --- /dev/null +++ b/system/doc/oam/book.xml @@ -0,0 +1,43 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + OAM Principles + Martin Björklund + + + + +
+ + + OAM Principles + + + + + + + + +
+ diff --git a/system/doc/oam/make.dep b/system/doc/oam/make.dep new file mode 100644 index 0000000000..3694df9f1b --- /dev/null +++ b/system/doc/oam/make.dep @@ -0,0 +1,26 @@ +# ---------------------------------------------------- +# >>>> Do not edit this file <<<< +# This file was automaticly generated by +# /home/otp/bin/docdepend +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# TeX files that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: book.tex oam_intro.tex part.tex + +# ---------------------------------------------------- +# Source inlined when transforming from source to LaTeX +# ---------------------------------------------------- + +oam_intro.tex: ../../../system/doc/definitions/term.defs + +# ---------------------------------------------------- +# Pictures that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: snmp_model_1.ps snmp_model_2.ps snmp_model_3.ps \ + terminology.ps + diff --git a/system/doc/oam/note.gif b/system/doc/oam/note.gif new file mode 100644 index 0000000000..6fffe30419 Binary files /dev/null and b/system/doc/oam/note.gif differ diff --git a/system/doc/oam/oam_intro.xml b/system/doc/oam/oam_intro.xml new file mode 100644 index 0000000000..bd7369b84c --- /dev/null +++ b/system/doc/oam/oam_intro.xml @@ -0,0 +1,269 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Introduction + Martin Björklund + + 1997-11-01 + A + oam_intro.xml +
+

The operation and maintenance support in OTP consists of a + generic model for management subsystems in OTP, and some + components to be used in these subsystems. This document + describes the model. +

+

The main idea in the model is that it is management protocol + independent. Thus, it is not tied to any specific management + protocol. An API is defined which can be used to write + adaptations for specific management protocols. +

+

Each OAM component in OTP is implemented as one sub application, + which can be included in a management application for the system. + Note that such a complete management application is not in the + scope of this generic functionality. Examples illustrating how such an + application can be built are included however. +

+ +
+ Terminology +

The protocol independent architectural model on the network + level is the well-known Client-Server model for management operations. This model is based on the client-server + principle, where the manager (client) sends A request is sent from a manager to an agent when it accesses management information.to the + agent (server), the agent sends A reply is sent from the agent as a response to a request from a manager.back to the manager. There are two main + differences to the normal client-server model. First, there are + usually a few managers that communicate with many agents; and + second, the agent may spontaneously send A notification is sent spontaneously from an agent to a manager, e.g. an alarm.to the + manager. The picture below illustrates the idea.

+ + Terminology + +

The manager is often referred to as the , to + emphasize that it usually is realized as a program that presents + data to an operator. +

+

The agent is an entity that executes within a . + In OTP, the network element may be a distributed system, meaning + that the distributed system is managed as one entity. Of + course, the agent may be configured to be able to run on one of + several nodes, making it a distributed OTP application. +

+

The management information is defined in an . + It is a formal definition of which information the agent makes + available to the manager. The manager accesses the MIB through + a management protocol, such as SNMP, CMIP, HTTP or CORBA. Each + of these protocols have their own MIB definition language. In + SNMP, it is a subset of ASN.1, in CMIP it is GDMO, in HTTP it is + implicit, and using CORBA, it is IDL. Usually, the entities + defined in the MIB are called , although these + objects do not have to be objects in the OO way,for example, a simple + scalar variable defined in an MIB is called a Managed Object. + The Managed Objects are logical objects, not necessarily with a + one-to-one mapping to the resources. +

+
+ +
+ Model +

In this section, the generic protocol independent model for use + within an OTP based network element is presented. This model is + used by all operation and maintenance components, and may be + used by the applications. The advantage of the model is that it + clearly separates the resources from the management protocol. + The resources do not need to be aware of which management + protocol is used to manage the system. This makes it possible + to manage the same resources with different protocols. +

+

The different entities involved in this model are the which terminates the management protocol, and the + which is to be managed, i.e. the actual + application entities. The resources should in general have no + knowledge of the management protocol used, and the agent should + have no knowledge of the managed resources. This implies that + some sort of translation mechanism must be used, to translate + the management operations to operations on the resources. This + translation mechanism is usually called + instrumentation, and the function that implements it is + called . The + instrumentation functions are written for each combination of + management protocol and resource to be managed. For example, if + an application is to be managed by SNMP and HTTP, two sets of + instrumentation functions are defined; one that maps SNMP + requests to the resources, and one that e.g. generates an HTML + page for some resources. +

+

When a manager makes a request to the agent, we have the + following picture:

+ + Request to an agent by a manager + +

Note that the mapping between instrumentation function and + resource is not necessarily 1-1. It is also possible to write + one instrumentation function for each resource, and use that + function from different protocols. +

+

The agent receives a request and maps this request to calls to + one or several instrumentation functions. The instrumentation + functions perform operations on the resources to implement the + semantics associated with the managed object. +

+

For example, a system that is managed with SNMP and HTTP may be + structured in the following way:

+ + Structure of a system managed with SNMP and HTTP + +

The resources may send notifications to the manager as well. + Examples of notifications are events and alarms. There is a + need for the resource to generate protocol independent + notifications. The following picture illustrates how this is + achieved:

+ + Notification handling + +

The main idea is that the resource sends the notfications as + Erlang terms to a dedicated gen_event process. Into this + process, handlers for the different management protocols are + installed. When an event is received by this process, it is + forwarded to each installed handler. The handlers are + responsible for translating the event into a notification to be + sent over the management protocol. For example, a handler for + SNMP would translate each event into an SNMP trap. +

+
+ +
+ SNMP based OAM +

For all OAM components, SNMP adaptations are provided. Other + adaptations may be defined in the future. +

+

The OAM components, and some other OTP applications, define + SNMP MIBs. All these MIBs are written in SNMPv2 SMI syntax, as + defined in RFC1902. For convenience we also deliver the SNMPv1 + SMI equivalent. All MIBs are designed to be v1/v2 compatible, + i.e. the v2 MIBs do not use any construct not available in v1. +

+ +
+ MIB structure +

The top-level OTP MIB is called OTP-REG, and it is + included in the sasl application. All other OTP mibs + import some objects from this MIB. +

+

Each MIB is contained in one application. The MIB text files + are stored under .mib]]> in the application + directory. The generated .hrl files with constant + declarations are stored under .hrl]]>, and + the compiled MIBs are stored under + .bin]]>. For example, the OTP-MIB + is included in the sasl application: +

+ +sasl-1.3/mibs/OTP-MIB.mib + include/OTP-MIB.hrl + priv/mibs/OTP-MIB.bin +

An application that needs to IMPORT this mib into another + MIB, should use the il option to the snmp mib compiler: +

+ +snmp:c("MY-MIB", [{il, ["sasl/priv/mibs"]}]). +

If the application needs to include the generated + .hrl file, it should use the -include_lib + directive to the Erlang compiler. +

+ +-module(my_mib). + +-include_lib("sasl/include/OTP-MIB.hrl"). +

The following MIBs are defined in the OTP system: +

+ + OTP-REG (sasl) + +

This MIB contains the top-level OTP registration + objects, used by all other MIBs. +

+
+ OTP-TC (sasl) + +

This MIB contains the general Textual Conventions, + which can be used by any other MIB. +

+
+ OTP-MIB (sasl) + +

This MIB contains objects for instrumentation of the + Erlang nodes, the Erlang machines and the applications in + the system. +

+
+ OTP-OS-MON-MIB (os_mon) + +

This MIB contains objects for instrumentation of disk, + memory and cpu usage of the nodes in the system. +

+
+ OTP-SNMPEA-MIB (snmp) + +

This MIB contains objects for instrumentation and + control of the extensible snmp agent itself. Note that + the agent also implements the standard SNMPv2-MIB (or v1 + part of MIB-II, if SNMPv1 is used). +

+
+ OTP-EVA-MIB (eva) + +

This MIB contains objects for instrumentation and + control of the events and alarms in the system. +

+
+ OTP-LOG-MIB (eva) + +

This MIB contains objects for instrumentation and + control of the logs and FTP transfer of logs. +

+
+ OTP-EVA-LOG-MIB (eva) + +

This MIB contains objects for instrumentation and + control of the events and alarm logs in the system. +

+
+ OTP-SNMPEA-LOG-MIB (eva) + +

This MIB contains objects for instrumentation and + control of the snmp audit trail log in the system. +

+
+
+

The different applications use different strategies for + loading the MIBs into the agent. Some MIB implementations are + code-only, while others need a server. One way, used by the + code-only mib implementations, is for the user to call a + function such as otp_mib:init(Agent) to load the MIB, + and otp_mib:stop(Agent) to unload the MIB. See the + application manual page for each application for a description + of how to load each MIB. +

+
+
+
+ diff --git a/system/doc/oam/part.xml b/system/doc/oam/part.xml new file mode 100644 index 0000000000..8e3acb6e0d --- /dev/null +++ b/system/doc/oam/part.xml @@ -0,0 +1,36 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + OAM Principles + Martin Björklund + + + + + 1997-11-01 + A + +
+ +
+ diff --git a/system/doc/oam/snmp_model_1.fig b/system/doc/oam/snmp_model_1.fig new file mode 100644 index 0000000000..ab5ec76eaf --- /dev/null +++ b/system/doc/oam/snmp_model_1.fig @@ -0,0 +1,42 @@ +#FIG 3.1 +Portrait +Center +Inches +1200 2 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 3900 2850 5625 2850 5625 3600 3900 3600 3900 2850 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 1500 2850 3225 2850 3225 3600 1500 3600 1500 2850 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 2775 1500 4575 1500 4575 2325 2775 2325 2775 1500 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 5025 4200 6225 4200 6225 4800 5025 4800 5025 4200 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 1650 4200 2850 4200 2850 4800 1650 4800 1650 4200 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 3600 825 3600 1500 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 3150 2325 2325 2850 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4200 2325 4800 2850 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2250 3600 2250 4200 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4500 3600 4050 4200 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 5175 3600 5700 4200 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 6975 1050 6975 4350 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 3450 4200 4650 4200 4650 4800 3450 4800 3450 4200 +4 0 -1 0 0 0 12 0.0000 4 135 1110 1875 3300 Instrumentation\001 +4 0 -1 0 0 0 12 0.0000 4 135 1110 4200 3300 Instrumentation\001 +4 0 -1 0 0 0 12 0.0000 4 135 360 2025 4575 Res1\001 +4 0 -1 0 0 0 12 0.0000 4 135 345 3450 525 NET\001 +4 0 -1 0 0 0 12 0.0000 4 180 435 3375 1950 Agent\001 +4 0 -1 0 0 0 12 0.0000 4 135 330 6825 600 flow\001 +4 0 -1 0 0 0 12 0.0000 4 135 360 3825 4575 Res2\001 +4 0 -1 0 0 0 12 0.0000 4 135 360 5475 4575 Res3\001 +4 0 -1 0 0 0 12 0.0000 4 135 240 1500 2175 NE\001 diff --git a/system/doc/oam/snmp_model_1.gif b/system/doc/oam/snmp_model_1.gif new file mode 100644 index 0000000000..cf44d0fcc4 Binary files /dev/null and b/system/doc/oam/snmp_model_1.gif differ diff --git a/system/doc/oam/snmp_model_1.ps b/system/doc/oam/snmp_model_1.ps new file mode 100644 index 0000000000..1e4307cd09 --- /dev/null +++ b/system/doc/oam/snmp_model_1.ps @@ -0,0 +1,160 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: snmp_model_1.fig +%%Creator: fig2dev Version 3.1 Patchlevel 2 +%%CreationDate: Wed Jan 12 11:13:58 2000 +%%For: nibe@gundor (Bengt Nilsson, ETX/DN/SP) +%Magnification: 1.00 +%%Orientation: Portrait +%%BoundingBox: 0 0 341 264 +%%Pages: 0 +%%BeginSetup +%%IncludeFeature: *PageSize Letter +%%EndSetup +%%EndComments +/$F2psDict 200 dict def +$F2psDict begin +$F2psDict /mtrx matrix put +/col-1 {0 setgray} bind def +/col0 {0.000 0.000 0.000 srgb} bind def +/col1 {0.000 0.000 1.000 srgb} bind def +/col2 {0.000 1.000 0.000 srgb} bind def +/col3 {0.000 1.000 1.000 srgb} bind def +/col4 {1.000 0.000 0.000 srgb} bind def +/col5 {1.000 0.000 1.000 srgb} bind def +/col6 {1.000 1.000 0.000 srgb} bind def +/col7 {1.000 1.000 1.000 srgb} bind def +/col8 {0.000 0.000 0.560 srgb} bind def +/col9 {0.000 0.000 0.690 srgb} bind def +/col10 {0.000 0.000 0.820 srgb} bind def +/col11 {0.530 0.810 1.000 srgb} bind def +/col12 {0.000 0.560 0.000 srgb} bind def +/col13 {0.000 0.690 0.000 srgb} bind def +/col14 {0.000 0.820 0.000 srgb} bind def +/col15 {0.000 0.560 0.560 srgb} bind def +/col16 {0.000 0.690 0.690 srgb} bind def +/col17 {0.000 0.820 0.820 srgb} bind def +/col18 {0.560 0.000 0.000 srgb} bind def +/col19 {0.690 0.000 0.000 srgb} bind def +/col20 {0.820 0.000 0.000 srgb} bind def +/col21 {0.560 0.000 0.560 srgb} bind def +/col22 {0.690 0.000 0.690 srgb} bind def +/col23 {0.820 0.000 0.820 srgb} bind def +/col24 {0.500 0.190 0.000 srgb} bind def +/col25 {0.630 0.250 0.000 srgb} bind def +/col26 {0.750 0.380 0.000 srgb} bind def +/col27 {1.000 0.500 0.500 srgb} bind def +/col28 {1.000 0.630 0.630 srgb} bind def +/col29 {1.000 0.750 0.750 srgb} bind def +/col30 {1.000 0.880 0.880 srgb} bind def +/col31 {1.000 0.840 0.000 srgb} bind def + +end +save +-89.0 289.0 translate +1 -1 scale + +/cp {closepath} bind def +/ef {eofill} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth} bind def +/tr {translate} bind def +/tnt {dup dup currentrgbcolor + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} + bind def +/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul + 4 -2 roll mul srgb} bind def +/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def +/$F2psEnd {$F2psEnteredState restore end} def +%%EndProlog + +$F2psBegin +10 setmiterlimit +n 0 792 m 0 0 l 612 0 l 612 792 l cp clip + 0.06000 0.06000 sc +7.500 slw +% Polyline +n 3900 2850 m 5625 2850 l 5625 3600 l 3900 3600 l cp gs col-1 s gr +% Polyline +n 1500 2850 m 3225 2850 l 3225 3600 l 1500 3600 l cp gs col-1 s gr +% Polyline +n 2775 1500 m 4575 1500 l 4575 2325 l 2775 2325 l cp gs col-1 s gr +% Polyline +n 5025 4200 m 6225 4200 l 6225 4800 l 5025 4800 l cp gs col-1 s gr +% Polyline +n 1650 4200 m 2850 4200 l 2850 4800 l 1650 4800 l cp gs col-1 s gr +% Polyline +gs clippath +3630 1353 m 3600 1473 l 3570 1353 l 3570 1515 l 3630 1515 l cp clip +n 3600 825 m 3600 1500 l gs col-1 s gr gr + +% arrowhead +n 3630 1353 m 3600 1473 l 3570 1353 l col-1 s +% Polyline +n 3150 2325 m 2325 2850 l gs col-1 s gr +% Polyline +n 4200 2325 m 4800 2850 l gs col-1 s gr +% Polyline +n 2250 3600 m 2250 4200 l gs col-1 s gr +% Polyline +n 4500 3600 m 4050 4200 l gs col-1 s gr +% Polyline +n 5175 3600 m 5700 4200 l gs col-1 s gr +% Polyline +gs clippath +7005 4203 m 6975 4323 l 6945 4203 l 6945 4365 l 7005 4365 l cp clip +n 6975 1050 m 6975 4350 l gs col-1 s gr gr + +% arrowhead +n 7005 4203 m 6975 4323 l 6945 4203 l col-1 s +% Polyline +n 3450 4200 m 4650 4200 l 4650 4800 l 3450 4800 l cp gs col-1 s gr +/Times-Roman ff 180.00 scf sf +1875 3300 m +gs 1 -1 sc (Instrumentation) col-1 sh gr +/Times-Roman ff 180.00 scf sf +4200 3300 m +gs 1 -1 sc (Instrumentation) col-1 sh gr +/Times-Roman ff 180.00 scf sf +2025 4575 m +gs 1 -1 sc (Res1) col-1 sh gr +/Times-Roman ff 180.00 scf sf +3450 525 m +gs 1 -1 sc (NET) col-1 sh gr +/Times-Roman ff 180.00 scf sf +3375 1950 m +gs 1 -1 sc (Agent) col-1 sh gr +/Times-Roman ff 180.00 scf sf +6825 600 m +gs 1 -1 sc (flow) col-1 sh gr +/Times-Roman ff 180.00 scf sf +3825 4575 m +gs 1 -1 sc (Res2) col-1 sh gr +/Times-Roman ff 180.00 scf sf +5475 4575 m +gs 1 -1 sc (Res3) col-1 sh gr +/Times-Roman ff 180.00 scf sf +1500 2175 m +gs 1 -1 sc (NE) col-1 sh gr +$F2psEnd +rs diff --git a/system/doc/oam/snmp_model_2.fig b/system/doc/oam/snmp_model_2.fig new file mode 100644 index 0000000000..7719ea58bf --- /dev/null +++ b/system/doc/oam/snmp_model_2.fig @@ -0,0 +1,52 @@ +#FIG 3.1 +Landscape +Center +Inches +1200 2 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 1200 1200 2475 1200 2475 1800 1200 1800 1200 1200 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 2475 1800 2475 1800 2475 1800 2475 1800 2475 1800 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 3600 1200 4875 1200 4875 1800 3600 1800 3600 1200 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 3600 1200 4875 1200 4875 1800 3600 1800 3600 1200 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 1050 2400 2550 2400 2550 3000 1050 3000 1050 2400 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 3450 2400 4950 2400 4950 3000 3450 3000 3450 2400 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 1200 3600 2400 3600 2400 4125 1200 4125 1200 3600 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 2400 4125 2400 4125 2400 4125 2400 4125 2400 4125 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 2775 3600 3900 3600 3900 4125 2775 4125 2775 3600 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 4275 3600 5400 3600 5400 4125 4275 4125 4275 3600 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 1800 1800 1800 2400 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4200 1800 4200 2400 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 1800 3000 1800 3600 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3 + 4125 3000 3300 3600 3375 3600 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4350 3000 4875 3600 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2250 3000 3150 3600 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 3600 3000 2100 3600 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 6225 1200 6225 3600 +4 0 -1 0 0 0 12 0.0000 4 135 510 1500 1425 SNMP\001 +4 0 -1 0 0 0 12 0.0000 4 135 450 3825 1425 HTTP\001 +4 0 -1 0 0 0 12 0.0000 4 135 465 3825 1665 Server\001 +4 0 -1 0 0 0 12 0.0000 4 135 465 1500 1665 Server\001 +4 0 -1 0 0 0 12 0.0000 4 135 1110 1275 2775 Instrumentation\001 +4 0 -1 0 0 0 12 0.0000 4 135 1110 3675 2775 Instrumentation\001 +4 0 -1 0 0 0 12 0.0000 4 135 360 1575 3900 Res1\001 +4 0 -1 0 0 0 12 0.0000 4 135 360 3150 3900 Res2\001 +4 0 -1 0 0 0 12 0.0000 4 135 360 4500 3900 Res3\001 +4 0 -1 0 0 0 12 0.0000 4 135 330 6075 1050 flow\001 diff --git a/system/doc/oam/snmp_model_2.gif b/system/doc/oam/snmp_model_2.gif new file mode 100644 index 0000000000..79c6ef1af5 Binary files /dev/null and b/system/doc/oam/snmp_model_2.gif differ diff --git a/system/doc/oam/snmp_model_2.ps b/system/doc/oam/snmp_model_2.ps new file mode 100644 index 0000000000..a58b061690 --- /dev/null +++ b/system/doc/oam/snmp_model_2.ps @@ -0,0 +1,168 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: snmp_model_2.fig +%%Creator: fig2dev Version 3.1 Patchlevel 2 +%%CreationDate: Wed Jan 12 12:16:38 2000 +%%For: nibe@gundor (Bengt Nilsson, ETX/DN/SP) +%Magnification: 1.00 +%%Orientation: Portrait +%%BoundingBox: 0 0 323 193 +%%Pages: 0 +%%BeginSetup +%%IncludeFeature: *PageSize Letter +%%EndSetup +%%EndComments +/$F2psDict 200 dict def +$F2psDict begin +$F2psDict /mtrx matrix put +/col-1 {0 setgray} bind def +/col0 {0.000 0.000 0.000 srgb} bind def +/col1 {0.000 0.000 1.000 srgb} bind def +/col2 {0.000 1.000 0.000 srgb} bind def +/col3 {0.000 1.000 1.000 srgb} bind def +/col4 {1.000 0.000 0.000 srgb} bind def +/col5 {1.000 0.000 1.000 srgb} bind def +/col6 {1.000 1.000 0.000 srgb} bind def +/col7 {1.000 1.000 1.000 srgb} bind def +/col8 {0.000 0.000 0.560 srgb} bind def +/col9 {0.000 0.000 0.690 srgb} bind def +/col10 {0.000 0.000 0.820 srgb} bind def +/col11 {0.530 0.810 1.000 srgb} bind def +/col12 {0.000 0.560 0.000 srgb} bind def +/col13 {0.000 0.690 0.000 srgb} bind def +/col14 {0.000 0.820 0.000 srgb} bind def +/col15 {0.000 0.560 0.560 srgb} bind def +/col16 {0.000 0.690 0.690 srgb} bind def +/col17 {0.000 0.820 0.820 srgb} bind def +/col18 {0.560 0.000 0.000 srgb} bind def +/col19 {0.690 0.000 0.000 srgb} bind def +/col20 {0.820 0.000 0.000 srgb} bind def +/col21 {0.560 0.000 0.560 srgb} bind def +/col22 {0.690 0.000 0.690 srgb} bind def +/col23 {0.820 0.000 0.820 srgb} bind def +/col24 {0.500 0.190 0.000 srgb} bind def +/col25 {0.630 0.250 0.000 srgb} bind def +/col26 {0.750 0.380 0.000 srgb} bind def +/col27 {1.000 0.500 0.500 srgb} bind def +/col28 {1.000 0.630 0.630 srgb} bind def +/col29 {1.000 0.750 0.750 srgb} bind def +/col30 {1.000 0.880 0.880 srgb} bind def +/col31 {1.000 0.840 0.000 srgb} bind def + +end +save +-62.0 249.0 translate +1 -1 scale + +/cp {closepath} bind def +/ef {eofill} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth} bind def +/tr {translate} bind def +/tnt {dup dup currentrgbcolor + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} + bind def +/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul + 4 -2 roll mul srgb} bind def +/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def +/$F2psEnd {$F2psEnteredState restore end} def +%%EndProlog + +$F2psBegin +10 setmiterlimit +n 0 792 m 0 0 l 612 0 l 612 792 l cp clip + 0.06000 0.06000 sc +7.500 slw +% Polyline +n 1200 1200 m 2475 1200 l 2475 1800 l 1200 1800 l cp gs col-1 s gr +% Polyline +n 2475 1800 m 2475 1800 l 2475 1800 l 2475 1800 l cp gs col-1 s gr +% Polyline +n 3600 1200 m 4875 1200 l 4875 1800 l 3600 1800 l cp gs col-1 s gr +% Polyline +n 3600 1200 m 4875 1200 l 4875 1800 l 3600 1800 l cp gs col-1 s gr +% Polyline +n 1050 2400 m 2550 2400 l 2550 3000 l 1050 3000 l cp gs col-1 s gr +% Polyline +n 3450 2400 m 4950 2400 l 4950 3000 l 3450 3000 l cp gs col-1 s gr +% Polyline +n 1200 3600 m 2400 3600 l 2400 4125 l 1200 4125 l cp gs col-1 s gr +% Polyline +n 2400 4125 m 2400 4125 l 2400 4125 l 2400 4125 l cp gs col-1 s gr +% Polyline +n 2775 3600 m 3900 3600 l 3900 4125 l 2775 4125 l cp gs col-1 s gr +% Polyline +n 4275 3600 m 5400 3600 l 5400 4125 l 4275 4125 l cp gs col-1 s gr +% Polyline +n 1800 1800 m 1800 2400 l gs col-1 s gr +% Polyline +n 4200 1800 m 4200 2400 l gs col-1 s gr +% Polyline +n 1800 3000 m 1800 3600 l gs col-1 s gr +% Polyline +n 4125 3000 m 3300 3600 l 3375 3600 l gs col-1 s gr +% Polyline +n 4350 3000 m 4875 3600 l gs col-1 s gr +% Polyline +n 2250 3000 m 3150 3600 l gs col-1 s gr +% Polyline +n 3600 3000 m 2100 3600 l gs col-1 s gr +% Polyline +gs clippath +6255 3453 m 6225 3573 l 6195 3453 l 6195 3615 l 6255 3615 l cp clip +n 6225 1200 m 6225 3600 l gs col-1 s gr gr + +% arrowhead +n 6255 3453 m 6225 3573 l 6195 3453 l col-1 s +/Times-Roman ff 180.00 scf sf +1500 1425 m +gs 1 -1 sc (SNMP) col-1 sh gr +/Times-Roman ff 180.00 scf sf +3825 1425 m +gs 1 -1 sc (HTTP) col-1 sh gr +/Times-Roman ff 180.00 scf sf +3825 1665 m +gs 1 -1 sc (Server) col-1 sh gr +/Times-Roman ff 180.00 scf sf +1500 1665 m +gs 1 -1 sc (Server) col-1 sh gr +/Times-Roman ff 180.00 scf sf +1275 2775 m +gs 1 -1 sc (Instrumentation) col-1 sh gr +/Times-Roman ff 180.00 scf sf +3675 2775 m +gs 1 -1 sc (Instrumentation) col-1 sh gr +/Times-Roman ff 180.00 scf sf +1575 3900 m +gs 1 -1 sc (Res1) col-1 sh gr +/Times-Roman ff 180.00 scf sf +3150 3900 m +gs 1 -1 sc (Res2) col-1 sh gr +/Times-Roman ff 180.00 scf sf +4500 3900 m +gs 1 -1 sc (Res3) col-1 sh gr +/Times-Roman ff 180.00 scf sf +6075 1050 m +gs 1 -1 sc (flow) col-1 sh gr +$F2psEnd +rs diff --git a/system/doc/oam/snmp_model_3.fig b/system/doc/oam/snmp_model_3.fig new file mode 100644 index 0000000000..b2356c7cfe --- /dev/null +++ b/system/doc/oam/snmp_model_3.fig @@ -0,0 +1,56 @@ +#FIG 3.1 +Landscape +Center +Inches +1200 2 +6 1800 1500 2325 1950 +4 0 -1 0 0 0 12 0.0000 4 135 465 1800 1890 Server\001 +4 0 -1 0 0 0 12 0.0000 4 135 510 1800 1650 SNMP\001 +-6 +6 4200 1425 4725 1875 +4 0 -1 0 0 0 12 0.0000 4 135 450 4200 1575 HTTP\001 +4 0 -1 0 0 0 12 0.0000 4 135 465 4200 1815 Server\001 +-6 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 1200 1200 3000 1200 3000 2250 1200 2250 1200 1200 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 3600 1200 5400 1200 5400 2250 3600 2250 3600 1200 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 1200 3000 3000 3000 3000 3825 1200 3825 1200 3000 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 3600 3000 5400 3000 5400 3825 3600 3825 3600 3000 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 2475 4500 4200 4500 4200 5400 2475 5400 2475 4500 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 4200 6000 5400 6000 5400 6600 4200 6600 4200 6000 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 1200 6000 2400 6000 2400 6600 1200 6600 1200 6000 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 2700 6000 3900 6000 3900 6600 2700 6600 2700 6000 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2100 2250 2100 3000 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4500 2250 4500 3000 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2100 3825 3000 4500 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4500 3825 3600 4500 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 1800 6000 3000 5400 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 3300 6000 3300 5400 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 4800 6000 3600 5400 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 1 2 + 2 1 1.00 60.00 120.00 + 6600 1575 6600 5850 +4 0 -1 0 0 0 12 0.0000 4 135 1110 3900 3450 Instrumentation\001 +4 0 -1 0 0 0 12 0.0000 4 135 1110 1500 3450 Instrumentation\001 +4 0 -1 0 0 0 12 0.0000 4 165 720 3000 4950 gen_event\001 +4 0 -1 0 0 0 12 0.0000 4 135 360 3150 6375 Res2\001 +4 0 -1 0 0 0 12 0.0000 4 135 360 4650 6375 Res3\001 +4 0 -1 0 0 0 12 0.0000 4 135 360 1650 6375 Res1\001 +4 0 -1 0 0 0 12 0.0000 4 135 330 6450 1275 flow\001 diff --git a/system/doc/oam/snmp_model_3.gif b/system/doc/oam/snmp_model_3.gif new file mode 100644 index 0000000000..dbc8157ed1 Binary files /dev/null and b/system/doc/oam/snmp_model_3.gif differ diff --git a/system/doc/oam/snmp_model_3.ps b/system/doc/oam/snmp_model_3.ps new file mode 100644 index 0000000000..c615918cca --- /dev/null +++ b/system/doc/oam/snmp_model_3.ps @@ -0,0 +1,182 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: snmp_model_3.fig +%%Creator: fig2dev Version 3.1 Patchlevel 2 +%%CreationDate: Wed Jan 12 12:37:37 2000 +%%For: nibe@gundor (Bengt Nilsson, ETX/DN/SP) +%Magnification: 1.00 +%%Orientation: Portrait +%%BoundingBox: 0 0 337 327 +%%Pages: 0 +%%BeginSetup +%%IncludeFeature: *PageSize Letter +%%EndSetup +%%EndComments +/$F2psDict 200 dict def +$F2psDict begin +$F2psDict /mtrx matrix put +/col-1 {0 setgray} bind def +/col0 {0.000 0.000 0.000 srgb} bind def +/col1 {0.000 0.000 1.000 srgb} bind def +/col2 {0.000 1.000 0.000 srgb} bind def +/col3 {0.000 1.000 1.000 srgb} bind def +/col4 {1.000 0.000 0.000 srgb} bind def +/col5 {1.000 0.000 1.000 srgb} bind def +/col6 {1.000 1.000 0.000 srgb} bind def +/col7 {1.000 1.000 1.000 srgb} bind def +/col8 {0.000 0.000 0.560 srgb} bind def +/col9 {0.000 0.000 0.690 srgb} bind def +/col10 {0.000 0.000 0.820 srgb} bind def +/col11 {0.530 0.810 1.000 srgb} bind def +/col12 {0.000 0.560 0.000 srgb} bind def +/col13 {0.000 0.690 0.000 srgb} bind def +/col14 {0.000 0.820 0.000 srgb} bind def +/col15 {0.000 0.560 0.560 srgb} bind def +/col16 {0.000 0.690 0.690 srgb} bind def +/col17 {0.000 0.820 0.820 srgb} bind def +/col18 {0.560 0.000 0.000 srgb} bind def +/col19 {0.690 0.000 0.000 srgb} bind def +/col20 {0.820 0.000 0.000 srgb} bind def +/col21 {0.560 0.000 0.560 srgb} bind def +/col22 {0.690 0.000 0.690 srgb} bind def +/col23 {0.820 0.000 0.820 srgb} bind def +/col24 {0.500 0.190 0.000 srgb} bind def +/col25 {0.630 0.250 0.000 srgb} bind def +/col26 {0.750 0.380 0.000 srgb} bind def +/col27 {1.000 0.500 0.500 srgb} bind def +/col28 {1.000 0.630 0.630 srgb} bind def +/col29 {1.000 0.750 0.750 srgb} bind def +/col30 {1.000 0.880 0.880 srgb} bind def +/col31 {1.000 0.840 0.000 srgb} bind def + +end +save +-71.0 397.0 translate +1 -1 scale + +/cp {closepath} bind def +/ef {eofill} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth} bind def +/tr {translate} bind def +/tnt {dup dup currentrgbcolor + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} + bind def +/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul + 4 -2 roll mul srgb} bind def +/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def +/$F2psEnd {$F2psEnteredState restore end} def +%%EndProlog + +$F2psBegin +10 setmiterlimit +n 0 792 m 0 0 l 612 0 l 612 792 l cp clip + 0.06000 0.06000 sc +/Times-Roman ff 180.00 scf sf +1800 1890 m +gs 1 -1 sc (Server) col-1 sh gr +/Times-Roman ff 180.00 scf sf +1800 1650 m +gs 1 -1 sc (SNMP) col-1 sh gr +/Times-Roman ff 180.00 scf sf +4200 1575 m +gs 1 -1 sc (HTTP) col-1 sh gr +/Times-Roman ff 180.00 scf sf +4200 1815 m +gs 1 -1 sc (Server) col-1 sh gr +7.500 slw +% Polyline +n 1200 1200 m 3000 1200 l 3000 2250 l 1200 2250 l cp gs col-1 s gr +% Polyline +n 3600 1200 m 5400 1200 l 5400 2250 l 3600 2250 l cp gs col-1 s gr +% Polyline +n 1200 3000 m 3000 3000 l 3000 3825 l 1200 3825 l cp gs col-1 s gr +% Polyline +n 3600 3000 m 5400 3000 l 5400 3825 l 3600 3825 l cp gs col-1 s gr +% Polyline +n 2475 4500 m 4200 4500 l 4200 5400 l 2475 5400 l cp gs col-1 s gr +% Polyline +n 4200 6000 m 5400 6000 l 5400 6600 l 4200 6600 l cp gs col-1 s gr +% Polyline +n 1200 6000 m 2400 6000 l 2400 6600 l 1200 6600 l cp gs col-1 s gr +% Polyline +n 2700 6000 m 3900 6000 l 3900 6600 l 2700 6600 l cp gs col-1 s gr +% Polyline +n 2100 2250 m 2100 3000 l gs col-1 s gr +% Polyline +n 4500 2250 m 4500 3000 l gs col-1 s gr +% Polyline +n 2100 3825 m 3000 4500 l gs col-1 s gr +% Polyline +n 4500 3825 m 3600 4500 l gs col-1 s gr +% Polyline +gs clippath +2855 5439 m 2975 5412 l 2882 5493 l 3027 5420 l 3000 5366 l cp clip +n 1800 6000 m 3000 5400 l gs col-1 s gr gr + +% arrowhead +n 2855 5439 m 2975 5412 l 2882 5493 l col-1 s +% Polyline +gs clippath +3270 5547 m 3300 5427 l 3330 5547 l 3330 5385 l 3270 5385 l cp clip +n 3300 6000 m 3300 5400 l gs col-1 s gr gr + +% arrowhead +n 3270 5547 m 3300 5427 l 3330 5547 l col-1 s +% Polyline +gs clippath +3718 5493 m 3624 5412 l 3745 5439 l 3600 5366 l 3573 5420 l cp clip +n 4800 6000 m 3600 5400 l gs col-1 s gr gr + +% arrowhead +n 3718 5493 m 3624 5412 l 3745 5439 l col-1 s +% Polyline +gs clippath +6570 1746 m 6600 1602 l 6630 1746 l 6630 1560 l 6570 1560 l cp clip +n 6600 1575 m 6600 5850 l gs col-1 s gr gr + +% arrowhead +n 6570 1746 m 6600 1602 l 6630 1746 l 6600 1722 l 6570 1746 l cp gs 0.00 setgray ef gr col-1 s +/Times-Roman ff 180.00 scf sf +3900 3450 m +gs 1 -1 sc (Instrumentation) col-1 sh gr +/Times-Roman ff 180.00 scf sf +1500 3450 m +gs 1 -1 sc (Instrumentation) col-1 sh gr +/Times-Roman ff 180.00 scf sf +3000 4950 m +gs 1 -1 sc (gen_event) col-1 sh gr +/Times-Roman ff 180.00 scf sf +3150 6375 m +gs 1 -1 sc (Res2) col-1 sh gr +/Times-Roman ff 180.00 scf sf +4650 6375 m +gs 1 -1 sc (Res3) col-1 sh gr +/Times-Roman ff 180.00 scf sf +1650 6375 m +gs 1 -1 sc (Res1) col-1 sh gr +/Times-Roman ff 180.00 scf sf +6450 1275 m +gs 1 -1 sc (flow) col-1 sh gr +$F2psEnd +rs diff --git a/system/doc/oam/terminology.fig b/system/doc/oam/terminology.fig new file mode 100644 index 0000000000..5a3638764a --- /dev/null +++ b/system/doc/oam/terminology.fig @@ -0,0 +1,37 @@ +#FIG 3.1 +Portrait +Center +Inches +1200 2 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 2400 525 3600 525 3600 1050 2400 1050 2400 525 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 2400 1950 3600 1950 3600 2475 2400 2475 2400 1950 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5 + 1575 3075 2775 3075 2775 3600 1575 3600 1575 3075 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1 + 3000 2475 +2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 + 3600 750 3600 825 +2 2 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5 + 3075 3075 4275 3075 4275 3600 3075 3600 3075 3075 +2 1 1 1 -1 7 0 0 -1 4.000 0 0 7 0 0 2 + 3000 2475 3675 3075 +2 1 1 1 -1 7 0 0 -1 4.000 0 0 7 0 0 2 + 3000 2475 2175 3075 +2 1 1 1 -1 7 0 0 -1 4.000 0 0 7 0 0 2 + 3000 1050 3000 1950 +2 1 1 1 -1 7 0 0 -1 4.000 0 0 7 0 0 2 + 3600 750 4275 1350 +2 1 1 1 -1 7 0 0 -1 4.000 0 0 7 0 0 2 + 3600 2175 4275 1650 +4 0 -1 0 0 0 14 0.0000 4 105 330 3975 2100 sees\001 +4 0 -1 0 0 0 14 0.0000 4 150 450 1275 750 NMS\001 +4 0 -1 0 0 0 14 0.0000 4 150 420 1275 1575 NET\001 +4 0 -1 0 0 0 14 0.0000 4 150 285 1350 2700 NE\001 +4 0 -1 0 0 0 14 0.0000 4 105 330 3975 975 sees\001 +4 0 -1 0 0 0 14 0.0000 4 150 390 4125 1575 MIB\001 +4 0 -1 0 0 0 14 0.0000 4 150 405 1950 3375 Res1\001 +4 0 -1 0 0 0 14 0.0000 4 150 405 3450 3375 Res2\001 +4 0 -1 0 0 0 14 0.0000 4 195 510 2775 2325 Agent\001 +4 0 -1 0 0 0 14 0.0000 4 195 735 2625 825 Manager\001 diff --git a/system/doc/oam/terminology.gif b/system/doc/oam/terminology.gif new file mode 100644 index 0000000000..89f071abf6 Binary files /dev/null and b/system/doc/oam/terminology.gif differ diff --git a/system/doc/oam/terminology.ps b/system/doc/oam/terminology.ps new file mode 100644 index 0000000000..525fa24f88 --- /dev/null +++ b/system/doc/oam/terminology.ps @@ -0,0 +1,154 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: terminology.fig +%%Creator: fig2dev Version 3.1 Patchlevel 2 +%%CreationDate: Fri Dec 17 10:43:21 1999 +%%For: nibe@gundor (Bengt Nilsson, ETX/DN/SP) +%Magnification: 1.00 +%%Orientation: Portrait +%%BoundingBox: 0 0 196 187 +%%Pages: 0 +%%BeginSetup +%%IncludeFeature: *PageSize Letter +%%EndSetup +%%EndComments +/$F2psDict 200 dict def +$F2psDict begin +$F2psDict /mtrx matrix put +/col-1 {0 setgray} bind def +/col0 {0.000 0.000 0.000 srgb} bind def +/col1 {0.000 0.000 1.000 srgb} bind def +/col2 {0.000 1.000 0.000 srgb} bind def +/col3 {0.000 1.000 1.000 srgb} bind def +/col4 {1.000 0.000 0.000 srgb} bind def +/col5 {1.000 0.000 1.000 srgb} bind def +/col6 {1.000 1.000 0.000 srgb} bind def +/col7 {1.000 1.000 1.000 srgb} bind def +/col8 {0.000 0.000 0.560 srgb} bind def +/col9 {0.000 0.000 0.690 srgb} bind def +/col10 {0.000 0.000 0.820 srgb} bind def +/col11 {0.530 0.810 1.000 srgb} bind def +/col12 {0.000 0.560 0.000 srgb} bind def +/col13 {0.000 0.690 0.000 srgb} bind def +/col14 {0.000 0.820 0.000 srgb} bind def +/col15 {0.000 0.560 0.560 srgb} bind def +/col16 {0.000 0.690 0.690 srgb} bind def +/col17 {0.000 0.820 0.820 srgb} bind def +/col18 {0.560 0.000 0.000 srgb} bind def +/col19 {0.690 0.000 0.000 srgb} bind def +/col20 {0.820 0.000 0.000 srgb} bind def +/col21 {0.560 0.000 0.560 srgb} bind def +/col22 {0.690 0.000 0.690 srgb} bind def +/col23 {0.820 0.000 0.820 srgb} bind def +/col24 {0.500 0.190 0.000 srgb} bind def +/col25 {0.630 0.250 0.000 srgb} bind def +/col26 {0.750 0.380 0.000 srgb} bind def +/col27 {1.000 0.500 0.500 srgb} bind def +/col28 {1.000 0.630 0.630 srgb} bind def +/col29 {1.000 0.750 0.750 srgb} bind def +/col30 {1.000 0.880 0.880 srgb} bind def +/col31 {1.000 0.840 0.000 srgb} bind def + +end +save +-76.0 217.0 translate +1 -1 scale + +/cp {closepath} bind def +/ef {eofill} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth} bind def +/tr {translate} bind def +/tnt {dup dup currentrgbcolor + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} + bind def +/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul + 4 -2 roll mul srgb} bind def +/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def +/$F2psEnd {$F2psEnteredState restore end} def +%%EndProlog + +$F2psBegin +10 setmiterlimit +n 0 792 m 0 0 l 612 0 l 612 792 l cp clip + 0.06000 0.06000 sc +7.500 slw +% Polyline +n 2400 525 m 3600 525 l 3600 1050 l 2400 1050 l cp gs col-1 s gr +% Polyline +n 2400 1950 m 3600 1950 l 3600 2475 l 2400 2475 l cp gs col-1 s gr +% Polyline +n 1575 3075 m 2775 3075 l 2775 3600 l 1575 3600 l cp gs col-1 s gr +% Polyline +n 3000 2475 m 3000 2475 l gs col-1 s gr +% Polyline +n 3600 750 m 3600 825 l gs col-1 s gr +% Polyline +n 3075 3075 m 4275 3075 l 4275 3600 l 3075 3600 l cp gs col-1 s gr +% Polyline + [66.7] 0 sd +n 3000 2475 m 3675 3075 l gs col-1 s gr [] 0 sd +% Polyline + [66.7] 0 sd +n 3000 2475 m 2175 3075 l gs col-1 s gr [] 0 sd +% Polyline + [66.7] 0 sd +n 3000 1050 m 3000 1950 l gs col-1 s gr [] 0 sd +% Polyline + [66.7] 0 sd +n 3600 750 m 4275 1350 l gs col-1 s gr [] 0 sd +% Polyline + [66.7] 0 sd +n 3600 2175 m 4275 1650 l gs col-1 s gr [] 0 sd +/Times-Roman ff 210.00 scf sf +3975 2100 m +gs 1 -1 sc (sees) col-1 sh gr +/Times-Roman ff 210.00 scf sf +1275 750 m +gs 1 -1 sc (NMS) col-1 sh gr +/Times-Roman ff 210.00 scf sf +1275 1575 m +gs 1 -1 sc (NET) col-1 sh gr +/Times-Roman ff 210.00 scf sf +1350 2700 m +gs 1 -1 sc (NE) col-1 sh gr +/Times-Roman ff 210.00 scf sf +3975 975 m +gs 1 -1 sc (sees) col-1 sh gr +/Times-Roman ff 210.00 scf sf +4125 1575 m +gs 1 -1 sc (MIB) col-1 sh gr +/Times-Roman ff 210.00 scf sf +1950 3375 m +gs 1 -1 sc (Res1) col-1 sh gr +/Times-Roman ff 210.00 scf sf +3450 3375 m +gs 1 -1 sc (Res2) col-1 sh gr +/Times-Roman ff 210.00 scf sf +2775 2325 m +gs 1 -1 sc (Agent) col-1 sh gr +/Times-Roman ff 210.00 scf sf +2625 825 m +gs 1 -1 sc (Manager) col-1 sh gr +$F2psEnd +rs diff --git a/system/doc/oam/warning.gif b/system/doc/oam/warning.gif new file mode 100644 index 0000000000..96af52360e Binary files /dev/null and b/system/doc/oam/warning.gif differ diff --git a/system/doc/oam/xmlfiles.mk b/system/doc/oam/xmlfiles.mk new file mode 100644 index 0000000000..0610bdb989 --- /dev/null +++ b/system/doc/oam/xmlfiles.mk @@ -0,0 +1,19 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +OAM_CHAPTER_FILES = oam_intro.xml diff --git a/system/doc/pdf/.gitignore b/system/doc/pdf/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/system/doc/pics/Makefile b/system/doc/pics/Makefile new file mode 100644 index 0000000000..fc5996259d --- /dev/null +++ b/system/doc/pics/Makefile @@ -0,0 +1,58 @@ +# +# Copyright (C) 1996,1997 Ericsson Telecommunications +# Author: Lars Thorsen +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/doc + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +# +# Common macros +# + +GIF_FILES= \ + min_head.gif \ + ps.gif + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- + +docs: + +pdf: + +ps: + +debug opt: + + + +clean: + @echo "No action" >/dev/null + +# +# Release Targets +# +include $(ERL_TOP)/make/otp_release_targets.mk + +ifeq ($(DOCTYPE),pdf) +release_docs_spec: pdf +else +ifeq ($(DOCTYPE),ps) +release_docs_spec: ps +else +release_docs_spec: docs + $(INSTALL_DIR) $(RELSYSDIR)/pics + $(INSTALL_DATA) $(GIF_FILES) $(RELSYSDIR)/pics +endif +endif + +release_spec: diff --git a/system/doc/pics/app.gif b/system/doc/pics/app.gif new file mode 100644 index 0000000000..345d5795b1 Binary files /dev/null and b/system/doc/pics/app.gif differ diff --git a/system/doc/pics/ede.gif b/system/doc/pics/ede.gif new file mode 100644 index 0000000000..7a51766898 Binary files /dev/null and b/system/doc/pics/ede.gif differ diff --git a/system/doc/pics/ede_logo.gif b/system/doc/pics/ede_logo.gif new file mode 100644 index 0000000000..f7c902791b Binary files /dev/null and b/system/doc/pics/ede_logo.gif differ diff --git a/system/doc/pics/min_head.gif b/system/doc/pics/min_head.gif new file mode 100644 index 0000000000..67948a6378 Binary files /dev/null and b/system/doc/pics/min_head.gif differ diff --git a/system/doc/pics/notes.gif b/system/doc/pics/notes.gif new file mode 100644 index 0000000000..e000cca26a Binary files /dev/null and b/system/doc/pics/notes.gif differ diff --git a/system/doc/pics/otp.gif b/system/doc/pics/otp.gif new file mode 100644 index 0000000000..48c4ca9c02 Binary files /dev/null and b/system/doc/pics/otp.gif differ diff --git a/system/doc/pics/otp_logo.gif b/system/doc/pics/otp_logo.gif new file mode 100644 index 0000000000..d1a1f7f72d Binary files /dev/null and b/system/doc/pics/otp_logo.gif differ diff --git a/system/doc/pics/ps.gif b/system/doc/pics/ps.gif new file mode 100644 index 0000000000..186dfc7e24 Binary files /dev/null and b/system/doc/pics/ps.gif differ diff --git a/system/doc/pics/ref_man.gif b/system/doc/pics/ref_man.gif new file mode 100644 index 0000000000..b13c4efd53 Binary files /dev/null and b/system/doc/pics/ref_man.gif differ diff --git a/system/doc/pics/user_guide.gif b/system/doc/pics/user_guide.gif new file mode 100644 index 0000000000..e6275a803d Binary files /dev/null and b/system/doc/pics/user_guide.gif differ diff --git a/system/doc/programming_examples/Makefile b/system/doc/programming_examples/Makefile new file mode 100644 index 0000000000..73512c9654 --- /dev/null +++ b/system/doc/programming_examples/Makefile @@ -0,0 +1,98 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2003-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include $(ERL_TOP)/erts/vsn.mk +#VSN=$(SYSTEM_VSN) + +APPLICATION=otp-system-documentation +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/doc/programming_examples + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +XML_PART_FILES = part.xml + +include xmlfiles.mk + +XML_CHAPTER_FILES=$(PROG_EX_CHAPTER_FILES) + +TOPDOCDIR=.. + +BOOK_FILES = book.xml + +GIF_FILES = + +PS_FILES = + +XML_FILES = \ + $(BOOK_FILES) $(XML_CHAPTER_FILES) \ + $(XML_PART_FILES) +# ---------------------------------------------------- + +HTML_FILES = \ + $(XML_PART_FILES:%.xml=%.html) + +HTMLDIR = ../html/programming_examples + +HTML_UG_FILE = $(HTMLDIR)/users_guide.html + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAGS += +DVIPS_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +docs: html +local_docs: PDFDIR=../../pdf + +html: $(GIF_FILES) $(HTML_UG_FILE) + +debug opt: + +clean clean_docs: + rm -rf $(HTMLDIR) + rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f errs core *~ + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_docs_spec: docs + $(INSTALL_DIR) $(RELSYSDIR) + $(INSTALL_DATA) $(GIF_FILES) $(HTMLDIR)/*.html \ + $(RELSYSDIR) + +release_spec: + + + diff --git a/system/doc/programming_examples/bit_syntax.xml b/system/doc/programming_examples/bit_syntax.xml new file mode 100644 index 0000000000..3306365c0e --- /dev/null +++ b/system/doc/programming_examples/bit_syntax.xml @@ -0,0 +1,327 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Bit Syntax + + + + + bit_syntax.xml +
+ +
+ Introduction +

In Erlang a Bin is used for constructing binaries and matching + binary patterns. A Bin is written with the following syntax:

+ >]]> +

A Bin is a low-level sequence of bits or bytes. The purpose of a Bin is + to be able to, from a high level, construct a binary,

+ >]]> +

in which case all elements must be bound, or to match a binary,

+ > = Bin ]]> +

where Bin is bound, and where the elements are bound or + unbound, as in any match.

+

In R12B, a Bin need not consist of a whole number of bytes.

+ +

A bitstring is a sequence of zero or more bits, where + the number of bits doesn't need to be divisible by 8. If the number + of bits is divisible by 8, the bitstring is also a binary.

+

Each element specifies a certain segment of the bitstring. + A segment is a set of contiguous bits of the binary (not + necessarily on a byte boundary). The first element specifies + the initial segment, the second element specifies the following + segment etc.

+

The following examples illustrate how binaries are constructed + or matched, and how elements and tails are specified.

+ +
+ Examples +

Example 1: A binary can be constructed from a set of + constants or a string literal:

+ >, +Bin12 = <<"abc">>]]> +

yields binaries of size 3; binary_to_list(Bin11) + evaluates to [1, 17, 42], and + binary_to_list(Bin12) evaluates to [97, 98, 99].

+

Example 2: Similarly, a binary can be constructed + from a set of bound variables:

+ >]]> +

yields a binary of size 4, and binary_to_list(Bin2) + evaluates to [1, 17, 00, 42] too. Here we used a + size expression for the variable C in order to + specify a 16-bits segment of Bin2.

+

Example 3: A Bin can also be used for matching: if + D, E, and F are unbound variables, and + Bin2 is bound as in the former example,

+ > = Bin2]]> +

yields D = 273, E = 00, and F binds to a binary + of size 1: binary_to_list(F) = [42].

+

Example 4: The following is a more elaborate example + of matching, where Dgram is bound to the consecutive + bytes of an IP datagram of IP protocol version 4, and where we + want to extract the header and the data of the datagram:

+ > when HLen>=5, 4*HLen= + OptsLen = 4*(HLen - ?IP_MIN_HDR_LEN), + <> = RestDgram, + ... +end.]]> +

Here the segment corresponding to the Opts variable + has a type modifier specifying that Opts should + bind to a binary. All other variables have the default type + equal to unsigned integer.

+

An IP datagram header is of variable length, and its length - + measured in the number of 32-bit words - is given in + the segment corresponding to HLen, the minimum value of + which is 5. It is the segment corresponding to Opts + that is variable: if HLen is equal to 5, Opts + will be an empty binary.

+

The tail variables RestDgram and Data bind to + binaries, as all tail variables do. Both may bind to empty + binaries.

+

If the first 4-bits segment of Dgram is not equal to + 4, or if HLen is less than 5, or if the size of + Dgram is less than 4*HLen, the match of + Dgram fails.

+
+
+ +
+ A Lexical Note +

Note that ">]]>" will be interpreted as + ">]]>", which is a syntax error. + The correct way to write the expression is + ">]]>".

+
+ +
+ Segments +

Each segment has the following general syntax:

+

Value:Size/TypeSpecifierList

+

Both the Size and the TypeSpecifier or both may be + omitted; thus the following variations are allowed:

+

Value

+

Value:Size

+

Value/TypeSpecifierList

+

Default values will be used for missing specifications. + The default values are described in the section + Defaults.

+

Used in binary construction, the Value part is any + expression. Used in binary matching, the Value part must + be a literal or variable. You can read more about + the Value part in the section about constructing + binaries and matching binaries.

+

The Size part of the segment multiplied by the unit in + the TypeSpecifierList (described below) gives the number + of bits for the segment. In construction, Size is any + expression that evaluates to an integer. In matching, + Size must be a constant expression or a variable.

+

The TypeSpecifierList is a list of type specifiers + separated by hyphens.

+ + Type + The type can be integer, float, or + binary. + Signedness + The signedness specification can be either signed + or unsigned. Note that signedness only matters for + matching. + Endianness + The endianness specification can be either big, + little, or native. Native-endian means that + the endian will be resolved at load time to be either + big-endian or little-endian, depending on what is "native" + for the CPU that the Erlang machine is run on. + Unit + The unit size is given as unit:IntegerLiteral. + The allowed range is 1-256. It will be multiplied by + the Size specifier to give the effective size of + the segment. In R12B, the unit size specifies the alignment + for binary segments without size (examples will follow). + +

Example:

+ +X:4/little-signed-integer-unit:8 +

This element has a total size of 4*8 = 32 bits, and it contains + a signed integer in little-endian order.

+
+ +
+ Defaults +

The default type for a segment is integer. The default + type does not depend on the value, even if the value is a + literal. For instance, the default type in '>]]>' is + integer, not float.

+

The default Size depends on the type. For integer it is + 8. For float it is 64. For binary it is all of the binary. In + matching, this default value is only valid for the very last + element. All other binary elements in matching must have a size + specification.

+

The default unit depends on the the type. For integer, + float, and bitstring it is 1. For binary it is 8.

+

The default signedness is unsigned.

+

The default endianness is big.

+
+ +
+ Constructing Binaries and Bitstrings +

This section describes the rules for constructing binaries using + the bit syntax. Unlike when constructing lists or tuples, + the construction of a binary can fail with a badarg + exception.

+

There can be zero or more segments in a binary to be + constructed. The expression '>]]>' constructs a zero + length binary.

+

Each segment in a binary can consist of zero or more bits. + There are no alignment rules for individual segments of type + integer and float. For binaries and bitstrings + without size, the unit specifies the alignment. Since the default + alignment for the binary type is 8, the size of a binary + segment must be a multiple of 8 bits (i.e. only whole bytes). + Example:

+ >]]> +

The variable Bin must contain a whole number of bytes, + because the binary type defaults to unit:8. + A badarg exception will be generated if Bin would + consist of (for instance) 17 bits.

+ +

On the other hand, the variable Bitstring may consist of + any number of bits, for instance 0, 1, 8, 11, 17, 42, and so on, + because the default unit for bitstrings is 1.

+ +

For clarity, it is recommended not to change the unit + size for binaries, but to use binary when you need byte + alignment, and bitstring when you need bit alignment.

+ +

The following example

+ >]]> +

will successfully construct a bitstring of 7 bits. + (Provided that all of X and Y are integers.)

+

As noted earlier, segments have the following general syntax:

+

Value:Size/TypeSpecifierList

+

When constructing binaries, Value and Size can be + any Erlang expression. However, for syntactical reasons, both + Value and Size must be enclosed in parenthesis if + the expression consists of anything more than a single literal + or variable. The following gives a compiler syntax error:

+ >]]> +

This expression must be rewritten to

+ >]]> +

in order to be accepted by the compiler.

+ +
+ Including Literal Strings +

As syntactic sugar, an literal string may be written instead + of a element.

+ >]]> +

which is syntactic sugar for

+ >]]> +
+
+ +
+ Matching Binaries +

This section describes the rules for matching binaries using + the bit syntax.

+

There can be zero or more segments in a binary pattern. + A binary pattern can occur in every place patterns are allowed, + also inside other patterns. Binary patterns cannot be nested.

+

The pattern '>]]>' matches a zero length binary.

+

Each segment in a binary can consist of zero or more bits.

+

A segment of type binary must have a size evenly + divisible by 8 (or divisible by the unit size, if the unit size has been changed).

+

A segment of type bitstring has no restrictions on the size.

+

As noted earlier, segments have the following general syntax:

+

Value:Size/TypeSpecifierList

+

When matching Value value must be either a variable or + an integer or floating point literal. Expressions are not + allowed.

+

Size must be an integer literal, or a previously bound + variable. Note that the following is not allowed:

+ >) -> + {X,T}.]]> +

The two occurrences of N are not related. The compiler + will complain that the N in the size field is unbound.

+

The correct way to write this example is like this:

+ + <> = Bin, + {X,T}.]]> + +
+ Getting the Rest of the Binary or Bitstring +

To match out the rest of a binary, specify a binary field + without size:

+ >) ->]]> +

The size of the tail must be evenly divisible by 8.

+ +

To match out the rest of a bitstring, specify a field + without size:

+ >) ->]]> +

There is no restriction on the number of bits in the tail.

+
+
+ +
+ Appending to a Binary +

In R12B, the following function for creating a binary out of + a list of triples of integers is now efficient:

+ + triples_to_bin(T, <<>>). + +triples_to_bin([{X,Y,Z} | T], Acc) -> + triples_to_bin(T, <>); % inefficient before R12B +triples_to_bin([], Acc) -> + Acc.]]> +

In previous releases, this function was highly inefficient, because + the binary constructed so far (Acc) was copied in each recursion step. + That is no longer the case. See the Efficiency Guide for more information.

+
+
+ diff --git a/system/doc/programming_examples/book.xml b/system/doc/programming_examples/book.xml new file mode 100644 index 0000000000..91346ceea4 --- /dev/null +++ b/system/doc/programming_examples/book.xml @@ -0,0 +1,37 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Programming Examples + + + + +
+ Programming Examples + + + + + +
+ diff --git a/system/doc/programming_examples/fun_test.erl b/system/doc/programming_examples/fun_test.erl new file mode 100644 index 0000000000..8472fd87f8 --- /dev/null +++ b/system/doc/programming_examples/fun_test.erl @@ -0,0 +1,17 @@ +%1 +-module(fun_test). +-export([t1/0, t2/0, t3/0, t4/0, double/1]). +-import(lists, [map/2]). + +t1() -> map(fun(X) -> 2 * X end, [1,2,3,4,5]). + +t2() -> map(fun double/1, [1,2,3,4,5]). + +t3() -> map({?MODULE, double}, [1,2,3,4,5]). + +double(X) -> X * 2. +%1 + + +t4() -> + "hello world". diff --git a/system/doc/programming_examples/funparse.erl b/system/doc/programming_examples/funparse.erl new file mode 100644 index 0000000000..5e23c90df9 --- /dev/null +++ b/system/doc/programming_examples/funparse.erl @@ -0,0 +1,74 @@ +-module(funparse). +-compile(export_all). +-import(lists, [reverse/1]). + +%17 +%% > hof:parse([a,c]). +%% {ok,{'and',{'or',1,{const,a}},{'or',1,{const,c}}}} +%% > hof:parse([a,d]). +%% {ok,{'and',{'or',1,{const,a}},{'or',2,{const,d}}}} +%% > hof:parse([b,c]). +%% {ok,{'and',{'or',2,{const,b}},{'or',1,{const,c}}}} +%% > hof:parse([b,d]). +%% {ok,{'and',{'or',2,{const,b}},{'or',2,{const,d}}}} +%% > hof:parse([a,b]). +%% fail +%17 + +%% Grammar = (a | b) & (c | d) + +%12 +parse(List) -> + (grammar())(List). +%12 + +%13 +grammar() -> + pand( + por(pconst(a), pconst(b)), + por(pconst(c), pconst(d))). +%13 + +%14 +pconst(X) -> + fun (T) -> + case T of + [X|T1] -> {ok, {const, X}, T1}; + _ -> fail + end + end. +%14 + +%15 +por(P1, P2) -> + fun (T) -> + case P1(T) of + {ok, R, T1} -> + {ok, {'or',1,R}, T1}; + fail -> + case P2(T) of + {ok, R1, T1} -> + {ok, {'or',2,R1}, T1}; + fail -> + fail + end + end + end. +%15 + +%16 +pand(P1, P2) -> + fun (T) -> + case P1(T) of + {ok, R1, T1} -> + case P2(T1) of + {ok, R2, T2} -> + {ok, {'and', R1, R2}}; + fail -> + fail + end; + fail -> + fail + end + end. +%16 diff --git a/system/doc/programming_examples/funs.xmlsrc b/system/doc/programming_examples/funs.xmlsrc new file mode 100644 index 0000000000..92f99cf6d3 --- /dev/null +++ b/system/doc/programming_examples/funs.xmlsrc @@ -0,0 +1,515 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Funs + + + + + funs.xml +
+ +
+ Example 1 - map +

If we want to double every element in a list, we could write a + function named double:

+ +double([H|T]) -> [2*H|double(T)]; +double([]) -> []. +

This function obviously doubles the argument entered as input + as follows:

+
+> double([1,2,3,4]).
+[2,4,6,8]
+

We now add the function add_one, which adds one to every + element in a list:

+ +add_one([H|T]) -> [H+1|add_one(T)]; +add_one([]) -> []. +

These functions, double and add_one, have a very + similar structure. We can exploit this fact and write a function + map which expresses this similarity:

+ +

We can now express the functions double and + add_one in terms of map as follows:

+ +double(L) -> map(fun(X) -> 2*X end, L). +add_one(L) -> map(fun(X) -> 1 + X end, L). +

map(F, List) is a function which takes a function + F and a list L as arguments and returns the new + list which is obtained by applying F to each of + the elements in L.

+

The process of abstracting out the common features of a number + of different programs is called procedural abstraction. + Procedural abstraction can be used in order to write several + different functions which have a similar structure, but differ + only in some minor detail. This is done as follows:

+ + write one function which represents the common features of + these functions + parameterize the difference in terms of functions which + are passed as arguments to the common function. + +
+ +
+ Example 2 - foreach +

This example illustrates procedural abstraction. Initially, we + show the following two examples written as conventional + functions:

+ + all elements of a list are printed onto a stream + a message is broadcast to a list of processes. + + +print_list(Stream, [H|T]) -> + io:format(Stream, "~p~n", [H]), + print_list(Stream, T); +print_list(Stream, []) -> + true. + +broadcast(Msg, [Pid|Pids]) -> + Pid ! Msg, + broadcast(Msg, Pids); +broadcast(_, []) -> + true. +

Both these functions have a very similar structure. They both + iterate over a list doing something to each element in the list. + The "something" has to be carried round as an extra argument to + the function which does this.

+

The function foreach expresses this similarity:

+ +

Using foreach, print_list becomes:

+ +foreach(fun(H) -> io:format(S, "~p~n",[H]) end, L) +

broadcast becomes:

+ +foreach(fun(Pid) -> Pid ! M end, L) +

foreach is evaluated for its side-effect and not its + value. foreach(Fun ,L) calls Fun(X) for each + element X in L and the processing occurs in + the order in which the elements were defined in L. + map does not define the order in which its elements are + processed.

+
+ +
+ The Syntax of Funs +

Funs are written with the syntax:

+ +F = fun (Arg1, Arg2, ... ArgN) -> + ... + end +

This creates an anonymous function of N arguments and + binds it to the variable F.

+

If we have already written a function in the same module and + wish to pass this function as an argument, we can use + the following syntax:

+ +F = fun FunctionName/Arity +

With this form of function reference, the function which is + referred to does not need to be exported from the module.

+

We can also refer to a function defined in a different module + with the following syntax:

+ +F = {Module, FunctionName} +

In this case, the function must be exported from the module in + question.

+

The follow program illustrates the different ways of creating + funs:

+ +

We can evaluate the fun F with the syntax:

+ +F(Arg1, Arg2, ..., Argn) +

To check whether a term is a fun, use the test + is_function/1 in a guard. Example:

+ +f(F, Args) when is_function(F) -> + apply(F, Args); +f(N, _) when is_integer(N) -> + N. +

Funs are a distinct type. The BIFs erlang:fun_info/1,2 can + be used to retrieve information about a fun, and the BIF + erlang:fun_to_list/1 returns a textual representation of a fun. + The check_process_code/2 BIF returns true if the process + contains funs that depend on the old version of a module.

+ +

In OTP R5 and earlier releases, funs were represented using + tuples.

+
+
+ +
+ Variable Bindings Within a Fun +

The scope rules for variables which occur in funs are as + follows:

+ + All variables which occur in the head of a fun are assumed + to be "fresh" variables. + Variables which are defined before the fun, and which + occur in function calls or guard tests within the fun, have + the values they had outside the fun. + No variables may be exported from a fun. + +

The following examples illustrate these rules:

+ +print_list(File, List) -> + {ok, Stream} = file:open(File, write), + foreach(fun(X) -> io:format(Stream,"~p~n",[X]) end, List), + file:close(Stream). +

In the above example, the variable X which is defined in + the head of the fun is a new variable. The value of the variable + Stream which is used within within the fun gets its value + from the file:open line.

+

Since any variable which occurs in the head of a fun is + considered a new variable it would be equally valid to write:

+ +print_list(File, List) -> + {ok, Stream} = file:open(File, write), + foreach(fun(File) -> + io:format(Stream,"~p~n",[File]) + end, List), + file:close(Stream). +

In this example, File is used as the new variable + instead of X. This is rather silly since code in the body + of the fun cannot refer to the variable File which is + defined outside the fun. Compiling this example will yield + the diagnostic:

+ +./FileName.erl:Line: Warning: variable 'File' + shadowed in 'lambda head' +

This reminds us that the variable File which is defined + inside the fun collides with the variable File which is + defined outside the fun.

+

The rules for importing variables into a fun has the consequence + that certain pattern matching operations have to be moved into + guard expressions and cannot be written in the head of the fun. + For example, we might write the following code if we intend + the first clause of F to be evaluated when the value of + its argument is Y:

+ +f(...) -> + Y = ... + map(fun(X) when X == Y -> + ; + (_) -> + ... + end, ...) + ... +

instead of

+ +f(...) -> + Y = ... + map(fun(Y) -> + ; + (_) -> + ... + end, ...) + ... +
+ +
+ Funs and the Module Lists +

The following examples show a dialogue with the Erlang shell. + All the higher order functions discussed are exported from + the module lists.

+ +
+ map + +

map takes a function of one argument and a list of + terms. It returns the list obtained by applying the function + to every argument in the list.

+
+> Double = fun(X) -> 2 * X end.
+#Fun<erl_eval.6.72228031>
+> lists:map(Double, [1,2,3,4,5]).
+[2,4,6,8,10]
+

When a new fun is defined in the shell, the value of the Fun + is printed as ]]>.

+
+ +
+ any + +

any takes a predicate P of one argument and a + list of terms. A predicate is a function which returns + true or false. any is true if there is a + term X in the list such that P(X) is true.

+

We define a predicate Big(X) which is true if + its argument is greater that 10.

+
+> Big =  fun(X) -> if X > 10 -> true; true -> false end end.
+#Fun<erl_eval.6.72228031>
+> lists:any(Big, [1,2,3,4]).
+false
+> lists:any(Big, [1,2,3,12,5]).
+true
+
+ +
+ all + +

all has the same arguments as any. It is true + if the predicate applied to all elements in the list is true.

+
+> lists:all(Big, [1,2,3,4,12,6]).   
+false
+> lists:all(Big, [12,13,14,15]).       
+true
+
+ +
+ foreach + +

foreach takes a function of one argument and a list of + terms. The function is applied to each argument in the list. + foreach returns ok. It is used for its + side-effect only.

+
+> lists:foreach(fun(X) -> io:format("~w~n",[X]) end, [1,2,3,4]). 
+1
+2
+3
+4
+ok
+
+ +
+ foldl + +

foldl takes a function of two arguments, an + accumulator and a list. The function is called with two + arguments. The first argument is the successive elements in + the list, the second argument is the accumulator. The function + must return a new accumulator which is used the next time + the function is called.

+

If we have a list of lists L = ["I","like","Erlang"], + then we can sum the lengths of all the strings in L as + follows:

+
+> L = ["I","like","Erlang"].
+["I","like","Erlang"]
+10> lists:foldl(fun(X, Sum) -> length(X) + Sum end, 0, L).                    
+11
+

foldl works like a while loop in an imperative + language:

+ +L = ["I","like","Erlang"], +Sum = 0, +while( L != []){ + Sum += length(head(L)), + L = tail(L) +end +
+ +
+ mapfoldl + +

mapfoldl simultaneously maps and folds over a list. + The following example shows how to change all letters in + L to upper case and count them.

+

First upcase:

+
+> Upcase =  fun(X) when $a =< X,  X =< $z -> X + $A - $a;
+(X) -> X 
+end.
+#Fun<erl_eval.6.72228031>
+> Upcase_word = 
+fun(X) -> 
+lists:map(Upcase, X) 
+end.
+#Fun<erl_eval.6.72228031>
+> Upcase_word("Erlang").
+"ERLANG"
+> lists:map(Upcase_word, L).
+["I","LIKE","ERLANG"]
+

Now we can do the fold and the map at the same time:

+
+> lists:mapfoldl(fun(Word, Sum) ->
+{Upcase_word(Word), Sum + length(Word)}
+end, 0, L).
+{["I","LIKE","ERLANG"],11}
+
+ +
+ filter + +

filter takes a predicate of one argument and a list + and returns all element in the list which satisfy + the predicate.

+
+> lists:filter(Big, [500,12,2,45,6,7]).
+[500,12,45]
+

When we combine maps and filters we can write very succinct + code. For example, suppose we want to define a set difference + function. We want to define diff(L1, L2) to be + the difference between the lists L1 and L2. + This is the list of all elements in L1 which are not contained + in L2. This code can be written as follows:

+ +diff(L1, L2) -> + filter(fun(X) -> not member(X, L2) end, L1). +

The AND intersection of the list L1 and L2 is + also easily defined:

+ +intersection(L1,L2) -> filter(fun(X) -> member(X,L1) end, L2). +
+ +
+ takewhile + +

takewhile(P, L) takes elements X from a list + L as long as the predicate P(X) is true.

+
+> lists:takewhile(Big, [200,500,45,5,3,45,6]).  
+[200,500,45]
+
+ +
+ dropwhile + +

dropwhile is the complement of takewhile.

+
+> lists:dropwhile(Big, [200,500,45,5,3,45,6]).
+[5,3,45,6]
+
+ +
+ splitwith + +

splitwith(P, L) splits the list L into the two + sub-lists {L1, L2}, where L = takewhile(P, L) + and L2 = dropwhile(P, L).

+
+> lists:splitwith(Big, [200,500,45,5,3,45,6]).
+{[200,500,45],[5,3,45,6]}
+
+
+ +
+ Funs Which Return Funs +

So far, this section has only described functions which take + funs as arguments. It is also possible to write more powerful + functions which themselves return funs. The following examples + illustrate these type of functions.

+ +
+ Simple Higher Order Functions +

Adder(X) is a function which, given X, returns + a new function G such that G(K) returns + K + X.

+
+> Adder = fun(X) -> fun(Y) -> X + Y end end.
+#Fun<erl_eval.6.72228031>
+> Add6 = Adder(6).
+#Fun<erl_eval.6.72228031>
+> Add6(10).
+16
+
+ +
+ Infinite Lists +

The idea is to write something like:

+ +-module(lazy). +-export([ints_from/1]). +ints_from(N) -> + fun() -> + [N|ints_from(N+1)] + end. +

Then we can proceed as follows:

+
+> XX = lazy:ints_from(1).
+#Fun<lazy.0.29874839>
+> XX().
+[1|#Fun<lazy.0.29874839>]
+> hd(XX()).
+1
+> Y = tl(XX()).
+#Fun<lazy.0.29874839>
+> hd(Y()).
+2
+

etc. - this is an example of "lazy embedding".

+
+ +
+ Parsing +

The following examples show parsers of the following type:

+
+Parser(Toks) -> {ok, Tree, Toks1} | fail
+

Toks is the list of tokens to be parsed. A successful + parse returns {ok, Tree, Toks1}, where Tree is a + parse tree and Toks1 is a tail of Tree which + contains symbols encountered after the structure which was + correctly parsed. Otherwise fail is returned.

+

The example which follows illustrates a simple, functional + parser which parses the grammar:

+
+(a | b) & (c | d)
+

The following code defines a function pconst(X) in + the module funparse, which returns a fun which parses a + list of tokens.

+ +

This function can be used as follows:

+
+> P1 = funparse:pconst(a).
+#Fun<funparse.0.22674075>
+> P1([a,b,c]).
+{ok,{const,a},[b,c]}
+> P1([x,y,z]).     
+fail
+

Next, we define the two higher order functions pand + and por which combine primitive parsers to produce more + complex parsers. Firstly pand:

+ +

Given a parser P1 for grammar G1, and a parser + P2 for grammar G2, pand(P1, P2) returns a + parser for the grammar which consists of sequences of tokens + which satisfy G1 followed by sequences of tokens which + satisfy G2.

+

por(P1, P2) returns a parser for the language + described by the grammar G1 or G2.

+ +

The original problem was to parse the grammar + . The following code addresses this + problem:

+ +

The following code adds a parser interface to the grammar:

+ +

We can test this parser as follows:

+
+> funparse:parse([a,c]).
+{ok,{'and',{'or',1,{const,a}},{'or',1,{const,c}}}}
+> funparse:parse([a,d]). 
+{ok,{'and',{'or',1,{const,a}},{'or',2,{const,d}}}}
+> funparse:parse([b,c]).   
+{ok,{'and',{'or',2,{const,b}},{'or',1,{const,c}}}}
+> funparse:parse([b,d]). 
+{ok,{'and',{'or',2,{const,b}},{'or',2,{const,d}}}}
+> funparse:parse([a,b]).   
+fail
+
+
+
+ diff --git a/system/doc/programming_examples/funs1.erl b/system/doc/programming_examples/funs1.erl new file mode 100644 index 0000000000..8cf20378ea --- /dev/null +++ b/system/doc/programming_examples/funs1.erl @@ -0,0 +1,125 @@ +-module(funs1). +-compile(export_all). +-import(lists, [reverse/1]). + +%1 +map(F, [H|T]) -> [F(H)|map(F, T)]; +map(F, []) -> []. +%1 + +%2 +foreach(F, [H|T]) -> + F(H), + foreach(F, T); +foreach(F, []) -> + ok. +%2 +% +%3 +all(Pred, [H|T]) -> + case Pred(H) of + true -> all(Pred, T); + false -> false + end; +all(Pred, []) -> + true. +%3 +%4 +any(Pred, [H|T]) -> + case Pred(H) of + true -> true; + false -> any(Pred, T) + end; +any(Pred, []) -> + false. +%4 +%5 +takewhile(Pred, [H|T]) -> + case Pred(H) of + true -> [H|takewhile(Pred, T)]; + false -> [] + end; +takewhile(Pred, []) -> + []. +%5 +%6 +dropwhile(Pred, [H|T]) -> + case Pred(H) of + true -> dropwhile(Pred, T); + false -> [H|T] + end; +dropwhile(Pred, []) -> + []. +%6 +%7 +splitwith(Pred, L) -> + splitwith(Pred, L, []). + +splitwith(Pred, [H|T], L) -> + case Pred(H) of + true -> splitwith(Pred, T, [H|L]); + false -> {reverse(L), [H|T]} + end; +splitwith(Pred, [], L) -> + {reverse(L), []}. +%7 + +flatmap(F, [Hd|Tail]) -> + F(Hd) ++ flatmap(F, Tail); +flatmap(F, []) -> []. + +%8 +foldl(F, Accu, [Hd|Tail]) -> + foldl(F, F(Hd, Accu), Tail); +foldl(F, Accu, []) -> Accu. +%8 +% +foldr(F, Accu, [Hd|Tail]) -> + F(Hd, foldr(F, Accu, Tail)); +foldr(F, Accu, []) -> Accu. +%9 +filter(F, [H|T]) -> + case F(H) of + true -> [H|filter(F, T)]; + false -> filter(F, T) + end; +filter(F, []) -> []. +%9 +%10 +mapfoldl(F, Accu0, [Hd|Tail]) -> + {R,Accu1} = F(Hd, Accu0), + {Rs,Accu2} = mapfoldl(F, Accu1, Tail), + {[R|Rs], Accu2}; +mapfoldl(F, Accu, []) -> {[], Accu}. +%10 +mapfoldr(F, Accu0, [Hd|Tail]) -> + {Rs,Accu1} = mapfoldr(F, Accu0, Tail), + {R,Accu2} = F(Hd, Accu1), + {[R|Rs],Accu2}; +mapfoldr(F, Accu, []) -> {[], Accu}. +%11 +first(Pred, [H|T]) -> + case Pred(H) of + true -> + {true, H}; + false -> + first(Pred, T) + end; +first(Pred, []) -> + false. +%11 +% +compose(F, G) -> + fun(X) -> + F(G(X)) + end. + +%20 +iterate(N, F) -> + iterate(N, N+1, F). + +iterate(Stop, Stop, _) -> + []; +iterate(N, Stop, Fun) -> + [Fun(N)|iterate(N+1, Stop, Fun)]. +%20 diff --git a/system/doc/programming_examples/list_comprehensions.xml b/system/doc/programming_examples/list_comprehensions.xml new file mode 100644 index 0000000000..825459238b --- /dev/null +++ b/system/doc/programming_examples/list_comprehensions.xml @@ -0,0 +1,206 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + List Comprehensions + + + + + list_comprehensions.xml +
+ +
+ Simple Examples +

We start with a simple example:

+
+> [X || X <- [1,2,a,3,4,b,5,6], X > 3].
+[a,4,b,5,6]
+

This should be read as follows:

+ +

The list of X such that X is taken from the list + [1,2,a,...] and X is greater than 3.

+
+

The notation is a generator and + the expression X > 3 is a filter.

+

An additional filter can be added in order to restrict + the result to integers:

+
+> [X || X <- [1,2,a,3,4,b,5,6], integer(X), X > 3].
+[4,5,6]
+

Generators can be combined. For example, the Cartesian product + of two lists can be written as follows:

+
+> [{X, Y} || X <- [1,2,3], Y <- [a,b]].
+[{1,a},{1,b},{2,a},{2,b},{3,a},{3,b}]
+
+ +
+ Quick Sort +

The well known quick sort routine can be written as follows:

+ + sort([ X || X <- T, X < Pivot]) ++ + [Pivot] ++ + sort([ X || X <- T, X >= Pivot]); +sort([]) -> [].]]> +

The expression is the list of + all elements in T, which are less than Pivot.

+

= Pivot]]]> is the list of all elements in + T, which are greater or equal to Pivot.

+

To sort a list, we isolate the first element in the list and + split the list into two sub-lists. The first sub-list contains + all elements which are smaller than the first element in + the list, the second contains all elements which are greater + than or equal to the first element in the list. We then sort + the sub-lists and combine the results.

+
+ +
+ Permutations +

The following example generates all permutations of + the elements in a list:

+ [[]]; +perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])].]]> +

We take take H from L in all possible ways. + The result is the set of all lists [H|T], where T + is the set of all possible permutations of L with + H removed.

+
+> perms([b,u,g]).
+[[b,u,g],[b,g,u],[u,b,g],[u,g,b],[g,b,u],[g,u,b]]
+
+ +
+ Pythagorean Triplets +

Pythagorean triplets are sets of integers {A,B,C} such + that A**2 + B**2 = C**2.

+

The function pyth(N) generates a list of all integers + {A,B,C} such that A**2 + B**2 = C**2 and where + the sum of the sides is equal to or less than N.

+ + [ {A,B,C} || + A <- lists:seq(1,N), + B <- lists:seq(1,N), + C <- lists:seq(1,N), + A+B+C =< N, + A*A+B*B == C*C + ].]]> +
+> pyth(3).
+[].
+> pyth(11).
+[].
+> pyth(12).
+[{3,4,5},{4,3,5}]
+> pyth(50).
+[{3,4,5},
+ {4,3,5},
+ {5,12,13},
+ {6,8,10},
+ {8,6,10},
+ {8,15,17},
+ {9,12,15},
+ {12,5,13},
+ {12,9,15},
+ {12,16,20},
+ {15,8,17},
+ {16,12,20}]
+

The following code reduces the search space and is more + efficient:

+ + [{A,B,C} || + A <- lists:seq(1,N-2), + B <- lists:seq(A+1,N-1), + C <- lists:seq(B+1,N), + A+B+C =< N, + A*A+B*B == C*C ].]]> +
+ +
+ Simplifications with List Comprehensions +

As an example, list comprehensions can be used to simplify some + of the functions in lists.erl:

+ [X || L1 <- L, X <- L1]. +map(Fun, L) -> [Fun(X) || X <- L]. +filter(Pred, L) -> [X || X <- L, Pred(X)].]]> +
+ +
+ Variable Bindings in List Comprehensions +

The scope rules for variables which occur in list + comprehensions are as follows:

+ + all variables which occur in a generator pattern are + assumed to be "fresh" variables + any variables which are defined before the list + comprehension and which are used in filters have the values + they had before the list comprehension + no variables may be exported from a list comprehension. + +

As an example of these rules, suppose we want to write + the function select, which selects certain elements from + a list of tuples. We might write + [Y || {X, Y} <- L].]]> with the intention + of extracting all tuples from L where the first item is + X.

+

Compiling this yields the following diagnostic:

+ +./FileName.erl:Line: Warning: variable 'X' shadowed in generate +

This diagnostic warns us that the variable X in + the pattern is not the same variable as the variable X + which occurs in the function head.

+

Evaluating select yields the following result:

+
+> select(b,[{a,1},{b,2},{c,3},{b,7}]).
+[1,2,3,7]
+

This result is not what we wanted. To achieve the desired + effect we must write select as follows:

+ [Y || {X1, Y} <- L, X == X1].]]> +

The generator now contains unbound variables and the test has + been moved into the filter. This now works as expected:

+
+> select(b,[{a,1},{b,2},{c,3},{b,7}]).
+[2,7]
+

One consequence of the rules for importing variables into a + list comprehensions is that certain pattern matching operations + have to be moved into the filters and cannot be written directly + in the generators. To illustrate this, do not write as follows:

+ + Y = ... + [ Expression || PatternInvolving Y <- Expr, ...] + ...]]> +

Instead, write as follows:

+ + Y = ... + [ Expression || PatternInvolving Y1 <- Expr, Y == Y1, ...] + ...]]> +
+
+ diff --git a/system/doc/programming_examples/make.dep b/system/doc/programming_examples/make.dep new file mode 100644 index 0000000000..b0655f56b3 --- /dev/null +++ b/system/doc/programming_examples/make.dep @@ -0,0 +1,20 @@ +# ---------------------------------------------------- +# >>>> Do not edit this file <<<< +# This file was automaticly generated by +# /home/otp/bin/docdepend +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# TeX files that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: bit_syntax.tex book.tex funs.tex list_comprehensions.tex \ + part.tex records.tex + +# ---------------------------------------------------- +# Source inlined when transforming from source to LaTeX +# ---------------------------------------------------- + +funs.tex: fun_test.erl funparse.erl funs1.erl + diff --git a/system/doc/programming_examples/part.xml b/system/doc/programming_examples/part.xml new file mode 100644 index 0000000000..5b22ddf82f --- /dev/null +++ b/system/doc/programming_examples/part.xml @@ -0,0 +1,39 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Programming Examples + + + + +
+ +

This chapter contains examples on using records, funs, list + comprehensions and the bit syntax.

+
+ + + + +
+ diff --git a/system/doc/programming_examples/records.xml b/system/doc/programming_examples/records.xml new file mode 100644 index 0000000000..2f2434f11c --- /dev/null +++ b/system/doc/programming_examples/records.xml @@ -0,0 +1,232 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Records + + + + + records.xml +
+ +
+ Records vs Tuples +

The main advantage of using records instead of tuples is that + fields in a record are accessed by name, whereas fields in a + tuple are accessed by position. To illustrate these differences, + suppose that we want to represent a person with the tuple + {Name, Address, Phone}.

+

We must remember that the Name field is the first + element of the tuple, the Address field is the second + element, and so on, in order to write functions which manipulate + this data. For example, to extract data from a variable P + which contains such a tuple we might write the following code + and then use pattern matching to extract the relevant fields.

+ +Name = element(1, P), +Address = element(2, P), +... +

Code like this is difficult to read and understand and errors + occur if we get the numbering of the elements in the tuple wrong. + If we change the data representation by re-ordering the fields, + or by adding or removing a field, then all references to + the person tuple, wherever they occur, must be checked and + possibly modified.

+

Records allow us to refer to the fields by name and not + position. We use a record instead of a tuple to store the data. + If we write a record definition of the type shown below, we can + then refer to the fields of the record by name.

+ +-record(person, {name, phone, address}). +

For example, if P is now a variable whose value is a + person record, we can code as follows in order to access + the name and address fields of the records.

+ +Name = P#person.name, +Address = P#person.address, +... +

Internally, records are represented using tagged tuples:

+ +{person, Name, Phone, Address} +
+ +
+ Defining a Record +

This definition of a person will be used in many of + the examples which follow. It contains three fields, name, + phone and address. The default values for + name and phone is "" and [], respectively. + The default value for address is the atom + undefined, since no default value is supplied for this + field:

+
+-record(person, {name = "", phone = [], address}).
+

We have to define the record in the shell in order to be able + use the record syntax in the examples:

+
+> rd(person, {name = "", phone = [], address}).
+person
+

This is due to the fact that record definitions are available + at compile time only, not at runtime. See shell(3) for + details on records in the shell. +

+
+ +
+ Creating a Record +

A new person record is created as follows:

+
+> #person{phone=[0,8,2,3,4,3,1,2], name="Robert"}.
+#person{name = "Robert",phone = [0,8,2,3,4,3,1,2],address = undefined}
+

Since the address field was omitted, its default value + is used.

+

There is a new feature introduced in Erlang 5.1/OTP R8B, + with which you can set a value to all fields in a record, + overriding the defaults in the record specification. The special + field _, means "all fields not explicitly specified".

+
+> #person{name = "Jakob", _ = '_'}.
+#person{name = "Jakob",phone = '_',address = '_'}
+

It is primarily intended to be used in ets:match/2 and + mnesia:match_object/3, to set record fields to the atom + '_'. (This is a wildcard in ets:match/2.)

+
+ +
+ Accessing a Record Field +
+> P = #person{name = "Joe", phone = [0,8,2,3,4,3,1,2]}.
+#person{name = "Joe",phone = [0,8,2,3,4,3,1,2],address = undefined}
+> P#person.name.
+"Joe"
+
+ +
+ Updating a Record +
+> P1 = #person{name="Joe", phone=[1,2,3], address="A street"}.
+#person{name = "Joe",phone = [1,2,3],address = "A street"}
+> P2 = P1#person{name="Robert"}.
+#person{name = "Robert",phone = [1,2,3],address = "A street"}
+
+ +
+ Type Testing +

The following example shows that the guard succeeds if + P is record of type person.

+
+foo(P) when is_record(P, person) -> a_person;
+foo(_) -> not_a_person.
+
+ +
+ Pattern Matching +

Matching can be used in combination with records as shown in + the following example:

+
+> P3 = #person{name="Joe", phone=[0,0,7], address="A street"}.
+#person{name = "Joe",phone = [0,0,7],address = "A street"}
+> #person{name = Name} = P3, Name.
+"Joe"
+

The following function takes a list of person records + and searches for the phone number of a person with a particular + name:

+ +find_phone([#person{name=Name, phone=Phone} | _], Name) -> + {found, Phone}; +find_phone([_| T], Name) -> + find_phone(T, Name); +find_phone([], Name) -> + not_found. +

The fields referred to in the pattern can be given in any order.

+
+ +
+ Nested Records +

The value of a field in a record might be an instance of a + record. Retrieval of nested data can be done stepwise, or in a + single step, as shown in the following example:

+
+-record(name, {first = "Robert", last = "Ericsson"}).
+-record(person, {name = #name{}, phone}).
+
+demo() ->
+  P = #person{name= #name{first="Robert",last="Virding"}, phone=123},
+  First = (P#person.name)#name.first.
+

In this example, demo() evaluates to "Robert".

+
+ +
+ Example +
+%% File: person.hrl
+
+%%-----------------------------------------------------------
+%% Data Type: person
+%% where:
+%%    name:  A string (default is undefined).
+%%    age:   An integer (default is undefined).
+%%    phone: A list of integers (default is []).
+%%    dict:  A dictionary containing various information 
+%%           about the person. 
+%%           A {Key, Value} list (default is the empty list).
+%%------------------------------------------------------------
+-record(person, {name, age, phone = [], dict = []}).
+
+-module(person).
+-include("person.hrl").
+-compile(export_all). % For test purposes only.
+
+%% This creates an instance of a person.
+%%   Note: The phone number is not supplied so the
+%%         default value [] will be used.
+
+make_hacker_without_phone(Name, Age) ->
+   #person{name = Name, age = Age, 
+           dict = [{computer_knowledge, excellent}, 
+                   {drinks, coke}]}.
+
+%% This demonstrates matching in arguments
+
+print(#person{name = Name, age = Age,
+              phone = Phone, dict = Dict}) ->
+  io:format("Name: ~s, Age: ~w, Phone: ~w ~n" 
+            "Dictionary: ~w.~n", [Name, Age, Phone, Dict]).
+
+%% Demonstrates type testing, selector, updating.
+
+birthday(P) when record(P, person) -> 
+   P#person{age = P#person.age + 1}.
+
+register_two_hackers() ->
+   Hacker1 = make_hacker_without_phone("Joe", 29),
+   OldHacker = birthday(Hacker1),
+   % The central_register_server should have 
+   % an interface function for this.
+   central_register_server ! {register_person, Hacker1},
+   central_register_server ! {register_person, 
+             OldHacker#person{name = "Robert", 
+                              phone = [0,8,3,2,4,5,3,1]}}.
+
+
+ diff --git a/system/doc/programming_examples/xmlfiles.mk b/system/doc/programming_examples/xmlfiles.mk new file mode 100644 index 0000000000..5eb42a2881 --- /dev/null +++ b/system/doc/programming_examples/xmlfiles.mk @@ -0,0 +1,23 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +PROG_EX_CHAPTER_FILES = \ + bit_syntax.xml \ + funs.xml \ + list_comprehensions.xml \ + records.xml diff --git a/system/doc/reference_manual/Makefile b/system/doc/reference_manual/Makefile new file mode 100644 index 0000000000..34e5b7f555 --- /dev/null +++ b/system/doc/reference_manual/Makefile @@ -0,0 +1,113 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2003-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include $(ERL_TOP)/erts/vsn.mk +#VSN=$(SYSTEM_VSN) + +APPLICATION=otp-system-documentation +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/doc/reference_manual + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +XML_PART_FILES = part.xml + +include xmlfiles.mk +XML_CHAPTER_FILES=$(REF_MAN_CHAPTER_FILES) + +TOPDOCDIR=.. + +BOOK_FILES = book.xml + +GIF_FILES= + + +XML_FILES = \ + $(BOOK_FILES) $(XML_CHAPTER_FILES) \ + $(XML_PART_FILES) +# ---------------------------------------------------- + +C_FILES = + +ERL_FILES = + +HRL_FILES = + +HTML_FILES = \ + $(XML_PART_FILES:%.xml=%.html) + +HTMLDIR = ../html/reference_manual + +EXTRA_FILES = $(DEFAULT_GIF_FILES) \ + $(DEFAULT_HTML_FILES) \ + $(C_FILES) \ + $(ERL_FILES) \ + $(HRL_FILES) \ + $(MISC_FILES) \ + $(XML_CHAPTER_FILES:%.xml=%.html) + +HTML_UG_FILE = $(HTMLDIR)/users_guide.html + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAGS += +DVIPS_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +docs: html + +local_docs: PDFDIR=../../pdf + +html: $(GIF_FILES) $(HTML_UG_FILE) + +debug opt: + +clean clean_docs: + rm -rf $(HTMLDIR) + rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f errs core *~ + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_docs_spec: docs +# $(INSTALL_DIR) $(RELEASE_PATH)/pdf +# $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELEASE_PATH)/pdf + $(INSTALL_DIR) $(RELSYSDIR) + $(INSTALL_DATA) $(GIF_FILES) $(HTMLDIR)/*.html \ + $(RELSYSDIR) + +release_spec: + + + diff --git a/system/doc/reference_manual/book.xml b/system/doc/reference_manual/book.xml new file mode 100644 index 0000000000..eb2e860f80 --- /dev/null +++ b/system/doc/reference_manual/book.xml @@ -0,0 +1,43 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Erlang Reference Manual + Gunilla Arendt + + 2003-01-11 + + +
+ + + Erlang Reference Manual + + + + + + + + +
+ diff --git a/system/doc/reference_manual/code_loading.xml b/system/doc/reference_manual/code_loading.xml new file mode 100644 index 0000000000..8861b3bea5 --- /dev/null +++ b/system/doc/reference_manual/code_loading.xml @@ -0,0 +1,158 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Compilation and Code Loading + + + + + code_loading.xml +
+

How code is compiled and loaded is not a language issue, but + is system dependent. This chapter describes compilation and + code loading in Erlang/OTP with pointers to relevant parts of + the documentation.

+ +
+ Compilation +

Erlang programs must be compiled to object code. + The compiler can generate a new file which contains the object + code. The current abstract machine which runs the object code is + called BEAM, therefore the object files get the suffix + .beam. The compiler can also generate a binary which can + be loaded directly.

+

The compiler is located in the Kernel module compile, see + compile(3).

+
+compile:file(Module)
+compile:file(Module, Options)
+

The Erlang shell understands the command c(Module) which + both compiles and loads Module.

+

There is also a module make which provides a set of + functions similar to the UNIX type Make functions, see + make(3).

+

The compiler can also be accessed from the OS prompt, see + erl(1).

+
+% erl -compile Module1...ModuleN
+% erl -make
+

The erlc program provides an even better way to compile + modules from the shell, see erlc(1). It understands a + number of flags that can be used to define macros, add search + paths for include files, and more.

+
+% erlc <flags> File1.erl...FileN.erl
+
+ +
+ + Code Loading +

The object code must be loaded into the Erlang runtime + system. This is handled by the code server, see + code(3).

+

The code server loads code according to a code loading strategy + which is either interactive (default) or + embedded. In interactive mode, code are searched for in + a code path and loaded when first referenced. In + embedded mode, code is loaded at start-up according to a boot script. This is described in System Principles.

+
+ +
+ Code Replacement +

Erlang supports change of code in a running system. Code + replacement is done on module level.

+

The code of a module can exist in two variants in a system: + current and old. When a module is loaded into + the system for the first time, the code becomes 'current'. If then + a new instance of the module is loaded, the code of the previous + instance becomes 'old' and the new instance becomes 'current'.

+

Both old and current code is valid, and may be evaluated + concurrently. Fully qualified function calls always refer to + current code. Old code may still be evaluated because of processes + lingering in the old code.

+

If a third instance of the module is loaded, the code server will + remove (purge) the old code and any processes lingering in it will + be terminated. Then the third instance becomes 'current' and + the previously current code becomes 'old'.

+

To change from old code to current code, a process must make a + fully qualified function call. Example:

+
+-module(m).
+-export([loop/0]).
+
+loop() ->
+    receive
+        code_switch ->
+            m:loop();
+        Msg ->
+            ...
+            loop()
+    end.
+

To make the process change code, send the message + code_switch to it. The process then will make a fully + qualified call to m:loop() and change to current code. + Note that m:loop/0 must be exported.

+

For code replacement of funs to work, the tuple syntax + {Module,FunctionName} must be used to represent the fun.

+
+ +
+ Running a function when a module is loaded + + +

This section describes an experimental feature introduced in R13B03. + There may be backward-incompatible changes in the feature in future releases.

+
+ +

The -on_load() directive names a function that should + be run automatically when a module a loaded. Its syntax is:

+ +
+-on_load(Name/0).
+ +

It is not necessary to export the function. It will be called in a + freshly spawned process (which will be terminated as soon as the function + returns). The function must return true if the module is to + be remained loaded and be callable, or false if the module + is to be unloaded. Returning any other value or generating an exception + will also cause the module to be unloaded.

+ +

A process that calls any function in a module whose on_load + function has not yet returned will be suspended until the on_load + function has returned.

+ +

Example:

+ +
+-module(m).
+-on_load(run_me/0).
+
+run_me() ->
+    %% Do something with side effects here, for instance load a library
+    %% containing native-implemented functions.
+    true.
+ +
+ +
+ diff --git a/system/doc/reference_manual/data_types.xml b/system/doc/reference_manual/data_types.xml new file mode 100644 index 0000000000..c85ac44165 --- /dev/null +++ b/system/doc/reference_manual/data_types.xml @@ -0,0 +1,399 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Data Types + + + + + data_types.xml +
+ +
+ Terms +

Erlang provides a number of data types which are listed in this + chapter. A piece of data of any data type is called a + term.

+
+ +
+ Number +

There are two types of numeric literals, integers and + floats. Besides the conventional notation, there are two + Erlang-specific notations:

+ + $char

+ + ASCII value of the character char.
+ base#value

+ + Integer with the base base, which must be an + integer in the range 2..36.

+ + In Erlang 5.2/OTP R9B and earlier versions, the allowed range + is 2..16.
+
+

Examples:

+
+1> 42.
+42
+2> $A.
+65
+3> $\ .
+10
+4> 2#101.
+5
+5> 16#1f.
+31
+6> 2.3.
+2.3
+7> 2.3e3.
+2.3e3
+8> 2.3e-3.
+0.0023
+
+ +
+ Atom +

An atom is a literal, a constant with name. An atom should be + enclosed in single quotes (') if it does not begin with a + lower-case letter or if it contains other characters than + alphanumeric characters, underscore (_), or @.

+

Examples:

+
+hello
+phone_number
+'Monday'
+'phone number'
+
+ +
+ Bit Strings and Binaries +

A bit string is used to store an area of untyped memory.

+

Bit Strings are expressed using the + bit syntax.

+

Bit Strings which consists of a number of bits which is evenly + divisible by eight are called Binaries

+

Examples:

+
+1> <<10,20>>.
+<<10,20>>
+2> <<"ABC">>.
+<<"ABC">>
+1> <<1:1,0:1>>.
+<<2:2>>
+

More examples can be found in Programming Examples.

+
+ +
+ Reference +

A reference is a term which is unique in an Erlang runtime + system, created by calling make_ref/0.

+
+ +
+ Fun +

A fun is a functional object. Funs make it possible to create + an anonymous function and pass the function itself -- not its + name -- as argument to other functions.

+

Example:

+
+1> Fun1 = fun (X) -> X+1 end.
+#Fun<erl_eval.6.39074546>
+2> Fun1(2).
+3
+

Read more about funs in Fun Expressions. More examples can be found in Programming + Examples.

+
+ +
+ Port Identifier +

A port identifier identifies an Erlang port. open_port/2, + which is used to create ports, will return a value of this type.

+

Read more about ports in Ports and Port Drivers.

+
+ +
+ Pid +

A process identifier, pid, identifies a process. + spawn/1,2,3,4, spawn_link/1,2,3,4 and + spawn_opt/4, which are used to create processes, return + values of this type. Example:

+
+1> spawn(m, f, []).
+<0.51.0>
+

The BIF self() returns the pid of the calling process. + Example:

+
+-module(m).
+-export([loop/0]).
+
+loop() ->
+    receive
+        who_are_you ->
+            io:format("I am ~p~n", [self()]),
+            loop()
+    end.
+
+1> P = spawn(m, loop, []).
+<0.58.0>
+2> P ! who_are_you.
+I am <0.58.0>
+who_are_you
+

Read more about processes in + Processes.

+
+ +
+ Tuple +

Compound data type with a fixed number of terms:

+
+{Term1,...,TermN}
+

Each term Term in the tuple is called an + element. The number of elements is said to be + the size of the tuple.

+

There exists a number of BIFs to manipulate tuples.

+

Examples:

+
+1> P = {adam,24,{july,29}}.
+{adam,24,{july,29}}
+2> element(1,P).
+adam
+3> element(3,P).
+{july,29}
+4> P2 = setelement(2,P,25).
+{adam,25,{july,29}}
+5> tuple_size(P).
+3
+6> tuple_size({}).
+0
+
+ +
+ List +

Compound data type with a variable number of terms.

+
+[Term1,...,TermN]
+

Each term Term in the list is called an + element. The number of elements is said to be + the length of the list.

+

Formally, a list is either the empty list [] or + consists of a head (first element) and a tail + (remainder of the list) which is also a list. The latter can + be expressed as [H|T]. The notation + [Term1,...,TermN] above is actually shorthand for + the list [Term1|[...|[TermN|[]]]].

+

Example:

+[] is a list, thus

+[c|[]] is a list, thus

+[b|[c|[]]] is a list, thus

+[a|[b|[c|[]]]] is a list, or in short [a,b,c].

+

+

A list where the tail is a list is sometimes called a proper list. It is allowed to have a list where the tail is not a + list, for example [a|b]. However, this type of list is of + little practical use.

+

Examples:

+
+1> L1 = [a,2,{c,4}].
+[a,2,{c,4}]
+2> [H|T] = L1.
+[a,2,{c,4}]
+3> H.
+a
+4> T.
+[2,{c,4}]
+5> L2 = [d|T].
+[d,2,{c,4}]
+6> length(L1).
+3
+7> length([]).
+0
+

A collection of list processing functions can be found in + the STDLIB module lists.

+
+ +
+ String +

Strings are enclosed in double quotes ("), but is not a + data type in Erlang. Instead a string "hello" is + shorthand for the list [$h,$e,$l,$l,$o], that is + [104,101,108,108,111].

+

Two adjacent string literals are concatenated into one. This is + done at compile-time and does not incur any runtime overhead. + Example:

+
+"string" "42"
+

is equivalent to

+
+"string42"
+
+ +
+ Record +

A record is a data structure for storing a fixed number of + elements. It has named fields and is similar to a struct in C. + However, record is not a true data type. Instead record + expressions are translated to tuple expressions during + compilation. Therefore, record expressions are not understood by + the shell unless special actions are taken. See shell(3) + for details.

+

Examples:

+
+-module(person).
+-export([new/2]).
+
+-record(person, {name, age}).
+
+new(Name, Age) ->
+    #person{name=Name, age=Age}.
+
+1> person:new(ernie, 44).
+{person,ernie,44}
+

Read more about records in + Records. More examples can be + found in Programming Examples.

+
+ +
+ Boolean +

There is no Boolean data type in Erlang. Instead the atoms + true and false are used to denote Boolean values.

+

Examples:

+
+1> 2 =< 3.
+true
+2> true or false.
+true
+
+ +
+ Escape Sequences +

Within strings and quoted atoms, the following escape sequences + are recognized:

+ + + Sequence + Description + + + \\b + backspace + + + \\d + delete + + + \\e + escape + + + \\f + form feed + + + \ + newline + + + \\r + carriage return + + + \\s + space + + + \\t + tab + + + \\v + vertical tab + + + \\XYZ, \\YZ, \\Z + character with octal representation XYZ, YZ or Z + + + \\xXY + character with hexadecimal representation XY + + + \\x{X...} + character with hexadecimal representation; X... is one or more hexadecimal characters + + + \\^a...\\^z

+\\^A...\\^Z
+ control A to control Z +
+ + \\' + single quote + + + \\" + double quote + + + \\\\ + backslash + + Recognized Escape Sequences. +
+
+ +
+ Type Conversions +

There are a number of BIFs for type conversions. Examples:

+
+1> atom_to_list(hello).
+"hello"
+2> list_to_atom("hello").
+hello
+3> binary_to_list(<<"hello">>).
+"hello"
+4> binary_to_list(<<104,101,108,108,111>>).
+"hello"
+5> list_to_binary("hello").
+<<104,101,108,108,111>>
+6> float_to_list(7.0).
+"7.00000000000000000000e+00"
+7> list_to_float("7.000e+00").
+7.0
+8> integer_to_list(77).
+"77"
+9> list_to_integer("77").
+77
+10> tuple_to_list({a,b,c}).
+[a,b,c]
+11> list_to_tuple([a,b,c]).
+{a,b,c}
+12> term_to_binary({a,b,c}).
+<<131,104,3,100,0,1,97,100,0,1,98,100,0,1,99>>
+13> binary_to_term(<<131,104,3,100,0,1,97,100,0,1,98,100,0,1,99>>).
+{a,b,c}
+
+
+ diff --git a/system/doc/reference_manual/distributed.xml b/system/doc/reference_manual/distributed.xml new file mode 100644 index 0000000000..52222c6d9d --- /dev/null +++ b/system/doc/reference_manual/distributed.xml @@ -0,0 +1,279 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Distributed Erlang + + + + + distributed.xml +
+ +
+ Distributed Erlang System +

A distributed Erlang system consists of a number of + Erlang runtime systems communicating with each other. Each such + runtime system is called a node. Message passing between + processes at different nodes, as well as links and monitors, are + transparent when pids are used. Registered names, however, are + local to each node. This means the node must be specified as well + when sending messages etc. using registered names.

+

The distribution mechanism is implemented using TCP/IP sockets. + How to implement an alternative carrier is described in ERTS User's Guide.

+
+ +
+ Nodes +

A node is an executing Erlang runtime system which has + been given a name, using the command line flag -name + (long names) or -sname (short names).

+

The format of the node name is an atom name@host where + name is the name given by the user and host is + the full host name if long names are used, or the first part of + the host name if short names are used. node() returns + the name of the node. Example:

+
+% erl -name dilbert
+(dilbert@uab.ericsson.se)1> node().
+'dilbert@uab.ericsson.se'
+
+% erl -sname dilbert
+(dilbert@uab)1> node().
+dilbert@uab
+ +

A node with a long node name cannot communicate with a node + with a short node name.

+
+
+ +
+ Node Connections +

The nodes in a distributed Erlang system are loosely connected. + The first time the name of another node is used, for example if + spawn(Node,M,F,A) or net_adm:ping(Node) is called, + a connection attempt to that node will be made.

+

Connections are by default transitive. If a node A connects to + node B, and node B has a connection to node C, then node A will + also try to connect to node C. This feature can be turned off by + using the command line flag -connect_all false, see + erl(1).

+

If a node goes down, all connections to that node are removed. + Calling erlang:disconnect(Node) will force disconnection + of a node.

+

The list of (visible) nodes currently connected to is returned by + nodes().

+
+ +
+ epmd +

The Erlang Port Mapper Daemon epmd is automatically + started at every host where an Erlang node is started. It is + responsible for mapping the symbolic node names to machine + addresses. See epmd(1).

+
+ +
+ Hidden Nodes +

In a distributed Erlang system, it is sometimes useful to + connect to a node without also connecting to all other nodes. + An example could be some kind of O&M functionality used to + inspect the status of a system without disturbing it. For this + purpose, a hidden node may be used.

+

A hidden node is a node started with the command line flag + -hidden. Connections between hidden nodes and other nodes + are not transitive, they must be set up explicitly. Also, hidden + nodes does not show up in the list of nodes returned by + nodes(). Instead, nodes(hidden) or + nodes(connected) must be used. This means, for example, + that the hidden node will not be added to the set of nodes that + global is keeping track of.

+

This feature was added in Erlang 5.0/OTP R7.

+
+ +
+ C Nodes +

A C node is a C program written to act as a hidden node + in a distributed Erlang system. The library Erl_Interface + contains functions for this purpose. Refer to the documentation + for Erl_Interface and Interoperability Tutorial for more + information about C nodes.

+
+ +
+ Security +

Authentication determines which nodes are allowed to communicate + with each other. In a network of different Erlang nodes, it is + built into the system at the lowest possible level. Each node has + its own magic cookie, which is an Erlang atom.

+

When a nodes tries to connect to another node, the magic cookies + are compared. If they do not match, the connected node rejects + the connection.

+

At start-up, a node has a random atom assigned as its magic + cookie and the cookie of other nodes is assumed to be + nocookie. The first action of the Erlang network + authentication server (auth) is then to read a file named + $HOME/.erlang.cookie. If the file does not exist, it is + created. The UNIX permissions mode of the file is set to octal + 400 (read-only by user) and its contents are a random string. An + atom Cookie is created from the contents of the file and + the cookie of the local node is set to this using + erlang:set_cookie(node(), Cookie). This also makes + the local node assume that all other nodes have the same cookie + Cookie.

+

Thus, groups of users with identical cookie files get Erlang + nodes which can communicate freely and without interference from + the magic cookie system. Users who want run nodes on separate + file systems must make certain that their cookie files are + identical on the different file systems.

+

For a node Node1 with magic cookie Cookie to be + able to connect to, or accept a connection from, another node + Node2 with a different cookie DiffCookie, + the function erlang:set_cookie(Node2, DiffCookie) must + first be called at Node1. Distributed systems with + multiple user IDs can be handled in this way.

+

The default when a connection is established between two nodes, + is to immediately connect all other visible nodes as well. This + way, there is always a fully connected network. If there are + nodes with different cookies, this method might be inappropriate + and the command line flag -connect_all false must be set, + see erl(1).

+

The magic cookie of the local node is retrieved by calling + erlang:get_cookie().

+
+ +
+ Distribution BIFs +

Some useful BIFs for distributed programming, see + erlang(3) for more information:

+ + + erlang:disconnect_node(Node) + Forces the disconnection of a node. + + + erlang:get_cookie() + Returns the magic cookie of the current node. + + + is_alive() + Returns trueif the runtime system is a node and can connect to other nodes, falseotherwise. + + + monitor_node(Node, true|false) + Monitor the status of Node. A message{nodedown, Node}is received if the connection to it is lost. + + + node() + Returns the name of the current node. Allowed in guards. + + + node(Arg) + Returns the node where Arg, a pid, reference, or port, is located. + + + nodes() + Returns a list of all visible nodes this node is connected to. + + + nodes(Arg) + Depending on Arg, this function can return a list not only of visible nodes, but also hidden nodes and previously known nodes, etc. + + + set_cookie(Node, Cookie) + Sets the magic cookie used when connecting to Node. If Nodeis the current node, Cookiewill be used when connecting to all new nodes. + + + spawn[_link|_opt](Node, Fun) + Creates a process at a remote node. + + + spawn[_link|opt](Node, Module, FunctionName, Args) + Creates a process at a remote node. + + Distribution BIFs. +
+
+ +
+ Distribution Command Line Flags +

Examples of command line flags used for distributed programming, + see erl(1) for more information:

+ + + -connect_all false + Only explicit connection set-ups will be used. + + + -hidden + Makes a node into a hidden node. + + + -name Name + Makes a runtime system into a node, using long node names. + + + -setcookie Cookie + Same as calling erlang:set_cookie(node(), Cookie). + + + -sname Name + Makes a runtime system into a node, using short node names. + + Distribution Command Line Flags. +
+
+ +
+ Distribution Modules +

Examples of modules useful for distributed programming:

+

In Kernel:

+ + + global + A global name registration facility. + + + global_group + Grouping nodes to global name registration groups. + + + net_adm + Various Erlang net administration routines. + + + net_kernel + Erlang networking kernel. + + Kernel Modules Useful For Distribution. +
+

In STDLIB:

+ + + slave + Start and control of slave nodes. + + STDLIB Modules Useful For Distribution. +
+
+
+ diff --git a/system/doc/reference_manual/errors.xml b/system/doc/reference_manual/errors.xml new file mode 100644 index 0000000000..02885a3813 --- /dev/null +++ b/system/doc/reference_manual/errors.xml @@ -0,0 +1,217 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Errors and Error Handling + + + + + errors.xml +
+ +
+ Terminology +

Errors can roughly be divided into four different types:

+ + Compile-time errors + Logical errors + Run-time errors + Generated errors + +

A compile-time error, for example a syntax error, should not + cause much trouble as it is caught by the compiler.

+

A logical error is when a program does not behave as intended, + but does not crash. An example could be that nothing happens when + a button in a graphical user interface is clicked.

+

A run-time error is when a crash occurs. An example could be + when an operator is applied to arguments of the wrong type. + The Erlang programming language has built-in features for + handling of run-time errors.

+

A run-time error can also be emulated by calling + erlang:error(Reason), erlang:error(Reason, Args) + (those appeared in Erlang 5.4/OTP-R10), + erlang:fault(Reason) or erlang:fault(Reason, Args) + (old equivalents).

+

A run-time error is another name for an exception + of class error. +

+

A generated error is when the code itself calls + exit/1 or throw/1. Note that emulated run-time + errors are not denoted as generated errors here. +

+

Generated errors are exceptions of classes exit and + throw. +

+

When a run-time error or generated error occurs in Erlang, + execution for the process which evaluated + the erroneous expression is stopped. + This is referred to as a failure, that execution or + evaluation fails, or that the process fails, + terminates or exits. Note that a process may + terminate/exit for other reasons than a failure.

+

A process that terminates will emit an exit signal with + an exit reason that says something about which error + has occurred. Normally, some information about the error will + be printed to the terminal.

+
+ +
+ Exceptions +

Exceptions are run-time errors or generated errors and + are of three different classes, with different origins. The + try expression + (appeared in Erlang 5.4/OTP-R10B) + can distinguish between the different classes, whereas the + catch + expression can not. They are described in the Expressions chapter.

+ + + Class + Origin + + + error + Run-time error for example 1+a, or the process called erlang:error/1,2 (appeared in Erlang 5.4/OTP-R10B) or erlang:fault/1,2 (old equivalent) + + + exit + The process called exit/1 + + + throw + The process called throw/1 + + Exception Classes. +
+

An exception consists of its class, an exit reason + (the Exit Reason), + and a stack trace (that aids in finding the code location of + the exception).

+

The stack trace can be retrieved using + erlang:get_stacktrace/0 (new in Erlang 5.4/OTP-R10B + from within a try expression, and is returned for + exceptions of class error from a catch expression.

+

An exception of class error is also known as a run-time + error.

+
+ +
+ Handling of Run-Time Errors in Erlang + +
+ Error Handling Within Processes +

It is possible to prevent run-time errors and other + exceptions from causing + the process to terminate by using catch or + try, see the Expressions chapter about + Catch + and Try.

+
+ +
+ Error Handling Between Processes +

Processes can monitor other processes and detect process + terminations, see + the Processes + chapter.

+
+
+ +
+ + Exit Reasons +

When a run-time error occurs, + that is an exception of class error, + the exit reason is a tuple {Reason,Stack}. + Reason is a term indicating the type of error:

+ + + Reason + Type of error + + + badarg + Bad argument. The argument is of wrong data type, or is otherwise badly formed. + + + badarith + Bad argument in an arithmetic expression. + + + {badmatch,V} + Evaluation of a match expression failed. The value V did not match. + + + function_clause + No matching function clause is found when evaluating a function call. + + + {case_clause,V} + No matching branch is found when evaluating a case expression. The value V did not match. + + + if_clause + No true branch is found when evaluating an if expression. + + + {try_clause,V} + No matching branch is found when evaluating the of-section of a try expression. The value V did not match. + + + undef + The function cannot be found when evaluating a function call. + + + {badfun,F} + There is something wrong with a fun F. + + + {badarity,F} + A fun is applied to the wrong number of arguments. F describes the fun and the arguments. + + + timeout_value + The timeout value in a receive..after expression is evaluated to something else than an integer or infinity. + + + noproc + Trying to link to a non-existing process. + + + {nocatch,V} + Trying to evaluate a throw outside a catch. V is the thrown term. + + + system_limit + A system limit has been reached. See Efficiency Guide for information about system limits. + + Exit Reasons. +
+

Stack is the stack of function calls being evaluated + when the error occurred, given as a list of tuples + {Module,Name,Arity} with the most recent function call + first. The most recent function call tuple may in some + cases be {Module,Name,[Arg]}.

+
+
+ diff --git a/system/doc/reference_manual/expressions.xml b/system/doc/reference_manual/expressions.xml new file mode 100644 index 0000000000..fa7870d96c --- /dev/null +++ b/system/doc/reference_manual/expressions.xml @@ -0,0 +1,1422 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Expressions + + + + + expressions.xml +
+

In this chapter, all valid Erlang expressions are listed. + When writing Erlang programs, it is also allowed to use macro- + and record expressions. However, these expressions are expanded + during compilation and are in that sense not true Erlang + expressions. Macro- and record expressions are covered in + separate chapters: Macros and + Records.

+ +
+ Expression Evaluation +

All subexpressions are evaluated before an expression itself is + evaluated, unless explicitly stated otherwise. For example, + consider the expression:

+ +Expr1 + Expr2 +

Expr1 and Expr2, which are also expressions, are + evaluated first - in any order - before the addition is + performed.

+

Many of the operators can only be applied to arguments of a + certain type. For example, arithmetic operators can only be + applied to numbers. An argument of the wrong type will cause + a badarg run-time error.

+
+ +
+ + Terms +

The simplest form of expression is a term, that is an integer, + float, atom, string, list or tuple. + The return value is the term itself.

+
+ +
+ Variables +

A variable is an expression. If a variable is bound to a value, + the return value is this value. Unbound variables are only + allowed in patterns.

+

Variables start with an uppercase letter or underscore (_) + and may contain alphanumeric characters, underscore and @. + Examples:

+
+X
+Name1
+PhoneNumber
+Phone_number
+_
+_Height
+

Variables are bound to values using + pattern matching. Erlang + uses single assignment, a variable can only be bound + once.

+

The anonymous variable is denoted by underscore (_) and + can be used when a variable is required but its value can be + ignored. Example:

+
+[H|_] = [1,2,3]
+

Variables starting with underscore (_), for example + _Height, are normal variables, not anonymous. They are + however ignored by the compiler in the sense that they will not + generate any warnings for unused variables. Example: The following + code

+
+member(_, []) ->
+    [].
+

can be rewritten to be more readable:

+
+member(Elem, []) ->
+    [].
+

This will however cause a warning for an unused variable + Elem, if the code is compiled with the flag + warn_unused_vars set. Instead, the code can be rewritten + to:

+
+member(_Elem, []) ->
+    [].
+

Note that since variables starting with an underscore are + not anonymous, this will match:

+
+{_,_} = {1,2}
+

But this will fail:

+
+{_N,_N} = {1,2}
+

The scope for a variable is its function clause. + Variables bound in a branch of an if, case, + or receive expression must be bound in all branches + to have a value outside the expression, otherwise they + will be regarded as 'unsafe' outside the expression.

+

For the try expression introduced in + Erlang 5.4/OTP-R10B, variable scoping is limited so that + variables bound in the expression are always 'unsafe' outside + the expression. This will be improved.

+
+ +
+ + Patterns +

A pattern has the same structure as a term but may contain + unbound variables. Example:

+
+Name1
+[H|T]
+{error,Reason}
+

Patterns are allowed in clause heads, case and + receive expressions, and match expressions.

+ +
+ Match Operator = in Patterns +

If Pattern1 and Pattern2 are valid patterns, + then the following is also a valid pattern:

+
+Pattern1 = Pattern2
+

When matched against a term, both Pattern1 and + Pattern2 will be matched against the term. The idea + behind this feature is to avoid reconstruction of terms. + Example:

+
+f({connect,From,To,Number,Options}, To) ->
+    Signal = {connect,From,To,Number,Options},
+    ...;
+f(Signal, To) ->
+    ignore.
+

can instead be written as

+
+f({connect,_,To,_,_} = Signal, To) ->
+    ...;
+f(Signal, To) ->
+    ignore.
+
+ +
+ String Prefix in Patterns +

When matching strings, the following is a valid pattern:

+
+f("prefix" ++ Str) -> ...
+

This is syntactic sugar for the equivalent, but harder to + read

+
+f([$p,$r,$e,$f,$i,$x | Str]) -> ...
+
+ +
+ Expressions in Patterns +

An arithmetic expression can be used within a pattern, if + it uses only numeric or bitwise operators, and if its value + can be evaluated to a constant at compile-time. Example:

+
+case {Value, Result} of
+    {?THRESHOLD+1, ok} -> ...
+

This feature was added in Erlang 5.0/OTP R7.

+
+
+ +
+ Match +
+Expr1 = Expr2
+

Matches Expr1, a pattern, against Expr2. + If the matching succeeds, any unbound variable in the pattern + becomes bound and the value of Expr2 is returned.

+

If the matching fails, a badmatch run-time error will + occur.

+

Examples:

+
+1> {A, B} = {answer, 42}.
+{answer,42}
+2> A.
+answer
+3> {C, D} = [1, 2].
+** exception error: no match of right hand side value [1,2]
+
+ +
+ + Function Calls +
+ExprF(Expr1,...,ExprN)
+ExprM:ExprF(Expr1,...,ExprN)
+

In the first form of function calls, + ExprM:ExprF(Expr1,...,ExprN), each of ExprM and + ExprF must be an atom or an expression that evaluates to + an atom. The function is said to be called by using the + fully qualified function name. This is often referred + to as a remote or external function call. + Example:

+ +lists:keysearch(Name, 1, List) +

In the second form of function calls, + ExprF(Expr1,...,ExprN), ExprF must be an atom or + evaluate to a fun.

+

If ExprF is an atom the function is said to be called by + using the implicitly qualified function name. If + ExprF/N is the name of a function explicitly or + automatically imported from module M, then the call is + short for M:ExprF(Expr1,...,ExprN). Otherwise, + ExprF/N must be a locally defined function. Examples:

+ +handle(Msg, State) +spawn(m, init, []) +

Examples where ExprF is a fun:

+ +Fun1 = fun(X) -> X+1 end +Fun1(3) +=> 4 + +Fun2 = {lists,append} +Fun2([1,2], [3,4]) +=> [1,2,3,4] + +fun lists:append/2([1,2], [3,4]) +=> [1,2,3,4] +

To avoid possible ambiguities, the fully qualified function + name must be used when calling a function with the same name as + a BIF, and the compiler does not allow defining a function with + the same name as an explicitly imported function.

+

Note that when calling a local function, there is a difference + between using the implicitly or fully qualified function name, as + the latter always refers to the latest version of the module. See + Compilation and Code Loading.

+

See also the chapter about + Function Evaluation.

+
+ +
+ If +
+if
+    GuardSeq1 ->
+        Body1;
+    ...;
+    GuardSeqN ->
+        BodyN
+end
+

The branches of an if-expression are scanned sequentially + until a guard sequence GuardSeq which evaluates to true is + found. Then the corresponding Body (sequence of expressions + separated by ',') is evaluated.

+

The return value of Body is the return value of + the if expression.

+

If no guard sequence is true, an if_clause run-time error + will occur. If necessary, the guard expression true can be + used in the last branch, as that guard sequence is always true.

+

Example:

+
+is_greater_than(X, Y) ->
+    if
+        X>Y ->
+            true;
+        true -> % works as an 'else' branch
+            false
+    end
+
+ +
+ + Case +
+case Expr of
+    Pattern1 [when GuardSeq1] ->
+        Body1;
+    ...;
+    PatternN [when GuardSeqN] ->
+        BodyN
+end
+

The expression Expr is evaluated and the patterns + Pattern are sequentially matched against the result. If a + match succeeds and the optional guard sequence GuardSeq is + true, the corresponding Body is evaluated.

+

The return value of Body is the return value of + the case expression.

+

If there is no matching pattern with a true guard sequence, + a case_clause run-time error will occur.

+

Example:

+
+is_valid_signal(Signal) ->
+    case Signal of
+        {signal, _What, _From, _To} ->
+            true;
+        {signal, _What, _To} ->
+            true;
+        _Else ->
+            false
+    end.
+
+ +
+ + Send +
+Expr1 ! Expr2
+

Sends the value of Expr2 as a message to the process + specified by Expr1. The value of Expr2 is also + the return value of the expression.

+

Expr1 must evaluate to a pid, a registered name (atom) or + a tuple {Name,Node}, where Name is an atom and + Node a node name, also an atom.

+ + If Expr1 evaluates to a name, but this name is not + registered, a badarg run-time error will occur. + Sending a message to a pid never fails, even if the pid + identifies a non-existing process. + Distributed message sending, that is if Expr1 + evaluates to a tuple {Name,Node} (or a pid located at + another node), also never fails. + +
+ +
+ + Receive +
+receive
+    Pattern1 [when GuardSeq1] ->
+        Body1;
+    ...;
+    PatternN [when GuardSeqN] ->
+        BodyN
+end
+

Receives messages sent to the process using the send operator + (!). The patterns Pattern are sequentially matched + against the first message in time order in the mailbox, then + the second, and so on. If a match succeeds and the optional + guard sequence GuardSeq is true, the corresponding + Body is evaluated. The matching message is consumed, that + is removed from the mailbox, while any other messages in + the mailbox remain unchanged.

+

The return value of Body is the return value of + the receive expression.

+

receive never fails. Execution is suspended, possibly + indefinitely, until a message arrives that does match one of + the patterns and with a true guard sequence.

+

Example:

+
+wait_for_onhook() ->
+    receive
+        onhook ->
+            disconnect(),
+            idle();
+        {connect, B} ->
+            B ! {busy, self()},
+            wait_for_onhook()
+    end.
+

It is possible to augment the receive expression with a + timeout:

+
+receive
+    Pattern1 [when GuardSeq1] ->
+        Body1;
+    ...;
+    PatternN [when GuardSeqN] ->
+        BodyN
+after
+    ExprT ->
+        BodyT
+end
+

ExprT should evaluate to an integer. The highest allowed + value is 16#ffffffff, that is, the value must fit in 32 bits. + receive..after works exactly as receive, except + that if no matching message has arrived within ExprT + milliseconds, then BodyT is evaluated instead and its + return value becomes the return value of the receive..after + expression.

+

Example:

+
+wait_for_onhook() ->
+    receive
+        onhook ->
+            disconnect(),
+            idle();
+        {connect, B} ->
+            B ! {busy, self()},
+            wait_for_onhook()
+    after
+        60000 ->
+            disconnect(),
+            error()
+    end.
+

It is legal to use a receive..after expression with no + branches:

+
+receive
+after
+    ExprT ->
+        BodyT
+end
+

This construction will not consume any messages, only suspend + execution in the process for ExprT milliseconds and can be + used to implement simple timers.

+

Example:

+
+timer() ->
+    spawn(m, timer, [self()]).
+
+timer(Pid) ->
+    receive
+    after
+        5000 ->
+            Pid ! timeout
+    end.
+

There are two special cases for the timeout value ExprT:

+ + infinity + The process should wait indefinitely for a matching message + -- this is the same as not using a timeout. Can be + useful for timeout values that are calculated at run-time. + 0 + If there is no matching message in the mailbox, the timeout + will occur immediately. + +
+ +
+ Term Comparisons +
+Expr1 op Expr2
+ + + op + Description + + + == + equal to + + + /= + not equal to + + + =< + less than or equal to + + + < + less than + + + >= + greater than or equal to + + + > + greater than + + + =:= + exactly equal to + + + =/= + exactly not equal to + + Term Comparison Operators. +
+

The arguments may be of different data types. The following + order is defined:

+
+number < atom < reference < fun < port < pid < tuple < list < bit string
+

Lists are compared element by element. Tuples are ordered by + size, two tuples with the same size are compared element by + element.

+

If one of the compared terms is an integer and the other a + float, the integer is first converted into a float, unless the + operator is one of =:= and =/=. If the integer is too big to fit + in a float no conversion is done, but the order is determined by + inspecting the sign of the numbers.

+

Returns the Boolean value of the expression, true or + false.

+

Examples:

+
+1> 1==1.0.
+true
+2> 1=:=1.0.
+false
+3> 1 > a.
+false
+
+ +
+ Arithmetic Expressions +
+op Expr
+Expr1 op Expr2
+ + + op + Description + Argument type + + + + + unary + + number + + + - + unary - + number + + + + +   + number + + + - +   + number + + + * +   + number + + + / + floating point division + number + + + bnot + unary bitwise not + integer + + + div + integer division + integer + + + rem + integer remainder of X/Y + integer + + + band + bitwise and + integer + + + bor + bitwise or + integer + + + bxor + arithmetic bitwise xor + integer + + + bsl + arithmetic bitshift left + integer + + + bsr + bitshift right + integer + + Arithmetic Operators. +
+ +

Examples:

+
+1> +1.
+1
+2> -1.
+-1
+3> 1+1.
+2
+4> 4/2.
+2.0
+5> 5 div 2.
+2
+6> 5 rem 2.
+1
+7> 2#10 band 2#01.
+0
+8> 2#10 bor 2#01.
+3
+9> a + 10.
+** exception error: bad argument in an arithmetic expression
+     in operator  +/2
+        called as a + 10
+10> 1 bsl (1 bsl 64).
+** exception error: a system limit has been reached
+     in operator  bsl/2
+        called as 1 bsl 18446744073709551616
+
+ +
+ Boolean Expressions +
+op Expr
+Expr1 op Expr2
+ + + op + Description + + + not + unary logical not + + + and + logical and + + + or + logical or + + + xor + logical xor + + Logical Operators. +
+

Examples:

+
+1> not true.
+false
+2> true and false.
+false
+3> true xor false.
+true
+4> true or garbage.
+** exception error: bad argument
+     in operator  or/2
+        called as true or garbage
+
+ +
+ Short-Circuit Expressions +
+Expr1 orelse Expr2
+Expr1 andalso Expr2
+

Expressions where Expr2 is evaluated only if + necessary. That is, Expr2 is evaluated only if Expr1 + evaluates to false in an orelse expression, or only + if Expr1 evaluates to true in an andalso + expression. Returns either the value of Expr1 (that is, + true or false) or the value of Expr2 + (if Expr2 was evaluated).

+ +

Example 1:

+
+case A >= -1.0 andalso math:sqrt(A+1) > B of
+

This will work even if A is less than -1.0, + since in that case, math:sqrt/1 is never evaluated.

+

Example 2:

+
+OnlyOne = is_atom(L) orelse
+         (is_list(L) andalso length(L) == 1),
+ +

From R13A, Expr2 is no longer required to evaluate to a + boolean value. As a consequence, andalso and orelse + are now tail-recursive. For instance, the following function is + tail-recursive in R13A and later:

+ +
+all(Pred, [Hd|Tail]) ->
+    Pred(Hd) andalso all(Pred, Tail);
+all(_, []) ->
+    true.
+
+ +
+ List Operations +
+Expr1 ++ Expr2
+Expr1 -- Expr2
+

The list concatenation operator ++ appends its second + argument to its first and returns the resulting list.

+

The list subtraction operator -- produces a list which + is a copy of the first argument, subjected to the following + procedure: for each element in the second argument, the first + occurrence of this element (if any) is removed.

+

Example:

+
+1> [1,2,3]++[4,5].
+[1,2,3,4,5]
+2> [1,2,3,2,1,2]--[2,1,2].
+[3,1,2]
+ +

The complexity of A -- B is + proportional to length(A)*length(B), meaning that it + will be very slow if both A and B are + long lists.

+
+ +
+ + Bit Syntax Expressions + > +<>]]> +

Each element Ei specifies a segment of + the bit string. Each element Ei is a value, followed by an + optional size expression and an optional type specifier list.

+
+Ei = Value |
+     Value:Size |
+     Value/TypeSpecifierList |
+     Value:Size/TypeSpecifierList
+

Used in a bit string construction, Value is an expression + which should evaluate to an integer, float or bit string. If the + expression is something else than a single literal or variable, it + should be enclosed in parenthesis.

+ +

Used in a bit string matching, Value must be a variable, + or an integer, float or string.

+ +

Note that, for example, using a string literal as in + >]]> is syntactic sugar for + >]]>.

+ +

Used in a bit string construction, Size is an expression + which should evaluate to an integer.

+ +

Used in a bit string matching, Size must be an integer or a + variable bound to an integer.

+ +

The value of Size specifies the size of the segment in + units (see below). The default value depends on the type (see + below). For integer it is 8, for + float it is 64, for binary and bitstring it is + the whole binary or bit string. In matching, this default value is only + valid for the very last element. All other bit string or binary + elements in the matching must have a size specification.

+ +

For the utf8, utf16, and utf32 types, + Size must not be given. The size of the segment is implicitly + determined by the type and value itself.

+ +

TypeSpecifierList is a list of type specifiers, in any + order, separated by hyphens (-). Default values are used for any + omitted type specifiers.

+ + Type= integer | float | binary | + bytes | bitstring | bits | + utf8 | utf16 | utf32 + The default is integer. bytes is a shorthand for + binary and bits is a shorthand for bitstring. + See below for more information about the utf types. + + + Signedness= signed | unsigned + Only matters for matching and when the type is integer. + The default is unsigned. + + Endianness= big | little | native + Native-endian means that the endianness will be resolved at load + time to be either big-endian or little-endian, depending on + what is native for the CPU that the Erlang machine is run on. + Endianness only matters when the Type is either integer, + utf16, utf32, or float. The default is big. + + + Unit= unit:IntegerLiteral + The allowed range is 1..256. Defaults to 1 for integer, + float and bitstring, and to 8 for binary. + No unit specifier must be given for the types + utf8, utf16, and utf32. + + +

The value of Size multiplied with the unit gives + the number of bits. A segment of type binary must have + a size that is evenly divisible by 8.

+ +

When constructing binaries, if the size N of an integer + segment is too small to contain the given integer, the most significant + bits of the integer will be silently discarded and only the N least + significant bits will be put into the binary.

+ +

The types utf8, utf16, and utf32 specifies + encoding/decoding of the Unicode Transformation Formats UTF-8, UTF-16, + and UTF-32, respectively.

+ +

When constructing a segment of a utf type, Value + must be an integer in one of the ranges 0..16#D7FF, + 16#E000..16#FFFD, or 16#10000..16#10FFFF + (i.e. a valid Unicode code point). Construction + will fail with a badarg exception if Value is + outside the allowed ranges. The size of the resulting binary + segment depends on the type and/or Value. For utf8, + Value will be encoded in 1 through 4 bytes. For + utf16, Value will be encoded in 2 or 4 + bytes. Finally, for utf32, Value will always be + encoded in 4 bytes.

+ +

When constructing, a literal string may be given followed + by one of the UTF types, for example: >]]> + which is syntatic sugar for + >]]>.

+ +

A successful match of a segment of a utf type results + in an integer in one of the ranges 0..16#D7FF, 16#E000..16#FFFD, + or 16#10000..16#10FFFF + (i.e. a valid Unicode code point). The match will fail if returned value + would fall outside those ranges.

+ +

A segment of type utf8 will match 1 to 4 bytes in the binary, + if the binary at the match position contains a valid UTF-8 sequence. + (See RFC-2279 or the Unicode standard.)

+ +

A segment of type utf16 may match 2 or 4 bytes in the binary. + The match will fail if the binary at the match position does not contain + a legal UTF-16 encoding of a Unicode code point. (See RFC-2781 or + the Unicode standard.)

+ +

A segment of type utf32 may match 4 bytes in the binary in the + same way as an integer segment matching 32 bits. + The match will fail if the resulting integer is outside the legal ranges + mentioned above.

+ +

Examples:

+
+1> Bin1 = <<1,17,42>>.
+<<1,17,42>>
+2> Bin2 = <<"abc">>.
+<<97,98,99>>
+3> Bin3 = <<1,17,42:16>>.
+<<1,17,0,42>>
+4> <<A,B,C:16>> = <<1,17,42:16>>.
+<<1,17,0,42>>
+5> C.
+42
+6> <<D:16,E,F>> = <<1,17,42:16>>.
+<<1,17,0,42>>
+7> D.
+273
+8> F.
+42
+9> <<G,H/binary>> = <<1,17,42:16>>.
+<<1,17,0,42>>
+10> H.
+<<17,0,42>>
+11> <<G,H/bitstring>> = <<1,17,42:12>>.
+<<1,17,1,10:4>>
+12> H.
+<<17,1,10:4>>
+13> <<1024/utf8>>.
+<<208,128>>
+
+

Note that bit string patterns cannot be nested.

+

Note also that ">]]>" is interpreted as + ">]]>" which is a syntax error. The correct way is + to write a space after '=': ">]]>.

+

More examples can be found in Programming Examples.

+
+ +
+ + Fun Expressions +
+fun
+    (Pattern11,...,Pattern1N) [when GuardSeq1] ->
+        Body1;
+    ...;
+    (PatternK1,...,PatternKN) [when GuardSeqK] ->
+        BodyK
+end
+

A fun expression begins with the keyword fun and ends + with the keyword end. Between them should be a function + declaration, similar to a + regular function declaration, except that no function name is + specified.

+

Variables in a fun head shadow variables in the + function clause surrounding the fun expression, and + variables bound in a fun body are local to the fun body.

+

The return value of the expression is the resulting fun.

+

Examples:

+
+1> Fun1 = fun (X) -> X+1 end.
+#Fun<erl_eval.6.39074546>
+2> Fun1(2).
+3
+3> Fun2 = fun (X) when X>=5 -> gt; (X) -> lt end.
+#Fun<erl_eval.6.39074546>
+4> Fun2(7).
+gt
+

The following fun expressions are also allowed:

+
+fun Name/Arity
+fun Module:Name/Arity
+

In Name/Arity, Name is an atom and Arity is an integer. + Name/Arity must specify an existing local function. The expression is + syntactic sugar for:

+
+fun (Arg1,...,ArgN) -> Name(Arg1,...,ArgN) end
+

In Module:Name/Arity, Module and Name are atoms + and Arity is an integer. + A fun defined in this way will refer to the function Name + with arity Arity in the latest version of module Module. +

+

When applied to a number N of arguments, a tuple + {Module,FunctionName} is interpreted as a fun, referring + to the function FunctionName with arity N in the module + Module. The function must be exported. + This usage is deprecated. + See Function Calls for an example.

+

More examples can be found in Programming Examples.

+
+ +
+ + Catch and Throw + +catch Expr +

Returns the value of Expr unless an exception + occurs during the evaluation. In that case, the exception is + caught. For exceptions of class error, + that is run-time errors: {'EXIT',{Reason,Stack}} + is returned. For exceptions of class exit, that is + the code called exit(Term): {'EXIT',Term} is returned. + For exceptions of class throw, that is + the code called throw(Term): Term is returned.

+

Reason depends on the type of error that occurred, and + Stack is the stack of recent function calls, see + Errors and Error Handling.

+

Examples:

+

+
+1> catch 1+2.
+3
+2> catch 1+a.
+{'EXIT',{badarith,[...]}}
+

Note that catch has low precedence and catch + subexpressions often needs to be enclosed in a block + expression or in parenthesis:

+
+3> A = catch 1+2.
+** 1: syntax error before: 'catch' **
+4> A = (catch 1+2).
+3
+

The BIF throw(Any) can be used for non-local return from + a function. It must be evaluated within a catch, which will + return the value Any. Example:

+
+5> catch throw(hello).
+hello
+

If throw/1 is not evaluated within a catch, a + nocatch run-time error will occur.

+
+ +
+ + Try + +try Exprs +catch + [Class1:]ExceptionPattern1 [when ExceptionGuardSeq1] -> + ExceptionBody1; + [ClassN:]ExceptionPatternN [when ExceptionGuardSeqN] -> + ExceptionBodyN +end +

This is an enhancement of + catch that appeared in + Erlang 5.4/OTP-R10B. It gives the possibility do distinguish + between different exception classes, and to choose to handle only + the desired ones, passing the others on to an enclosing + try or catch or to default error handling.

+

Note that although the keyword catch is used in + the try expression, there is not a catch expression + within the try expression.

+

Returns the value of Exprs (a sequence of expressions + Expr1, ..., ExprN) unless an exception occurs during + the evaluation. In that case the exception is caught and + the patterns ExceptionPattern with the right exception + class Class are sequentially matched against the caught + exception. An omitted Class is shorthand for throw. + If a match succeeds and the optional guard sequence + ExceptionGuardSeq is true, the corresponding + ExceptionBody is evaluated to become the return value.

+

If an exception occurs during evaluation of Exprs but + there is no matching ExceptionPattern of the right + Class with a true guard sequence, the exception is passed + on as if Exprs had not been enclosed in a try + expression.

+

If an exception occurs during evaluation of ExceptionBody + it is not caught.

+

The try expression can have an of + section: +

+ +try Exprs of + Pattern1 [when GuardSeq1] -> + Body1; + ...; + PatternN [when GuardSeqN] -> + BodyN +catch + [Class1:]ExceptionPattern1 [when ExceptionGuardSeq1] -> + ExceptionBody1; + ...; + [ClassN:]ExceptionPatternN [when ExceptionGuardSeqN] -> + ExceptionBodyN +end +

If the evaluation of Exprs succeeds without an exception, + the patterns Pattern are sequentially matched against + the result in the same way as for a + case expression, except that if + the matching fails, a try_clause run-time error will occur.

+

An exception occurring during the evaluation of Body is + not caught.

+

The try expression can also be augmented with an + after section, intended to be used for cleanup with side + effects:

+ +try Exprs of + Pattern1 [when GuardSeq1] -> + Body1; + ...; + PatternN [when GuardSeqN] -> + BodyN +catch + [Class1:]ExceptionPattern1 [when ExceptionGuardSeq1] -> + ExceptionBody1; + ...; + [ClassN:]ExceptionPatternN [when ExceptionGuardSeqN] -> + ExceptionBodyN +after + AfterBody +end +

AfterBody is evaluated after either Body or + ExceptionBody no matter which one. The evaluated value of + AfterBody is lost; the return value of the try + expression is the same with an after section as without.

+

Even if an exception occurs during evaluation of Body or + ExceptionBody, AfterBody is evaluated. In this case + the exception is passed on after AfterBody has been + evaluated, so the exception from the try expression is + the same with an after section as without.

+

If an exception occurs during evaluation of AfterBody + itself it is not caught, so if AfterBody is evaluated after + an exception in Exprs, Body or ExceptionBody, + that exception is lost and masked by the exception in + AfterBody.

+

The of, catch and after sections are all + optional, as long as there is at least a catch or an + after section, so the following are valid try + expressions:

+ +try Exprs of + Pattern when GuardSeq -> + Body +after + AfterBody +end + +try Exprs +catch + ExpressionPattern -> + ExpressionBody +after + AfterBody +end + +try Exprs after AfterBody end +

Example of using after, this code will close the file + even in the event of exceptions in file:read/2 or in + binary_to_term/1, and exceptions will be the same as + without the try...after...end expression:

+ +termize_file(Name) -> + {ok,F} = file:open(Name, [read,binary]), + try + {ok,Bin} = file:read(F, 1024*1024), + binary_to_term(Bin) + after + file:close(F) + end. +

Example: Using try to emulate catch Expr.

+ +try Expr +catch + throw:Term -> Term; + exit:Reason -> {'EXIT',Reason} + error:Reason -> {'EXIT',{Reason,erlang:get_stacktrace()}} +end +
+ +
+ Parenthesized Expressions +
+(Expr)
+

Parenthesized expressions are useful to override + operator precedences, + for example in arithmetic expressions:

+
+1> 1 + 2 * 3.
+7
+2> (1 + 2) * 3.
+9
+
+ +
+ Block Expressions +
+begin
+   Expr1,
+   ...,
+   ExprN
+end
+

Block expressions provide a way to group a sequence of + expressions, similar to a clause body. The return value is + the value of the last expression ExprN.

+
+ +
+ + List Comprehensions +

List comprehensions are a feature of many modern functional + programming languages. Subject to certain rules, they provide a + succinct notation for generating elements in a list.

+

List comprehensions are analogous to set comprehensions in + Zermelo-Frankel set theory and are called ZF expressions in + Miranda. They are analogous to the setof and + findall predicates in Prolog.

+

List comprehensions are written with the following syntax:

+
+[Expr || Qualifier1,...,QualifierN]
+

Expr is an arbitrary expression, and each + Qualifier is either a generator or a filter.

+ + A generator is written as:

+ +   .

+ListExpr must be an expression which evaluates to a + list of terms.
+A bit string generator is written as:

+ +   .

+BitStringExpr must be an expression which evaluates to a + bitstring.
+ A filter is an expression which evaluates to + true or false. +
+

The variables in the generator patterns shadow variables in the function + clause surrounding the list comprehensions.

A list comprehension + returns a list, where the elements are the result of evaluating Expr + for each combination of generator list elements and bit string generator + elements for which all filters are true.

Example:

+
+1> [X*2 || X <- [1,2,3]].
+[2,4,6]
+

More examples can be found in Programming Examples.

+ + +
+ +
+ Bit String Comprehensions + +

Bit string comprehensions are + analogous to List Comprehensions. They are used to generate bit strings + efficiently and succinctly.

+

Bit string comprehensions are written with + the following syntax:

+
+<< BitString || Qualifier1,...,QualifierN >>
+

BitString is a bit string expression, and each + Qualifier is either a generator, a bit string generator or a filter.

+ + A generator is written as:

+   .

+ ListExpr must be an expression which evaluates to a + list of terms.
+ A bit string generator is written as:

+ +   .

+BitStringExpr must be an expression which evaluates to a + bitstring.
+ A filter is an expression which evaluates to + true or false. +
+

The variables in the generator patterns shadow variables in + the function clause surrounding the bit string comprehensions.

+

A bit string comprehension returns a bit string, which is + created by concatenating the results of evaluating BitString + for each combination of bit string generator elements for which all + filters are true.

+

+

Example:

+
+1> << << (X*2) >> || 
+<<X>> <= << 1,2,3 >> >>.
+<<2,4,6>>
+

More examples can be found in Programming Examples.

+
+ +
+ + Guard Sequences + +

A guard sequence is a sequence of guards, separated + by semicolon (;). The guard sequence is true if at least one of + the guards is true. (The remaining guards, if any, will not be + evaluated.)

+Guard1;...;GuardK

+

A guard is a sequence of guard expressions, separated + by comma (,). The guard is true if all guard expressions + evaluate to true.

+GuardExpr1,...,GuardExprN

+

The set of valid guard expressions (sometimes called + guard tests) is a subset of the set of valid Erlang expressions. + The reason for restricting the set of valid expressions is that + evaluation of a guard expression must be guaranteed to be free + of side effects. Valid guard expressions are:

+ + the atom true, + other constants (terms and bound variables), all regarded + as false, + calls to the BIFs specified below, + term comparisons, + arithmetic expressions, + boolean expressions, and + short-circuit expressions (andalso/orelse). + + + + is_atom/1 + + + is_binary/1 + + + is_bitstring/1 + + + is_float/1 + + + is_function/1 + + + is_function/2 + + + is_integer/1 + + + is_list/1 + + + is_number/1 + + + is_pid/1 + + + is_port/1 + + + is_record/2 + + + is_record/3 + + + is_reference/1 + + + is_tuple/1 + + Type Test BIFs. +
+

Note that most type test BIFs have older equivalents, without + the is_ prefix. These old BIFs are retained for backwards + compatibility only and should not be used in new code. They are + also only allowed at top level. For example, they are not allowed + in boolean expressions in guards.

+ + + abs(Number) + + + bit_size(Bitstring) + + + byte_size(Bitstring) + + + element(N, Tuple) + + + float(Term) + + + hd(List) + + + length(List) + + + node() + + + node(Pid|Ref|Port) + + + round(Number) + + + self() + + + size(Tuple|Bitstring) + + + tl(List) + + + trunc(Number) + + + tuple_size(Tuple) + + Other BIFs Allowed in Guard Expressions. +
+ +

If an arithmetic expression, a boolean expression, a + short-circuit expression, or a call to a guard BIF fails (because + of invalid arguments), the entire guard fails. If the guard was + part of a guard sequence, the next guard in the sequence (that is, + the guard following the next semicolon) will be evaluated.

+ +
+ +
+ + Operator Precedence +

Operator precedence in falling priority:

+ + + : +   + + + # +   + + + Unary + - bnot not +   + + + / * div rem band and + Left associative + + + + - bor bxor bsl bsr or xor + Left associative + + + ++ -- + Right associative + + + == /= =< < >= > =:= =/= +   + + + andalso +   + + + orelse +   + + + = ! + Right associative + + + catch +   + + Operator Precedence. +
+

When evaluating an expression, the operator with the highest + priority is evaluated first. Operators with the same priority + are evaluated according to their associativity. Example: + The left associative arithmetic operators are evaluated left to + right:

+
+6 + 5 * 4 - 3 / 2 evaluates to
+6 + 20 - 1.5 evaluates to
+26 - 1.5 evaluates to
+24.5
+
+
+ diff --git a/system/doc/reference_manual/functions.xml b/system/doc/reference_manual/functions.xml new file mode 100644 index 0000000000..3746ee6fad --- /dev/null +++ b/system/doc/reference_manual/functions.xml @@ -0,0 +1,168 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Functions + + + + + functions.xml +
+ +
+ + Function Declaration Syntax +

A function declaration is a sequence of function + clauses separated by semicolons, and terminated by period (.).

+

A function clause consists of a clause head and a + clause body, separated by ->.

+

A clause head consists of the function name, an + argument list, and an optional guard sequence + beginning with the keyword when.

+
+Name(Pattern11,...,Pattern1N) [when GuardSeq1] ->
+    Body1;
+...;
+Name(PatternK1,...,PatternKN) [when GuardSeqK] ->
+    BodyK.
+

The function name is an atom. Each argument is a pattern.

+

The number of arguments N is the arity of + the function. A function is uniquely defined by the module name, + function name and arity. That is, two functions with the same + name and in the same module, but with different arities are two + completely different functions.

+

A function named f in the module m and with arity + N is often denoted as m:f/N.

+

A clause body consists of a sequence of expressions + separated by comma (,):

+
+Expr1,
+...,
+ExprN
+

Valid Erlang expressions and guard sequences are described in + Erlang Expressions.

+

Example:

+
+fact(N) when N>0 ->  % first clause head
+    N * fact(N-1);   % first clause body
+
+fact(0) ->           % second clause head
+    1.               % second clause body
+
+ +
+ + Function Evaluation +

When a function m:f/N is called, first the code for + the function is located. If the function cannot be found, an + undef run-time error will occur. Note that the function + must be exported to be visible outside the module it is defined + in.

+

If the function is found, the function clauses are scanned + sequentially until a clause is found that fulfills the following + two conditions:

+ + the patterns in the clause head can be successfully + matched against the given arguments, and + the guard sequence, if any, is true. + +

If such a clause cannot be found, a function_clause + run-time error will occur.

+

If such a clause is found, the corresponding clause body is + evaluated. That is, the expressions in the body are evaluated + sequentially and the value of the last expression is returned.

+

Example: Consider the function fact:

+
+-module(m).
+-export([fact/1]).
+
+fact(N) when N>0 ->
+    N * fact(N-1);
+fact(0) ->
+    1.
+

Assume we want to calculate factorial for 1:

+
+1> m:fact(1).
+

Evaluation starts at the first clause. The pattern N is + matched against the argument 1. The matching succeeds and + the guard (N>0) is true, thus N is bound to 1 and + the corresponding body is evaluated:

+
+N * fact(N-1) => (N is bound to 1)
+1 * fact(0)
+

Now fact(0) is called and the function clauses are + scanned sequentially again. First, the pattern N is + matched against 0. The matching succeeds, but the guard + (N>0) is false. Second, the pattern 0 is matched against + 0. The matching succeeds and the body is evaluated:

+
+1 * fact(0) =>
+1 * 1 =>
+1
+

Evaluation has succeed and m:fact(1) returns 1.

+

If m:fact/1 is called with a negative number as + argument, no clause head will match. A function_clause + run-time error will occur.

+
+ +
+ Tail recursion +

If the last expression of a function body is a function call, + a tail recursive call is done so that no system + resources for example call stack are consumed. This means + that an infinite loop can be done if it uses tail recursive + calls.

+

Example:

+
+loop(N) ->
+    io:format("~w~n", [N]),
+    loop(N+1).
+

As a counter-example see the factorial example above + that is not tail recursive since a multiplication is done + on the result of the recursive call to fact(N-1).

+
+ +
+ Built-In Functions, BIFs +

Built-in functions, BIFs, are implemented in C code in + the runtime system and do things that are difficult or impossible + to implement in Erlang. Most of the built-in functions belong + to the module erlang but there are also built-in functions + belonging to a few other modules, for example lists and + ets.

+

The most commonly used BIFs belonging to erlang are + auto-imported, they do not need to be prefixed with + the module name. Which BIFs are auto-imported is specified in + erlang(3). For example, standard type conversion BIFs like + atom_to_list and BIFs allowed in guards can be called + without specifying the module name. Examples:

+
+1> tuple_size({a,b,c}).
+3
+2> atom_to_list('Erlang').
+"Erlang"
+

Note that normally it is the set of auto-imported built-in + functions that is referred to when talking about 'BIFs'.

+
+
+ diff --git a/system/doc/reference_manual/introduction.xml b/system/doc/reference_manual/introduction.xml new file mode 100644 index 0000000000..3dac5cfe13 --- /dev/null +++ b/system/doc/reference_manual/introduction.xml @@ -0,0 +1,155 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Introduction + + + + + introduction.xml +
+ +
+ Purpose +

This reference manual describes the Erlang programming + language. The focus is on the language itself, not + the implementation. The language constructs are described in + text and with examples rather than formally specified, with + the intention to make the manual more readable. + The manual is not intended as a tutorial.

+

Information about this implementation of Erlang can be found, for + example, in System Principles (starting and stopping, + boot scripts, code loading, error logging, creating target + systems), Efficiency Guide (memory consumption, system + limits) and ERTS User's Guide (crash dumps, drivers).

+
+ +
+ Prerequisites +

It is assumed that the reader has done some programming and + is familiar with concepts such as data types and programming + language syntax.

+
+ +
+ Document Conventions +

In the document, the following terminology is used:

+ + A sequence is one or more items. For example, a + clause body consists of a sequence of expressions. This + means that there must be at least one expression. + A list is any number of items. For example, + an argument list can consist of zero, one or more arguments. + +

If a feature has been added recently, in Erlang 5.0/OTP R7 or + later, this is mentioned in the text.

+
+ +
+ Complete List of BIFs +

For a complete list of BIFs, their arguments and return values, + refer to erlang(3).

+
+ +
+ Reserved Words +

The following are reserved words in Erlang:

+

after and andalso band begin bnot bor bsl bsr bxor case catch + cond div end fun if let not of or orelse query receive rem try + when xor

+
+ +
+ Character Set +

In Erlang 4.8/OTP R5A the syntax of Erlang tokens was extended to + allow the use of the full ISO-8859-1 (Latin-1) character set. This + is noticeable in the following ways:

+ + +

All the Latin-1 printable characters can be used and are + shown without the escape backslash convention.

+
+ +

Atoms and variables can use all Latin-1 letters.

+
+
+ + + Octal + Decimal +   + Class + + + 200 - 237 + 128 - 159 +   + Control characters + + + 240 - 277 + 160 - 191 + - ¿ + Punctuation characters + + + 300 - 326 + 192 - 214 + À - Ö + Uppercase letters + + + 327 + 215 + × + Punctuation character + + + 330 - 336 + 216 - 222 + Ø - Þ + Uppercase letters + + + 337 - 366 + 223 - 246 + ß - ö + Lowercase letters + + + 367 + 247 + ÷ + Punctuation character + + + 370 - 377 + 248 - 255 + ø - ÿ + Lowercase letters + + Character Classes. +
+
+
+ diff --git a/system/doc/reference_manual/macros.xml b/system/doc/reference_manual/macros.xml new file mode 100644 index 0000000000..a1ba182eff --- /dev/null +++ b/system/doc/reference_manual/macros.xml @@ -0,0 +1,211 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + The Preprocessor + + + + + macros.xml +
+ +
+ File Inclusion +

A file can be included in the following way:

+
+-include(File).
+-include_lib(File).
+

File, a string, should point out a file. The contents of + this file are included as-is, at the position of the directive.

+

Include files are typically used for record and macro + definitions that are shared by several modules. It is + recommended that the file name extension .hrl be used + for include files.

+

File may start with a path component $VAR, for + some string VAR. If that is the case, the value of + the environment variable VAR as returned by + os:getenv(VAR) is substituted for $VAR. If + os:getenv(VAR) returns false, $VAR is left + as is.

+

If the filename File is absolute (possibly after + variable substitution), the include file with that name is + included. Otherwise, the specified file is searched for in + the current working directory, in the same directory as + the module being compiled, and in the directories given by + the include option, in that order. + See erlc(1) and compile(3) for details.

+

Examples:

+
+-include("my_records.hrl").
+-include("incdir/my_records.hrl").
+-include("/home/user/proj/my_records.hrl").
+-include("$PROJ_ROOT/my_records.hrl").
+

include_lib is similar to include, but should not + point out an absolute file. Instead, the first path component + (possibly after variable substitution) is assumed to be + the name of an application. Example:

+
+-include_lib("kernel/include/file.hrl").
+

The code server uses code:lib_dir(kernel) to find + the directory of the current (latest) version of Kernel, and + then the subdirectory include is searched for the file + file.hrl.

+
+ +
+ Defining and Using Macros +

A macro is defined the following way:

+ +-define(Const, Replacement). +-define(Func(Var1,...,VarN), Replacement). +

A macro definition can be placed anywhere among the attributes + and function declarations of a module, but the definition must + come before any usage of the macro.

+

If a macro is used in several modules, it is recommended that + the macro definition is placed in an include file.

+

A macro is used the following way:

+ +?Const +?Func(Arg1,...,ArgN) +

Macros are expanded during compilation. A simple macro + ?Const will be replaced with Replacement. + Example:

+ +-define(TIMEOUT, 200). +... +call(Request) -> + server:call(refserver, Request, ?TIMEOUT). +

This will be expanded to:

+ +call(Request) -> + server:call(refserver, Request, 200). +

A macro ?Func(Arg1,...,ArgN) will be replaced with + Replacement, where all occurrences of a variable Var + from the macro definition are replaced with the corresponding + argument Arg. Example:

+ +-define(MACRO1(X, Y), {a, X, b, Y}). +... +bar(X) -> + ?MACRO1(a, b), + ?MACRO1(X, 123) +

This will be expanded to:

+ +bar(X) -> + {a,a,b,b}, + {a,X,b,123}. +

It is good programming practice, but not mandatory, to ensure + that a macro definition is a valid Erlang syntactic form.

+

To view the result of macro expansion, a module can be compiled + with the 'P' option. compile:file(File, ['P']). + This produces a listing of the parsed code after preprocessing + and parse transforms, in the file File.P.

+
+ +
+ Predefined Macros +

The following macros are predefined:

+ + ?MODULE + The name of the current module. + ?MODULE_STRING. + The name of the current module, as a string. + ?FILE. + The file name of the current module. + ?LINE. + The current line number. + ?MACHINE. + The machine name, 'BEAM'. + +
+ +
+ Flow Control in Macros +

The following macro directives are supplied:

+ + -undef(Macro). + Causes the macro to behave as if it had never been defined. + -ifdef(Macro). + Evaluate the following lines only if Macro is + defined. + -ifndef(Macro). + Evaluate the following lines only if Macro is not + defined. + -else. + Only allowed after an ifdef or ifndef + directive. If that condition was false, the lines following + else are evaluated instead. + -endif. + Specifies the end of an ifdef or ifndef + directive. + + +

The macro directives cannot be used inside functions.

+
+

Example:

+ +-module(m). +... + +-ifdef(debug). +-define(LOG(X), io:format("{~p,~p}: ~p~n", [?MODULE,?LINE,X])). +-else. +-define(LOG(X), true). +-endif. + +... +

When trace output is desired, debug should be defined + when the module m is compiled:

+
+% erlc -Ddebug m.erl
+
+or
+
+1> c(m, {d, debug}).
+{ok,m}
+

?LOG(Arg) will then expand to a call to io:format/2 + and provide the user with some simple trace output.

+
+ +
+ Stringifying Macro Arguments +

The construction ??Arg, where Arg is a macro + argument, will be expanded to a string containing the tokens of + the argument. This is similar to the #arg stringifying + construction in C.

+

The feature was added in Erlang 5.0/OTP R7.

+

Example:

+ +-define(TESTCALL(Call), io:format("Call ~s: ~w~n", [??Call, Call])). + +?TESTCALL(myfunction(1,2)), +?TESTCALL(you:function(2,1)). +

results in

+ +io:format("Call ~s: ~w~n",["myfunction ( 1 , 2 )",m:myfunction(1,2)]), +io:format("Call ~s: ~w~n",["you : function ( 2 , 1 )",you:function(2,1)]). +

That is, a trace output with both the function called and + the resulting value.

+
+
+ diff --git a/system/doc/reference_manual/make.dep b/system/doc/reference_manual/make.dep new file mode 100644 index 0000000000..0e7687448c --- /dev/null +++ b/system/doc/reference_manual/make.dep @@ -0,0 +1,16 @@ +# ---------------------------------------------------- +# >>>> Do not edit this file <<<< +# This file was automaticly generated by +# /home/otp/bin/docdepend +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# TeX files that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: book.tex code_loading.tex data_types.tex distributed.tex \ + errors.tex expressions.tex functions.tex introduction.tex \ + macros.tex modules.tex part.tex patterns.tex \ + ports.tex processes.tex records.tex + diff --git a/system/doc/reference_manual/modules.xml b/system/doc/reference_manual/modules.xml new file mode 100644 index 0000000000..8b14ca3459 --- /dev/null +++ b/system/doc/reference_manual/modules.xml @@ -0,0 +1,254 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Modules + + + + + modules.xml +
+ +
+ Module Syntax +

Erlang code is divided into modules. A module consists + of a sequence of attributes and function declarations, each + terminated by period (.). Example:

+
+-module(m).          % module attribute
+-export([fact/1]).   % module attribute
+
+fact(N) when N>0 ->  % beginning of function declaration
+    N * fact(N-1);   %  |
+fact(0) ->           %  |
+    1.               % end of function declaration
+

See the Functions chapter + for a description of function declarations.

+
+ +
+ Module Attributes +

A module attribute defines a certain property of a + module. A module attribute consists of a tag and a value.

+
+-Tag(Value).
+

Tag must be an atom, while Value must be a literal + term. As a convenience in user-defined attributes, the literal term + Value the syntax Name/Arity + (where Name is an atom and Arity a positive integer) + will be translated to {Name,Arity}.

+ +

Any module attribute can be specified. The attributes are stored + in the compiled code and can be retrieved by calling + Module:module_info(attributes) or by using + beam_lib(3).

+ +

There are several module attributes with predefined meanings, + some of which have arity two, but user-defined module + attributes must have arity one.

+ +
+ Pre-Defined Module Attributes +

Pre-defined module attributes should be placed before any + function declaration.

+ + -module(Module). + +

Module declaration, defining the name of the module. + The name Module, an atom, should be the same as + the file name minus the extension erl. Otherwise + code loading will + not work as intended.

+

This attribute should be specified first and is the only + attribute which is mandatory.

+
+ -export(Functions). + +

Exported functions. Specifies which of the functions + defined within the module that are visible outside + the module.

+

Functions is a list + [Name1/Arity1, ..., NameN/ArityN], where each + NameI is an atom and ArityI an integer.

+
+ -import(Module,Functions). + +

Imported functions. Imported functions can be called + the same way as local functions, that is without any module + prefix.

+

Module, an atom, specifies which module to import + functions from. Functions is a list similar as for + export above.

+
+ -compile(Options). + +

Compiler options. Options, which is a single option + or a list of options, will be added to the option list when + compiling the module. See compile(3).

+
+ -vsn(Vsn). + +

Module version. Vsn is any literal term and can be + retrieved using beam_lib:version/1, see + beam_lib(3).

+

If this attribute is not specified, the version defaults + to the MD5 checksum of the module.

+
+
+
+ +
+ Behaviour Module Attribute +

It is possible to specify that the module is the callback + module for a behaviour:

+
+-behaviour(Behaviour).
+

The atom Behaviour gives the name of the behaviour, + which can be a user defined behaviour or one of the OTP + standard behaviours gen_server, gen_fsm, + gen_event or supervisor.

+

The spelling behavior is also accepted.

+

Read more about behaviours and callback modules in OTP Design + Principles.

+
+ +
+ Record Definitions +

The same syntax as for module attributes is used by + for record definitions:

+
+-record(Record,Fields).
+

Record definitions are allowed anywhere in a module, + also among the function declarations. + Read more in Records.

+
+ +
+ The Preprocessor +

The same syntax as for module attributes is used by + the preprocessor, which supports file inclusion, macros, + and conditional compilation:

+
+-include("SomeFile.hrl").
+-define(Macro,Replacement).
+ +

Read more in The Preprocessor.

+
+ +
+ Setting File and Line +

The same syntax as for module attributes is used for + changing the pre-defined macros ?FILE and ?LINE:

+
+-file(File, Line).
+

This attribute is used by tools such as Yecc to inform the + compiler that the source program was generated by another tool + and indicates the correspondence of source files to lines of + the original user-written file from which the source program + was produced.

+
+
+ +
+ Comments +

Comments may be placed anywhere in a module except within strings + and quoted atoms. The comment begins with the character "%", + continues up to, but does not include the next end-of-line, and + has no effect. Note that the terminating end-of-line has + the effect of white space.

+
+ +
+ The module_info/0 and module_info/1 functions + +

The compiler automatically inserts the two special, exported + functions into each module: Module:module_info/0 and + Module:module_info/1. These functions can be called to + retrieve information about the module.

+ +
+ module_info/0 +

The module_info/0 function in each module returns + a list of {Key,Value} tuples with information about + the module. Currently, the list contain tuples with the following + Keys: attributes, compile, + exports, and imports. The order and number of tuples + may change without prior notice.

+ +

The {imports,Value} tuple may be removed in a future + release because Value is always an empty list. + Do not write code that depends on it being present.

+
+ +
+ module_info/1 +

The call module_info(Key), where key is an atom, + returns a single piece of information about the module.

+ +

The following values are allowed for Key:

+ + + attributes + +

Return a list of {AttributeName,ValueList} tuples, + where AttributeName is the name of an attribute, + and ValueList is a list of values. Note: a given + attribute may occur more than once in the list with different + values if the attribute occurs more than once in the module.

+ +

The list of attributes will be empty if + the module has been stripped with + beam_lib(3).

+
+ + compile + +

Return a list of tuples containing information about + how the module was compiled. This list will be empty if + the module has been stripped with + beam_lib(3).

+
+ + imports + +

Always return an empty list. The imports key may not + be supported in future release.

+
+ + exports + +

Return a list of {Name,Arity} tuples with + all exported functions in the module.

+
+ + functions + +

Return a list of {Name,Arity} tuples with + all functions in the module.

+
+
+
+
+ +
+ diff --git a/system/doc/reference_manual/part.xml b/system/doc/reference_manual/part.xml new file mode 100644 index 0000000000..aebeaf335a --- /dev/null +++ b/system/doc/reference_manual/part.xml @@ -0,0 +1,44 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Erlang Reference Manual + Gunilla Arendt + + 2003-01-11 + +
+ + + + + + + + + + + + + +
+ diff --git a/system/doc/reference_manual/patterns.xml b/system/doc/reference_manual/patterns.xml new file mode 100644 index 0000000000..7289f14d73 --- /dev/null +++ b/system/doc/reference_manual/patterns.xml @@ -0,0 +1,59 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Pattern Matching + + + + + patterns.xml +
+ +
+ Pattern Matching +

Variables are bound to values through the pattern matching mechanism. Pattern matching occurs when + evaluating a function call, case- receive- + try- expressions and match operator (=) expressions.

+

In a pattern matching, a left-hand side + pattern is matched + against a right-hand side + term. If + the matching succeeds, any unbound variables in the pattern + become bound. If the matching fails, a run-time error occurs.

+

Examples:

+
+1> X.
+** 1: variable 'X' is unbound **
+2> X = 2.
+2
+3> X + 1.
+3
+4> {X, Y} = {1, 2}.
+** exception error: no match of right hand side value {1,2}
+5> {X, Y} = {2, 3}.
+{2,3}
+6> Y.
+3
+
+
+ diff --git a/system/doc/reference_manual/ports.xml b/system/doc/reference_manual/ports.xml new file mode 100644 index 0000000000..4847dd67cd --- /dev/null +++ b/system/doc/reference_manual/ports.xml @@ -0,0 +1,159 @@ + + + + +
+ + 20042009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Ports and Port Drivers + + + + + ports.xml +
+

Examples of how to use ports and port drivers can be found in + Interoperability Tutorial. The BIFs mentioned are as usual + documented in erlang(3).

+ +
+ Ports +

Ports provide the basic mechanism for communication + with the external world, from Erlang's point of view. They + provide a byte-oriented interface to an external program. When a + port has been created, Erlang can communicate with it by sending + and receiving lists of bytes, including binaries.

+

The Erlang process which creates a port is said to be + the port owner, or the connected process of + the port. All communication to and from the port should go via + the port owner. If the port owner terminates, so will the port + (and the external program, if it is written correctly).

+

The external program resides in another OS process. By default, + it should read from standard input (file descriptor 0) and write + to standard output (file descriptor 1). The external program + should terminate when the port is closed.

+
+ +
+ Port Drivers +

It is also possible to write a driver in C according to certain + principles and dynamically link it to the Erlang runtime system. + The linked-in driver looks like a port from the Erlang + programmer's point of view and is called a port driver.

+ +

An erroneous port driver will cause the entire Erlang runtime + system to leak memory, hang or crash.

+
+

Port drivers are documented in erl_driver(4), + driver_entry(1) and erl_ddll(3).

+
+ +
+ Port BIFs +

To create a port:

+ + + open_port(PortName, PortSettings + Returns a port identifier Portas the result of opening a new Erlang port. Messages can be sent to and received from a port identifier, just like a pid. Port identifiers can also be linked to or registered under a name using link/1and register/2. + + Port Creation BIF. +
+

PortName is usually a tuple {spawn,Command}, where + the string Command is the name of the external program. + The external program runs outside the Erlang workspace unless a + port driver with the name Command is found. If found, that + driver is started.

+

PortSettings is a list of settings (options) for the port. + The list typically contains at least a tuple {packet,N} + which specifies that data sent between the port and the external + program are preceded by an N-byte length indicator. Valid values + for N are 1, 2 or 4. If binaries should be used instead of lists + of bytes, the option binary must be included.

+

The port owner Pid can communicate with the port + Port by sending and receiving messages. (In fact, any + process can send the messages to the port, but the messages from + the port always go to the port owner).

+

Below, Data must be an I/O list. An I/O list is a binary + or a (possibly deep) list of binaries or integers in the range + 0..255.

+ + + {Pid,{command,Data}} + Sends Datato the port. + + + {Pid,close} + Closes the port. Unless the port is already closed, the port replies with {Port,closed}when all buffers have been flushed and the port really closes. + + + {Pid,{connect,NewPid}} + Sets the port owner of Portto NewPid. Unless the port is already closed, the port replies with{Port,connected}to the old port owner. Note that the old port owner is still linked to the port, but the new port owner is not. + + Messages Sent To a Port. +
+ + + {Port,{data,Data}} + Datais received from the external program. + + + {Port,closed} + Reply to Port ! {Pid,close}. + + + {Port,connected} + Reply to Port ! {Pid,{connect,NewPid}} + + + {'EXIT',Port,Reason} + If the port has terminated for some reason. + + Messages Received From a Port. +
+

Instead of sending and receiving messages, there are also a + number of BIFs that can be used. These can be called by any + process, not only the port owner.

+ + + port_command(Port,Data) + Sends Datato the port. + + + port_close(Port) + Closes the port. + + + port_connect(Port,NewPid) + Sets the port owner of Portto NewPid. The old port owner Pidstays linked to the port and have to call unlink(Port)if this is not desired. + + + erlang:port_info(Port,Item) + Returns information as specified by Item. + + + erlang:ports() + Returns a list of all ports on the current node. + + Port BIFs. +
+

There are some additional BIFs that only apply to port drivers: + port_control/3 and erlang:port_call/3.

+
+
+ diff --git a/system/doc/reference_manual/processes.xml b/system/doc/reference_manual/processes.xml new file mode 100644 index 0000000000..305d7d9c66 --- /dev/null +++ b/system/doc/reference_manual/processes.xml @@ -0,0 +1,205 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Processes + + + + + processes.xml +
+ +
+ Processes +

Erlang is designed for massive concurrency. Erlang processes are + light-weight (grow and shrink dynamically) with small memory + footprint, fast to create and terminate and the scheduling + overhead is low.

+
+ +
+ Process Creation +

A process is created by calling spawn:

+
+spawn(Module, Name, Args) -> pid()
+  Module = Name = atom()
+  Args = [Arg1,...,ArgN]
+    ArgI = term()
+

spawn creates a new process and returns the pid.

+

The new process will start executing in + Module:Name(Arg1,...,ArgN) where the arguments is + the elements of the (possible empty) Args argument list.

+

There exist a number of other spawn BIFs, for example + spawn/4 for spawning a process at another node.

+
+ +
+ Registered Processes +

Besides addressing a process by using its pid, there are also + BIFs for registering a process under a name. The name must be an + atom and is automatically unregistered if the process terminates:

+ + + register(Name, Pid) + Associates the name Name, an atom, with the process Pid. + + + registered() + Returns a list of names which have been registered usingregister/2. + + + whereis(Name) + Returns the pid registered under Name, orundefinedif the name is not registered. + + Name Registration BIFs. +
+
+ +
+ + Process Termination +

When a process terminates, it always terminates with an + exit reason. The reason may be any term.

+

A process is said to terminate normally, if the exit + reason is the atom normal. A process with no more code to + execute terminates normally.

+

A process terminates with exit reason {Reason,Stack} + when a run-time error occurs. See + Error and Error Handling.

+

A process can terminate itself by calling one of the BIFs + exit(Reason), + erlang:error(Reason), erlang:error(Reason, Args), + erlang:fault(Reason) or erlang:fault(Reason, Args). + The process then terminates with reason Reason for + exit/1 or {Reason,Stack} for the others.

+

A process may also be terminated if it receives an exit signal + with another exit reason than normal, see + Error Handling below.

+
+ +
+ Message Sending +

Processes communicate by sending and receiving messages. + Messages are sent by using + the send operator ! + and received by calling + receive.

+

Message sending is asynchronous and safe, the message is + guaranteed to eventually reach the recipient, provided that + the recipient exists.

+
+ +
+ Links +

Two processes can be linked to each other. A link + between two processes Pid1 and Pid2 is created + by Pid1 calling the BIF link(Pid2) (or vice versa). + There also exists a number a spawn_link BIFs, which spawns + and links to a process in one operation.

+

Links are bidirectional and there can only be one link between + two processes. Repeated calls to link(Pid) have no effect.

+

A link can be removed by calling the BIF unlink(Pid).

+

Links are used to monitor the behaviour of other processes, see + Error Handling below.

+
+ +
+ + Error Handling +

Erlang has a built-in feature for error handling between + processes. Terminating processes will emit exit signals to all + linked processes, which may terminate as well or handle the exit + in some way. This feature can be used to build hierarchical + program structures where some processes are supervising other + processes, for example restarting them if they terminate + abnormally.

+

Refer to OTP Design Principles for more information about + OTP supervision trees, which uses this feature.

+ +
+ Emitting Exit Signals +

When a process terminates, it will terminate with an exit reason as explained in Process Termination above. This exit reason is emitted in + an exit signal to all linked processes.

+

A process can also call the function exit(Pid,Reason). + This will result in an exit signal with exit reason + Reason being emitted to Pid, but does not affect + the calling process.

+
+ +
+ Receiving Exit Signals +

The default behaviour when a process receives an exit signal + with an exit reason other than normal, is to terminate + and in turn emit exit signals with the same exit reason to its + linked processes. An exit signal with reason normal is + ignored.

+

A process can be set to trap exit signals by calling:

+
+process_flag(trap_exit, true)
+

When a process is trapping exits, it will not terminate when + an exit signal is received. Instead, the signal is transformed + into a message {'EXIT',FromPid,Reason} which is put into + the mailbox of the process just like a regular message.

+

An exception to the above is if the exit reason is kill, + that is if exit(Pid,kill) has been called. This will + unconditionally terminate the process, regardless of if it is + trapping exit signals or not.

+
+
+ +
+ Monitors +

An alternative to links are monitors. A process + Pid1 can create a monitor for Pid2 by calling + the BIF erlang:monitor(process, Pid2). The function returns + a reference Ref.

+

If Pid2 terminates with exit reason Reason, a + 'DOWN' message is sent to Pid1:

+ +{'DOWN', Ref, process, Pid2, Reason} +

If Pid2 does not exist, the 'DOWN' message is sent + immediately with Reason set to noproc.

+

Monitors are unidirectional. Repeated calls to + erlang:monitor(process, Pid) will create several, + independent monitors and each one will send a 'DOWN' message when + Pid terminates.

+

A monitor can be removed by calling + erlang:demonitor(Ref).

+

It is possible to create monitors for processes with registered + names, also at other nodes.

+
+ +
+ Process Dictionary +

Each process has its own process dictionary, accessed by calling + the following BIFs:

+
+put(Key, Value)
+get(Key)
+get()
+get_keys(Value)
+erase(Key)
+erase()
+
+
+ diff --git a/system/doc/reference_manual/records.xml b/system/doc/reference_manual/records.xml new file mode 100644 index 0000000000..e2fe5fe8de --- /dev/null +++ b/system/doc/reference_manual/records.xml @@ -0,0 +1,169 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Records + + + + + records.xml +
+

A record is a data structure for storing a fixed number of + elements. It has named fields and is similar to a struct in C. + Record expressions are translated to tuple expressions during + compilation. Therefore, record expressions are not understood by + the shell unless special actions are taken. See shell(3) + for details.

+

More record examples can be found in Programming Examples.

+ +
+ Defining Records +

A record definition consists of the name of the record, + followed by the field names of the record. Record and field names + must be atoms. Each field can be given an optional default value. + If no default value is supplied, undefined will be used.

+
+-record(Name, {Field1 [= Value1],
+               ...
+               FieldN [= ValueN]}).
+

A record definition can be placed anywhere among the attributes + and function declarations of a module, but the definition must + come before any usage of the record.

+

If a record is used in several modules, it is recommended that + the record definition is placed in an include file.

+
+ +
+ Creating Records +

The following expression creates a new Name record where + the value of each field FieldI is the value of evaluating + the corresponding expression ExprI:

+
+#Name{Field1=Expr1,...,FieldK=ExprK}
+

The fields may be in any order, not necessarily the same order as + in the record definition, and fields can be omitted. Omitted + fields will get their respective default value instead.

+

If several fields should be assigned the same value, + the following construction can be used:

+
+#Name{Field1=Expr1,...,FieldK=ExprK, _=ExprL}
+

Omitted fields will then get the value of evaluating ExprL + instead of their default values. This feature was added in + Erlang 5.1/OTP R8 and is primarily intended to be used to create + patterns for ETS and Mnesia match functions. Example:

+
+-record(person, {name, phone, address}).
+
+...
+
+lookup(Name, Tab) ->
+    ets:match_object(Tab, #person{name=Name, _='_'}).
+
+ +
+ Accessing Record Fields +
+Expr#Name.Field
+

Returns the value of the specified field. Expr should + evaluate to a Name record.

+

The following expression returns the position of the specified + field in the tuple representation of the record:

+
+#Name.Field
+

Example:

+
+-record(person, {name, phone, address}).
+
+...
+
+lookup(Name, List) ->
+    lists:keysearch(Name, #person.name, List).
+
+ +
+ Updating Records +
+Expr#Name{Field1=Expr1,...,FieldK=ExprK}
+

Expr should evaluate to a Name record. Returns a + copy of this record, with the value of each specified field + FieldI changed to the value of evaluating the corresponding + expression ExprI. All other fields retain their old + values.

+

+
+ +
+ Records in Guards +

Since record expressions are expanded to tuple expressions, + creating records and accessing record fields are allowed in + guards. However all subexpressions, for example for field + initiations, must of course be valid guard expressions as well. + Examples:

+ +handle(Msg, State) when Msg==#msg{to=void, no=3} -> + ... + +handle(Msg, State) when State#state.running==true -> + ... +

There is also a type test BIF is_record(Term, RecordTag). + Example:

+
+is_person(P) when is_record(P, person) ->
+    true;
+is_person(_P) ->
+    false.
+
+ +
+ Records in Patterns +

A pattern that will match a certain record is created the same + way as a record is created:

+
+#Name{Field1=Expr1,...,FieldK=ExprK}
+

In this case, one or more of Expr1...ExprK may be + unbound variables.

+
+ +
+ Internal Representation of Records +

Record expressions are translated to tuple expressions during + compilation. A record defined as

+
+-record(Name, {Field1,...,FieldN}).
+

is internally represented by the tuple

+
+{Name,Value1,...,ValueN}
+

where each ValueI is the default value for FieldI.

+

To each module using records, a pseudo function is added + during compilation to obtain information about records:

+
+record_info(fields, Record) -> [Field]
+record_info(size, Record) -> Size
+

Size is the size of the tuple representation, that is + one more than the number of fields.

+

In addition, #Record.Name returns the index in the tuple + representation of Name of the record Record. + Name must be an atom.

+
+
+ diff --git a/system/doc/reference_manual/xmlfiles.mk b/system/doc/reference_manual/xmlfiles.mk new file mode 100644 index 0000000000..6886c8c7cf --- /dev/null +++ b/system/doc/reference_manual/xmlfiles.mk @@ -0,0 +1,33 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +REF_MAN_CHAPTER_FILES = \ + introduction.xml \ + data_types.xml \ + patterns.xml \ + modules.xml \ + functions.xml \ + expressions.xml \ + macros.xml \ + records.xml \ + errors.xml \ + processes.xml \ + distributed.xml \ + code_loading.xml \ + ports.xml + diff --git a/system/doc/system_architecture_intro/Makefile b/system/doc/system_architecture_intro/Makefile new file mode 100644 index 0000000000..0fff9bc4d5 --- /dev/null +++ b/system/doc/system_architecture_intro/Makefile @@ -0,0 +1,97 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include $(ERL_TOP)/erts/vsn.mk +#VSN=$(SYSTEM_VSN) + +APPLICATION=otp-system-documentation +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/doc/system_architecture_intro + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +XML_PART_FILES = part.xml + +include xmlfiles.mk + + +TOPDOCDIR=.. + +BOOK_FILES = book.xml + +GIF_FILES = + +PS_FILES = + +XML_FILES = \ + $(BOOK_FILES) $(XML_CHAPTER_FILES) \ + $(XML_PART_FILES) + +# ---------------------------------------------------- + +HTMLDIR = ../html/system_architecture_intro + +HTML_UG_FILE = $(HTMLDIR)/users_guide.html + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAGS += +DVIPS_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +docs: html + +local_docs: PDFDIR=../../pdf + +html: $(GIF_FILES) $(HTML_UG_FILE) + +debug opt: + +clean clean_docs: + rm -rf $(HTMLDIR) + rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f errs core *~ + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_docs_spec: docs +# $(INSTALL_DIR) $(RELEASE_PATH)/pdf +# $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELEASE_PATH)/pdf + $(INSTALL_DIR) $(RELSYSDIR) + $(INSTALL_DATA) $(GIF_FILES) $(HTMLDIR)/*.html \ + $(RELSYSDIR) + +release_spec: + + diff --git a/system/doc/system_architecture_intro/book.xml b/system/doc/system_architecture_intro/book.xml new file mode 100644 index 0000000000..e83c1a482a --- /dev/null +++ b/system/doc/system_architecture_intro/book.xml @@ -0,0 +1,43 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + System Architecture + OTP Team + + 2000-03-21 + B + book.sgml +
+ + + System Architecture Introduction + + + + + + + + +
+ diff --git a/system/doc/system_architecture_intro/make.dep b/system/doc/system_architecture_intro/make.dep new file mode 100644 index 0000000000..6b7bd860a0 --- /dev/null +++ b/system/doc/system_architecture_intro/make.dep @@ -0,0 +1,13 @@ +# ---------------------------------------------------- +# >>>> Do not edit this file <<<< +# This file was automaticly generated by +# /home/otp/bin/docdepend +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# TeX files that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: book.tex part.tex sys_arch_intro.tex + diff --git a/system/doc/system_architecture_intro/note.gif b/system/doc/system_architecture_intro/note.gif new file mode 100644 index 0000000000..6fffe30419 Binary files /dev/null and b/system/doc/system_architecture_intro/note.gif differ diff --git a/system/doc/system_architecture_intro/part.xml b/system/doc/system_architecture_intro/part.xml new file mode 100644 index 0000000000..7f3ea62190 --- /dev/null +++ b/system/doc/system_architecture_intro/part.xml @@ -0,0 +1,33 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Introduction to the System Architecture + OTP Team + + 2000-03-21 + U + part.sgml +
+ +
+ diff --git a/system/doc/system_architecture_intro/sys_arch_intro.xml b/system/doc/system_architecture_intro/sys_arch_intro.xml new file mode 100644 index 0000000000..1cd8cf99e2 --- /dev/null +++ b/system/doc/system_architecture_intro/sys_arch_intro.xml @@ -0,0 +1,179 @@ + + + + +
+ + 20002009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Introduction + + + + + sys_arch_intro.xml +
+ +
+ Erlang and OTP +

Erlang is a general-purpose programming language with built-in + support for concurrency, distribution and fault tolerance.

+

OTP (Open Telecom Platform) is aimed at providing time-saving and + flexible development for robust, adaptable telecom systems. It + consists of an Erlang runtime system, a number of ready-to-use + components mainly written in Erlang, and a set of design principles + for Erlang programs. Since Erlang and OTP are closely interconnected + the term Erlang/OTP is normally used instead of OTP.

+
+ +
+ Erlang/OTP + +
+ Erlang Runtime System +

The Erlang runtime system (ERTS) is made up of an emulator running on top of the host operating system, a kernel providing low-level services such as distribution and I/O handling, and a standard library containing a large number of re-usable modules.

+

The OTP design principles provides the user with a way to structure the system based on a concept called application. An OTP application is a way to package a system component and is either a set of library modules or a supervision tree. A supervision tree is a hierarchical tree of processes used to program fault-tolerant systems. The processes are easiest implemented using behavior modules which are formalizations of design patterns. The standard library includes behavior modules for supervisors, servers, state machines and generic event handlers. In chapter 4 "OTP Design Principles" the design principles are explained in detail.

+
+ +
+ OTP Components +

The OTP components can be divided into six categories:

+ + +

Basic Applications - Basic Erlang/OTP functionality.

+ + Compiler A compiler for Erlang modules. + Kernel Functionality necessary to run Erlang/OTP itself. + SASL (System Architecture Support Libraries) A set of tools for code replacement and alarm handling etc. + Stdlib The standard library. + +
+ +

Operations and Maintenance - OAM both of the system developed by the user and of Erlang/OTP itself.

+ + EVA A multi-featured event and alarm handler. + OS_Mon A monitor which allows inspection of the underlying operating system. + SNMP SNMP support including a MIB compiler and tools for creating SNMP agents. + +
+ +

Interface and Communication - Interoperability and protocols support.

+ + Asn1 Support for ASN.1. + Comet A library that enables Erlang/OTP to call COM + objects on windows + Crypto Cryptographical support + Erl_Interface Low level interface to C. + GS A graphics system used to write platform + independent user interfaces. + Inets A set of services such as a web server + and a FTP client. + Jinterface Low level interface to Java. + SSL Secure Socket Layer (SSL),interface to UNIX BSD + sockets + +
+ +

Database Management.

+ + QLC Query language support for Mnesia DBMS. + Mnesia A heavy duty real-time distributed database. + ODBC ODBC database interface. + +
+ +

CORBA services and IDL compiler.

+ + cosEvent Orber OMG Event Service. + cosNotification Orber OMG Notification + Service. + cosTime Orber OMG Timer and TimerEvent + Services. + cosTransactions Orber OMG Transaction + Service. + IC IDL compiler + Orber A CORBA object request broker. + +
+ +

Tools.

+ + Appmon A utility used to view OTP applications. + Debugger For debugging and testing of Erlang programs. + Parsetools A set of parsing and lexical analysis tools. + Pman A process manager used to inspect the state of an Erlang/OTP system. + Runtime_Tools Tools to include in a production system. + Toolbar A tool bar simplifying access to the Erlang/OTP tools. + Tools A set of programming tools including a coverage analyzer etc. + TV An ETS and Mnesia graphical table visualizer. + +
+
+
+
+ +
+ Scope and Purpose +

This documentation describes the Erlang runtime system, the OTP applications and the OTP design principles. It assumes that the reader is familiar with the Erlang programming language and does not explain how to program in Erlang. The language is described in Concurrent Programming in Erlang, 2nd Edition, ISBN 0-13-508301-X.

+
+ +
+ About the Erlang/OTP Documentation + +
+ Structure of this Book +

The documentation is divided into eight parts. This book, Erlang 5.1/OTP R8 System Documentation, EN/LZT 108 4095 R2, is the starting point of the documentation and contains information about the Erlang programming language and runtime system, the OTP design principles, and how to install and configure Erlang/OTP.

+ + Chapter 2: "Getting Started with Erlang" describes the Erlang runtime system and introduces the reader to tools such as the compiler and debugger. + Chapter 3: "Erlang Extensions Since 4.4" lists all extensions added to the Erlang programming languages since the latest version of the book Concurrent Programming in ERLANG. + Chapter 4: "OTP Design Principles" describes a way to structure Erlang code in terms of applications and supervision trees. The standard behaviors are described and examples illustrate how to apply these behaviors to typical applications. + Chapter 5: "Installation Guide"gives guidelines on how to install Erlang/OTP on UNIX or Windows. + Chapter 6: "System Principles" describes the strategies + and options, which are available to start an Erlang/OTP system. This chapter also provides a brief description of the applications included in an Erla + ng/OTP system. + Chapter 7: "Embedded Systems" is a supplement to "Installation Guide". t describes issues that are specific for running Erlang/OTP on an embedded system. + Chapter 8: "Operation and Management Principles" describes the model for operation and maintenance of sub-systems. + Chapter 9: "Tutorial" gives an orientation of the different + interoperability mechanism, which can be used when integrating an + Erlang program with a program written in an other programming language. + +
+ +
+ Typographical Conventions +

The following typographical conventions are used in the documentation.

+ + + Convention + Where used + + + command + To show menu selections and equivalent command line entries.

+To show keyboard entries at system prompts.
+
+ + code + To highlight Erlang code, module and function names, arguments, variables, and file names. + + Examples of typographical conventions. +
+
+
+
+ diff --git a/system/doc/system_architecture_intro/warning.gif b/system/doc/system_architecture_intro/warning.gif new file mode 100644 index 0000000000..96af52360e Binary files /dev/null and b/system/doc/system_architecture_intro/warning.gif differ diff --git a/system/doc/system_architecture_intro/xmlfiles.mk b/system/doc/system_architecture_intro/xmlfiles.mk new file mode 100644 index 0000000000..0b91c3bc0f --- /dev/null +++ b/system/doc/system_architecture_intro/xmlfiles.mk @@ -0,0 +1,19 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +XML_CHAPTER_FILES = sys_arch_intro.xml diff --git a/system/doc/system_principles/Makefile b/system/doc/system_principles/Makefile new file mode 100644 index 0000000000..b0698fec9d --- /dev/null +++ b/system/doc/system_principles/Makefile @@ -0,0 +1,95 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 1996-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include $(ERL_TOP)/erts/vsn.mk +#VSN=$(SYSTEM_VSN) + +APPLICATION=otp-system-documentation +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/doc/system_principles + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +XML_PART_FILES = part.xml + +include xmlfiles.mk + +XML_CHAPTER_FILES=$(SYSTEM_PRINCIPLES_CHAPTER_FILES) + +TOPDOCDIR=.. + +BOOK_FILES = book.xml + +GIF_FILES = + +XML_FILES = \ + $(BOOK_FILES) $(XML_CHAPTER_FILES) \ + $(XML_PART_FILES) + +# ---------------------------------------------------- + +HTMLDIR = ../html/system_principles + +HTML_UG_FILE = $(HTMLDIR)/users_guide.html + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAGS += +DVIPS_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +docs: html + +local_docs: PDFDIR=../../pdf + +html: $(GIF_FILES) $(HTML_UG_FILE) + +debug opt: + +clean clean_docs: + rm -rf $(HTMLDIR) + rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f errs core *~ + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_docs_spec: docs +# $(INSTALL_DIR) $(RELEASE_PATH)/pdf +# $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELEASE_PATH)/pdf + $(INSTALL_DIR) $(RELSYSDIR) + $(INSTALL_DATA) $(GIF_FILES) $(HTMLDIR)/*.html \ + $(RELSYSDIR) + +release_spec: + diff --git a/system/doc/system_principles/book.xml b/system/doc/system_principles/book.xml new file mode 100644 index 0000000000..868bbeecdd --- /dev/null +++ b/system/doc/system_principles/book.xml @@ -0,0 +1,43 @@ + + + + +
+ + 19962009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + System Principles + OTP Team + + 1997-05-21 + + book.xml +
+ + + System Principles + + + + + + + + +
+ diff --git a/system/doc/system_principles/create_target.xml b/system/doc/system_principles/create_target.xml new file mode 100644 index 0000000000..9899b6e266 --- /dev/null +++ b/system/doc/system_principles/create_target.xml @@ -0,0 +1,502 @@ + + + + +
+ + 20022009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Creating a First Target System + Peter Högfeldt + + + + + 2002-09-17 + A + create_target.xml +
+ +
+ Introduction +

When creating a system using Erlang/OTP, the most simple way is + to install Erlang/OTP somewhere, install the application specific + code somewhere else, and then start the Erlang runtime system, + making sure the code path includes the application specific code.

+

Often it is not desirable to use an Erlang/OTP system as is. A + developer may create new Erlang/OTP compliant applications for a + particular purpose, and several original Erlang/OTP applications + may be irrelevant for the purpose in question. Thus, there is a + need to be able to create a new system based on a given + Erlang/OTP system, where dispensable applications are removed, + and a set of new applications that are included in the new + system. Documentation and source code is irrelevant and is + therefore not included in the new system.

+

This chapter is about creating such a system, which we call a + target system.

+

In the following sections we consider creating target systems with + different requirements of functionality:

+ + a basic target system that can be started by + calling the ordinary erl script, + a simple target system where also code + replacement in run-time can be performed, and + an embedded target system where there is also + support for logging output from the system to file for later + inspection, and where the system can be started automatically + at boot time. + +

We only consider the case when Erlang/OTP is running on a UNIX + system.

+

There is an example Erlang module target_system.erl that + contains functions for creating and installing a target system. + That module is used in the examples below. The source code of + the module is listed at the end of this chapter.

+
+ +
+ Creating a Target System +

It is assumed that you have a working Erlang/OTP system structured + according to the OTP Design Principles.

+

Step 1. First create a .rel file (see + rel(4)) that specifies the erts version + and lists all applications that should be included in the new + basic target system. An example is the following + mysystem.rel file:

+ +%% mysystem.rel +{release, + {"MYSYSTEM", "FIRST"}, + {erts, "5.1"}, + [{kernel, "2.7"}, + {stdlib, "1.10"}, + {sasl, "1.9.3"}, + {pea, "1.0"}]}. +

The listed applications are not only original Erlang/OTP + applications but possibly also new applications that you have + written yourself (here examplified by the application + pea).

+

Step 2. From the directory where the mysystem.rel + file reside, start the Erlang/OTP system:

+
+os> erl -pa /home/user/target_system/myapps/pea-1.0/ebin
+

where also the path to the pea-1.0 ebin directory is + provided.

+

Step 3. Now create the target system:

+
+1> target_system:create("mysystem").
+

The target_system:create/1 function does the following:

+ + Reads the mysystem.rel file, and creates a new file + plain.rel which is identical to former, except that it + only lists the kernel and stdlib applications. + From the mysystem.rel and plain.rel files + creates the files mysystem.script, + mysystem.boot, plain.script, and + plain.boot through a call to + systools:make_script/2. + +

Creates the file mysystem.tar.gz by a call to + systools:make_tar/2. That file has the following + contents:

+ +erts-5.1/bin/ +releases/FIRST/start.boot +releases/mysystem.rel +lib/kernel-2.7/ +lib/stdlib-1.10/ +lib/sasl-1.9.3/ +lib/pea-1.0/ +

The file releases/FIRST/start.boot is a copy of our + mysystem.boot, and a copy of the original + mysystem.rel has been put in the releases + directory.

+
+ Creates the temporary directory tmp and extracts the tar file + mysystem.tar.gz into that directory. + Deletes the erl and start files from + tmp/erts-5.1/bin. XXX Why. + Creates the directory tmp/bin. + Copies the previously creates file plain.boot to + tmp/bin/start.boot. + Copies the files epmd, run_erl, and + to_erl from the directory tmp/erts-5.1/bin to + the directory tmp/bin. + Creates the file tmp/releases/start_erl.data with the + contents "5.1 FIRST". + + Recreates the file mysystem.tar.gz from the directories + in the directory tmp, and removes tmp. +
+
+ +
+ Installing a Target System +

Step 4. Install the created target system in a + suitable directory.

+
+2> target_system:install("mysystem", "/usr/local/erl-target").
+

The function target_system:install/2 does the following: +

+ + Extracts the tar file mysystem.tar.gz into the target + directory /usr/local/erl-target. + In the target directory reads the file releases/start_erl.data + in order to find the Erlang runtime system version ("5.1"). + Substitutes %FINAL_ROOTDIR% and %EMU% for + /usr/local/erl-target and beam, respectively, in + the files erl.src, start.src, and + start_erl.src of the target erts-5.1/bin + directory, and puts the resulting files erl, + start, and run_erl in the target bin + directory. + Finally the target releases/RELEASES file is created + from data in the releases/mysystem.rel file. + +
+ +
+ Starting a Target System +

Now we have a target system that can be started in various ways.

+

We start it as a basic target system by invoking

+
+os> /usr/local/erl-target/bin/erl
+

where only the kernel and stdlib applications are + started, i.e. the system is started as an ordinary development + system. There are only two files needed for all this to work: + bin/erl file (obtained from erts-5.1/bin/erl.src) + and the bin/start.boot file (a copy of plain.boot).

+

We can also start a distributed system (requires bin/epmd).

+

To start all applications specified in the original + mysystem.rel file, use the -boot flag as follows:

+
+os> /usr/local/erl-target/bin/erl -boot /usr/local/erl-target/releases/FIRST/start
+

We start a simple target system as above. The only difference + is that also the file releases/RELEASES is present for + code replacement in run-time to work.

+

To start an embedded target system the shell script + bin/start is used. That shell script calls + bin/run_erl, which in turn calls bin/start_erl + (roughly, start_erl is an embedded variant of + erl).

+

The shell script start is only an example. You should + edit it to suite your needs. Typically it is executed when the + UNIX system boots.

+

run_erl is a wrapper that provides logging of output from + the run-time system to file. It also provides a simple mechanism + for attaching to the Erlang shell (to_erl).

+

start_erl requires the root directory + ("/usr/local/erl-target"), the releases directory + ("/usr/local/erl-target/releases"), and the location of + the start_erl.data file. It reads the run-time system + version ("5.1") and release version ("FIRST") from + the start_erl.data file, starts the run-time system of the + version found, and provides -boot flag specifying the boot + file of the release version found + ("releases/FIRST/start.boot").

+

start_erl also assumes that there is sys.config in + release version directory ("releases/FIRST/sys.config). That + is the topic of the next section (see below).

+

The start_erl shell script should normally not be + altered by the user.

+
+ +
+ System Configuration Parameters +

As was pointed out above start_erl requires a + sys.config in the release version directory + ("releases/FIRST/sys.config"). If there is no such a + file, the system start will fail. Hence such a file has to + added as well.

+

+

If you have system configuration data that are neither file + location dependent nor site dependent, it may be convenient to + create the sys.config early, so that it becomes a part of + the target system tar file created by + target_system:create/1. In fact, if you create, in the + current directory, not only the mysystem.rel file, but + also a sys.config file, that latter file will be tacitly + put in the apropriate directory.

+
+ +
+ Differences from the Install Script +

The above install/2 procedure differs somewhat from that + of the ordinary Install shell script. In fact, create/1 + makes the release package as complete as possible, and leave to the + install/2 procedure to finish by only considering location + dependent files.

+
+ +
+ Listing of target_system.erl + + RelFile = RelFileName ++ ".rel", + io:fwrite("Reading file: \\"~s\\" ...~n", [RelFile]), + {ok, [RelSpec]} = file:consult(RelFile), + io:fwrite("Creating file: \\"~s\\" from \\"~s\\" ...~n", + ["plain.rel", RelFile]), + {release, + {RelName, RelVsn}, + {erts, ErtsVsn}, + AppVsns} = RelSpec, + PlainRelSpec = {release, + {RelName, RelVsn}, + {erts, ErtsVsn}, + lists:filter(fun({kernel, _}) -> + true; + ({stdlib, _}) -> + true; + (_) -> + false + end, AppVsns) + }, + {ok, Fd} = file:open("plain.rel", [write]), + io:fwrite(Fd, "~p.~n", [PlainRelSpec]), + file:close(Fd), + + io:fwrite("Making \\"plain.script\\" and \\"plain.boot\\" files ...~n"), + make_script("plain"), + + io:fwrite("Making \\"~s.script\\" and \\"~s.boot\\" files ...~n", + [RelFileName, RelFileName]), + make_script(RelFileName), + + TarFileName = io_lib:fwrite("~s.tar.gz", [RelFileName]), + io:fwrite("Creating tar file \\"~s\\" ...~n", [TarFileName]), + make_tar(RelFileName), + + io:fwrite("Creating directory \\"tmp\\" ...~n"), + file:make_dir("tmp"), + + io:fwrite("Extracting \\"~s\\" into directory \\"tmp\\" ...~n", [TarFileName]), + extract_tar(TarFileName, "tmp"), + + TmpBinDir = filename:join(["tmp", "bin"]), + ErtsBinDir = filename:join(["tmp", "erts-" ++ ErtsVsn, "bin"]), + io:fwrite("Deleting \\"erl\\" and \\"start\\" in directory \\"~s\\" ...~n", + [ErtsBinDir]), + file:delete(filename:join([ErtsBinDir, "erl"])), + file:delete(filename:join([ErtsBinDir, "start"])), + + io:fwrite("Creating temporary directory \\"~s\\" ...~n", [TmpBinDir]), + file:make_dir(TmpBinDir), + + io:fwrite("Copying file \\"plain.boot\\" to \\"~s\\" ...~n", + [filename:join([TmpBinDir, "start.boot"])]), + copy_file("plain.boot", filename:join([TmpBinDir, "start.boot"])), + + io:fwrite("Copying files \\"epmd\\", \\"run_erl\\" and \\"to_erl\\" from \ +" + "\\"~s\\" to \\"~s\\" ...~n", + [ErtsBinDir, TmpBinDir]), + copy_file(filename:join([ErtsBinDir, "epmd"]), + filename:join([TmpBinDir, "epmd"]), [preserve]), + copy_file(filename:join([ErtsBinDir, "run_erl"]), + filename:join([TmpBinDir, "run_erl"]), [preserve]), + copy_file(filename:join([ErtsBinDir, "to_erl"]), + filename:join([TmpBinDir, "to_erl"]), [preserve]), + + StartErlDataFile = filename:join(["tmp", "releases", "start_erl.data"]), + io:fwrite("Creating \\"~s\\" ...~n", [StartErlDataFile]), + StartErlData = io_lib:fwrite("~s ~s~n", [ErtsVsn, RelVsn]), + write_file(StartErlDataFile, StartErlData), + + io:fwrite("Recreating tar file \\"~s\\" from contents in directory " + "\\"tmp\\" ...~n", [TarFileName]), + {ok, Tar} = erl_tar:open(TarFileName, [write, compressed]), + {ok, Cwd} = file:get_cwd(), + file:set_cwd("tmp"), + erl_tar:add(Tar, "bin", []), + erl_tar:add(Tar, "erts-" ++ ErtsVsn, []), + erl_tar:add(Tar, "releases", []), + erl_tar:add(Tar, "lib", []), + erl_tar:close(Tar), + file:set_cwd(Cwd), + io:fwrite("Removing directory \\"tmp\\" ...~n"), + remove_dir_tree("tmp"), + ok. + + +install(RelFileName, RootDir) -> + TarFile = RelFileName ++ ".tar.gz", + io:fwrite("Extracting ~s ...~n", [TarFile]), + extract_tar(TarFile, RootDir), + StartErlDataFile = filename:join([RootDir, "releases", "start_erl.data"]), + {ok, StartErlData} = read_txt_file(StartErlDataFile), + [ErlVsn, RelVsn| _] = string:tokens(StartErlData, " \ +"), + ErtsBinDir = filename:join([RootDir, "erts-" ++ ErlVsn, "bin"]), + BinDir = filename:join([RootDir, "bin"]), + io:fwrite("Substituting in erl.src, start.src and start_erl.src to\ +" + "form erl, start and start_erl ...\ +"), + subst_src_scripts(["erl", "start", "start_erl"], ErtsBinDir, BinDir, + [{"FINAL_ROOTDIR", RootDir}, {"EMU", "beam"}], + [preserve]), + io:fwrite("Creating the RELEASES file ...\ +"), + create_RELEASES(RootDir, + filename:join([RootDir, "releases", RelFileName])). + +%% LOCALS + +%% make_script(RelFileName) +%% +make_script(RelFileName) -> + Opts = [no_module_tests], + systools:make_script(RelFileName, Opts). + +%% make_tar(RelFileName) +%% +make_tar(RelFileName) -> + RootDir = code:root_dir(), + systools:make_tar(RelFileName, [{erts, RootDir}]). + +%% extract_tar(TarFile, DestDir) +%% +extract_tar(TarFile, DestDir) -> + erl_tar:extract(TarFile, [{cwd, DestDir}, compressed]). + +create_RELEASES(DestDir, RelFileName) -> + release_handler:create_RELEASES(DestDir, RelFileName ++ ".rel"). + +subst_src_scripts(Scripts, SrcDir, DestDir, Vars, Opts) -> + lists:foreach(fun(Script) -> + subst_src_script(Script, SrcDir, DestDir, + Vars, Opts) + end, Scripts). + +subst_src_script(Script, SrcDir, DestDir, Vars, Opts) -> + subst_file(filename:join([SrcDir, Script ++ ".src"]), + filename:join([DestDir, Script]), + Vars, Opts). + +subst_file(Src, Dest, Vars, Opts) -> + {ok, Conts} = read_txt_file(Src), + NConts = subst(Conts, Vars), + write_file(Dest, NConts), + case lists:member(preserve, Opts) of + true -> + {ok, FileInfo} = file:read_file_info(Src), + file:write_file_info(Dest, FileInfo); + false -> + ok + end. + +%% subst(Str, Vars) +%% Vars = [{Var, Val}] +%% Var = Val = string() +%% Substitute all occurrences of %Var% for Val in Str, using the list +%% of variables in Vars. +%% +subst(Str, Vars) -> + subst(Str, Vars, []). + +subst([$%, C| Rest], Vars, Result) when $A =< C, C =< $Z -> + subst_var([C| Rest], Vars, Result, []); +subst([$%, C| Rest], Vars, Result) when $a =< C, C =< $z -> + subst_var([C| Rest], Vars, Result, []); +subst([$%, C| Rest], Vars, Result) when C == $_ -> + subst_var([C| Rest], Vars, Result, []); +subst([C| Rest], Vars, Result) -> + subst(Rest, Vars, [C| Result]); +subst([], _Vars, Result) -> + lists:reverse(Result). + +subst_var([$%| Rest], Vars, Result, VarAcc) -> + Key = lists:reverse(VarAcc), + case lists:keysearch(Key, 1, Vars) of + {value, {Key, Value}} -> + subst(Rest, Vars, lists:reverse(Value, Result)); + false -> + subst(Rest, Vars, [$%| VarAcc ++ [$%| Result]]) + end; +subst_var([C| Rest], Vars, Result, VarAcc) -> + subst_var(Rest, Vars, Result, [C| VarAcc]); +subst_var([], Vars, Result, VarAcc) -> + subst([], Vars, [VarAcc ++ [$%| Result]]). + +copy_file(Src, Dest) -> + copy_file(Src, Dest, []). + +copy_file(Src, Dest, Opts) -> + {ok, InFd} = file:open(Src, [raw, binary, read]), + {ok, OutFd} = file:open(Dest, [raw, binary, write]), + do_copy_file(InFd, OutFd), + file:close(InFd), + file:close(OutFd), + case lists:member(preserve, Opts) of + true -> + {ok, FileInfo} = file:read_file_info(Src), + file:write_file_info(Dest, FileInfo); + false -> + ok + end. + +do_copy_file(InFd, OutFd) -> + case file:read(InFd, ?BUFSIZE) of + {ok, Bin} -> + file:write(OutFd, Bin), + do_copy_file(InFd, OutFd); + eof -> + ok + end. + +write_file(FName, Conts) -> + {ok, Fd} = file:open(FName, [write]), + file:write(Fd, Conts), + file:close(Fd). + +read_txt_file(File) -> + {ok, Bin} = file:read_file(File), + {ok, binary_to_list(Bin)}. + +remove_dir_tree(Dir) -> + remove_all_files(".", [Dir]). + +remove_all_files(Dir, Files) -> + lists:foreach(fun(File) -> + FilePath = filename:join([Dir, File]), + {ok, FileInfo} = file:read_file_info(FilePath), + case FileInfo#file_info.type of + directory -> + {ok, DirFiles} = file:list_dir(FilePath), + remove_all_files(FilePath, DirFiles), + file:del_dir(FilePath); + _ -> + file:delete(FilePath) + end + end, Files). + ]]> +
+
+ diff --git a/system/doc/system_principles/error_logging.xml b/system/doc/system_principles/error_logging.xml new file mode 100644 index 0000000000..3cb290227e --- /dev/null +++ b/system/doc/system_principles/error_logging.xml @@ -0,0 +1,116 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Error Logging + + + + + error_logging.xml +
+ +
+ Error Information From the Runtime System +

Error information from the runtime system, that is, information + about a process terminating due to an uncaught error exception, + is by default written to terminal (tty):

+ with exit value: {{badmatch,[1,2,3]},[{m,f,1},{shell,eval_loop,2}]}]]> +

The error information is handled by the error logger, a + system process registered as error_logger. This process + receives all error messages from the Erlang runtime system and + also from the standard behaviours and different Erlang/OTP + applications.

+

The exit reasons (such as badarg above) used by + the runtime system are described in + Errors and Error Handling + in the Erlang Reference Manual.

+

The process error_logger and its user interface (with + the same name) are described in + error_logger(3). + It is possible to configure the system so that error information + is written to file instead/as well as tty. Also, it is possible + for user defined applications to send and format error + information using error_logger.

+
+ +
+ SASL Error Logging +

The standard behaviors (supervisor, gen_server, + etc.) sends progress and error information to error_logger. + If the SASL application is started, this information is written + to tty as well. See + SASL Error Logging + in the SASL User's Guide for further information.

+
+% erl -boot start_sasl
+Erlang (BEAM) emulator version 5.4.13 [hipe] [threads:0] [kernel-poll]
+
+
+=PROGRESS REPORT==== 31-Mar-2006::12:45:58 ===
+          supervisor: {local,sasl_safe_sup}
+             started: [{pid,<0.33.0>},
+                       {name,alarm_handler},
+                       {mfa,{alarm_handler,start_link,[]}},
+                       {restart_type,permanent},
+                       {shutdown,2000},
+                       {child_type,worker}]
+
+=PROGRESS REPORT==== 31-Mar-2006::12:45:58 ===
+          supervisor: {local,sasl_safe_sup}
+             started: [{pid,<0.34.0>},
+                       {name,overload},
+                       {mfa,{overload,start_link,[]}},
+                       {restart_type,permanent},
+                       {shutdown,2000},
+                       {child_type,worker}]
+
+=PROGRESS REPORT==== 31-Mar-2006::12:45:58 ===
+          supervisor: {local,sasl_sup}
+             started: [{pid,<0.32.0>},
+                       {name,sasl_safe_sup},
+                       {mfa,{supervisor,
+                                start_link,
+                                [{local,sasl_safe_sup},sasl,safe]}},
+                       {restart_type,permanent},
+                       {shutdown,infinity},
+                       {child_type,supervisor}]
+
+=PROGRESS REPORT==== 31-Mar-2006::12:45:58 ===
+          supervisor: {local,sasl_sup}
+             started: [{pid,<0.35.0>},
+                       {name,release_handler},
+                       {mfa,{release_handler,start_link,[]}},
+                       {restart_type,permanent},
+                       {shutdown,2000},
+                       {child_type,worker}]
+
+=PROGRESS REPORT==== 31-Mar-2006::12:45:58 ===
+         application: sasl
+          started_at: nonode@nohost
+Eshell V5.4.13  (abort with ^G)
+1> 
+
+
+ diff --git a/system/doc/system_principles/make.dep b/system/doc/system_principles/make.dep new file mode 100644 index 0000000000..28753ca5a0 --- /dev/null +++ b/system/doc/system_principles/make.dep @@ -0,0 +1,14 @@ +# ---------------------------------------------------- +# >>>> Do not edit this file <<<< +# This file was automaticly generated by +# /home/otp/bin/docdepend +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# TeX files that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: book.tex create_target.tex error_logging.tex \ + part.tex system_principles.tex + diff --git a/system/doc/system_principles/part.xml b/system/doc/system_principles/part.xml new file mode 100644 index 0000000000..94bb29be57 --- /dev/null +++ b/system/doc/system_principles/part.xml @@ -0,0 +1,35 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + System Principles + OTP Team + + 1997-02-21 + L + part.xml +
+ + + +
+ diff --git a/system/doc/system_principles/system_principles.xml b/system/doc/system_principles/system_principles.xml new file mode 100644 index 0000000000..27512a1660 --- /dev/null +++ b/system/doc/system_principles/system_principles.xml @@ -0,0 +1,236 @@ + + + + +
+ + 19962009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + System Principles + + + + + system_principles.xml +
+ +
+ Starting the System +

An Erlang runtime system is started with the command erl:

+
+% erl
+Erlang (BEAM) emulator version 5.2.3.5 [hipe] [threads:0]
+
+Eshell V5.2.3.5  (abort with ^G)
+1> 
+

erl understands a number of command line arguments, see + erl(1). A number of them are also described in this + chapter.

+

Application programs can access the values of the command line + arguments by calling one of the functions + init:get_argument(Key), or init:get_arguments(). + See init(3).

+
+ +
+ Restarting and Stopping the System +

The runtime system can be halted by calling halt/0,1. + See erlang(3).

+

The module init contains function for restarting, + rebooting and stopping the runtime system. See init(3).

+
+init:restart()
+init:reboot()
+init:stop()
+

Also, the runtime system will terminate if the Erlang shell is + terminated.

+
+ +
+ + Boot Scripts +

The runtime system is started using a boot script. + The boot script contains instructions on which code to load and + which processes and applications to start.

+

A boot script file has the extension .script. + The runtime system uses a binary version of the script. This + binary boot script file has the extension .boot.

+

Which boot script to use is specified by the command line flag + -boot. The extension .boot should be omitted. + Example, using the boot script start_all.boot:

+
+% erl -boot start_all
+

If no boot script is specified, it defaults to + ROOT/bin/start, see Default Boot Scripts below.

+

The command line flag -init_debug makes the init + process write some debug information while interpreting the boot + script:

+
+% erl -init_debug
+{progress,preloaded}
+{progress,kernel_load_completed}
+{progress,modules_loaded}
+{start,heart}
+{start,error_logger}
+...
+

See script(4) for a detailed description of the syntax + and contents of the boot script.

+ +
+ Default Boot Scripts +

Erlang/OTP comes with two boot scripts:

+ + start_clean.boot + +

Loads the code for and starts the applications Kernel and + STDLIB.

+
+ start_sasl.boot + +

Loads the code for and starts the applications Kernel, + STDLIB and SASL.

+
+
+

Which of start_clean and start_sasl to use as + default is decided by the user when installing Erlang/OTP using + Install. The user is asked "Do you want to use a minimal + system startup instead of the SASL startup". If the answer is + yes, then start_clean is used, otherwise + start_sasl is used. A copy of the selected boot script + is made, named start.boot and placed in + the ROOT/bin directory.

+
+ +
+ User-Defined Boot Scripts +

It is sometimes useful or necessary to create a user-defined + boot script. This is true especially when running Erlang in + embedded mode, see Code Loading Strategy.

+

It is possible to write a boot script manually. + The recommended way to create a boot script, however, is to + generate the boot script from a release resource file + Name.rel, using the function + systools:make_script/1,2. This requires that the source + code is structured as applications according to the OTP design + principles. (The program does not have to be started in terms of + OTP applications but can be plain Erlang).

+

Read more about .rel files in OTP Design Principles and + rel(4).

+

The binary boot script file Name.boot is generated from + the boot script file Name.script using the function + systools:script2boot(File).

+
+
+ +
+ + Code Loading Strategy +

The runtime system can be started in either embedded or + interactive mode. Which one is decided by the command + line flag -mode.

+
+% erl -mode embedded
+

Default mode is interactive.

+ + In embedded mode, all code is loaded during system start-up + according to the boot script. (Code can also be loaded later + by explicitly ordering the code server to do so). + In interactive mode, code is dynamically loaded when first + referenced. When a call to a function in a module is made, and + the module is not loaded, the code server searches the code path + and loads the module into the system. + +

Initially, the code path consists of the current + working directory and all object code directories under + ROOT/lib, where ROOT is the installation directory + of Erlang/OTP. Directories can be named Name[-Vsn] and + the code server, by default, chooses the directory with + the highest version number among those which have the same + Name. The -Vsn suffix is optional. If an + ebin directory exists under the Name[-Vsn] + directory, it is this directory which is added to the code path.

+

The code path can be extended by using the command line flags + -pa Directories and -pz Directories. These will add + Directories to the head or end of the code path, + respectively. Example

+
+% erl -pa /home/arne/mycode
+

The code server module code contains a number of + functions for modifying and checking the search path, see + code(3).

+
+ +
+ File Types +

The following file types are defined in Erlang/OTP:

+ + + File Type + File Name/Extension + Documented in + + + module + .erl + Erlang Reference Manual + + + include file + .hrl + Erlang Reference Manual + + + release resource file + .rel + rel(4) + + + application resource file + .app + app(4) + + + boot script + .script + script(4) + + + binary boot script + .boot + - + + + configuration file + .config + config(4) + + + application upgrade file + .appup + appup(4) + + + release upgrade file + relup + relup(4) + + File Types +
+
+
+ diff --git a/system/doc/system_principles/warning.gif b/system/doc/system_principles/warning.gif new file mode 100644 index 0000000000..96af52360e Binary files /dev/null and b/system/doc/system_principles/warning.gif differ diff --git a/system/doc/system_principles/xmlfiles.mk b/system/doc/system_principles/xmlfiles.mk new file mode 100644 index 0000000000..4cbc00ed52 --- /dev/null +++ b/system/doc/system_principles/xmlfiles.mk @@ -0,0 +1,22 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +SYSTEM_PRINCIPLES_CHAPTER_FILES = \ + system_principles.xml \ + error_logging.xml \ + create_target.xml diff --git a/system/doc/top/Makefile b/system/doc/top/Makefile new file mode 100644 index 0000000000..08fe265336 --- /dev/null +++ b/system/doc/top/Makefile @@ -0,0 +1,242 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 1999-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include $(ERL_TOP)/erts/vsn.mk + +APPLICATION=otp-system-documentation + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/doc + +GIF_FILES = + +INFO_FILES = ../../README ../../COPYRIGHT PR.template + +TOPDOCDIR=. + +TOP_HTML_GEN_FILES = \ + $(HTMLDIR)/incompatible.html \ + $(HTMLDIR)/highlights.html + +TOP_HTML_FILES = \ + $(TOP_HTML_GEN_FILES) + +include ../installation_guide/xmlfiles.mk +include ../system_principles/xmlfiles.mk +include ../embedded/xmlfiles.mk +include ../getting_started/xmlfiles.mk +include ../reference_manual/xmlfiles.mk +include ../programming_examples/xmlfiles.mk +include ../efficiency_guide/xmlfiles.mk +include ../tutorial/xmlfiles.mk +include ../design_principles/xmlfiles.mk +include ../oam/xmlfiles.mk + +XML_FILES = \ + $(INST_GUIDE_CHAPTER_FILES:%=../installation_guide/%) \ + $(SYSTEM_PRINCIPLES_CHAPTER_FILES:%=../system_principles/%) \ + $(EMBEDDED_CHAPTER_FILES:%=../embedded/%) \ + $(GETTING_STARTED_CHAPTER_FILES:%=../getting_started/%) \ + $(REF_MAN_CHAPTER_FILES:%=../reference_manual/%) \ + $(PROG_EX_CHAPTER_FILES:%=../programming_examples/%) \ + $(EFF_GUIDE_CHAPTER_FILES:%=../efficiency_guide/%) \ + $(TUTORIAL_CHAPTER_FILES:%=../tutorial/%) \ + $(DESIGN_PRINCIPLES_CHAPTER_FILES:%=../design_principles/%) \ + $(OAM_CHAPTER_FILES:%=../oam/%) \ + ../installation_guide/part.xml \ + ../system_principles/part.xml \ + ../embedded/part.xml \ + ../getting_started/part.xml \ + ../reference_manual/part.xml \ + ../programming_examples/part.xml \ + ../efficiency_guide/part.xml \ + ../tutorial/part.xml \ + ../design_principles/part.xml \ + ../oam/part.xml + +BOOK_FILES = book.xml + +HTMLDIR= ../html +PDFREFDIR= pdf + +TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf +TOPDOC=true + +#-------------------------------------------------------------------------- +# We generate the index page from the installed system. This make +# it important that this is done last. The file index.html.src +# is used as a template for the resulting page. + +EBIN = ebin + +INDEX_SCRIPT = $(EBIN)/erl_html_tools.$(EMULATOR) +INDEX_SRC = src/erl_html_tools.erl +INDEX_FILES = \ + $(HTMLDIR)/index.html \ + $(HTMLDIR)/applications.html + +JAVASCRIPT = $(HTMLDIR)/js/erlresolvelinks.js +JAVASCRIPT_BUILD_SCRIPT = $(EBIN)/erlresolvelinks.$(EMULATOR) +JAVASCRIPT_BUILD_SCRIPT_SRC = src/erlresolvelinks.erl + +MAN_INDEX_SCRIPT = $(ERL_TOP)/system/doc/top/bin/otp_man_index +MAN_INDEX = $(HTMLDIR)/man_index.html + +GLOSSARY = $(HTMLDIR)/glossary.html +GLOSSARY_SRC = $(ERL_TOP)/system/internal_tools/doctools/src/glossary.erl +GLOSSARY_SCRIPT = $(EBIN)/glossary.$(EMULATOR) + +#-------------------------------------------------------------------------- + +$(INDEX_SCRIPT): $(INDEX_SRC) + $(ERLC) -o$(EBIN) +warn_unused_vars $< + +# We don't list toc_*.html as targets because we don't know +$(HTMLDIR)/index.html: $(INDEX_SCRIPT) +ifneq ($(INSTALLROOT),) + echo "Generating index $@" + $(ERL) -noshell -pa $(EBIN) -s erl_html_tools top_index $(INSTALLROOT) \ + $(HTMLDIR) $(SYSTEM_VSN) -s erlang halt +else + @echo "INSTALLROOT unset, no indexes built." +endif + +#-------------------------------------------------------------------------- + +$(JAVASCRIPT_BUILD_SCRIPT): $(JAVASCRIPT_BUILD_SCRIPT_SRC) + $(ERLC) -o$(EBIN) +warn_unused_vars $< + +$(JAVASCRIPT): $(JAVASCRIPT_BUILD_SCRIPT) +ifneq ($(INSTALLROOT),) + echo "Generating javascript for resolving HTML links" + erl -noshell -pa $(EBIN) -s erlresolvelinks make $(INSTALLROOT) \ + . -s erlang halt + mkdir $(HTMLDIR)/js + mv erlresolvelinks.js $(JAVASCRIPT) # not portable !!! +else + @echo "INSTALLROOT unset, no javascript generated." +endif + +#-------------------------------------------------------------------------- + +$(MAN_INDEX): $(MAN_INDEX_SCRIPT) +ifneq ($(INSTALLROOT),) + echo "Generating index $@" + (cd $(INSTALLROOT); perl $< ) > $@ +else + @echo "INSTALLROOT unset, no manual index built." +endif +#-------------------------------------------------------------------------- + +$(HTMLDIR)/highlights.html: highlights.xml + date=`date +"%B %e %Y"`; \ + $(XSLTPROC) --output $(@) --stringparam docgen "$(DOCGEN)" --stringparam topdocdir "$(TOPDOCDIR)" \ + --stringparam pdfdir "$(PDFREFDIR)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" \ + --stringparam appver "$(VSN)" -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_html_entities \ + $(DOCGEN)/priv/xsl/db_html.xsl $< + + +$(HTMLDIR)/incompatible.html: incompatible.xml + date=`date +"%B %e %Y"`; \ + $(XSLTPROC) --output $(@) --stringparam docgen "$(DOCGEN)" --stringparam topdocdir "$(TOPDOCDIR)" \ + --stringparam pdfdir "$(PDFREFDIR)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" \ + --stringparam appver "$(VSN)" -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_html_entities \ + $(DOCGEN)/priv/xsl/db_html.xsl $< + +#-------------------------------------------------------------------------- + +$(GLOSSARY_SCRIPT): $(GLOSSARY_SRC) + $(ERLC) -o$(EBIN) $(GLOSSARY_SRC) + +$(GLOSSARY): $(GLOSSARY_SCRIPT) + $(ERL) -noshell -pa $(EBIN) \ + -s glossary make ../definitions/term.defs -s erlang halt > \ + $(GLOSSARY) + +#-------------------------------------------------------------------------- + +PR.template: PR.template.src $(ERL_TOP)/erts/vsn.mk + sed -e 's;%VSN%;$(VSN);' \ + -e 's;%SYSTEM_VSN%;$(SYSTEM_VSN);' \ + $< > $@ + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAGS += +DVIPS_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + + +docs: pdf html $(INFO_FILES) + +local_docs: PDFREFDIR=../pdf + +$(TOP_PDF_FILE): $(XML_FILES) + +pdf: $(TOP_PDF_FILE) + +html: $(INDEX_FILES) $(TOP_HTML_FILES) \ + $(MAN_INDEX) $(JAVASCRIPT) + +debug opt: + +clean: + rm -rf ../html/js + rm -f PR.template + rm -f $(INDEX_FILES) $(TOP_HTML_FILES) $(MAN_INDEX) + rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f $(INDEX_SCRIPT) $(GLOSSARY_SCRIPT) \ + $(JAVASCRIPT_BUILD_SCRIPT) + rm -f erl_crash.dump errs core *~ + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + + +release_docs_spec: docs + $(INSTALL_DIR) $(RELEASE_PATH) + $(INSTALL_DATA) $(INFO_FILES) $(RELEASE_PATH) + $(INSTALL_DIR) $(RELSYSDIR) + $(INSTALL_DIR) $(RELSYSDIR)/pdf + $(INSTALL_DATA) \ + $(TOP_PDF_FILE) $(RELSYSDIR)/pdf +#$(TOP_HTML_FILES) +ifneq ($(INSTALLROOT),) + $(INSTALL_DATA) $(INDEX_FILES) $(MAN_INDEX) $(TOP_HTML_FILES) $(RELSYSDIR) + $(INSTALL_DIR) $(RELSYSDIR)/js + $(INSTALL_DATA) \ + $(JAVASCRIPT) $(RELSYSDIR)/js +endif + + +release_spec: diff --git a/system/doc/top/PR.template.src b/system/doc/top/PR.template.src new file mode 100644 index 0000000000..fb593053d9 --- /dev/null +++ b/system/doc/top/PR.template.src @@ -0,0 +1,20 @@ +>Submitter-Id: +>Originator: +>Organization: +>Confidential: <[yes | no ] (one line)> +>Synopsis: +>Severity: < [non-critical | serious | critical ] (one line)> +>Priority: < [ low | medium | high ] (one line)> +>Category: +>Class: < [ sw-bug | doc-bug | change-request | support ] (one line)> +>Release: +>Environment: + +>Description: + +>How-To-Repeat: + Fix: + + diff --git a/system/doc/top/bin/otp_man_index b/system/doc/top/bin/otp_man_index new file mode 120000 index 0000000000..bb913b25df --- /dev/null +++ b/system/doc/top/bin/otp_man_index @@ -0,0 +1 @@ +../../../../internal_tools/integration/scripts/otp_man_index \ No newline at end of file diff --git a/system/doc/top/book.xml b/system/doc/top/book.xml new file mode 100644 index 0000000000..96f39b0b83 --- /dev/null +++ b/system/doc/top/book.xml @@ -0,0 +1,52 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Erlang/OTP System Documentation + OTP Team + + 2009-08-21 + A + book.xml +
+ + + + + + + + + + + + + + + + + + + + +
+ diff --git a/system/doc/top/ebin/.gitignore b/system/doc/top/ebin/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/system/doc/top/highlights.xml b/system/doc/top/highlights.xml new file mode 100644 index 0000000000..a30742aed6 --- /dev/null +++ b/system/doc/top/highlights.xml @@ -0,0 +1,238 @@ + + + + +
+ + 20062009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Highlights + + + + A + highlights.xml +
+

This document lists some highlights of Erlang 5.7/OTP R13A + (unpatched), compared to the previous version Erlang 5.6/OTP R12B, + with focus on things not already released as R12B patches.

+

Note: This document was compiled at the time when R13A was released + and does not list any features introduced in R13 patches.

+ +
+ Erlang Language and Run-time System +
+ Multi-core and SMP performance improvements +

+ There SMP performance is significantly improved and will + allow most applications to scale much better on systems with many + cores or processors. Listed below are some of the most important improvements: +

+ + +

+ The runtime system with SMP support now uses multiple, + scheduler specific run queues, instead of one globally shared + run queue. +

+

+ The lock protecting the shared run queue was heavily + contended, and the shared run queue also caused Erlang + processes to randomly migrate between schedulers with + negative cache effects as a result. +

+

+ With the current scheduler specific run queue solution, lock + contention due to run queue protection has been reduced, and + Erlang processes are only migrated when needed to balance the + load between the schedulers. The reduced amount of migration + also reduce lock contention on locks protecting the scheduler + specific instances of the erts internal memory allocators. +

+

+ The scheduler specific run queues are also a necessity for a + lot of future planned NUMA (Non-Uniform Memory Access) + specific optimizations. +

+
+ +

+ Message passing has been further optimized for parallell execution. + This makes parallell sending to one common receiver much more efficient. +

+
+ +

+ Scheduler threads can now be bound to logical processors on newer + Linux ans Solaris systems. +

+
+
+
+
+ Unicode support +

+ Support for Unicode is implemented as described in EEP10. + Formatting and reading of unicode data both from terminals + and files is supported by the io and io_lib modules. + Files + can be opened in modes with automatic translation to and from + different unicode formats. The module 'unicode' contains + functions for conversion between external and internal + unicode formats and the re module has support for unicode + data. There is also language syntax for specifying string and + character data beyond the ISO-latin-1 range. +

+
+ +
+ New BIF's +

+ The BIFs atom_to_binary/2, binary_to_atom/2 and + binary_to_existing_atom/2 have been added. +

+
+ +
+ Independent Erlang clusters on the same host +

+ Nodes belonging to different independent clusters can now + co-exist on the same host with the help of a new + environment variable setting ERL_EPMD_PORT. + The environment variable is used by Erl_interface and J_interface + as well. +

+
+
+ +
+ New Applications + +
+ Reltool + +

+ Reltool is a release management tool. + It analyses a given Erlang/OTP installation and determines + various dependencies between applications. + The graphical frontend depicts the dependencies and enables + interactive customization of a target system. + The backend provides a batch interface for generation of + customized target systems. + The application is still somewhat limited and should be regarded + as experimental in this release. The intention is that this + application will be a valuable tool for making both traditional + Erlang target systems as well as standalone components in Erlang. +

+
+ +
+ WxErlang +

+ wxErlang is an Erlang binding to the WxWidgets GUI library which + provides support for cross platform GUI applications. + wxErlang is still in beta status and the intention is that it shall + replace GS in a later stage. The Erlang debugger is also shipped in + a wxErlang version. +

+
+ + +
+ +
+ New features in Existing Applications + +
+ Common_test + +

+ A support client module for SSH and SFTP, ct_ssh, has + been introduced. +

+

+ Test case groups have been introduced. With this feature + it's possible to execute groups (possibly nested) + of test cases. +

+

+ A group definition contains a name tag, a list of + properties and a list of test cases (including possible + nested group definitions). The properties make it possible + to execute test cases in parallel, in sequence and in + shuffled order. It is also possible to repeat test cases + according to different criteria. +

+
+ + +
+ Dialyzer +

+ The analysis now accepts opaque type declarations and + detects + violations of opaqueness of terms of such types. Starting + with R13, many Erlang/OTP standard libraries (array, dict, + digraph, ets, gb_sets, gb_trees, queue, and sets) contain + opaque type declarations of their main data types. Dialyzer + will spit out warnings in code that explicitly depends on the + structure of these terms. +

+

+ Added support for handling UTF segments in bitstreams and for + detecting obvious type errors in these segments. Warning: + This code is not terribly tested though since there are very + few Erlang programs which use Unicode-based binaries - not + surprising since this is a new language feature of R13. +

+

+ Strengthened the discrepancy identification when testing for + equality and matching between terms of different types. This + detects more bugs in code. +

+

+ See the Dialyzer documentation and release notes for even more + enhancements. +

+
+ +
+ SSL +

+ The "new_ssl" implementation is significantly improved and should be + near product status now. + The new SSL is implemented in pure Erlang except for + the crypto routines that are implemented in the crypto driver which + is an interface to libcrypto from OpenSSL. +

+
+ +
+ STDLIB + +

The Erlang scanner has been augmented as to return white-space, + comments and exact location of tokens. + This means that the scanner can easily be used in tools such as editors, + pretty printers, syntax highlighters etc. + where it is important to be able recreate the original source document. +

+
+ +
+
+ diff --git a/system/doc/top/incompatible.xml b/system/doc/top/incompatible.xml new file mode 100644 index 0000000000..ce9522725b --- /dev/null +++ b/system/doc/top/incompatible.xml @@ -0,0 +1,383 @@ + + + + +
+ + 20062009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Potential Incompatibilities + + + + + incompatible.xml +
+

This document contains a list of potential incompatibilities + between Erlang 5.7/OTP R12A and Erl 5.6.5/OTP R12B-5, + and is an extract from the release notes for the respective applications.

+ +
+ compiler + + +

+ The undocumented, unsupported, and deprecated guard BIF + is_constant/1 has been removed.

+

+ *** INCOMPATIBILITY with R12B ***

+

+ Own Id: OTP-7673

+
+ +

The short-circuit operators andalso and + orelse no longer guarantees that their second + argument is either true or false. As a + consequence, andalso/orelse are now + tail-recursive.

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7748

+
+ +

The compiler will refuse to a compile file where the + module name in the file differs from the output file + name.

+

When compiling using erlc, the current working + directory will no be included in the code path (unless + explicitly added using "-pa .").

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7793

+
+ +

If a module contains an exported function with the + same name as an auto-imported BIF (such as + length/1), any calls to the BIF must have an + explicit erlang: prefix, or there will be a + compilation error (such calls would only generate a + warning in previous releases).

+

(The reason for the change is to avoid breaking code + in a future major release, R14 or R15, in which we plan + to make calls without a module prefix always call the + local function in the same module even if there is an + auto-imported BIF with the same name.)

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7873

+
+
+
+ +
+ Erts + + +

Support for Unicode is implemented as described in + EEP10. Formatting and reading of unicode data both from + terminals and files is supported by the io and io_lib + modules. Files can be opened in modes with automatic + translation to and from different unicode formats. The + module 'unicode' contains functions for conversion + between external and internal unicode formats and the re + module has support for unicode data. There is also + language syntax for specifying string and character data + beyond the ISO-latin-1 range.

+

The interactive shell will support input and output of + unicode characters when the terminal and operating system + supports it.

+

Please see the EEP and the io/io_lib manual pages as + well as the stdlib users guide for details.

+

I/O-protocol incompatibilities:

+

The io_protocol between io_Server and client is + updated to handle protocol data in unicode formats. The + updated protocol is now documented. The specification + resides in the stdlib users manual, which is a + new part of the manual.

+

io module incompatibilities:

+

The io:put_chars, io:get_chars and io:get_line all + handle and return unicode data. In the case where + binaries can be provided (as to io:put_chars), they shall + be encoded in UTF-8. When binaries are returned (as by + io:get_line/get_chars when the io_server is set in + binary mode) the returned data is also + always encoded as UTF-8. The file module however + still returns byte-oriented data, why file:read can be + used instead of io:get_chars to read binary data in + ISO-latin-1.

+

io_lib module incompatibilities:

+

io_lib:format can, given new format directives (i.e + "~ts" and "~tc"), return lists containing integers larger + than 255.

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7648 Aux Id: OTP-7580 OTP-7514 OTP-7494 + OTP-7443 OTP-7181 EEP10 EEP11

+
+ +

+ The undocumented, unsupported, and deprecated guard BIF + is_constant/1 has been removed.

+

+ *** INCOMPATIBILITY with R12B ***

+

+ Own Id: OTP-7673

+
+ +

The short-circuit operators andalso and + orelse no longer guarantees that their second + argument is either true or false. As a + consequence, andalso/orelse are now + tail-recursive.

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7748

+
+ +

The compiler will refuse to a compile file where the + module name in the file differs from the output file + name.

+

When compiling using erlc, the current working + directory will no be included in the code path (unless + explicitly added using "-pa .").

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7793

+
+ +

The deprecated functions erlang:fault/1, + erlang:fault/2, and file:rawopen/2 have + been removed.

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7812

+
+ +

The escape sequences \x and \{ have been + assigned new interpretations (they used to return the + ASCII code for x and { respectively). One + or more octal characters inside curly brackets after a + leading backslash is from now on an alternative to the + existing syntax \NNN, but can also be used for + codes greater than 255. In a similar fashion, one or more + hexadecimal characters can be put inside curly brackets + after a leading \x. Furthermore, the escape + sequences \xH and \xHH, where N is a + hexadecimal character, can be used for codes less than + 256.

+

NOTE: These new escape sequences are still considered + experimental and may be changed in the R13B release.

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7855

+
+
+
+ +
+ Inets + + +

+ [httpc] - The inets http client will now use persistent + connections without pipelining as default and if a + pipeline timeout is set it will pipeline the requests on + the persistent connections.

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7463

+
+
+
+ +
+ Jinterface + + +

+ A number of fixes and improvements from the ErlIDE group; + Vlad Dumitrescu and Jakob Cederlund: JDK 1.5 is now a + minimal requirement for building Jinterface. New method: + OtpEpmd.lookupNames. OtpErlangList is now iterable. + Non-proper lists are now allowed - you have to test if a + list is proper or not. Non-proper lists can also be + created. New methods: isProper, getHead, getTail and + getNthTail. The get tail methods creates a sublist object + that re-uses the original list. OtpErlangPid is now + Comparable. Empty atoms can now be constructed, a missing + feature pointed out by Sebastien Boisgerault on + erlang-questions.

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7832

+
+
+
+ +
+ Kernel + + +

The deprecated functions erlang:fault/1, + erlang:fault/2, and file:rawopen/2 have + been removed.

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7812

+
+
+
+ +
+ SSH + + +

+ Ssh timeouts will now behave as expected i.e. defaults to + infinity. Only the user of the ssh application can know of + a reasonable timeout value for their application.

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7807

+
+ +

+ Added the message {ssh_channel_up, ChannelId, + ConnectionManager} that shall be handled by the channel + callback handle_msg/2. This makes the function + handle_msg/2 a mandatory function for ssh channels + implementations which it was not in ssh-1.1.

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7828

+
+
+
+ +
+ STDLIB + + +

The functions lists:seq/1,2 return the empty + list in a few cases when they used to generate an + exception, for example lists:seq(1, 0). See + lists(3) for details. (Thanks to Richard O'Keefe.)

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7230

+
+ +

Support for Unicode is implemented as described in + EEP10. Formatting and reading of unicode data both from + terminals and files is supported by the io and io_lib + modules. Files can be opened in modes with automatic + translation to and from different unicode formats. The + module 'unicode' contains functions for conversion + between external and internal unicode formats and the re + module has support for unicode data. There is also + language syntax for specifying string and character data + beyond the ISO-latin-1 range.

+

The interactive shell will support input and output of + unicode characters when the terminal and operating system + supports it.

+

Please see the EEP and the io/io_lib manual pages as + well as the stdlib users guide for details.

+

I/O-protocol incompatibilities:

+

The io_protocol between io_Server and client is + updated to handle protocol data in unicode formats. The + updated protocol is now documented. The specification + resides in the stdlib users manual, which is a + new part of the manual.

+

io module incompatibilities:

+

The io:put_chars, io:get_chars and io:get_line all + handle and return unicode data. In the case where + binaries can be provided (as to io:put_chars), they shall + be encoded in UTF-8. When binaries are returned (as by + io:get_line/get_chars when the io_server is set in + binary mode) the returned data is also + always encoded as UTF-8. The file module however + still returns byte-oriented data, why file:read can be + used instead of io:get_chars to read binary data in + ISO-latin-1.

+

io_lib module incompatibilities:

+

io_lib:format can, given new format directives (i.e + "~ts" and "~tc"), return lists containing integers larger + than 255.

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7648 Aux Id: OTP-7580 OTP-7514 OTP-7494 + OTP-7443 OTP-7181 EEP10 EEP11

+
+ +

+ filelib:fold_files/5 now uses the re module + instead of the regexp module for regular + expression matching. In practice, this change will not be + a problem for most regular expressions used for + filelib:fold_files/5. (The major difference in + regular expression is that parenthesis and curly brackets + is treated as literal characters by regexp but as + special characters by re; fortunately, those + characters are rarely used in filenames.)

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7819

+
+ +

+ digraph:new(Type) will now cause a badarg + exception if Type is not a valid type. Similarly, + digraph_utils:subgraph/2,3 will now cause a + badarg if the arguments are invalid. (Those + functions used to return error tuples if something was + wrong.)

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7824

+
+ +

The argument passed to random:uniform/1 must + now be an integer (as stated in the documentation). In + previous releases, a floating point number was also + allowed.

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7827

+
+
+
+
+ diff --git a/system/doc/top/print.html b/system/doc/top/print.html new file mode 100644 index 0000000000..b562d0e9bc --- /dev/null +++ b/system/doc/top/print.html @@ -0,0 +1,55 @@ + + + + + Erlang/OTP Documentation for Printing + + + + + + +
+ + Ericsson AB + +
+ + + [Up | + Ericsson AB] + +
+ +

+Documentation for Printing
+

+
+ +

+ +You can get this documentation preformated for printing in PDF +format from the + + Erlang/OTP documentation page +. Here you can find links to documentation for the latest release as well as for older releases. + + +

+

+
+ + Copyright © 1991-2008 + Ericsson AB + +
+ + diff --git a/system/doc/top/src/erl_html_tools.erl b/system/doc/top/src/erl_html_tools.erl new file mode 120000 index 0000000000..35a199b08d --- /dev/null +++ b/system/doc/top/src/erl_html_tools.erl @@ -0,0 +1 @@ +../../../../internal_tools/integration/scripts/make_index/erl_html_tools.erl \ No newline at end of file diff --git a/system/doc/top/src/erlresolvelinks.erl b/system/doc/top/src/erlresolvelinks.erl new file mode 120000 index 0000000000..8d277ad17a --- /dev/null +++ b/system/doc/top/src/erlresolvelinks.erl @@ -0,0 +1 @@ +../../../../internal_tools/integration/scripts/resolve_links/erlresolvelinks.erl \ No newline at end of file diff --git a/system/doc/top/src/permuted_index.erl b/system/doc/top/src/permuted_index.erl new file mode 120000 index 0000000000..e65338a517 --- /dev/null +++ b/system/doc/top/src/permuted_index.erl @@ -0,0 +1 @@ +../../../../internal_tools/integration/scripts/make_index/permuted_index.erl \ No newline at end of file diff --git a/system/doc/top/templates/applications.html.src b/system/doc/top/templates/applications.html.src new file mode 100644 index 0000000000..0251d39b28 --- /dev/null +++ b/system/doc/top/templates/applications.html.src @@ -0,0 +1,34 @@ + + + + Erlang/OTP #version# + + + + +
+#groups# +
+ + diff --git a/system/doc/top/templates/erlang.gif b/system/doc/top/templates/erlang.gif new file mode 100644 index 0000000000..91fd4b9647 Binary files /dev/null and b/system/doc/top/templates/erlang.gif differ diff --git a/system/doc/top/templates/first.html.src b/system/doc/top/templates/first.html.src new file mode 100644 index 0000000000..edef1c0e5c --- /dev/null +++ b/system/doc/top/templates/first.html.src @@ -0,0 +1,104 @@ + + + + Erlang/OTP #release# Documentation + + + +
+

+Welcome to Erlang/OTP, a complete
+development environment
+for concurrent programming.
+

+
+
+
+
+

+ +Some hints that may get you started faster + +

+ +
    + +
  • In addition the the documentation here Erlang is described in the book +"Programming Erlang", ISBN 978-1-934356-00-5 which we really recommend as a start.
    +The complete language is also described in the Erlang Reference Manual. An Erlang tutorial can be found in Getting Started With Erlang. +
  • +
  • Erlang/OTP is divided into a number of OTP applications. An application normally contains +Erlang modules. Some OTP applications, +such as the C interface Erl_Interface, are written in other languages and have no Erlang +modules. + +

    +Note that functions that are not imported or prefixed with a module +name belong to the module +erlang +(in the Kernel application). +

    +

    +

  • On a Unix system you can view the manual pages from the command +line using +
    +    % erl -man <module>
    +
    +

    + +

  • You can of course use any editor you like to write Erlang +programs, but if you use Emacs there exists editing support such as +indentation, syntax highlighting, electric commands, module name +verification, comment support including paragraph filling, skeletons, +tags support and more. See the Tools application for details. +

    +There is also an + +Erlang plugin (ErlIde) for Eclipse if you prefer a more graphical +environment. ErlIde is under development and should at the time +of writing this be quite stable and useful. +

  • When developing with Erlang/OTP you usually test your programs +from the interactive shell (see Getting Started With Erlang) where you can call individual +functions. There is also a number of tools available, such as the graphical Debugger, the process +manager Pman and table +viewer TV. +

    Also note that there are some shell features like history list +(control-p and control-n), inline editing (emacs key bindings) and +module and function name completion (tab) if the module is loaded. +

    + +

  • OpenSource users can ask questions +and share experiences on the Erlang questions mailing list.

    + +

  • Before asking a question you can browse the mailing list archive and read the Frequently +Asked Questions.

    + +

  • Additional information and links of interest for Erlang programmers can be found on the Erlang Open Source site +http://www.erlang.org. +

    + +

+ + + diff --git a/system/doc/top/templates/flip_closed.gif b/system/doc/top/templates/flip_closed.gif new file mode 100755 index 0000000000..9a27c7c25d Binary files /dev/null and b/system/doc/top/templates/flip_closed.gif differ diff --git a/system/doc/top/templates/flip_google.gif b/system/doc/top/templates/flip_google.gif new file mode 100755 index 0000000000..3f0543c2bb Binary files /dev/null and b/system/doc/top/templates/flip_google.gif differ diff --git a/system/doc/top/templates/flip_open.gif b/system/doc/top/templates/flip_open.gif new file mode 100755 index 0000000000..9dda60e73a Binary files /dev/null and b/system/doc/top/templates/flip_open.gif differ diff --git a/system/doc/top/templates/flip_static.gif b/system/doc/top/templates/flip_static.gif new file mode 100755 index 0000000000..2b3ddb5382 Binary files /dev/null and b/system/doc/top/templates/flip_static.gif differ diff --git a/system/doc/top/templates/flipmenu.js b/system/doc/top/templates/flipmenu.js new file mode 100755 index 0000000000..92a5a58a06 --- /dev/null +++ b/system/doc/top/templates/flipmenu.js @@ -0,0 +1,342 @@ +// ###################################################################### + +// ## flipMenu 5.0.0 (c) J. Reijers +// ## Last modifications: 23 March 2007 + +// ###################################################################### + +// ## Degree of indentation from the left. + flipIndentation = "5px"; + +// ## Padding inbetween menu items. + flipVerticalPadding = "4px"; + +// ## Margin between the left of the browser and the menu. + flipLeftMargin = "16px"; + +// ## Margin between the top of the browser and the menu. + flipTopMargin = "10px"; + +// ## Allow multiple menus to fold out without closing all the other open ones. + flipOpenMultipleMenus = false; + +// ## Preserve the current state of the menu (requires cookies). + flipSaveMenuState = true; + +// ## Use custom images for bullets + flipImages = true; + +// ## Images to use (specify full path) + flipImg_open = "flip_open.gif"; + flipImg_closed = "flip_closed.gif"; + flipImg_static = "flip_static.gif"; + +// ## Initialise all flipMenus onload + flipInitOnLoad = true; + +// ## Message to display in status bar while loading + flipLoadingMessage = "Loading..."; + +// ###################################################################### + +function alterSize(someSize, alterAmount) { + someSize = String(someSize); + var tmpNr = parseFloat(someSize.replace(/\D/g, "")); + var tmpChar = someSize.replace(/\d/g, ""); + return isNaN(tmpNr) ? someSize : ((tmpNr + alterAmount) + tmpChar); +} + +isIE = (String(navigator.appVersion).indexOf("MSIE") > -1); +if (!isIE) flipIndentation = alterSize(flipIndentation, -16); +if (!isIE) flipLeftMargin = alterSize(flipLeftMargin, -16); + +document.write( + "" +); + +if (flipImages) { + aFlipPreloads = []; + aFlipPreloads[0] = new Image; + aFlipPreloads[0].src = flipImg_open; + aFlipPreloads[1] = new Image; + aFlipPreloads[1].src = flipImg_closed; + aFlipPreloads[2] = new Image; + aFlipPreloads[2].src = flipImg_static; +} + +function addEvent(someObj, someEvent, someFunction) { + if (someObj.addEventListener) { someObj.addEventListener(someEvent, someFunction, true); return true; } else if (someObj.attachEvent) return someObj.attachEvent("on" + someEvent, someFunction); else return false; +} + +function openCloseFlip(theItem, newSetting, openParents) { + if (theItem.flipID) { + if (openParents) { + var tmpItem = theItem; + while (tmpItem.parentElement || tmpItem.parentNode) { + tmpItem = (tmpItem.parentElement) ? tmpItem.parentElement : tmpItem.parentNode; + openCloseFlip(tmpItem, newSetting); + } + } + if ((theItem.className == "flipFolderOpen" && newSetting == "closed") || (theItem.className == "flipFolderClosed" && newSetting == "open")) { + if (!theItem.childrenInitialised) { + for (var j = 0; j < theItem.childNodes.length; j++) if (theItem.childNodes[j].nodeName == "UL" && !theItem.childNodes[j].initialised) initFlip(theItem.childNodes[j]); + theItem.childrenInitialised = true; + } + theItem.getElementsByTagName("UL")[0].style.display = (newSetting == "open") ? "" : "none"; + theItem.className = newSetting == "open" ? "flipFolderOpen" : "flipFolderClosed"; + } + } +} + +function openFlip(theItem, openParents) { + openCloseFlip(theItem, "open", openParents); +} + +function closeFlip(theItem, closeParents) { + openCloseFlip(theItem, "closed", closeParents); +} + +function toggleFlip(theElement) { + if (theElement.flipID) { + var theItem = theElement; + var isContained = true; + } else { + if (theElement && theElement.button > 0) return false; + var theItem = (isIE) ? event.srcElement : theElement.target; + + var isContained = false; + if (theItem.className == "flipFolderOpen" || theItem.className == "flipFolderClosed") isContained = true; else while (theItem.parentElement || theItem.parentNode) { + if (theItem.className == "flipStatic" || theItem.className == "flipFolderOpen" || theItem.className == "flipFolderClosed") { + isContained = (theItem.className == "flipFolderOpen" || theItem.className == "flipFolderClosed"); + break; + } + theItem = (theItem.parentElement) ? theItem.parentElement : theItem.parentNode; + } + } + + var toOpenFlip = (isContained && theItem.className == "flipFolderClosed"); + + if (!flipOpenMultipleMenus && (toOpenFlip || theItem.className == "flipStatic")) { + if (theItem.parentElement || theItem.parentNode) { + var parentUL = (theItem.parentElement) ? theItem.parentElement : theItem.parentNode; + for (var i = 0; i < parentUL.childNodes.length; i++) closeFlip(parentUL.childNodes[i]); + } + } + + if (isContained) { + if (toOpenFlip) openFlip(theItem); else closeFlip(theItem); + } +} + +function setAllFlips(startElement, newSetting) { + if (typeof startElement == "undefined") var startElement = document; + if (typeof newSetting == "undefined") var newSetting = "closed"; + + var aUL = startElement.getElementsByTagName("UL"); + for (var i = 0; i < aUL.length; i++) { + var parentFlip = aUL[i].parentElement ? aUL[i].parentElement : aUL[i].parentNode; + openCloseFlip(parentFlip, newSetting); + } +} + +function openAllFlips(startElement) { + setAllFlips(startElement, "open"); +} + +function closeAllFlips(startElement) { + setAllFlips(startElement, "closed"); +} + +function initFlip(startElement) { + if (!document.createElement) return false; + + if (!startElement || !startElement.nodeName) { + var aUL = document.getElementsByTagName("UL"); + for (var i = 0; i < aUL.length; i++) { + if (flipLoadingMessage != "") window.status = flipLoadingMessage + " " + parseInt((i / (aUL.length - 1)) * 100, 10) + "%"; + var curUL = aUL[i]; + if (curUL.className == "flipMenu") { + initFlip(curUL); + + // ## Fix text selecting problem in Mozilla + curUL.onselectstart = new Function("return false"); + curUL.onmousedown = new Function("return false"); + curUL.onclick = new Function("return true"); + } + } + + if (flipSaveMenuState) loadMenuState(); + + if (flipLoadingMessage != "") window.status = ""; + return true; + } + + if (startElement.className == "flipMenu") startElement.style.display = ""; + + if (!startElement.childNodes || startElement.childNodes.length == 0) return false; + + if (typeof flipIDCur == "undefined") flipIDCur = 0; + if (!startElement.initialised) { + var aUL = startElement.getElementsByTagName("UL"); + for (var i = 0; i < aUL.length; i++) aUL[i].style.display = "none"; + } + + for (var i = 0; i < startElement.childNodes.length; i++) { + var curNode = startElement.childNodes[i]; + if (curNode.nodeName == "LI") { + flipIDCur++; + curNode.flipID = flipIDCur; + + var nodeHasChildren = curNode.getElementsByTagName("UL").length > 0; + if (nodeHasChildren) { + if (flipImages && curNode.flipClosed) curNode.style.listStyleImage = "url(" + curNode.flipClosed + ")"; + + if (curNode.className == null || curNode.className == "") curNode.className = "flipFolderClosed"; + } else { + curNode.className = "flipStatic"; + if (flipImages && !curNode.style.listStyleImage) { + if (!curNode.flipStatic) curNode.flipStatic = flipImg_static; + curNode.style.listStyleImage = "url(" + curNode.flipStatic + ")"; + } + } + + if (!curNode.flipOpen) curNode.flipOpen = flipImg_open; + if (!curNode.flipClosed) curNode.flipClosed = flipImg_closed; + + if (curNode.flipIsOpen) openFlip(curNode); + } + } + + startElement.initialised = true; +} + +function rootOfFlip(flipID, startElement) { + + function containsFlip(startElement, flipID) { + var flipFound = false; + var i = 0; + while (i < startElement.childNodes.length && !flipFound) { + var curNode = startElement.childNodes[i]; + flipFound = (curNode.flipID == flipID) ? true : containsFlip(curNode, flipID); + i++; + } + return flipFound; + } + + var rootFlip = null; + + if (!startElement || !startElement.nodeName) { + var aUL = document.getElementsByTagName("UL"); + var i = 0; + while (rootFlip == null && i < aUL.length) { + var curUL = aUL[i]; + if (curUL.nodeName == "UL" && curUL.className == "flipMenu") rootFlip = rootOfFlip(flipID, curUL); + i++; + } + return rootFlip; + } + + if (startElement.childNodes) for (var i = 0; i < startElement.childNodes.length; i++) { + var curNode = startElement.childNodes[i]; + if (curNode.flipID == flipID || containsFlip(curNode, flipID)) rootFlip = curNode; + } + + return rootFlip; +} + +function getCookie(cookieName) { + var allCookies = document.cookie; + var indexStr = allCookies.indexOf(cookieName + "="); + if (indexStr == -1) return ""; + indexStr = allCookies.indexOf("=", indexStr) + 1; + var endStr = allCookies.indexOf(";", indexStr); + if (endStr == -1) endStr = allCookies.length; + return unescape(allCookies.substring(indexStr, endStr)); +} + +function inArray(someID, someArray) { + for (var i = 0; i < someArray.length; i++) if (someArray[i] == someID) return true; + return false; +} + +function getMenuState(startElement) { + if (!startElement.childNodes || startElement.childNodes.length == 0) return ""; + + var openItems = ""; + var aUL = startElement.getElementsByTagName("UL"); + for (var i = 0; i < aUL.length; i++) { + var curNode = aUL[i]; + var parentFlip = (curNode.parentElement) ? curNode.parentElement : curNode.parentNode; + if (curNode.style.display == "" && parentFlip.flipID) openItems += " " + parentFlip.flipID; + } + return openItems; +} + +function putMenuState(startElement) { + if (!startElement.childNodes || startElement.childNodes.length == 0) return false; + + var aUL = startElement.getElementsByTagName("UL"); + for (var i = 0; i < aUL.length; i++) { + var curNode = aUL[i]; + var parentFlip = (curNode.parentElement) ? curNode.parentElement : curNode.parentNode; + if (inArray(parentFlip.flipID, aOpenItems)) { + openFlip(parentFlip); + if (typeof prevFlipRoot == "undefined") { + var testRoot = rootOfFlip(parentFlip.flipID); + if (testRoot.flipID == parentFlip.flipID) prevFlipRoot = testRoot; + } + } + } +} + +function saveMenuState() { + if (flipSaveMenuState) { + var aUL = document.getElementsByTagName("UL"); + for (var i = 0; i < aUL.length; i++) { + var curUL = aUL[i]; + var curID = curUL.id ? curUL.id : i; + if (curUL.className == "flipMenu") document.cookie = cookiePrefix + curID + "=" + getMenuState(curUL) + ";"; + } + } +} + +function loadMenuState() { + var aUL = document.getElementsByTagName("UL"); + for (var i = 0; i < aUL.length; i++) { + var curUL = aUL[i]; + var curID = curUL.id ? curUL.id : i; + if (curUL.className == "flipMenu") { + var savedState = String(getCookie(cookiePrefix + curID)); + if (savedState != "") { + aOpenItems = savedState.split(" "); + putMenuState(curUL); + } + } + } + + addEvent(window, "unload", saveMenuState); +} + +function clearMenuState(flipMenuID) { + if (typeof flipMenuID == "undefined") { + var aUL = document.getElementsByTagName("UL"); + for (var i = 0; i < aUL.length; i++) { + var curUL = aUL[i]; + var curID = curUL.id ? curUL.id : i; + if (curUL.className == "flipMenu") document.cookie = cookiePrefix + curID + "=;"; + } + } else document.cookie = cookiePrefix + flipMenuID + "=;"; +} + +cookiePrefix = document.location.pathname + "_"; + +addEvent(document, "click", toggleFlip); +if (flipInitOnLoad) addEvent(window, "load", initFlip); diff --git a/system/doc/top/templates/index.html.src b/system/doc/top/templates/index.html.src new file mode 100644 index 0000000000..935bb11c80 --- /dev/null +++ b/system/doc/top/templates/index.html.src @@ -0,0 +1,180 @@ + + + + + + + Erlang/OTP #release# + + + + + + +
+ + + +
+
+
+Erlang/OTP #release#
+
+
+

+Welcome to Erlang/OTP, a complete
+development environment
+for concurrent programming.
+

+
+
+
+
+

+ +Some hints that may get you started faster + +

+ +
    + +
  • +The complete Erlang language is described in the +Erlang Reference Manual. +An Erlang tutorial can be found in + +Getting Started With Erlang. +

    +In addition to the documentation here Erlang is described in several recent books like: +

    + +

    +These books are highly recommended as a start for learning Erlang. +

    +
  • +
  • Erlang/OTP is divided into a number of OTP applications. An application normally contains +Erlang modules. Some OTP applications, +such as the C interface erl_interface, are written in other languages and have no Erlang +modules. + +

    +

  • On a Unix system you can view the manual pages from the command +line using +
    +    % erl -man <module>
    +
    +

    + +

  • You can of course use any editor you like to write Erlang +programs, but if you use Emacs there exists editing support such as +indentation, syntax highlighting, electric commands, module name +verification, comment support including paragraph filling, skeletons, +tags support and more. See the +Tools application for details. +

    +There is also an + +Erlang plugin (ErlIDE) for Eclipse if you prefer a more graphical +environment. ErlIDE is under active development with new features in almost every release. +

  • When developing with Erlang/OTP you usually test your programs +from the interactive shell (see +Getting Started With Erlang) where you can call individual +functions. There is also a number of tools available, such as the graphical Debugger, the process +manager Pman and table +viewer TV. +

    Also note that there are some shell features like history list +(control-p and control-n), in line editing (Emacs key bindings) and +module and function name completion (tab) if the module is loaded. +

    + +

  • OpenSource users can ask questions +and share experiences on the +Erlang questions mailing list.

    + +

  • Before asking a question you can browse the +mailing list archive and read the Frequently +Asked Questions.

    + +

  • Additional information and links of interest for Erlang programmers can be found on the Erlang Open Source site +http://www.erlang.org. +

    + +

+ +
+ +Copyright © 1999-2009 +Ericsson AB + +
+
+
+
+ + diff --git a/system/doc/top/templates/otp_top.css b/system/doc/top/templates/otp_top.css new file mode 100644 index 0000000000..1c6d27bd8d --- /dev/null +++ b/system/doc/top/templates/otp_top.css @@ -0,0 +1,53 @@ + BODY { background: white } + + BODY { font-family: Verdana, Arial, Helvetica, sans-serif } + TH { font-family: Verdana, Arial, Helvetica, sans-serif } + TD { font-family: Verdana, Arial, Helvetica, sans-serif } + P { font-family: Verdana, Arial, Helvetica, sans-serif } + + .header { background: #222; color: #fff } + .top { background: #efe } + .otp { background: #efe } + .erlang { background: #ffe } + .otp2 { background: #efe } + .app { background: #ffe } + + a:link { color: blue; text-decoration: none } + a:active { color: blue; text-decoration: none } + a:visited { color: blue; text-decoration: none } + body { + margin: 0; + padding: 0; + border: 0; + overflow: scroll; + height: 100%; + max-height: 100% + } + #container { + width: 100%; + margin: 10px auto; + background-color: #fff; + } + #leftnav { + float: left; + width: 200px; + margin: 0; + padding: 1em; + } + #content { + margin-left: 220px; /* set left value to WidthOfFrameDiv */ + border-left: 1px solid red; + } + + .innertube { + margin: 15px; /* Magins for inner DIV inside each DIV (to provide padding) */ + } + + * html body{ /* IE6 hack */ + padding: 0 0 0 200px; /* Set value to (0 0 0 WidthOfFrameDiv)*/ + } + * html #maincontent{ /* IE6 hack*/ + height: 100%; + width: 100%; + } + diff --git a/system/doc/top/templates/system.html.src b/system/doc/top/templates/system.html.src new file mode 100644 index 0000000000..761bc96ed0 --- /dev/null +++ b/system/doc/top/templates/system.html.src @@ -0,0 +1,281 @@ + + + + Erlang/OTP #release# + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ General +
+ + + + + +
+ + Introduction + + +
+
+About Erlang, OTP, Erlang/OTP and this documentation +
+ + + + + +
+ + Installation Guide + + +
+
+The Erlang/OTP Installation Guide +
+ + + + + +
+ + System Principles + + +
+
+Starting, stopping and configuring the Erlang runtime system +
+ + + + + +
+ + Embedded System + + +
+
+Erlang in an Embedded System +
 
+ Programming in Erlang +
+ + + + + +
+ + Erlang Reference Manual + + +
+
+Description of data types, language constructs and more +
+ + + + + +
+ + Getting Started + + +
+
+Getting started with Erlang +
+ + + + + +
+ + Programming Examples + + +
+
+Examples of using records, funs, list comprehensions and the bit syntax +
+ + + + + +
+ Efficiency Guide + +
+
+Learn how to write efficient programs in Erlang +
+ + + + + +
+ Interoperability Tutorial + +
+
+About interoperating with programs written in other programming languages +
 
+ Working with OTP +
+ + + + + +
+ + Design Principles + + +
+
+Structure your programs with applications, supervisors and generic behaviors (gen_server, gen_event and gen_fsm). +Also use the built in error logger. +
+ + + + + +
+ OAM Principles + +
+
+OTP Operation and Management Principles +
 
+ +
+ + + + diff --git a/system/doc/top/templates/toc_.html.src b/system/doc/top/templates/toc_.html.src new file mode 100644 index 0000000000..5e79bc0ac8 --- /dev/null +++ b/system/doc/top/templates/toc_.html.src @@ -0,0 +1,105 @@ + + + + Erlang/OTP #release# + + + + +
+Erlang/OTP #release#
+
+ + + +

+

+Erlang/OTP +
Installation Guide + +
System Principles + +
Embedded System + +
+ +

+

+ +

+

+Working with OTP +
Design Principles + + +
OAM Principles + +
+ +

+

+Applications +#applinks# +
+ +

+http://www.erlang.se + + + diff --git a/system/doc/tutorial/Makefile b/system/doc/tutorial/Makefile new file mode 100644 index 0000000000..efb380248e --- /dev/null +++ b/system/doc/tutorial/Makefile @@ -0,0 +1,121 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2000-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include $(ERL_TOP)/erts/vsn.mk +#VSN=$(SYSTEM_VSN) + +APPLICATION=otp-system-documentation +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/doc/tutorial + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +XML_PART_FILES = part.xml + +include xmlfiles.mk + +XML_CHAPTER_FILES=$(TUTORIAL_CHAPTER_FILES) + +TOPDOCDIR=.. + +BOOK_FILES = book.xml + +GIF_FILES= port.gif port_driver.gif + + +XML_FILES = \ + $(BOOK_FILES) $(XML_CHAPTER_FILES) \ + $(XML_PART_FILES) + +# ---------------------------------------------------- + +C_FILES = \ + cnode_c.c \ + cnode_s.c \ + cnode_s2.c \ + complex.c \ + ei.c \ + erl_comm.c \ + port.c \ + port_driver.c + +ERL_FILES = \ + complex1.erl \ + complex2.erl \ + complex3.erl \ + complex4.erl \ + complex5.erl + +HTMLDIR = ../html/tutorial + +EXTRA_FILES = \ + $(C_FILES) \ + $(ERL_FILES) + +HTML_UG_FILE = $(HTMLDIR)/users_guide.html + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAGS += +DVIPS_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +$(HTMLDIR)/%.gif: %.gif + $(INSTALL_DATA) $< $@ + +docs: html + +local_docs: PDFDIR=../../pdf + +html: $(HTML_UG_FILE) gifs + +gifs: $(GIF_FILES:%=$(HTMLDIR)/%) + +debug opt: + +clean clean_docs: + rm -rf $(HTMLDIR) + rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f errs core *~ + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_docs_spec: docs +# $(INSTALL_DIR) $(RELEASE_PATH)/pdf +# $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELEASE_PATH)/pdf + $(INSTALL_DIR) $(RELSYSDIR) + $(INSTALL_DATA) $(GIF_FILES) $(EXTRA_FILES) $(HTMLDIR)/*.html \ + $(RELSYSDIR) + +release_spec: diff --git a/system/doc/tutorial/appendix.xmlsrc b/system/doc/tutorial/appendix.xmlsrc new file mode 100644 index 0000000000..faa6319df2 --- /dev/null +++ b/system/doc/tutorial/appendix.xmlsrc @@ -0,0 +1,100 @@ + + + + +

+ + 20002009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Appendix - Programs + Bengt Nilsson + + 2000-09-04 + + appendix.xml +
+

This appendix contains the programs referred to in the previous + chapters within Interoperability Tutorial.

+ +
+ + complex1.erl + +
+ +
+ + complex2.erl + +
+ +
+ + complex3.erl + +
+ +
+ + complex4.erl + +
+ +
+ + complex5.erl + +
+ +
+ + port.c + +
+ +
+ + erl_comm.c + +
+ +
+ + ei.c + +
+ +
+ + cnode_s.c + +
+ +
+ + cnode_s2.c + +
+ +
+ + cnode_c.c + +
+ + diff --git a/system/doc/tutorial/book.xml b/system/doc/tutorial/book.xml new file mode 100644 index 0000000000..1273bbb865 --- /dev/null +++ b/system/doc/tutorial/book.xml @@ -0,0 +1,43 @@ + + + + +
+ + 20002009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Interoperability Tutorial + Gunilla Hugosson + + 2000-08-21 + C + book.sgml +
+ + + Interoperability Tutorial + + + + + + + + +
+ diff --git a/system/doc/tutorial/c_port.xmlsrc b/system/doc/tutorial/c_port.xmlsrc new file mode 100644 index 0000000000..7e6034807b --- /dev/null +++ b/system/doc/tutorial/c_port.xmlsrc @@ -0,0 +1,128 @@ + + + + +
+ + 20002009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Ports + + + + + c_port.xml +
+

This is an example of how to solve the example problem by using a port.

+ + Port Communication. + + +
+ Erlang Program +

First of all communication between Erlang and C must be established by creating the port. The Erlang process which creates a port is said to be the connected process of the port. All communication to and from the port should go via the connected process. If the connected process terminates, so will the port (and the external program, if it is written correctly).

+

The port is created using the BIF open_port/2 with {spawn,ExtPrg} as the first argument. The string ExtPrg is the name of the external program, including any command line arguments. The second argument is a list of options, in this case only {packet,2}. This option says that a two byte length indicator will be used to simplify the communication between C and Erlang. Adding the length indicator will be done automatically by the Erlang port, but must be done explicitly in the external C program.

+

The process is also set to trap exits which makes it possible to detect if the external program fails.

+
+-module(complex1).
+-export([start/1, init/1]).
+
+start(ExtPrg) ->
+  spawn(?MODULE, init, [ExtPrg]).
+
+init(ExtPrg) ->
+  register(complex, self()),
+  process_flag(trap_exit, true),
+  Port = open_port({spawn, ExtPrg}, [{packet, 2}]),
+  loop(Port).
+

Now it is possible to implement complex1:foo/1 and complex1:bar/1. They both send a message to the complex process and receive the reply.

+
+foo(X) ->
+  call_port({foo, X}).
+bar(Y) ->
+  call_port({bar, Y}).
+
+call_port(Msg) ->
+  complex ! {call, self(), Msg},
+  receive
+    {complex, Result} ->
+      Result
+  end.
+

The complex process encodes the message into a sequence of bytes, sends it to the port, waits for a reply, decodes the reply and sends it back to the caller.

+
+loop(Port) ->
+  receive
+    {call, Caller, Msg} ->
+      Port ! {self(), {command, encode(Msg)}},
+      receive
+\011{Port, {data, Data}} ->
+          Caller ! {complex, decode(Data)}
+      end,
+      loop(Port)
+ end.
+

Assuming that both the arguments and the results from the C functions will be less than 256, a very simple encoding/decoding scheme is employed where foo is represented by the byte 1, bar is represented by 2, and the argument/result is represented by a single byte as well.

+
+encode({foo, X}) -> [1, X];
+encode({bar, Y}) -> [2, Y].
+      
+decode([Int]) -> Int.
+

The resulting Erlang program, including functionality for stopping the port and detecting port failures is shown below. +

+ +
+ +
+ C Program +

On the C side, it is necessary to write functions for receiving and sending + data with two byte length indicators from/to Erlang. By default, the C program + should read from standard input (file descriptor 0) and write to standard output + (file descriptor 1). Examples of such functions, read_cmd/1 and + write_cmd/2, are shown below.

+ +

Note that stdin and stdout are for buffered input/output and should not be used for the communication with Erlang!

+

In the main function, the C program should listen for a message from Erlang and, according to the selected encoding/decoding scheme, use the first byte to determine which function to call and the second byte as argument to the function. The result of calling the function should then be sent back to Erlang.

+ +

Note that the C program is in a while-loop checking for the return value of read_cmd/1. The reason for this is that the C program must detect when the port gets closed and terminate.

+
+ +
+ Running the Example +

1. Compile the C code.

+
+unix> gcc -o extprg complex.c erl_comm.c port.c
+

2. Start Erlang and compile the Erlang code.

+
+unix> erl
+Erlang (BEAM) emulator version 4.9.1.2
+
+Eshell V4.9.1.2 (abort with ^G)
+1> c(complex1).
+{ok,complex1}
+

3. Run the example.

+
+2> complex1:start("extprg").
+<0.34.0>
+3> complex1:foo(3).
+4
+4> complex1:bar(5).
+10
+5> complex1:stop().
+stop
+
+
+ diff --git a/system/doc/tutorial/c_portdriver.xmlsrc b/system/doc/tutorial/c_portdriver.xmlsrc new file mode 100644 index 0000000000..f875fa80d2 --- /dev/null +++ b/system/doc/tutorial/c_portdriver.xmlsrc @@ -0,0 +1,183 @@ + + + + +
+ + 20002009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Port drivers + + + + + c_portdriver.xml +
+

This is an example of how to solve the example problem by using a linked in port driver.

+ + Port Driver Communication. + + +
+ Port Drivers +

A port driver is a linked in driver, that is accessible as a + port from an Erlang program. It is a shared library (SO in Unix, + DLL in Windows), with special entry points. The Erlang runtime + calls these entry points, when the driver is started and when + data is sent to the port. The port driver can also send data to + Erlang.

+

Since a port driver is dynamically linked into the emulator + process, this is the fastest way of calling C-code from Erlang. + Calling functions in the port driver requires no context + switches. But it is also the least safe, because a crash in the + port driver brings the emulator down too.

+
+ +
+ Erlang Program +

Just as with a port program, the port communicates with a Erlang + process. All communication goes through one Erlang process that + is the connected process of the port + driver. Terminating this process closes the port driver.

+

Before the port is created, the driver must be loaded. This is + done with the function erl_dll:load_driver/1, with the + name of the shared library as argument.

+

The port is then created using the BIF open_port/2 with + the tuple {spawn, DriverName} as the first argument. The + string SharedLib is the name of the port driver. The second + argument is a list of options, none in this case.

+
+-module(complex5).
+-export([start/1, init/1]).
+
+start(SharedLib) ->
+    case erl_ddll:load_driver(".", SharedLib) of
+        ok -> ok;
+\011{error, already_loaded} -> ok;
+\011_ -> exit({error, could_not_load_driver})
+    end,
+    spawn(?MODULE, init, [SharedLib]).
+
+init(SharedLib) ->
+  register(complex, self()),
+  Port = open_port({spawn, SharedLib}, []),
+  loop(Port).
+

Now it is possible to implement complex5:foo/1 and + complex5:bar/1. They both send a message to the + complex process and receive the reply.

+
+foo(X) ->
+    call_port({foo, X}).
+bar(Y) ->
+    call_port({bar, Y}).
+
+call_port(Msg) ->
+    complex ! {call, self(), Msg},
+    receive
+        {complex, Result} ->
+            Result
+    end.
+

The complex process encodes the message into a sequence + of bytes, sends it to the port, waits for a reply, decodes the + reply and sends it back to the caller. +

+
+loop(Port) ->
+    receive
+        {call, Caller, Msg} ->
+            Port ! {self(), {command, encode(Msg)}},
+            receive
+\011        {Port, {data, Data}} ->
+                    Caller ! {complex, decode(Data)}
+            end,
+            loop(Port)
+    end.
+

Assuming that both the arguments and the results from the C + functions will be less than 256, a very simple encoding/decoding + scheme is employed where foo is represented by the byte + 1, bar is represented by 2, and the argument/result is + represented by a single byte as well. +

+
+encode({foo, X}) -> [1, X];
+encode({bar, Y}) -> [2, Y].
+      
+decode([Int]) -> Int.
+

The resulting Erlang program, including functionality for + stopping the port and detecting port failures is shown below.

+ +
+ +
+ C Driver +

The C driver is a module that is compiled and linked into a + shared library. It uses a driver structure, and includes the + header file erl_driver.h.

+

The driver structure is filled with the driver name and function + pointers. It is returned from the special entry point, declared + with the macro )]]>.

+

The functions for receiving and sending data, are combined into + a function, pointed out by the driver structure. The data sent + into the port is given as arguments, and the data the port + sends back is sent with the C-function driver_output.

+

Since the driver is a shared module, not a program, no main + function should be present. All function pointers are not used + in our example, and the corresponding fields in the + driver_entry structure are set to NULL.

+

All functions in the driver, takes a handle (returned from + start), that is just passed along by the erlang + process. This must in some way refer to the port driver + instance.

+

The example_drv_start, is the only function that is called with + a handle to the port instance, so we must save this. It is + customary to use a allocated driver-defined structure for this + one, and pass a pointer back as a reference.

+

It is not a good idea to use a global variable; since the port + driver can be spawned by multiple Erlang processes, this + driver-structure should be instantiated multiple times. +

+ +
+ +
+ Running the Example +

1. Compile the C code.

+
+unix> gcc -o exampledrv -fpic -shared complex.c port_driver.c
+windows> cl -LD -MD -Fe exampledrv.dll complex.c port_driver.c
+

2. Start Erlang and compile the Erlang code.

+
+> erl
+Erlang (BEAM) emulator version 5.1
+
+Eshell V5.1 (abort with ^G)
+1> c(complex5).
+{ok,complex5}
+

3. Run the example.

+
+2> complex5:start("example_drv").
+<0.34.0>
+3> complex5:foo(3).
+4
+4> complex5:bar(5).
+10
+5> complex5:stop().
+stop
+
+
+ diff --git a/system/doc/tutorial/cnode.xmlsrc b/system/doc/tutorial/cnode.xmlsrc new file mode 100644 index 0000000000..a5443104de --- /dev/null +++ b/system/doc/tutorial/cnode.xmlsrc @@ -0,0 +1,189 @@ + + + + +
+ + 20002009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + C Nodes + + + + + cnode.xml +
+

This is an example of how to solve the example problem by using a C node. Note that a C node would not typically be used for solving a simple problem like this, a port would suffice.

+ +
+ Erlang Program +

From Erlang's point of view, the C node is treated like a normal Erlang node. Therefore, calling the functions foo and bar only involves sending a message to the C node asking for the function to be called, and receiving the result. Sending a message requires a recipient; a process which can be defined using either a pid or a tuple consisting of a registered name and a node name. In this case a tuple is the only alternative as no pid is known.

+
+{RegName, Node} ! Msg
+

The node name Node should be the name of the C node. If short node names are used, the plain name of the node will be cN where N is an integer. If long node names are used, there is no such restriction. An example of a C node name using short node names is thus c1@idril, an example using long node names is cnode@idril.ericsson.se.

+

The registered name RegName could be any atom. The name can be ignored by the C code, or it could be used for example to distinguish between different types of messages. Below is an example of what the Erlang code could look like when using short node names. +

+ +

+ When using long node names the code is slightly different as shown in the following example: +

+ + +
+ +
+ C Program + +
+ Setting Up the Communication +

Before calling any other Erl_Interface function, the memory handling must be initiated.

+
+erl_init(NULL, 0);
+

Now the C node can be initiated. If short node names are used, this is done by calling erl_connect_init().

+
+erl_connect_init(1, "secretcookie", 0);
+

The first argument is the integer which is used to construct the node name. In the example the plain node name will be c1.

+ + The second argument is a string defining the magic cookie.

+ + The third argument is an integer which is used to identify a particular instance of a C node.

+

If long node node names are used, initiation is done by calling erl_connect_xinit().

+
+erl_connect_xinit("idril", "cnode", "cnode@idril.ericsson.se",
+                  &addr, "secretcookie", 0);
+

The first three arguments are the host name, the plain node name, and the full node name. The fourth argument is a pointer to an in_addr struct with the IP address of the host, and the fifth and sixth arguments are the magic cookie and instance number.

+

The C node can act as a server or a client when setting up the communication Erlang-C. If it acts as a client, it connects to an Erlang node by calling erl_connect(), which will return an open file descriptor at success.

+
+fd = erl_connect("e1@idril");
+

If the C node acts as a server, it must first create a socket (call bind() and listen()) listening to a certain port number port. It then publishes its name and port number with epmd (the Erlang port mapper daemon, see the man page for epmd).

+
+erl_publish(port);
+

Now the C node server can accept connections from Erlang nodes.

+
+fd = erl_accept(listen, &conn);
+

The second argument to erl_accept is a struct ErlConnect that will contain useful information when a connection has been established; for example, the name of the Erlang node.

+
+ +
+ Sending and Receiving Messages +

The C node can receive a message from Erlang by calling erl_receive msg(). This function reads data from the open file descriptor fd into a buffer and puts the result in an ErlMessage struct emsg. ErlMessage has a field type defining which kind of data was received. In this case the type of interest is ERL_REG_SEND which indicates that Erlang sent a message to a registered process at the C node. The actual message, an ETERM, will be in the msg field.

+

It is also necessary to take care of the types ERL_ERROR (an error occurred) and ERL_TICK (alive check from other node, should be ignored). Other possible types indicate process events such as link/unlink and exit.

+
+  while (loop) {
+
+    got = erl_receive_msg(fd, buf, BUFSIZE, &emsg);
+    if (got == ERL_TICK) {
+      /* ignore */
+    } else if (got == ERL_ERROR) {
+      loop = 0; /* exit while loop */
+    } else {
+      if (emsg.type == ERL_REG_SEND) {
+

Since the message is an ETERM struct, Erl_Interface functions can be used to manipulate it. In this case, the message will be a 3-tuple (because that was how the Erlang code was written, see above). The second element will be the pid of the caller and the third element will be the tuple {Function,Arg} determining which function to call with which argument. The result of calling the function is made into an ETERM struct as well and sent back to Erlang using erl_send(), which takes the open file descriptor, a pid and a term as arguments.

+
+        fromp = erl_element(2, emsg.msg);
+        tuplep = erl_element(3, emsg.msg);
+        fnp = erl_element(1, tuplep);
+        argp = erl_element(2, tuplep);
+
+        if (strncmp(ERL_ATOM_PTR(fnp), "foo", 3) == 0) {
+          res = foo(ERL_INT_VALUE(argp));
+        } else if (strncmp(ERL_ATOM_PTR(fnp), "bar", 3) == 0) {
+          res = bar(ERL_INT_VALUE(argp));
+        }
+
+        resp = erl_format("{cnode, ~i}", res);
+        erl_send(fd, fromp, resp);
+

Finally, the memory allocated by the ETERM creating functions (including erl_receive_msg() must be freed.

+
+        erl_free_term(emsg.from); erl_free_term(emsg.msg);
+        erl_free_term(fromp); erl_free_term(tuplep);
+        erl_free_term(fnp); erl_free_term(argp);
+        erl_free_term(resp);
+

The resulting C programs can be found in looks like the following examples. First a C node server using short node names.

+ +

Below follows a C node server using long node names.

+ +

And finally we have the code for the C node client.

+ +
+
+ +
+ Running the Example +

1. Compile the C code, providing the paths to the Erl_Interface include files and libraries, and to the socket and nsl libraries.

+

In R5B and later versions of OTP, the include and lib directories are situated under OTPROOT/lib/erl_interface-VSN, where OTPROOT is the root directory of the OTP installation (/usr/local/otp in the example above) and VSN is the version of the erl_interface application (3.2.1 in the example above).

+ + In R4B and earlier versions of OTP, include and lib are situated under OTPROOT/usr.

+
+      
+>  gcc -o cserver \\ 
+-I/usr/local/otp/lib/erl_interface-3.2.1/include \\ 
+-L/usr/local/otp/lib/erl_interface-3.2.1/lib \\ 
+complex.c cnode_s.c \\ 
+-lerl_interface -lei -lsocket -lnsl
+
+unix> gcc -o cserver2 \\ 
+-I/usr/local/otp/lib/erl_interface-3.2.1/include \\ 
+-L/usr/local/otp/lib/erl_interface-3.2.1/lib \\ 
+complex.c cnode_s2.c \\ 
+-lerl_interface -lei -lsocket -lnsl
+
+unix> gcc -o cclient \\ 
+-I/usr/local/otp/lib/erl_interface-3.2.1/include \\ 
+-L/usr/local/otp/lib/erl_interface-3.2.1/lib \\ 
+complex.c cnode_c.c \\ 
+-lerl_interface -lei -lsocket -lnsl
+

2. Compile the Erlang code.

+
+unix> erl -compile complex3 complex4
+

3. Run the C node server example with short node names.

+

Start the C program cserver and Erlang in different windows. cserver takes a port number as argument and must be started before trying to call the Erlang functions. The Erlang node should be given the short name e1 and must be set to use the same magic cookie as the C node, secretcookie.

+
+unix> cserver 3456
+
+unix> erl -sname e1 -setcookie secretcookie
+Erlang (BEAM) emulator version 4.9.1.2
+ 
+Eshell V4.9.1.2  (abort with ^G)
+(e1@idril)1> complex3:foo(3).
+4
+(e1@idril)2> complex3:bar(5).
+10
+

4. Run the C node client example. Terminate cserver but not Erlang and start cclient. The Erlang node must be started before the C node client is.

+
+unix> cclient
+
+(e1@idril)3> complex3:foo(3).
+4
+(e1@idril)4> complex3:bar(5).
+10
+

5. Run the C node server, long node names, example.

+
+unix> cserver2 3456
+
+unix> erl -name e1 -setcookie secretcookie
+Erlang (BEAM) emulator version 4.9.1.2
+ 
+Eshell V4.9.1.2  (abort with ^G)
+(e1@idril.du.uab.ericsson.se)1> complex4:foo(3).
+4
+(e1@idril.du.uab.ericsson.se)2> complex4:bar(5).
+10
+
+
+ diff --git a/system/doc/tutorial/cnode_c.c b/system/doc/tutorial/cnode_c.c new file mode 100644 index 0000000000..8ddb6ffece --- /dev/null +++ b/system/doc/tutorial/cnode_c.c @@ -0,0 +1,64 @@ +/* cnode_c.c */ + +#include +#include +#include +#include + +#include "erl_interface.h" +#include "ei.h" + +#define BUFSIZE 1000 + +int main(int argc, char **argv) { + int fd; /* fd to Erlang node */ + + int loop = 1; /* Loop flag */ + int got; /* Result of receive */ + unsigned char buf[BUFSIZE]; /* Buffer for incoming message */ + ErlMessage emsg; /* Incoming message */ + + ETERM *fromp, *tuplep, *fnp, *argp, *resp; + int res; + + erl_init(NULL, 0); + + if (erl_connect_init(1, "secretcookie", 0) == -1) + erl_err_quit("erl_connect_init"); + + if ((fd = erl_connect("e1@idril")) < 0) + erl_err_quit("erl_connect"); + fprintf(stderr, "Connected to ei@idril\n\r"); + + while (loop) { + + got = erl_receive_msg(fd, buf, BUFSIZE, &emsg); + if (got == ERL_TICK) { + /* ignore */ + } else if (got == ERL_ERROR) { + loop = 0; + } else { + + if (emsg.type == ERL_REG_SEND) { + fromp = erl_element(2, emsg.msg); + tuplep = erl_element(3, emsg.msg); + fnp = erl_element(1, tuplep); + argp = erl_element(2, tuplep); + + if (strncmp(ERL_ATOM_PTR(fnp), "foo", 3) == 0) { + res = foo(ERL_INT_VALUE(argp)); + } else if (strncmp(ERL_ATOM_PTR(fnp), "bar", 3) == 0) { + res = bar(ERL_INT_VALUE(argp)); + } + + resp = erl_format("{cnode, ~i}", res); + erl_send(fd, fromp, resp); + + erl_free_term(emsg.from); erl_free_term(emsg.msg); + erl_free_term(fromp); erl_free_term(tuplep); + erl_free_term(fnp); erl_free_term(argp); + erl_free_term(resp); + } + } + } +} diff --git a/system/doc/tutorial/cnode_s.c b/system/doc/tutorial/cnode_s.c new file mode 100644 index 0000000000..f79d096ced --- /dev/null +++ b/system/doc/tutorial/cnode_s.c @@ -0,0 +1,99 @@ +/* cnode_s.c */ + +#include +#include +#include +#include + +#include "erl_interface.h" +#include "ei.h" + +#define BUFSIZE 1000 + +int main(int argc, char **argv) { + int port; /* Listen port number */ + int listen; /* Listen socket */ + int fd; /* fd to Erlang node */ + ErlConnect conn; /* Connection data */ + + int loop = 1; /* Loop flag */ + int got; /* Result of receive */ + unsigned char buf[BUFSIZE]; /* Buffer for incoming message */ + ErlMessage emsg; /* Incoming message */ + + ETERM *fromp, *tuplep, *fnp, *argp, *resp; + int res; + + port = atoi(argv[1]); + + erl_init(NULL, 0); + + if (erl_connect_init(1, "secretcookie", 0) == -1) + erl_err_quit("erl_connect_init"); + + /* Make a listen socket */ + if ((listen = my_listen(port)) <= 0) + erl_err_quit("my_listen"); + + if (erl_publish(port) == -1) + erl_err_quit("erl_publish"); + + if ((fd = erl_accept(listen, &conn)) == ERL_ERROR) + erl_err_quit("erl_accept"); + fprintf(stderr, "Connected to %s\n\r", conn.nodename); + + while (loop) { + + got = erl_receive_msg(fd, buf, BUFSIZE, &emsg); + if (got == ERL_TICK) { + /* ignore */ + } else if (got == ERL_ERROR) { + loop = 0; + } else { + + if (emsg.type == ERL_REG_SEND) { + fromp = erl_element(2, emsg.msg); + tuplep = erl_element(3, emsg.msg); + fnp = erl_element(1, tuplep); + argp = erl_element(2, tuplep); + + if (strncmp(ERL_ATOM_PTR(fnp), "foo", 3) == 0) { + res = foo(ERL_INT_VALUE(argp)); + } else if (strncmp(ERL_ATOM_PTR(fnp), "bar", 3) == 0) { + res = bar(ERL_INT_VALUE(argp)); + } + + resp = erl_format("{cnode, ~i}", res); + erl_send(fd, fromp, resp); + + erl_free_term(emsg.from); erl_free_term(emsg.msg); + erl_free_term(fromp); erl_free_term(tuplep); + erl_free_term(fnp); erl_free_term(argp); + erl_free_term(resp); + } + } + } /* while */ +} + + +int my_listen(int port) { + int listen_fd; + struct sockaddr_in addr; + int on = 1; + + if ((listen_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) + return (-1); + + setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); + + memset((void*) &addr, 0, (size_t) sizeof(addr)); + addr.sin_family = AF_INET; + addr.sin_port = htons(port); + addr.sin_addr.s_addr = htonl(INADDR_ANY); + + if (bind(listen_fd, (struct sockaddr*) &addr, sizeof(addr)) < 0) + return (-1); + + listen(listen_fd, 5); + return listen_fd; +} diff --git a/system/doc/tutorial/cnode_s2.c b/system/doc/tutorial/cnode_s2.c new file mode 100644 index 0000000000..46c248cc04 --- /dev/null +++ b/system/doc/tutorial/cnode_s2.c @@ -0,0 +1,102 @@ +/* cnode_s2.c */ + +#include +#include +#include +#include + +#include "erl_interface.h" +#include "ei.h" + +#define BUFSIZE 1000 + +int main(int argc, char **argv) { + struct in_addr addr; /* 32-bit IP number of host */ + int port; /* Listen port number */ + int listen; /* Listen socket */ + int fd; /* fd to Erlang node */ + ErlConnect conn; /* Connection data */ + + int loop = 1; /* Loop flag */ + int got; /* Result of receive */ + unsigned char buf[BUFSIZE]; /* Buffer for incoming message */ + ErlMessage emsg; /* Incoming message */ + + ETERM *fromp, *tuplep, *fnp, *argp, *resp; + int res; + + port = atoi(argv[1]); + + erl_init(NULL, 0); + + addr.s_addr = inet_addr("134.138.177.89"); + if (erl_connect_xinit("idril", "cnode", "cnode@idril.du.uab.ericsson.se", + &addr, "secretcookie", 0) == -1) + erl_err_quit("erl_connect_xinit"); + + /* Make a listen socket */ + if ((listen = my_listen(port)) <= 0) + erl_err_quit("my_listen"); + + if (erl_publish(port) == -1) + erl_err_quit("erl_publish"); + + if ((fd = erl_accept(listen, &conn)) == ERL_ERROR) + erl_err_quit("erl_accept"); + fprintf(stderr, "Connected to %s\n\r", conn.nodename); + + while (loop) { + + got = erl_receive_msg(fd, buf, BUFSIZE, &emsg); + if (got == ERL_TICK) { + /* ignore */ + } else if (got == ERL_ERROR) { + loop = 0; + } else { + + if (emsg.type == ERL_REG_SEND) { + fromp = erl_element(2, emsg.msg); + tuplep = erl_element(3, emsg.msg); + fnp = erl_element(1, tuplep); + argp = erl_element(2, tuplep); + + if (strncmp(ERL_ATOM_PTR(fnp), "foo", 3) == 0) { + res = foo(ERL_INT_VALUE(argp)); + } else if (strncmp(ERL_ATOM_PTR(fnp), "bar", 3) == 0) { + res = bar(ERL_INT_VALUE(argp)); + } + + resp = erl_format("{cnode, ~i}", res); + erl_send(fd, fromp, resp); + + erl_free_term(emsg.from); erl_free_term(emsg.msg); + erl_free_term(fromp); erl_free_term(tuplep); + erl_free_term(fnp); erl_free_term(argp); + erl_free_term(resp); + } + } + } +} + + +int my_listen(int port) { + int listen_fd; + struct sockaddr_in addr; + int on = 1; + + if ((listen_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) + return (-1); + + setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); + + memset((void*) &addr, 0, (size_t) sizeof(addr)); + addr.sin_family = AF_INET; + addr.sin_port = htons(port); + addr.sin_addr.s_addr = htonl(INADDR_ANY); + + if (bind(listen_fd, (struct sockaddr*) &addr, sizeof(addr)) < 0) + return (-1); + + listen(listen_fd, 5); + return listen_fd; +} diff --git a/system/doc/tutorial/complex.c b/system/doc/tutorial/complex.c new file mode 100644 index 0000000000..206d8abf4e --- /dev/null +++ b/system/doc/tutorial/complex.c @@ -0,0 +1,9 @@ +/* complex.c */ + +int foo(int x) { + return x+1; +} + +int bar(int y) { + return y*2; +} diff --git a/system/doc/tutorial/complex1.erl b/system/doc/tutorial/complex1.erl new file mode 100644 index 0000000000..7bad93f7d3 --- /dev/null +++ b/system/doc/tutorial/complex1.erl @@ -0,0 +1,50 @@ +-module(complex1). +-export([start/1, stop/0, init/1]). +-export([foo/1, bar/1]). + +start(ExtPrg) -> + spawn(?MODULE, init, [ExtPrg]). +stop() -> + complex ! stop. + +foo(X) -> + call_port({foo, X}). +bar(Y) -> + call_port({bar, Y}). + +call_port(Msg) -> + complex ! {call, self(), Msg}, + receive + {complex, Result} -> + Result + end. + +init(ExtPrg) -> + register(complex, self()), + process_flag(trap_exit, true), + Port = open_port({spawn, ExtPrg}, [{packet, 2}]), + loop(Port). + +loop(Port) -> + receive + {call, Caller, Msg} -> + Port ! {self(), {command, encode(Msg)}}, + receive + {Port, {data, Data}} -> + Caller ! {complex, decode(Data)} + end, + loop(Port); + stop -> + Port ! {self(), close}, + receive + {Port, closed} -> + exit(normal) + end; + {'EXIT', Port, Reason} -> + exit(port_terminated) + end. + +encode({foo, X}) -> [1, X]; +encode({bar, Y}) -> [2, Y]. + +decode([Int]) -> Int. diff --git a/system/doc/tutorial/complex2.erl b/system/doc/tutorial/complex2.erl new file mode 100644 index 0000000000..93d00dab6b --- /dev/null +++ b/system/doc/tutorial/complex2.erl @@ -0,0 +1,45 @@ +-module(complex2). +-export([start/1, stop/0, init/1]). +-export([foo/1, bar/1]). + +start(ExtPrg) -> + spawn(?MODULE, init, [ExtPrg]). +stop() -> + complex ! stop. + +foo(X) -> + call_port({foo, X}). +bar(Y) -> + call_port({bar, Y}). + +call_port(Msg) -> + complex ! {call, self(), Msg}, + receive + {complex, Result} -> + Result + end. + +init(ExtPrg) -> + register(complex, self()), + process_flag(trap_exit, true), + Port = open_port({spawn, ExtPrg}, [{packet, 2}, binary]), + loop(Port). + +loop(Port) -> + receive + {call, Caller, Msg} -> + Port ! {self(), {command, term_to_binary(Msg)}}, + receive + {Port, {data, Data}} -> + Caller ! {complex, binary_to_term(Data)} + end, + loop(Port); + stop -> + Port ! {self(), close}, + receive + {Port, closed} -> + exit(normal) + end; + {'EXIT', Port, Reason} -> + exit(port_terminated) + end. diff --git a/system/doc/tutorial/complex3.erl b/system/doc/tutorial/complex3.erl new file mode 100644 index 0000000000..f2e9c2c171 --- /dev/null +++ b/system/doc/tutorial/complex3.erl @@ -0,0 +1,14 @@ +-module(complex3). +-export([foo/1, bar/1]). + +foo(X) -> + call_cnode({foo, X}). +bar(Y) -> + call_cnode({bar, Y}). + +call_cnode(Msg) -> + {any, c1@idril} ! {call, self(), Msg}, + receive + {cnode, Result} -> + Result + end. diff --git a/system/doc/tutorial/complex4.erl b/system/doc/tutorial/complex4.erl new file mode 100644 index 0000000000..c1df273b60 --- /dev/null +++ b/system/doc/tutorial/complex4.erl @@ -0,0 +1,14 @@ +-module(complex4). +-export([foo/1, bar/1]). + +foo(X) -> + call_cnode({foo, X}). +bar(Y) -> + call_cnode({bar, Y}). + +call_cnode(Msg) -> + {any, 'cnode@idril.du.uab.ericsson.se'} ! {call, self(), Msg}, + receive + {cnode, Result} -> + Result + end. diff --git a/system/doc/tutorial/complex5.erl b/system/doc/tutorial/complex5.erl new file mode 100644 index 0000000000..473056dd11 --- /dev/null +++ b/system/doc/tutorial/complex5.erl @@ -0,0 +1,56 @@ +-module(complex5). +-export([start/1, stop/0, init/1]). +-export([foo/1, bar/1]). + +start(SharedLib) -> + case erl_ddll:load_driver(".", SharedLib) of + ok -> ok; + {error, already_loaded} -> ok; + _ -> exit({error, could_not_load_driver}) + end, + spawn(?MODULE, init, [SharedLib]). + +init(SharedLib) -> + register(complex, self()), + Port = open_port({spawn, SharedLib}, []), + loop(Port). + +stop() -> + complex ! stop. + +foo(X) -> + call_port({foo, X}). +bar(Y) -> + call_port({bar, Y}). + +call_port(Msg) -> + complex ! {call, self(), Msg}, + receive + {complex, Result} -> + Result + end. + +loop(Port) -> + receive + {call, Caller, Msg} -> + Port ! {self(), {command, encode(Msg)}}, + receive + {Port, {data, Data}} -> + Caller ! {complex, decode(Data)} + end, + loop(Port); + stop -> + Port ! {self(), close}, + receive + {Port, closed} -> + exit(normal) + end; + {'EXIT', Port, Reason} -> + io:format("~p ~n", [Reason]), + exit(port_terminated) + end. + +encode({foo, X}) -> [1, X]; +encode({bar, Y}) -> [2, Y]. + +decode([Int]) -> Int. diff --git a/system/doc/tutorial/distribution.xml b/system/doc/tutorial/distribution.xml new file mode 100644 index 0000000000..54d352dd5a --- /dev/null +++ b/system/doc/tutorial/distribution.xml @@ -0,0 +1,69 @@ + + + + +
+ + 20002009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Distributed Erlang + + + + + distribution.xml +
+ +
+ What is distributed Erlang? +
+ +
+ Example +
+ +
+ When to use distributed Erlang +

+
+ +
+ Where to read more +

Erlang book:

+ + Chapter 6 Distributed Programming - Describes how to write distributed Erlang applications which run on a network of Erlang nodes. + Chapter 11 Distributed Programming Techniques. + Chapter 12 Distributed Data. + +

Man pages:

+ + auth - The Erlang authentication server. Note: The actual authentication has been moved from this process to the handshaking procedure. The man page gives a good description of the principles behind the cookie authentication mechanism however. + erlang - Description of the BIFs. + global - A global name registration facility. + global_group - Grouping nodes to global name registration groups. + net_adm - Various net administration routines. + net_kernel - Networking kernel. + pg - Distributed named process groups, experimental implementation. + pg2 - Distributed named process groups. + pool - Load distribution facility. + slave - Functions for starting and controlling slave nodes. + +

Other:

+
+
+ diff --git a/system/doc/tutorial/ei.c b/system/doc/tutorial/ei.c new file mode 100644 index 0000000000..b234a00768 --- /dev/null +++ b/system/doc/tutorial/ei.c @@ -0,0 +1,38 @@ +/* ei.c */ + +#include "erl_interface.h" +#include "ei.h" + +typedef unsigned char byte; + +int main() { + ETERM *tuplep, *intp; + ETERM *fnp, *argp; + int res; + byte buf[100]; + long allocated, freed; + + erl_init(NULL, 0); + + while (read_cmd(buf) > 0) { + tuplep = erl_decode(buf); + fnp = erl_element(1, tuplep); + argp = erl_element(2, tuplep); + + if (strncmp(ERL_ATOM_PTR(fnp), "foo", 3) == 0) { + res = foo(ERL_INT_VALUE(argp)); + } else if (strncmp(ERL_ATOM_PTR(fnp), "bar", 17) == 0) { + res = bar(ERL_INT_VALUE(argp)); + } + + intp = erl_mk_int(res); + erl_encode(intp, buf); + write_cmd(buf, erl_term_len(intp)); + + erl_free_compound(tuplep); + erl_free_term(fnp); + erl_free_term(argp); + erl_free_term(intp); + } +} + diff --git a/system/doc/tutorial/erl_comm.c b/system/doc/tutorial/erl_comm.c new file mode 100644 index 0000000000..303c6dc170 --- /dev/null +++ b/system/doc/tutorial/erl_comm.c @@ -0,0 +1,52 @@ +/* erl_comm.c */ + +typedef unsigned char byte; + +read_cmd(byte *buf) +{ + int len; + + if (read_exact(buf, 2) != 2) + return(-1); + len = (buf[0] << 8) | buf[1]; + return read_exact(buf, len); +} + +write_cmd(byte *buf, int len) +{ + byte li; + + li = (len >> 8) & 0xff; + write_exact(&li, 1); + + li = len & 0xff; + write_exact(&li, 1); + + return write_exact(buf, len); +} + +read_exact(byte *buf, int len) +{ + int i, got=0; + + do { + if ((i = read(0, buf+got, len-got)) <= 0) + return(i); + got += i; + } while (got + + + +
+ + 20002009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Erl_Interface + + + + + erl_interface.xml +
+

This is an example of how to solve the example problem by using a port and erl_interface. It is necessary to read the port example before reading this chapter.

+ +
+ Erlang Program +

The example below shows an Erlang program communicating with a C program over a plain port with home made encoding.

+ +

Compared to the Erlang module + above used for the plain port, there are two differences when using Erl_Interface on the C side: Since Erl_Interface operates on the Erlang external term format the port must be set to use binaries and, instead of inventing an encoding/decoding scheme, the BIFs term_to_binary/1 and binary_to_term/1 should be used. That is:

+
+open_port({spawn, ExtPrg}, [{packet, 2}])
+

is replaced with:

+
+open_port({spawn, ExtPrg}, [{packet, 2}, binary])
+

And:

+
+Port ! {self(), {command, encode(Msg)}},
+receive
+  {Port, {data, Data}} ->
+    Caller ! {complex, decode(Data)}
+end
+

is replaced with:

+
+Port ! {self(), {command, term_to_binary(Msg)}},
+receive
+  {Port, {data, Data}} ->
+    Caller ! {complex, binary_to_term(Data)}
+end
+

The resulting Erlang program is shown below.

+ +

Note that calling complex2:foo/1 and complex2:bar/1 will result in the tuple {foo,X} or {bar,Y} being sent to the complex process, which will code them as binaries and send them to the port. This means that the C program must be able to handle these two tuples.

+
+ +
+ C Program +

The example below shows a C program communicating with an Erlang program over a plain port with home made encoding.

+ +

Compared to the C program above + used for the plain port the while-loop must be rewritten. Messages coming from the port will be on the Erlang external term format. They should be converted into an ETERM struct, a C struct similar to an Erlang term. The result of calling foo() or bar() must be converted to the Erlang external term format before being sent back to the port. But before calling any other erl_interface function, the memory handling must be initiated.

+
+erl_init(NULL, 0);
+

For reading from and writing to the port the functions read_cmd() and write_cmd() from the erl_comm.c example below + can still be used. +

+ +

The function erl_decode() from erl_marshal will convert the binary into an ETERM struct.

+
+int main() {
+  ETERM *tuplep;
+
+  while (read_cmd(buf) > 0) {
+    tuplep = erl_decode(buf);
+

In this case tuplep now points to an ETERM struct representing a tuple with two elements; the function name (atom) and the argument (integer). By using the function erl_element() from erl_eterm it is possible to extract these elements, which also must be declared as pointers to an ETERM struct.

+
+    fnp = erl_element(1, tuplep);
+    argp = erl_element(2, tuplep);
+

The macros ERL_ATOM_PTR and ERL_INT_VALUE from erl_eterm can be used to obtain the actual values of the atom and the integer. The atom value is represented as a string. By comparing this value with the strings "foo" and "bar" it can be decided which function to call.

+
+    if (strncmp(ERL_ATOM_PTR(fnp), "foo", 3) == 0) {
+      res = foo(ERL_INT_VALUE(argp));
+    } else if (strncmp(ERL_ATOM_PTR(fnp), "bar", 3) == 0) {
+      res = bar(ERL_INT_VALUE(argp));
+    }
+

Now an ETERM struct representing the integer result can be constructed using the function erl_mk_int() from erl_eterm. It is also possible to use the function erl_format() from the module erl_format.

+
+    intp = erl_mk_int(res);
+

The resulting ETERM struct is converted into the Erlang external term format using the function erl_encode() from erl_marshal and sent to Erlang using write_cmd().

+
+    erl_encode(intp, buf);
+    write_cmd(buf, erl_eterm_len(intp));
+

Last, the memory allocated by the ETERM creating functions must be freed.

+
+    erl_free_compound(tuplep);
+    erl_free_term(fnp);
+    erl_free_term(argp);
+    erl_free_term(intp);
+

The resulting C program is shown below:

+ +
+ +
+ Running the Example +

1. Compile the C code, providing the paths to the include files erl_interface.h and ei.h, and to the libraries erl_interface and ei.

+
+unix> gcc -o extprg -I/usr/local/otp/lib/erl_interface-3.2.1/include \\ 
+      -L/usr/local/otp/lib/erl_interface-3.2.1/lib \\ 
+      complex.c erl_comm.c ei.c -lerl_interface -lei
+

In R5B and later versions of OTP, the include and lib directories are situated under OTPROOT/lib/erl_interface-VSN, where OTPROOT is the root directory of the OTP installation (/usr/local/otp in the example above) and VSN is the version of the erl_interface application (3.2.1 in the example above).

+ + In R4B and earlier versions of OTP, include and lib are situated under OTPROOT/usr.

+

2. Start Erlang and compile the Erlang code.

+
+unix> erl
+Erlang (BEAM) emulator version 4.9.1.2
+
+Eshell V4.9.1.2 (abort with ^G)
+1> c(complex2).
+{ok,complex2}
+

3. Run the example.

+
+2> complex2:start("extprg").
+<0.34.0>
+3> complex2:foo(3).
+4
+4> complex2:bar(5).
+10
+5> complex2:bar(352).
+704
+6> complex2:stop().
+stop
+
+
+ diff --git a/system/doc/tutorial/example.xmlsrc b/system/doc/tutorial/example.xmlsrc new file mode 100644 index 0000000000..7ee2ef6ff3 --- /dev/null +++ b/system/doc/tutorial/example.xmlsrc @@ -0,0 +1,46 @@ + + + + +
+ + 20002009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Problem Example + + + + + example.xml +
+ +
+ Description +

A common interoperability situation is when there exists a piece of code solving some complex problem, and we would like to incorporate this piece of code in our Erlang program. Suppose for example we have the following C functions that we would like to be able to call from Erlang.

+ +

(For the sake of keeping the example as simple as possible, the functions are not very complicated in this case).

+

Preferably we would like to able to call foo and bar without having to bother about them actually being C functions.

+
+% Erlang code
+...
+Res = complex:foo(X),
+...
+

The communication with C is hidden in the implementation of complex.erl. In the following chapters it is shown how this module can be implemented using the different interoperability mechanisms.

+
+
+ diff --git a/system/doc/tutorial/introduction.xml b/system/doc/tutorial/introduction.xml new file mode 100644 index 0000000000..0a761f77fb --- /dev/null +++ b/system/doc/tutorial/introduction.xml @@ -0,0 +1,46 @@ + + + + +
+ + 20002009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Introduction + Gunilla Hugosson + + + + introduction.xml +
+ +
+ Purpose +

The purpose of this tutorial is to give the reader an orientation of the different interoperability mechanisms that can be used when integrating a program written in Erlang with a program written in another programming language, from the Erlang programmer's point of view.

+
+ +
+ Prerequisites +

It is assumed that the reader is a skilled Erlang programmer, familiar with concepts such as Erlang data types, processes, messages and error handling.

+

To illustrate the interoperability principles C programs running in a UNIX environment have been used. It is assumed that the reader has enough knowledge to be able to apply these principles to the relevant programming languages and platforms.

+ +

For the sake of readability, the example code has been kept as simple as possible. It does not include functionality such as error handling, which might be vital in a real-life system.

+
+
+
+ diff --git a/system/doc/tutorial/make.dep b/system/doc/tutorial/make.dep new file mode 100644 index 0000000000..e9f77ab439 --- /dev/null +++ b/system/doc/tutorial/make.dep @@ -0,0 +1,35 @@ +# ---------------------------------------------------- +# >>>> Do not edit this file <<<< +# This file was automaticly generated by +# /home/otp/bin/docdepend +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# TeX files that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: book.tex c_port.tex c_portdriver.tex cnode.tex \ + erl_interface.tex example.tex introduction.tex \ + overview.tex part.tex + +# ---------------------------------------------------- +# Source inlined when transforming from source to LaTeX +# ---------------------------------------------------- + +c_port.tex: port.c + +c_portdriver.tex: port_driver.c + +cnode.tex: complex3.erl + +example.tex: complex.c + +# ---------------------------------------------------- +# Pictures that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: port.ps + +book.dvi: port_driver.ps + diff --git a/system/doc/tutorial/overview.xml b/system/doc/tutorial/overview.xml new file mode 100644 index 0000000000..b8a9b88a86 --- /dev/null +++ b/system/doc/tutorial/overview.xml @@ -0,0 +1,131 @@ + + + + +
+ + 20002009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Overview + + + + + overview.xml +
+ +
+ Built-In Mechanisms +

There are two interoperability mechanisms built into the Erlang runtime system. One is distributed Erlang and the other one is ports. A variation of ports is linked-in drivers.

+ + +
+ Distributed Erlang +

An Erlang runtime system is made into a distributed Erlang node by giving it a name. A distributed Erlang node can connect to and monitor other nodes, it is also possible to spawn processes at other nodes. Message passing and error handling between processes at different nodes are transparent. There exists a number of useful stdlib modules intended for use in a distributed Erlang system; for example, global which provides global name registration. The distribution mechanism is implemented using TCP/IP sockets.

+

When to use: Distributed Erlang is primarily used for communication Erlang-Erlang. It can also be used for communication between Erlang and C, if the C program is implemented as a C node, see below.

+

Where to read more: Distributed Erlang and some distributed programming techniques are described in the Erlang book.

+ + In the Erlang/OTP documentation there is a chapter about distributed Erlang in "Getting Started" (User's Guide).

+ + Relevant man pages are erlang (describes the BIFs) and global, net_adm, pg2, rpc, pool and slave.

+
+ +
+ Ports and Linked-In Drivers +

Ports provide the basic mechanism for communication with the external world, from Erlang's point of view. They provide a byte-oriented interface to an external program. When a port has been created, Erlang can communicate with it by sending and receiving lists of bytes (not Erlang terms). This means that the programmer may have to invent a suitable encoding and decoding scheme.

+

The actual implementation of the port mechanism depends on the platform. In the Unix case, pipes are used and the external program should as default read from standard input and write to standard output. Theoretically, the external program could be written in any programming language as long as it can handle the interprocess communication mechanism with which the port is implemented.

+

The external program resides in another OS process than the Erlang runtime system. In some cases this is not acceptable, consider for example drivers with very hard time requirements. It is therefore possible to write a program in C according to certain principles and dynamically link it to the Erlang runtime system, this is called a linked-in driver.

+

When to use: Being the basic mechanism, ports can be used for all kinds of interoperability situations where the Erlang program and the other program runs on the same machine. Programming is fairly straight-forward.

+ + Linked-in drivers involves writing certain call-back functions in C. Very good skills are required as the code is linked to the Erlang runtime system.

+ +

An erroneous linked-in driver will cause the entire Erlang runtime system to leak memory, hang or crash.

+
+

Where to read more: Ports are described in the "Miscellaneous Items" chapter of the Erlang book. Linked-in drivers are described in Appendix E.

+ + The BIF open_port/2 is documented in the man page for erlang. For linked-in drivers, the programmer needs to read the information in the man page for erl_ddll.

+

Examples:Port example.

+
+
+ +
+ C and Java Libraries + +
+ Erl_Interface +

Very often the program at the other side of a port is a C program. To help the C programmer a library called Erl_Interface has been developed. It consists of five parts:

+ + erl_marshal, erl_eterm, erl_format, erl_malloc Handling of the Erlang external term format. + erl_connect Communication with distributed Erlang, see C nodes below. + erl_error Error print routines. + erl_global Access globally registered names. + Registry Store and backup of key-value pairs. + +

The Erlang external term format is a representation of an Erlang term as a sequence of bytes, a binary. Conversion between the two representations is done using BIFs.

+
+Binary = term_to_binary(Term)
+Term = binary_to_term(Binary)
+

A port can be set to use binaries instead of lists of bytes. It is then not necessary to invent any encoding/decoding scheme. Erl_Interface functions are used for unpacking the binary and convert it into a struct similar to an Erlang term. Such a struct can be manipulated in different ways and be converted to the Erlang external format and sent to Erlang.

+

When to use: In C code, in conjunction with Erlang binaries.

+

Where to read more: Read about the Erl_Interface User's Guide; Command Reference and Library Reference. In R5B and earlier versions the information can be found under the Kernel application.

+
+

Examples:erl_interface example.

+ + +
+ C Nodes +

A C program which uses the Erl_Interface functions for setting up a connection to and communicating with a distributed Erlang node is called a C node, or a hidden node. The main advantage with a C node is that the communication from the Erlang programmer's point of view is extremely easy, since the C program behaves as a distributed Erlang node.

+

When to use: C nodes can typically be used on device processors (as opposed to control processors) where C is a better choice than Erlang due to memory limitations and/or application characteristics.

+

Where to read more: In the erl_connect part of the Erl_Interface documentation, see above. The programmer also needs to be familiar with TCP/IP sockets, see below, and distributed Erlang, see above.

+

Examples:C node example.

+
+ +
+ Jinterface +

In Erlang/OTP R6B, a library similar to Erl_Interface for Java was added called jinterface.

+
+
+ +
+ Standard Protocols +

Sometimes communication between an Erlang program and another program using a standard protocol is desirable. Erlang/OTP currently supports TCP/IP and UDP sockets, SNMP, HTTP and IIOP (CORBA). Using one of the latter three requires good knowledge about the protocol and is not covered by this tutorial. Please refer to the documentation for the SNMP, Inets and Orber applications, respectively.

+ + +
+ Sockets +

Simply put, connection-oriented socket communication (TCP/IP) consists of an initiator socket ("server") started at a certain host with a certain port number. A connector socket ("client") aware of the initiator's host name and port number can connect to it and data can be sent between them. Connection-less socket communication (UDP) consists of an initiator socket at a certain host with a certain port number and a connector socket sending data to it. For a detailed description of the socket concept, please refer to a suitable book about network programming. A suggestion is UNIX Network Programming, Volume 1: Networking APIs - Sockets and XTI by W. Richard Stevens, ISBN: 013490012X.

+

In Erlang/OTP, access to TCP/IP and UDP sockets is provided by the + Kernel modules gen_tcp and gen_udp. Both are easy to + use and do not require any deeper knowledge about the socket concept.

+

When to use: For programs running on the same or on another machine than the Erlang program.

+

Where to read more: The man pages for gen_tcp and gen_udp.

+
+
+ +
+ IC +

IC (IDL Compiler) is an interface generator which given an IDL interface specification automatically generates stub code in Erlang, C or Java. Please refer to the IC User's Guide and IC Reference Manual.

+
+ +
+ Old Applications +

There are two old applications of interest when talking about interoperability: IG which was removed in Erlang/OTP R6B and Jive which was removed in Erlang/OTP R7B. Both applications have been replaced by IC and are mentioned here for reference only.

+

IG (Interface Generator) automatically generated code for port or socket communication between an Erlang program and a C program, given a C header file with certain keywords. Jive provided a simple interface between an Erlang program and a Java program.

+
+
+ diff --git a/system/doc/tutorial/part.xml b/system/doc/tutorial/part.xml new file mode 100644 index 0000000000..1a8a873242 --- /dev/null +++ b/system/doc/tutorial/part.xml @@ -0,0 +1,38 @@ + + + + +
+ + 20002009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Interoperability Tutorial + Gunilla Hugosson + + 2000-01-18 + R7B +
+ + + + + + + +
+ diff --git a/system/doc/tutorial/port.c b/system/doc/tutorial/port.c new file mode 100644 index 0000000000..3a9a4e442c --- /dev/null +++ b/system/doc/tutorial/port.c @@ -0,0 +1,23 @@ +/* port.c */ + +typedef unsigned char byte; + +int main() { + int fn, arg, res; + byte buf[100]; + + while (read_cmd(buf) > 0) { + fn = buf[0]; + arg = buf[1]; + + if (fn == 1) { + res = foo(arg); + } else if (fn == 2) { + res = bar(arg); + } + + buf[0] = res; + write_cmd(buf, 1); + } +} + diff --git a/system/doc/tutorial/port.gif b/system/doc/tutorial/port.gif new file mode 100644 index 0000000000..1f5afd51da Binary files /dev/null and b/system/doc/tutorial/port.gif differ diff --git a/system/doc/tutorial/port.ps b/system/doc/tutorial/port.ps new file mode 100644 index 0000000000..c17959fbe7 --- /dev/null +++ b/system/doc/tutorial/port.ps @@ -0,0 +1,5981 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: /home/super/gunilla/tutorial/interoperability/port.ps +%%Creator: XV Version 3.10a Rev: 12/29/94 - by John Bradley +%%BoundingBox: 127 298 485 494 +%%Pages: 1 +%%DocumentFonts: +%%EndComments +%%EndProlog + +%%Page: 1 1 + +% remember original state +/origstate save def + +% build a temporary dictionary +20 dict begin + +% define string to hold a scanline's worth of data +/pix 1074 string def + +% define space for color conversions +/grays 358 string def % space for gray scale line +/npixls 0 def +/rgbindx 0 def + +% lower left corner +127 298 translate + +% size of image (on paper, in 1/72inch coords) +357.98400 195.98400 scale + +% define 'colorimage' if it isn't defined +% ('colortogray' and 'mergeprocs' come from xwd2ps +% via xgrab) +/colorimage where % do we know about 'colorimage'? + { pop } % yes: pop off the 'dict' returned + { % no: define one + /colortogray { % define an RGB->I function + /rgbdata exch store % call input 'rgbdata' + rgbdata length 3 idiv + /npixls exch store + /rgbindx 0 store + 0 1 npixls 1 sub { + grays exch + rgbdata rgbindx get 20 mul % Red + rgbdata rgbindx 1 add get 32 mul % Green + rgbdata rgbindx 2 add get 12 mul % Blue + add add 64 idiv % I = .5G + .31R + .18B + put + /rgbindx rgbindx 3 add store + } for + grays 0 npixls getinterval + } bind def + + % Utility procedure for colorimage operator. + % This procedure takes two procedures off the + % stack and merges them into a single procedure. + + /mergeprocs { % def + dup length + 3 -1 roll + dup + length + dup + 5 1 roll + 3 -1 roll + add + array cvx + dup + 3 -1 roll + 0 exch + putinterval + dup + 4 2 roll + putinterval + } bind def + + /colorimage { % def + pop pop % remove 'false 3' operands + {colortogray} mergeprocs + image + } bind def + } ifelse % end of 'false' case + + + +358 196 8 % dimensions of data +[358 0 0 -196 0 196] % mapping matrix +{currentfile pix readhexstring pop} +false 3 colorimage + +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffff000000000000000000000000 +000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000 +000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffff000000000000000000000000 +000000000000000000000000000000000000000000000000000000ffffff000000000000 +000000000000000000000000000000ffffff000000000000000000ffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffff000000ffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffff000000ffffffffffff +ffffffffffff000000ffffff000000ffffffffffffffffff000000000000000000ffffff +ffffff000000ffffffffffff000000000000ffffffffffffffffff000000000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000 +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffff000000ffffffffffff +ffffffffffffffffffffffff000000ffffffffffffffffffffffff000000ffffffffffff +ffffff000000ffffffffffffffffff000000ffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffff000000ffffffffffff +ffffff000000ffffffffffffffffff000000000000ffffff000000000000000000000000 +000000000000ffffffffffff000000000000ffffffffffff000000ffffff000000000000 +000000ffffff000000000000ffffffffffffffffffffffff000000000000ffffffffffff +000000ffffffffffffffffff000000000000000000000000ffffffffffff000000ffffff +000000000000ffffffffffff000000000000ffffffffffffffffffffffff000000000000 +000000000000000000ffffff000000000000ffffffffffff000000000000ffffff000000 +ffffff000000000000ffffff000000000000ffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffff000000ffffffffffff +ffffff000000ffffffffffff000000ffffffffffffffffff000000000000ffffffffffff +ffffff000000ffffffffffffffffffffffff000000000000ffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffff000000000000000000 +000000000000ffffffffffffffffffffffff000000ffffff000000ffffffffffff000000 +ffffffffffffffffff000000ffffffffffff000000ffffffffffff000000000000ffffff +ffffff000000ffffffffffff000000ffffffffffff000000ffffffffffff000000ffffff +000000ffffffffffffffffffffffff000000ffffffffffff000000ffffffffffff000000 +000000ffffffffffff000000ffffffffffff000000ffffffffffff000000ffffffffffff +000000ffffffffffff000000000000ffffffffffff000000ffffffffffff000000ffffff +000000ffffffffffff000000ffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffff000000000000000000 +000000000000ffffffffffff000000000000000000000000000000ffffffffffffffffff +ffffff000000ffffffffffffffffffffffffffffff000000000000000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffff000000ffffffffffff +ffffff000000ffffffffffffffffffffffffffffff000000ffffffffffffffffff000000 +ffffffffffffffffff000000000000000000000000ffffffffffff000000ffffffffffff +ffffff000000ffffffffffff000000ffffffffffffffffff000000000000000000ffffff +000000ffffffffffffffffffffffff000000ffffffffffff000000ffffffffffff000000 +ffffffffffffffffff000000ffffffffffff000000ffffffffffff000000ffffffffffff +000000ffffffffffff000000ffffffffffffffffffffffff000000000000000000ffffff +000000ffffffffffff000000ffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffff000000ffffffffffff +ffffff000000ffffffffffff000000ffffffffffff000000ffffffffffffffffffffffff +ffffff000000ffffffffffffffffffffffffffffffffffffffffff000000000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff000000 +ffffffffffffffffff000000ffffffffffffffffffffffffffffff000000ffffffffffff +ffffff000000ffffffffffff000000ffffffffffff000000ffffffffffff000000ffffff +000000ffffffffffffffffffffffff000000ffffffffffff000000ffffffffffff000000 +ffffffffffffffffff000000ffffffffffff000000ffffffffffff000000000000000000 +ffffffffffffffffff000000ffffffffffffffffff000000ffffffffffff000000ffffff +000000ffffffffffff000000ffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffff000000ffffffffffff +ffffffffffffffffffffffff000000ffffffffffffffffff000000ffffffffffffffffff +ffffff000000ffffffffffffffffff000000ffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffff000000ffffffffffff +ffffffffffff000000ffffffffffffffffff000000ffffff000000ffffffffffff000000 +ffffffffffffffffff000000000000ffffffffffff000000ffffff000000ffffffffffff +ffffff000000ffffffffffff000000ffffffffffff000000ffffffffffff000000ffffff +000000ffffffffffffffffffffffff000000ffffffffffff000000ffffffffffff000000 +ffffffffffffffffff000000ffffffffffff000000ffffffffffffffffff000000ffffff +ffffffffffffffffff000000ffffffffffffffffff000000ffffffffffff000000ffffff +000000ffffffffffff000000ffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffff000000ffffffffffff +ffffffffffff000000ffffff000000ffffffffffffffffffffffff000000ffffffffffff +ffffff000000ffffffffffffffffff000000000000ffffffffffff000000000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffff000000000000000000000000 +000000000000000000ffffffffffff000000000000ffffff000000000000ffffffffffff +000000000000ffffffffffff000000000000000000ffffff000000000000000000ffffff +000000000000000000ffffff000000000000ffffffffffff000000000000ffffff000000 +000000000000ffffffffffffffffff000000000000000000ffffffffffff000000000000 +000000ffffffffffffffffff000000000000ffffffffffffffffffffffff000000000000 +000000ffffff000000000000000000ffffffffffffffffff000000000000ffffff000000 +000000000000ffffff000000000000ffffff000000000000ffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffff000000000000000000000000 +000000000000000000000000000000000000ffffffffffffffffff000000000000ffffff +000000000000000000ffffffffffff000000ffffff000000000000000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffff000000000000000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000 +000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +000000000000000000000000000000000000000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000 +ffffffffffffffffffffffffffffffffffffffffff000000000000000000000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000 +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000000000ffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000 +000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000000000ffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffff000000000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000 +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000 +000000000000000000ffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000 +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000 +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000ffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000 +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000 +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000 +000000000000000000ffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffff000000000000000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000 +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffff000000ffffffffffffffffff000000ffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffff000000000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffff000000000000 +ffffffffffff000000000000ffffffffffff000000000000ffffffffffffffffffffffff +000000000000ffffff000000000000ffffff000000000000000000ffffff000000000000 +ffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffff000000ffffffffffff +000000ffffff000000ffffff000000ffffff000000ffffff000000ffffffffffff000000 +ffffff000000000000ffffffffffffffffff000000ffffff000000000000ffffff000000 +ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffff000000ffffffffffffffffff000000ffffff000000ffffffffffff +000000ffffff000000ffffff000000ffffff000000ffffff000000ffffffffffff000000 +ffffffffffff000000ffffffffffffffffff000000ffffffffffff000000ffffffffffff +ffffff000000ffffffffffffffffffffffffffffff000000000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000 +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffff000000000000000000ffffffffffffffffff000000000000 +ffffffffffff000000ffffff000000ffffff000000ffffff000000ffffffffffffffffff +000000000000ffffff000000000000ffffff000000000000ffffff000000000000000000 +ffffffffffff000000000000000000000000000000000000000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000 +000000000000000000ffffffffffffffffffffffffffffffffffff000000ffffffffffff +000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffff000000000000000000000000000000000000000000000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000 +000000000000000000000000000000000000ffffffffffffffffff000000ffffffffffff +ffffff000000ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffff000000ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000ffffff000000ffffffffffff +ffffff000000ffffffffffff000000ffffff000000000000ffffffffffff000000000000 +ffffff000000ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffff000000000000000000000000000000000000000000000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000 +000000000000000000000000000000000000ffffffffffffffffff000000ffffffffffff +ffffff000000ffffff000000ffffff000000ffffffffffff000000ffffff000000ffffff +ffffff000000ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffff000000000000000000000000000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000 +000000000000000000ffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffff000000ffffffffffffffffff000000ffffffffffff000000ffffff000000ffffff +ffffff000000ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffff000000000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000 +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +000000000000000000ffffffffffffffffff000000000000ffffffffffff000000ffffff +ffffff000000ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffff000000000000000000ffffffffffff000000000000ffffff000000 +000000ffffffffffffffffff000000000000ffffffffffff000000000000ffffffffffff +000000000000ffffff000000000000ffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffff000000ffffffffffff000000ffffff000000ffffff000000ffffff +ffffff000000ffffff000000ffffffffffffffffff000000ffffff000000ffffff000000 +ffffffffffff000000ffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffff000000ffffffffffff000000ffffff000000ffffff000000ffffff +ffffff000000ffffff000000ffffffffffffffffff000000ffffffffffffffffffffffff +ffffff000000ffffffffffff000000ffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffff000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffff000000ffffff000000ffffffffffff000000ffffffffffff000000 +000000ffffffffffffffffff000000000000ffffffffffff000000000000ffffff000000 +000000000000000000000000000000ffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffff000000000000 +000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000 +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000 +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffff000000000000000000000000000000 +000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000 +ffffffffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000 +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffff000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffff000000000000000000000000000000 +000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffff000000000000 +000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffff000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000000000ffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000 +000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000000000ffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000 +ffffffffffffffffffffffffffffffffffffffffff000000000000000000000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000 +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +000000000000000000000000000000000000000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffff000000000000000000ffffffffffffffffff000000000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffff000000ffffffffffffffffff000000ffffff000000ffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffff000000ffffffffffffffffff000000ffffff000000000000ffffffffffffffffff +ffffff000000000000000000ffffffffffff000000000000ffffffffffff000000000000 +ffffffffffffffffff000000000000ffffffffffff000000000000ffffffffffff000000 +000000ffffff000000000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffff000000ffffffffffffffffff000000ffffffffffffffffff000000000000ffffff +ffffff000000ffffffffffff000000ffffff000000ffffffffffff000000ffffffffffff +000000ffffff000000ffffffffffffffffff000000ffffff000000ffffff000000ffffff +ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffff000000ffffffffffffffffff000000ffffff000000ffffffffffff000000ffffff +ffffff000000ffffffffffff000000ffffff000000ffffffffffff000000ffffffffffff +000000ffffff000000ffffffffffffffffff000000ffffffffffffffffffffffffffffff +000000ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffff000000000000000000ffffffffffffffffff000000000000ffffffffffff +ffffff000000ffffff000000ffffffffffff000000ffffffffffffffffff000000000000 +ffffffffffffffffff000000000000ffffffffffff000000000000ffffff000000000000 +000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffff000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffff000000000000ffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000000000ffffffffffff000000000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffff000000ffffffffffffffffff +ffffff000000000000000000000000000000ffffffffffffffffff000000000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff000000ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffff000000000000000000ffffffffffff000000000000ffffff000000ffffff +000000000000000000ffffff000000000000ffffffffffffffffff000000000000000000 +000000ffffff000000000000000000ffffffffffff000000000000ffffffffffff000000 +000000ffffffffffffffffff000000000000ffffffffffff000000000000ffffffffffff +000000000000ffffff000000000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffff000000ffffffffffffffffffffffff000000ffffffffffff000000ffffff +ffffffffffff000000ffffff000000ffffff000000ffffff000000ffffffffffff000000 +ffffffffffff000000ffffffffffff000000ffffff000000ffffffffffff000000ffffff +ffffff000000ffffff000000ffffffffffffffffff000000ffffff000000ffffff000000 +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffff000000ffffffffffffffffff000000000000ffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffff000000ffffffffffff000000ffffff +000000ffffff000000ffffff000000ffffff000000ffffffffffff000000000000ffffff +ffffffffffff000000ffffffffffff000000ffffff000000ffffffffffff000000ffffff +ffffff000000ffffff000000ffffffffffffffffff000000ffffffffffffffffffffffff +ffffff000000ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffff000000000000000000ffffffffffffffffffffffffffffff +ffffff000000000000000000000000000000ffffff000000ffffffffffff000000ffffff +000000000000000000ffffff000000ffffff000000ffffffffffff000000000000ffffff +ffffffffffff000000ffffff000000ffffffffffff000000ffffffffffffffffff000000 +000000ffffffffffffffffff000000000000ffffffffffff000000000000ffffff000000 +000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff000000 +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000ffffff +ffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000 +000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000 +000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000000000000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000 +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000ffffffffffffffffffffffff +ffffff000000ffffffffffffffffff000000ffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000 +000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffff +ffffff000000ffffffffffffffffffffffffffffffffffff000000000000ffffff000000 +000000ffffff000000ffffffffffffffffff000000000000ffffff000000ffffffffffff +ffffff000000ffffff000000ffffffffffff000000000000ffffffffffff000000000000 +ffffffffffff000000000000ffffff000000000000000000ffffff000000000000000000 +000000ffffffffffff000000000000ffffff000000000000ffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000 +000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffff000000ffffffffffffffffffffffffffffff000000ffffffffffff000000000000 +ffffff000000ffffff000000ffffffffffff000000ffffff000000ffffff000000ffffff +ffffff000000ffffff000000ffffffffffff000000ffffff000000ffffffffffff000000 +ffffff000000ffffffffffffffffffffffffffffff000000ffffff000000ffffffffffff +000000ffffff000000ffffffffffff000000000000ffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000 +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffff000000ffffffffffffffffff000000ffffff000000ffffffffffff000000000000 +ffffff000000ffffff000000ffffffffffff000000ffffff000000ffffff000000ffffff +ffffff000000ffffff000000ffffffffffff000000ffffff000000ffffffffffff000000 +ffffff000000ffffffffffffffffff000000ffffff000000ffffff000000ffffffffffff +000000ffffff000000ffffffffffff000000000000ffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000000000000000ffffffffffffffffff000000000000ffffff000000 +ffffff000000ffffff000000ffffffffffff000000ffffff000000ffffff000000ffffff +ffffffffffff000000000000ffffffffffff000000ffffff000000ffffffffffff000000 +ffffffffffff000000000000ffffff000000000000000000ffffff000000000000ffffff +000000ffffffffffff000000000000ffffff000000ffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000ffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + +showpage + +% stop using temporary dictionary +end + +% restore original state +origstate restore + +%%Trailer diff --git a/system/doc/tutorial/port_driver.c b/system/doc/tutorial/port_driver.c new file mode 100644 index 0000000000..d428d08ff3 --- /dev/null +++ b/system/doc/tutorial/port_driver.c @@ -0,0 +1,52 @@ +/* port_driver.c */ + +#include +#include "erl_driver.h" + +typedef struct { + ErlDrvPort port; +} example_data; + +static ErlDrvData example_drv_start(ErlDrvPort port, char *buff) +{ + example_data* d = (example_data*)driver_alloc(sizeof(example_data)); + d->port = port; + return (ErlDrvData)d; +} + +static void example_drv_stop(ErlDrvData handle) +{ + driver_free((char*)handle); +} + +static void example_drv_output(ErlDrvData handle, char *buff, int bufflen) +{ + example_data* d = (example_data*)handle; + char fn = buff[0], arg = buff[1], res; + if (fn == 1) { + res = foo(arg); + } else if (fn == 2) { + res = bar(arg); + } + driver_output(d->port, &res, 1); +} + +ErlDrvEntry example_driver_entry = { + NULL, /* F_PTR init, N/A */ + example_drv_start, /* L_PTR start, called when port is opened */ + example_drv_stop, /* F_PTR stop, called when port is closed */ + example_drv_output, /* F_PTR output, called when erlang has sent */ + NULL, /* F_PTR ready_input, called when input descriptor ready */ + NULL, /* F_PTR ready_output, called when output descriptor ready */ + "example_drv", /* char *driver_name, the argument to open_port */ + NULL, /* F_PTR finish, called when unloaded */ + NULL, /* F_PTR control, port_command callback */ + NULL, /* F_PTR timeout, reserved */ + NULL /* F_PTR outputv, reserved */ +}; + +DRIVER_INIT(example_drv) /* must match name in driver_entry */ +{ + return &example_driver_entry; +} + diff --git a/system/doc/tutorial/port_driver.gif b/system/doc/tutorial/port_driver.gif new file mode 100644 index 0000000000..cf22ceef61 Binary files /dev/null and b/system/doc/tutorial/port_driver.gif differ diff --git a/system/doc/tutorial/port_driver.ps b/system/doc/tutorial/port_driver.ps new file mode 100644 index 0000000000..ad8a3b50f9 --- /dev/null +++ b/system/doc/tutorial/port_driver.ps @@ -0,0 +1,901 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%Creator: (ImageMagick) +%%Title: (./port_driver.tmp.eps) +%%CreationDate: (Tue Jun 12 17:25:22 2001) +%%BoundingBox: 0 43 377 246 +%%DocumentData: Clean7Bit +%%LanguageLevel: 1 +%%Pages: 0 +%%EndComments + +%%BeginDefaults +%%PageOrientation: Portrait +%%EndDefaults + +%%BeginProlog +% +% Display a color image. The image is displayed in color on +% Postscript viewers or printers that support color, otherwise +% it is displayed as grayscale. +% +/buffer 512 string def +/byte 1 string def +/color_packet 3 string def +/pixels 768 string def + +/DirectClassPacket +{ + % + % Get a DirectClass packet. + % + % Parameters: + % red. + % green. + % blue. + % length: number of pixels minus one of this color (optional). + % + currentfile color_packet readhexstring pop pop + compression 0 gt + { + /number_pixels 3 def + } + { + currentfile byte readhexstring pop 0 get + /number_pixels exch 1 add 3 mul def + } ifelse + 0 3 number_pixels 1 sub + { + pixels exch color_packet putinterval + } for + pixels 0 number_pixels getinterval +} bind def + +/DirectClassImage +{ + % + % Display a DirectClass image. + % + systemdict /colorimage known + { + columns rows 8 + [ + columns 0 0 + rows neg 0 rows + ] + { DirectClassPacket } false 3 colorimage + } + { + % + % No colorimage operator; convert to grayscale. + % + columns rows 8 + [ + columns 0 0 + rows neg 0 rows + ] + { GrayDirectClassPacket } image + } ifelse +} bind def + +/GrayDirectClassPacket +{ + % + % Get a DirectClass packet; convert to grayscale. + % + % Parameters: + % red + % green + % blue + % length: number of pixels minus one of this color (optional). + % + currentfile color_packet readhexstring pop pop + color_packet 0 get 0.299 mul + color_packet 1 get 0.587 mul add + color_packet 2 get 0.114 mul add + cvi + /gray_packet exch def + compression 0 gt + { + /number_pixels 1 def + } + { + currentfile byte readhexstring pop 0 get + /number_pixels exch 1 add def + } ifelse + 0 1 number_pixels 1 sub + { + pixels exch gray_packet put + } for + pixels 0 number_pixels getinterval +} bind def + +/GrayPseudoClassPacket +{ + % + % Get a PseudoClass packet; convert to grayscale. + % + % Parameters: + % index: index into the colormap. + % length: number of pixels minus one of this color (optional). + % + currentfile byte readhexstring pop 0 get + /offset exch 3 mul def + /color_packet colormap offset 3 getinterval def + color_packet 0 get 0.299 mul + color_packet 1 get 0.587 mul add + color_packet 2 get 0.114 mul add + cvi + /gray_packet exch def + compression 0 gt + { + /number_pixels 1 def + } + { + currentfile byte readhexstring pop 0 get + /number_pixels exch 1 add def + } ifelse + 0 1 number_pixels 1 sub + { + pixels exch gray_packet put + } for + pixels 0 number_pixels getinterval +} bind def + +/PseudoClassPacket +{ + % + % Get a PseudoClass packet. + % + % Parameters: + % index: index into the colormap. + % length: number of pixels minus one of this color (optional). + % + currentfile byte readhexstring pop 0 get + /offset exch 3 mul def + /color_packet colormap offset 3 getinterval def + compression 0 gt + { + /number_pixels 3 def + } + { + currentfile byte readhexstring pop 0 get + /number_pixels exch 1 add 3 mul def + } ifelse + 0 3 number_pixels 1 sub + { + pixels exch color_packet putinterval + } for + pixels 0 number_pixels getinterval +} bind def + +/PseudoClassImage +{ + % + % Display a PseudoClass image. + % + % Parameters: + % class: 0-PseudoClass or 1-Grayscale. + % + currentfile buffer readline pop + token pop /class exch def pop + class 0 gt + { + currentfile buffer readline pop + token pop /depth exch def pop + /grays columns 8 add depth sub depth mul 8 idiv string def + columns rows depth + [ + columns 0 0 + rows neg 0 rows + ] + { currentfile grays readhexstring pop } image + } + { + % + % Parameters: + % colors: number of colors in the colormap. + % colormap: red, green, blue color packets. + % + currentfile buffer readline pop + token pop /colors exch def pop + /colors colors 3 mul def + /colormap colors string def + currentfile colormap readhexstring pop pop + systemdict /colorimage known + { + columns rows 8 + [ + columns 0 0 + rows neg 0 rows + ] + { PseudoClassPacket } false 3 colorimage + } + { + % + % No colorimage operator; convert to grayscale. + % + columns rows 8 + [ + columns 0 0 + rows neg 0 rows + ] + { GrayPseudoClassPacket } image + } ifelse + } ifelse +} bind def + +/DisplayImage +{ + % + % Display a DirectClass or PseudoClass image. + % + % Parameters: + % x & y translation. + % x & y scale. + % label pointsize. + % image label. + % image columns & rows. + % class: 0-DirectClass or 1-PseudoClass. + % compression: 0-RunlengthEncodedCompression or 1-NoCompression. + % hex color packets. + % + gsave + currentfile buffer readline pop + token pop /x exch def + token pop /y exch def pop + x y translate + currentfile buffer readline pop + token pop /x exch def + token pop /y exch def pop + currentfile buffer readline pop + token pop /pointsize exch def pop + /Helvetica findfont pointsize scalefont setfont + x y scale + currentfile buffer readline pop + token pop /columns exch def + token pop /rows exch def pop + currentfile buffer readline pop + token pop /class exch def pop + currentfile buffer readline pop + token pop /compression exch def pop + class 0 gt { PseudoClassImage } { DirectClassImage } ifelse + grestore +} bind def +%%EndProlog +%%Page: 1 1 +%%PageBoundingBox: 0 43 377 246 +userdict begin +%%BeginData: +DisplayImage +0 43 +377.000000 203.000000 +12 +698 376 +1 +0 +0 +256 +000000 +000055 +0000aa +0000ff +002400 +002455 +0024aa +0024ff +004900 +004955 +0049aa +0049ff +006d00 +006d55 +006daa +006dff +009200 +009255 +0092aa +0092ff +00b600 +00b655 +00b6aa +00b6ff +00db00 +00db55 +00dbaa +00dbff +00ff00 +00ff55 +00ffaa +00ffff +240000 +240055 +2400aa +2400ff +242400 +242455 +2424aa +2424ff +244900 +244955 +2449aa +2449ff +246d00 +246d55 +246daa +246dff +249200 +249255 +2492aa +2492ff +24b600 +24b655 +24b6aa +24b6ff +24db00 +24db55 +24dbaa +24dbff +24ff00 +24ff55 +24ffaa +24ffff +490000 +490055 +4900aa +4900ff +492400 +492455 +4924aa +4924ff +494900 +494955 +4949aa +4949ff +496d00 +496d55 +496daa +496dff +499200 +499255 +4992aa +4992ff +49b600 +49b655 +49b6aa +49b6ff +49db00 +49db55 +49dbaa +49dbff +49ff00 +49ff55 +49ffaa +49ffff +6d0000 +6d0055 +6d00aa +6d00ff +6d2400 +6d2455 +6d24aa +6d24ff +6d4900 +6d4955 +6d49aa +6d49ff +6d6d00 +6d6d55 +6d6daa +6d6dff +6d9200 +6d9255 +6d92aa +6d92ff +6db600 +6db655 +6db6aa +6db6ff +6ddb00 +6ddb55 +6ddbaa +6ddbff +6dff00 +6dff55 +6dffaa +6dffff +920000 +920055 +9200aa +9200ff +922400 +922455 +9224aa +9224ff +924900 +924955 +9249aa +9249ff +926d00 +926d55 +926daa +926dff +929200 +929255 +9292aa +9292ff +92b600 +92b655 +92b6aa +92b6ff +92db00 +92db55 +92dbaa +92dbff +92ff00 +92ff55 +92ffaa +92ffff +b60000 +b60055 +b600aa +b600ff +b62400 +b62455 +b624aa +b624ff +b64900 +b64955 +b649aa +b649ff +b66d00 +b66d55 +b66daa +b66dff +b69200 +b69255 +b692aa +b692ff +b6b600 +b6b655 +b6b6aa +b6b6ff +b6db00 +b6db55 +b6dbaa +b6dbff +b6ff00 +b6ff55 +b6ffaa +b6ffff +db0000 +db0055 +db00aa +db00ff +db2400 +db2455 +db24aa +db24ff +db4900 +db4955 +db49aa +db49ff +db6d00 +db6d55 +db6daa +db6dff +db9200 +db9255 +db92aa +db92ff +dbb600 +dbb655 +dbb6aa +dbb6ff +dbdb00 +dbdb55 +dbdbaa +dbdbff +dbff00 +dbff55 +dbffaa +dbffff +ff0000 +ff0055 +ff00aa +ff00ff +ff2400 +ff2455 +ff24aa +ff24ff +ff4900 +ff4955 +ff49aa +ff49ff +ff6d00 +ff6d55 +ff6daa +ff6dff +ff9200 +ff9255 +ff92aa +ff92ff +ffb600 +ffb655 +ffb6aa +ffb6ff +ffdb00 +ffdb55 +ffdbaa +ffdbff +ffff00 +ffff55 +ffffaa +ffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ff8c00ff00ff00adff0b00ff00ff00adff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ff2b00ff009effde0001ff0b0001ff2b +0000ffffff9c0000ffde0001ff0b0001ff2b0000ffffff9c0000ffde0001ff0b0001ff2b +0000ffffff9c0000ffde0001ff0b0001ff2b0000ffffff9c0000ffde0001ff0b0001ff2b +0000ffffff9c0000ffde0001ff0b0001ff2b0000ffffff9c0000ffde0001ff0b0001ff2b +0000ff2b0002ffffff6d0000ffde0001ff0b0001ff2b0000ff2c0001ffffff6d0000ffde +0001ff0b0001ff2b0000ff2c0001ff100000ffffff5b0000ffde0001ff0b0001ff2b0000 +ff2c0001ff0f0001ffffff5b0000ffde0001ff0b0001ff2b0000ff2c0001ff0f0001ffff +ff5b0000ffde0001ff0b0001ff2b0000ff050003ff030002ff010002ff030002ff020002 +ff030002ff020001ff050004ff020006ff020003ff040002ff000001ffffff460000ffde +0001ff0b0001ff2b0000ff030001ff020001ff030001ff000004ff010004ff020001ff04 +0001ff020001ff040001ff010002ff030001ff030002ff010002ff030001ff000001ffff +ff460000ffde0001ff0b0001ff2b0000ff030000ff040001ff020002ff020003ff020002 +ff010001ff040001ff020001ff040001ff020001ff030001ff030001ff030001ff030002 +ffffff480000ffde0001ff0b0001ff2b0000ff020001ff040001ff020001ff040001ff04 +0001ff010001ff040001ff020001ff090001ff030001ff020001ff050001ff020001ffff +ff490000ffde0001ff0b0001ff2b0000ff020008ff020001ff040001ff040001ff010001 +ff040001ff020001ff070003ff030001ff020001ff050001ff020001ffffff490000ffde +0001ff0b0001ff2b0000ff020001ff090001ff040001ff040001ff010001ff040001ff02 +0001ff050002ff000001ff030001ff020001ff050001ff020001ffffff490000ffde0001 +ff0b0001ff2b0000ff020001ff090001ff040001ff040001ff010001ff040001ff020001 +ff040001ff020001ff030001ff020001ff050001ff020001ff9500a2ff100000ffde0001 +ff0b0001ff2b0000ff020001ff090001ff040001ff040001ff010001ff040001ff020001 +ff030001ff030001ff030001ff020001ff050001ff020001ff950000ffa00000ff100000 +ffde0001ff0b0001ff2b0000ff020002ff080001ff040001ff040001ff010001ff040001 +ff020001ff030001ff030001ff030001ff020001ff050001ff020001ff950000ffa00000 +ff100000ffde0001ff0b0001ff2b0000ff030002ff030000ff020001ff040001ff040001 +ff010002ff020002ff020001ff030001ff020002ff030001ff030001ff030001ff030001 +ff950000ffa00000ff100000ffde0001ff0b0001ff2b0000ff030006ff030001ff040001 +ff040001ff020004ff000001ff020001ff030004ff000001ff030001ff010000ff000002 +ff010002ff030001ff950000ffa00000ff100000ffde0001ff0b0001ff2b0000ff050003 +ff030003ff020003ff020003ff020002ff010002ff000003ff030002ff020001ff030002 +ff030003ff040003ff940000ffa00000ff100000ffde0001ff0b0001ff2b0000ffe80000 +ffa00000ff100000ffde0001ff0b0001ff2b0000ffe80000ffa00000ff100000ffde0001 +ff0b0001ff2b0000ffe80000ffa00000ff100000ffde0001ff0b0001ff2b0000ffe80000 +ffa00000ff100000ffde0001ff0b0001ff2b0000ffe80000ffa00000ff100000ffde0001 +ff0b0001ff2b0000ffe80000ff110009ff290002ff0b0001ff490000ff100000ffde0001 +ff0b0001ff2b0000ffe80000ff130001ff040002ff280001ff0b0001ff490000ff100000 +ffde0001ff0b0001ff2b0000ffe80000ff130001ff050001ff180000ff0e0001ff570000 +ff100000ffde0001ff0b0001ff2b0000ffe80000ff130001ff060001ff160001ff0e0001 +ff570000ff100000ffde0001ff0b0001ff2b0000ffe80000ff130001ff060001ff160001 +ff0e0001ff570000ff100000ffde0001ff0b0001ff2b0000ffe80000ff130001ff060001 +ff040003ff040002ff000001ff000006ff070002ff000001ff020002ff000001ff010002 +ff010003ff020003ff030003ff030002ff000001ff2a0000ff100000ffde0001ff0b0001 +ff2b0000ffe80000ff130001ff050001ff030002ff010002ff030001ff000001ff020001 +ff080002ff010002ff030001ff000001ff020001ff020001ff040001ff020001ff020001 +ff030001ff000001ff2a0000ff100000ffde0001ff0b0001ff2b0000ff320004ffae0002 +ff130001ff040002ff030001ff030001ff030002ff040001ff080001ff030001ff030002 +ff040001ff020001ff040000ff030000ff040001ff020002ff2c0000ff100000ffde0001 +ff0b0001ff2b0000ff2d0004ff040004ffa40004ff010000ff130007ff040001ff050001 +ff020001ff050001ff070001ff040001ff030001ff050001ff030001ff030000ff020001 +ff040001ff020001ff2d0000ff100000ffde0001ff0b0001ff2b0000ff290003ff0e0003 +ff9c0003ff060000ff130001ff0a0001ff050001ff020001ff050001ff070001ff040001 +ff030001ff050001ff030001ff030000ff020008ff020001ff2d0000ff100000ffde0001 +ff0b0001ff2b0000ff260002ff160002ff960002ff0a0000ff130001ff0a0001ff050001 +ff020001ff050001ff070001ff040001ff030001ff050001ff030001ff020000ff030001 +ff090001ff2d0000ff100000ffde0001ff0b0001ff2b0000ff240001ff1c0001ff920001 +ff0d0000ff130001ff0a0001ff050001ff020001ff050001ff070001ff040001ff030001 +ff050001ff040001ff010000ff030001ff090001ff2d0000ff100000ffde0001ff0b0001 +ff2b0000ff230000ff200000ff900000ff0f0000ff130001ff0a0001ff050001ff020001 +ff050001ff070001ff040001ff030001ff050001ff040001ff010000ff030001ff090001 +ff2d0000ff100000ffde0001ff0b0001ff2b0000ff220000ff220000ff8e0000ff100000 +ff130001ff0a0001ff050001ff020001ff050001ff070001ff040001ff030001ff050001 +ff040001ff000000ff040002ff080001ff2d0000ff100000ffde0001ff0b0001ff2b0000 +ff200001ff240001ff8a0001ff110000ff130001ff0b0001ff030001ff030001ff050001 +ff080001ff030001ff030001ff050001ff050002ff050002ff030000ff020001ff2d0000 +ff100000ffde0001ff0b0001ff2b0000ff1f0000ff280000ff880000ff130000ff130001 +ff0b0002ff010002ff030001ff050001ff010000ff050002ff010002ff030001ff050001 +ff050002ff050006ff030001ff2d0000ff100000ffde0001ff0b0001ff2b0000ff1e0000 +ff2a0000ff860000ff140000ff110005ff0b0003ff040003ff050002ff080003ff000001 +ff010003ff030003ff050000ff080003ff030003ff2c0000ff100000ffde0001ff0b0001 +ff2b0000ff1c0001ff2c0001ff820001ff150000ffa00000ff100000ffde0001ff0b0001 +ff2b0000ff1b0000ff300000ff800000ff170000ffa00000ff100000ffde0001ff0b0001 +ff2b0000ff1a0000ff320000ff7e0000ff130001ff020000ffa00000ff100000ffde0001 +ff0b0001ff2b0000ff1a0000ff320000ff7e0000ff130005ffa00000ff100000ffde0001 +ff0b0001ff2b0000ff190000ff340000ff7c0000ff140008ff9d0000ff100000ffde0001 +ff0b0001ff2b0000ff180000ff360000ff7a0000ff15000bff9a0000ff100000ffde0001 +ff0b0001ff2b0000ff170000ff380000ff780000ff16000fff960000ff100000ffde0001 +ff0b0001ff2b0000ff170000ff380000ff780000ff160013ff920000ff100000ffde0001 +ff0b0001ff2b0000ff160000ff3a0000ff760000ff0a0023ff0a0002ff2d0002ff080002 +ff030001ff020002ff380000ff100000ffde0001ff0b0001ff2b0000ff150000ff080003 +ff010000ff2c0000ff0d0002ff630000ff180013ff0e0001ff2e0001ff090001ff030001 +ff030001ff380000ff100000ffde0001ff0b0001ff2b0000ff140000ff070001ff030002 +ff2d0000ff0d0001ff620000ff19000fff120001ff2e0001ff090001ff090001ff380000 +ff100000ffde0001ff0b0001ff2b0000ff140000ff060001ff050001ff2c0001ff0d0001 +ff620000ff19000bff160001ff2e0001ff090001ff090001ff380000ff100000ffde0001 +ff0b0001ff2b0000ff130000ff070001ff060000ff2b0001ff000000ff0c0001ff610000 +ff1a0008ff190001ff2e0001ff090001ff090001ff380000ff100000ffde0001ff0b0001 +ff2b0000ff130000ff060001ff0a0003ff020002ff010001ff010002ff010001ff030003 +ff030003ff010004ff010003ff030004ff610000ff1a0005ff130004ff030001ff010002 +ff060004ff030002ff000001ff040003ff060002ff000001ff090001ff020002ff030001 +ff000002ff040002ff000001ff030004ff030002ff000001ff000003ff020003ff0a0000 +ff100000ffde0001ff0b0001ff2b0000ff130000ff060001ff090001ff010001ff020001 +ff000003ff010001ff000003ff010001ff010001ff010001ff010001ff010001ff000000 +ff000001ff010001ff010001ff010001ff610000ff1a0001ff020000ff120000ff020001 +ff030001ff000004ff040001ff010002ff030001ff000001ff020001ff020001ff030002 +ff010002ff090001ff030001ff030002ff010002ff030001ff000001ff020001ff010002 +ff030001ff000001ff010001ff040001ff0b0000ff100000ffde0001ff0b0001ff2b0000 +ff120000ff070001ff080001ff030001ff010002ff010001ff010002ff010001ff000001 +ff030000ff000001ff060001ff010001ff030000ff000001ff020001ff600000ff200000 +ff110001ff030000ff030002ff020002ff030001ff020001ff030002ff040000ff040001 +ff020001ff030001ff090001ff030001ff030001ff030001ff030002ff040001ff020001 +ff030002ff030001ff040000ff0c0000ff100000ffde0001ff0b0001ff2b0000ff120000 +ff070001ff080001ff030001ff010001ff020001ff010001ff020001ff000006ff000001 +ff060001ff010006ff000001ff020001ff600000ff200000ff110002ff070001ff040001 +ff080001ff030001ff040001ff040001ff010001ff040001ff090001ff030001ff030001 +ff040001ff020001ff0a0001ff030001ff050001ff030000ff0c0000ff100000ffde0001 +ff0b0001ff2b0000ff120000ff070001ff080001ff030001ff010001ff020001ff010001 +ff020001ff000001ff050001ff060001ff010001ff050001ff020001ff600000ff200000 +ff120002ff060001ff040001ff060003ff030001ff040008ff010001ff040001ff090001 +ff030001ff030001ff040001ff020001ff080003ff030001ff050001ff030000ff0c0000 +ff100000ffde0001ff0b0001ff2b0000ff120000ff080001ff070001ff030001ff010001 +ff020001ff010001ff020001ff000001ff050001ff060001ff010001ff050001ff020001 +ff600000ff200000ff120004ff040001ff040001ff040002ff000001ff030001ff040001 +ff080001ff040001ff090001ff030001ff030001ff040001ff020001ff060002ff000001 +ff030001ff050001ff020000ff0d0000ff100000ffde0001ff0b0001ff2b0000ff110000 +ff090001ff050003ff030001ff010001ff020001ff010001ff020001ff000001ff050001 +ff060001ff010001ff050001ff020001ff5f0000ff210000ff140003ff030001ff040001 +ff030001ff020001ff030001ff040001ff080001ff040001ff090001ff030001ff030001 +ff040001ff020001ff050001ff020001ff030001ff060001ff010000ff0d0000ff100000 +ffde0001ff0b0001ff2b0000ff110000ff0a0002ff020001ff010001ff010001ff020001 +ff020001ff010001ff020001ff010001ff010001ff010001ff010001ff010002ff000002 +ff010001ff010001ff010001ff080000ff190001ff190007ff170000ff210000ff160002 +ff020001ff040001ff020001ff030001ff030001ff040001ff080001ff040001ff090001 +ff030001ff030001ff040001ff020001ff040001ff030001ff030001ff060001ff010000 +ff0d0000ff100000ffde0001ff0b0001ff2b0000ff110000ff0c0003ff040003ff020003 +ff010006ff010002ff010003ff030003ff030002ff000004ff030005ff040003ff190004 +ff170001ff020002ff160000ff210000ff170001ff020001ff040001ff020001ff030001 +ff030001ff040002ff070001ff040001ff090001ff030001ff030001ff040001ff020001 +ff040001ff030001ff030001ff060001ff000000ff0e0000ff100000ffde0001ff0b0001 +ff2b0000ff110000ff440000ff0e0007ff190008ff130001ff030001ff100000ff040000 +ff210000ff110000ff040001ff020001ff040001ff020001ff020002ff030001ff050002 +ff030000ff020001ff030001ff090001ff030001ff030001ff030001ff030001ff040001 +ff020002ff030001ff070002ff0e0000ff100000ffde0001ff0b0001ff2b0000ff110000 +ff440000ff0b000aff19000bff100001ff030001ff0f0001ff040000ff210000ff110001 +ff020001ff030001ff040001ff020004ff000001ff030001ff050006ff030002ff010002 +ff090001ff030001ff030002ff010002ff030001ff040004ff000001ff030001ff070002 +ff0e0000ff100000ffde0001ff0b0001ff2b0000ff100000ff460000ff06000eff19000f +ff0c0001ff030001ff010003ff020002ff000006ff010000ff220000ff110004ff040003 +ff020003ff020002ff020001ff010003ff060003ff060003ff000001ff070003ff010003 +ff020000ff000003ff040003ff040002ff020001ff010003ff070000ff0f0000ff100000 +ffde0001ff0b0001ff2b0000ff100000ff460000ff020012ff190013ff080001ff020001 +ff010001ff010001ff020001ff000001ff000001ff030000ff220000ff8e0001ff0f0000 +ff100000ffde0001ff0b0001ff2b0000ff100000ff460047ff050005ff010001ff030001 +ff010002ff020001ff030000ff220000ff8e0000ff100000ff100000ffde0001ff0b0001 +ff2b0000ff100000ff460000ff020012ff190013ff080001ff050001ff030001ff010001 +ff030001ff030000ff220000ff8d0001ff100000ff100000ffde0001ff0b0001ff2b0000 +ff100000ff460000ff06000eff19000fff0c0001ff050001ff030001ff010001ff030001 +ff030000ff220000ff8a0003ff110000ff100000ffde0001ff0b0001ff2b0000ff110000 +ff440000ff0b000aff19000bff100001ff050001ff030001ff010001ff030001ff040000 +ff210000ff8a0002ff120000ff100000ffde0001ff0b0001ff2b0000ff110000ff440000 +ff0e0007ff190008ff130001ff050001ff030001ff010001ff030001ff040000ff210000 +ffa00000ff100000ffde0001ff0b0001ff2b0000ff110000ff070002ff000002ff010002 +ff000001ff010003ff040003ff030003ff020001ff000000ff020001ff000000ff080000 +ff120003ff190004ff170001ff060001ff010001ff020001ff030002ff030000ff210000 +ffa00000ff100000ffde0001ff0b0001ff2b0000ff110000ff080002ff000002ff010001 +ff000001ff000001ff010001ff020001ff010001ff010001ff010001ff000000ff010001 +ff010000ff010001ff080000ff150000ff190001ff190003ff060003ff020003ff030002 +ff020000ff210000ffa00000ff100000ffde0001ff0b0001ff2b0000ff110000ff080001 +ff020001ff010002ff010001ff030001ff000001ff050001ff030000ff000001ff010000 +ff010001ff010000ff070000ff6d0000ff210000ffa00000ff100000ffde0001ff0b0001 +ff2b0000ff120000ff070001ff020001ff010001ff020001ff030001ff000001ff050006 +ff000002ff030002ff090000ff6e0000ff200000ffa00000ff100000ffde0001ff0b0001 +ff2b0000ff120000ff070001ff020001ff010001ff020001ff030001ff000001ff050001 +ff060002ff030002ff080000ff6e0000ff200000ffa00000ff100000ffde0001ff0b0001 +ff2b0000ff120000ff070001ff020001ff010001ff020001ff030001ff000001ff050001 +ff070002ff030002ff070000ff6e0000ff200000ffa00000ff100000ffde0001ff0b0001 +ff2b0000ff120000ff070001ff020001ff010001ff020001ff030001ff000001ff050001 +ff050000ff010001ff010000ff010001ff070000ff6e0000ff200000ffa00000ff100000 +ffde0001ff0b0001ff2b0000ff130000ff060002ff000001ff020001ff030001ff010001 +ff020001ff010001ff010001ff010001ff000001ff010000ff010001ff010000ff060000 +ff700000ff1f0000ff020000ff9c0000ff100000ffde0001ff0b0001ff2b0000ff130000 +ff060004ff020003ff030003ff040003ff030003ff010000ff000001ff020000ff000001 +ff070000ff700000ff1f0004ff9c0000ff100000ffde0001ff0b0001ff2b0000ff130000 +ff060001ff370000ff700000ff1c0007ff9c0000ff100000ffde0001ff0b0001ff2b0000 +ff140000ff050001ff360000ff720000ff18000aff9c0000ff100000ffde0001ff0b0001 +ff2b0000ff140000ff050001ff360000ff720000ff14000eff9c0000ff100000ffde0001 +ff0b0001ff2b0000ff150000ff030003ff340000ff740000ff0f0012ff9c0000ff100000 +ffde0001ff0b0001ff2b0000ff160000ff3a0000ff760000ff0b0023ff8e0000ff100000 +ffde0001ff0b0001ff2b0000ff170000ff380000ff780000ff0d0012ff9c0000ff100000 +ffde0001ff0b0001ff2b0000ff170000ff380000ff780000ff11000eff9c0000ff100000 +ffde0001ff0b0001ff2b0000ff180000ff360000ff7a0000ff14000aff9c0000ff100000 +ffde0001ff0b0001ff2b0000ff190000ff340000ff7c0000ff160007ff9c0000ff100000 +ffde0001ff0b0001ff2b0000ff1a0000ff320000ff7e0000ff180004ff9c0000ff100000 +ffde0001ff0b0001ff2b0000ff1a0000ff320000ff7e0000ff180000ff020000ff9c0000 +ff100000ffde0001ff0b0001ff2b0000ff1b0000ff300000ff800000ff170000ffa00000 +ff100000ffde0001ff0b0001ff2b0000ff1c0001ff2c0001ff820001ff150000ffa00000 +ff100000ffde0001ff0b0001ff2b0000ff1e0000ff2a0000ff860000ff140000ffa00000 +ff100000ffde0001ff0b0001ff2b0000ff1f0000ff280000ff880000ff130000ffa00000 +ff100000ffde0001ff0b0001ff2b0000ff200001ff240001ff8a0001ff110000ffa00000 +ff100000ffde0001ff0b0001ff2b0000ff220000ff220000ff8e0000ff100000ffa00000 +ff100000ffde0001ff0b0001ff2b0000ff230000ff200000ff900000ff0f0000ffa00000 +ff100000ffde0001ff0b0001ff2b0000ff240001ff1c0001ff920001ff0d0000ffa00000 +ff100000ffde0001ff0b0001ff2b0000ff260002ff160002ff960002ff0a0000ffa00000 +ff100000ffde0001ff0b0001ff2b0000ff290004ff0c0004ff9c0004ff050000ffa00000 +ff100000ffde0001ff0b0001ff2b0000ff2e0003ff040003ffa60003ff010000ffa00000 +ff100000ffde0001ff0b0001ff2b0000ff320004ffae0002ffa00000ff100000ffde0001 +ff0b0001ff2b0000ffe80000ffa00000ff100000ffde0001ff0b0001ff2b0000ffe80000 +ffa00000ff100000ffde0001ff0b0001ff2b0000ffe80000ffa00000ff100000ffde0001 +ff0b0001ff2b0000ffe80000ffa00000ff100000ffde0001ff0b0001ff2b0000ffe80000 +ffa00000ff100000ffde0001ff0b0001ff2b0000ffe80000ffa00000ff100000ffde0001 +ff0b0001ff2b0000ffe80000ffa00000ff100000ffde0001ff0b0001ff2b0000ffe80000 +ffa00000ff100000ffde0001ff0b0001ff2b0000ffe80000ffa00000ff100000ffde0001 +ff0b0001ff2b0000ffe80000ffa00000ff100000ffde0001ff0b0001ff2b0000ffe80000 +ffa00000ff100000ffde0001ff0b0001ff2b0000ffe80000ffa00000ff100000ffde0001 +ff0b0001ff2b0000ffe80000ffa00000ff100000ffde0001ff0b0001ff2b0000ffe80000 +ffa00000ff100000ffde0001ff0b0001ff2b0000ffe80000ffa00000ff100000ffde0001 +ff0b0001ff2b0000ffe80000ffa00000ff100000ffde0001ff0b0001ff2b0000ffe80000 +ffa00000ff100000ffde0001ff0b0001ff2b0000ffe800a2ff100000ffde0001ff0b0001 +ff2b0000ffffff9c0000ffde0001ff0b0001ff2b0000ffffff9c0000ffde0001ff0b0001 +ff2b0000ffffff9c0000ffde0001ff0b0001ff2b0000ffffff9c0000ffde0001ff0b0001 +ff2b0000ffffff9c0000ffde0001ff0b0001ff2b0000ffffff9c0000ffde0001ff0b0001 +ff2b0000ffffff9c0000ffde0001ff0b0001ff2b0000ffffff9c0000ffde0001ff0b0001 +ff2b0000ffffff9c0000ffde0001ff0b0001ff2b0000ffffff9c0000ffde0001ff0b0001 +ff2b0000ffffff9c0000ffde0001ff0b0001ff2b0000ffffff9c0000ffde0001ff0b0001 +ff2b0000ffffff9c0000ffde0001ff0b0001ff2b0000ffffff9c0000ffde0001ff0b0001 +ff2b0000ffffff9c0000ffde0001ff0b0001ff2b0000ffffff9c0000ffde0001ff0b0001 +ff2b0000ffffff9c0000ffde0001ff0b0001ff2b00ff009effde0001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffff +ffa90001ff0b0001ff5e002fffffffffff1a0001ff0b0001ff5e0000ff2d0000ffffffff +ff1a0001ff0b0001ff5e0000ff2d0000ffffffffff1a0001ff0b0001ff5e0000ff2d0000 +ffffffffff1a0001ff0b0001ff5e0000ff2d0000ffffffffff1a0001ff0b0001ff5e0000 +ff2d0000ffffffffff1a0001ff0b0001ff5e0000ff2d0000ffffffffff1a0001ff0b0001 +ff5e0000ff2d0000ffffffffff1a0001ff0b0001ff5e0000ff2d0000ffffffffff1a0001 +ff0b0001ff5e0000ff2d0000ffffffffff1a0001ff0b0001ff5e0000ff2d0000ffffffff +ff1a0001ff0b0001ff5e0000ff2d0000ffffffffff1a0001ff0b0001ff5e0000ff2d0000 +ff0c0003ff070002ff000000fffffffc0001ff0b0001ff5e0000ff2d0000ff0a0001ff03 +0001ff040000ff020001fffffffc0001ff0b0001ff5e0000ff2d0000ff090001ff050001 +ff020001ff030000fffffffc0001ff0b0001ff5e0000ff2d0000ff090001ff050001ff02 +0001ffffffffff010001ff0b0001ff5e0000ff2d0000ff080001ff070001ff010002ff09 +0002ff000002ff010002ff000001ff020003ff040003ff030003ff020001ff000000ff01 +0001ff000000ffffffc20001ff0b0001ff5e0000ff2d0000ff080001ff070001ff020003 +ff080002ff000002ff010001ff000001ff010001ff010001ff020001ff010001ff010001 +ff010001ff000000ff010001ff000000ff010001ffffffc20001ff0b0001ff5e0000ff2d +0000ff080001ff070001ff030003ff070001ff020001ff010002ff020001ff030001ff00 +0001ff050001ff030000ff000001ff010000ff000001ff010000ffffffc20001ff0b0001 +ff5e0000ff2d0000ff080001ff070001ff050002ff060001ff020001ff010001ff030001 +ff030001ff000001ff050006ff000002ff020002ffffffc40001ff0b0001ff5e0000ff2d +0000ff080001ff070001ff060002ff050001ff020001ff010001ff030001ff030001ff00 +0001ff050001ff060002ff020002ffffffc30001ff0b0001ff5e0000ff2d0000ff090001 +ff050001ff080001ff050001ff020001ff010001ff030001ff030001ff000001ff050001 +ff070002ff020002ffffffc20001ff0b0001ff5e0000ff2d0000ff090001ff050001ff02 +0000ff040001ff050001ff020001ff010001ff030001ff030001ff000001ff050001ff05 +0000ff010001ff000000ff010001ffffffc20001ff0b0001ff5e0000ff2d0000ff0a0001 +ff030001ff030001ff020001ff060002ff000001ff020001ff040001ff010001ff020001 +ff010001ff010001ff010001ff000001ff010000ff000001ff010000ffffffc20001ff0b +0001ff5e0000ff2d0000ff0c0003ff050000ff000002ff080004ff020003ff040003ff04 +0003ff030003ff010000ff000001ff010000ff000001ffffffc30001ff0b0001ff5e0000 +ff2d0000ff240001fffffff30001ff0b0001ff5e0000ff2d0000ff240001fffffff30001 +ff0b0001ff5e0000ff2d0000ff240001fffffff30001ff0b0001ff5e0000ff2d0000ff23 +0003fffffff20001ff0b0001ff5e002fffffffffff1a0001ff0b0001ffffffffffa90001 +ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001 +ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001 +ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001 +ff0b0001ff7e0004ffffffffff250001ff0b0001ff7b0002ff040002ffffffffff220001 +ff0b0001ff790001ff0a0001ffffffffff200001ff0b0001ff780000ff0e0000ffffffff +ff1f0001ff0b0001ff770000ff100000ffffffffff1e0001ff0b0001ff760000ff120000 +ffffffffff1d0001ff0b0001ff750000ff130000ffffffffff1d0001ff0b0001ff750000 +ff140000ffffffffff1c0001ff0b0001ff740000ff160000ffffffffff1b0001ff0b0001 +ff740000ff160000ffffffffff1b0001ff0b0001ff740000ff160000ffffffffff1b0001 +ff0b0001ff730000ff170000ff090008ff070002fffffffd0001ff0b0001ff730000ff18 +0000ff090001ff030001ff080001fffffffd0001ff0b0001ff730000ff180000ff090001 +ff040000ff080001fffffffd0001ff0b0001ff730000ff180000ff090001ff0e0001ffff +fffd0001ff0b0001ff730000ff180000ff090001ff060002ff000001ff010001ff030003 +ff020002ff010001ff040004ff030002ff000002ff010002ff000001ff020003ff040003 +ff030003ff020001ff000000ff010001ff000000ffffffa90001ff0b0001ff730000ff18 +0000ff090001ff030000ff020001ff000001ff010001ff020001ff010000ff030001ff00 +0003ff010001ff010001ff050002ff000002ff010001ff000001ff010001ff010001ff02 +0001ff010001ff010001ff010001ff000000ff010001ff000000ff010001ffffffa90001 +ff0b0001ff740000ff160000ff0a0006ff020002ff030001ff020001ff010001ff020002 +ff010001ff010001ff020000ff050001ff020001ff010002ff020001ff030001ff000001 +ff050001ff030000ff000001ff010000ff000001ff010000ffffffa90001ff0b0001ff74 +0000ff160000ff0a0001ff030000ff020001ff040001ff050002ff020001ff020001ff01 +0001ff020000ff050001ff020001ff010001ff030001ff030001ff000001ff050006ff00 +0002ff020002ffffffab0001ff0b0001ff740000ff160000ff0a0001ff070001ff040001 +ff030001ff000001ff020001ff020001ff010001ff010001ff050001ff020001ff010001 +ff030001ff030001ff000001ff050001ff060002ff020002ffffffaa0001ff0b0001ff75 +0000ff140000ff0b0001ff070001ff040001ff020001ff010001ff020001ff020001ff02 +0003ff060001ff020001ff010001ff030001ff030001ff000001ff050001ff070002ff02 +0002ffffffa90001ff0b0001ff750000ff140000ff0b0001ff040000ff010001ff040001 +ff020001ff010001ff020001ff020001ff020000ff090001ff020001ff010001ff030001 +ff030001ff000001ff050001ff050000ff010001ff000000ff010001ffffffa90001ff0b +0001ff760000ff120000ff0c0001ff030001ff010001ff040001ff020005ff020001ff02 +0001ff020004ff050002ff000001ff020001ff040001ff010001ff020001ff010001ff01 +0001ff010001ff000001ff010000ff000001ff010000ffffffa90001ff0b0001ff760000 +ff120000ff0b0008ff000003ff020003ff020001ff010001ff000003ff010002ff010006 +ff030004ff020003ff040003ff040003ff030003ff010000ff000001ff010000ff000001 +ffffffaa0001ff0b0001ff770000ff100000ff350000ff040001ff030001ffffffda0001 +ff0b0001ff780001ff0c0001ff360001ff040000ff030001ffffffda0001ff0b0001ff7a +0000ff0a0000ff380002ff020000ff040001ffffffda0001ff0b0001ff7b0002ff040002 +ff3a0004ff040003ffffffd90001ff0b0001ff7e0004ffffffffff250001ff0b0001ffff +ffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffff +ffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffff +ffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffff +ffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffff +ffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffff +ffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ff77 +0001ff210003ff010000ff370001ff170001ffffffb20001ff0b0001ff770004ff1c0001 +ff030002ff370001ff170001ffffffb20001ff0b0001ff770008ff170001ff050001ff4d +0000ffffffb70001ff0b0001ff77000bff140001ff060000ff4c0001ffffffb70001ff0b +0001ff77000fff0f0001ff0a0003ff020002ff010001ff020001ff010002ff010001ff02 +0001ff000002ff010002ff010002ff010001ff010002ff030003ff030003ff010007ff03 +0003ff020002ff010001ffffffa00001ff0b0001ff770013ff0b0001ff090001ff010001 +ff020001ff000003ff000003ff010001ff000003ff000003ff000001ff020001ff020001 +ff000003ff010001ff020001ff010001ff010001ff010000ff020001ff020001ff020001 +ff010001ff020001ff000003ffffff9f0001ff0b0001ff62002bff080001ff080001ff03 +0001ff010002ff010002ff010001ff010002ff010002ff010001ff000001ff020001ff02 +0002ff010001ff010001ff010001ff060001ff010001ff010001ff020001ff010001ff03 +0001ff010002ff010001ffffff9f0001ff0b0001ff770013ff0b0001ff080001ff030001 +ff010001ff020001ff020001ff010001ff020001ff020001ff000001ff020001ff020001 +ff020001ff010001ff010001ff090002ff010001ff020001ff010001ff030001ff010001 +ff020001ffffff9f0001ff0b0001ff77000fff0f0001ff080001ff030001ff010001ff02 +0001ff020001ff010001ff020001ff020001ff000001ff020001ff020001ff020001ff01 +0001ff010001ff070001ff000001ff010001ff020001ff010001ff030001ff010001ff02 +0001ffffff9f0001ff0b0001ff77000bff140001ff070001ff030001ff010001ff020001 +ff020001ff010001ff020001ff020001ff000001ff020001ff020001ff020001ff010001 +ff010001ff060001ff010001ff010001ff020001ff010001ff030001ff010001ff020001 +ffffff9f0001ff0b0001ff770008ff170001ff050003ff030001ff010001ff020001ff02 +0001ff010001ff020001ff020001ff000001ff020001ff020001ff020001ff010001ff01 +0001ff060001ff010001ff010001ff020001ff010001ff030001ff010001ff020001ffff +ff9f0001ff0b0001ff770004ff1c0002ff020001ff010001ff010001ff020001ff020001 +ff020001ff010001ff020001ff020001ff000002ff000002ff020001ff020001ff010001 +ff020001ff010001ff010005ff010002ff000002ff020001ff010001ff020001ff020001 +ffffff9f0001ff0b0001ff770001ff210003ff040003ff020003ff000003ff000007ff00 +0003ff000003ff000002ff000002ff000003ff010006ff020003ff030001ff010001ff01 +0006ff020003ff020003ff010002ffffff9e0001ff0b0001ffffffffffa90001ff0b0001 +ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001 +ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001 +ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001 +ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001 +ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001 +ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001 +ffffffffffa90001ff0b0001ffffffffffa90001ff0b0001ffffffffffa90001ff0b00ff +00ff00adff0b00ff00ff00adffffffffffffffffffffffffffffffffff34 +%%EndData +end +%%PageTrailer +%%Trailer +%%BoundingBox: 0 43 377 246 +%%EOF diff --git a/system/doc/tutorial/xmlfiles.mk b/system/doc/tutorial/xmlfiles.mk new file mode 100644 index 0000000000..794ef49774 --- /dev/null +++ b/system/doc/tutorial/xmlfiles.mk @@ -0,0 +1,29 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +TUTORIAL_CHAPTER_FILES = \ + introduction.xml\ + cnode.xml\ + c_port.xml\ + erl_interface.xml \ + c_portdriver.xml \ + example.xml\ + overview.xml +# appendix.xml +# distribution.xml (to be part of tutorial later) + -- cgit v1.2.3