aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/.gitignore6
-rw-r--r--docs/.python-version1
-rw-r--r--docs/Gemfile25
-rw-r--r--[-rwxr-xr-x]docs/Makefile81
-rw-r--r--docs/Pipfile13
-rw-r--r--docs/Pipfile.lock225
-rw-r--r--docs/_config.yml37
-rw-r--r--docs/_data/sections.yml48
-rw-r--r--docs/_layouts/default.html55
-rw-r--r--docs/_layouts/page.html11
-rw-r--r--docs/assets/bootstrap.min.css5
-rwxr-xr-xdocs/assets/main.css121
-rw-r--r--docs/assets/syntax.css61
-rw-r--r--docs/char.md92
-rw-r--r--docs/conf.py78
-rw-r--r--docs/devel.rst12
-rw-r--r--docs/devel/concepts.rst164
-rw-r--r--docs/devel/logging-internals.rst40
-rw-r--r--docs/errors.md30
-rw-r--r--docs/favicon.icobin67646 -> 0 bytes
-rw-r--r--docs/file-organization.md31
-rw-r--r--docs/file.md4
-rw-r--r--docs/filesystems.md4
-rw-r--r--docs/getting-started.md35
-rw-r--r--docs/index.md19
-rw-r--r--docs/index.rst26
-rw-r--r--docs/install.rst34
-rw-r--r--docs/link.md4
-rw-r--r--docs/logging-internals.md40
-rw-r--r--docs/logging.md69
-rw-r--r--docs/logo.pngbin0 -> 4809 bytes
-rw-r--r--docs/make.bat35
-rw-r--r--docs/mcs.md4
-rw-r--r--docs/streams.md102
-rw-r--r--docs/user.rst18
-rw-r--r--docs/user/character.rst98
-rw-r--r--docs/user/concepts.rst80
-rw-r--r--docs/user/file.rst164
-rw-r--r--docs/user/link.rst240
-rw-r--r--docs/user/link/cas.rst5
-rw-r--r--docs/user/link/seven.rst177
-rw-r--r--docs/user/logging.rst78
-rw-r--r--docs/user/mcs.rst9
-rw-r--r--docs/user/picture.rst252
-rw-r--r--include/libcasio.h2
-rw-r--r--include/libcasio/cdefs.h118
-rw-r--r--include/libcasio/cdefs/endian.h16
-rw-r--r--include/libcasio/char.h8
-rw-r--r--include/libcasio/date.h4
-rw-r--r--include/libcasio/error.h10
-rw-r--r--include/libcasio/file.h88
-rw-r--r--include/libcasio/fontchar.h13
-rw-r--r--include/libcasio/iter.h77
-rw-r--r--include/libcasio/link.h149
-rw-r--r--include/libcasio/log.h17
-rw-r--r--include/libcasio/mcs.h52
-rw-r--r--include/libcasio/mcsfile.h49
-rw-r--r--include/libcasio/misc.h81
-rw-r--r--include/libcasio/mutex.h36
-rw-r--r--include/libcasio/number.h30
-rw-r--r--include/libcasio/picture.h231
-rw-r--r--include/libcasio/protocol/legacy.h2
-rw-r--r--include/libcasio/protocol/seven.h9
-rw-r--r--include/libcasio/protocol/typz.h4
-rw-r--r--include/libcasio/setup.h28
-rw-r--r--include/libcasio/stream.h29
-rw-r--r--lib/error.c118
-rw-r--r--lib/errors.c89
-rw-r--r--lib/file/manage.c4
-rw-r--r--lib/iter/iter.c130
-rw-r--r--lib/iter/super.c96
-rw-r--r--lib/mcsfile/mcsfile.h15
-rw-r--r--lib/picture/decode.c65
-rw-r--r--lib/picture/encode.c41
-rw-r--r--lib/picture/internals.h (renamed from lib/picture/picture.h)19
-rw-r--r--lib/picture/manage.c75
-rw-r--r--lib/picture/size.c37
-rw-r--r--lib/stream/csum32.c2
-rw-r--r--lib/stream/open_usb.c29
-rw-r--r--lib/stream/usb_stream.c45
-rw-r--r--lib/utils/mutex.c80
-rw-r--r--lib/utils/sleep.c89
-rw-r--r--lib/utils/timer.c115
83 files changed, 2504 insertions, 2231 deletions
diff --git a/docs/.gitignore b/docs/.gitignore
deleted file mode 100644
index 5aef737..0000000
--- a/docs/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-_site
-.sass-cache
-.jekyll-metadata
-Gemfile.lock
-/vendor
-/.bundle
diff --git a/docs/.python-version b/docs/.python-version
new file mode 100644
index 0000000..0b2eb36
--- /dev/null
+++ b/docs/.python-version
@@ -0,0 +1 @@
+3.7.2
diff --git a/docs/Gemfile b/docs/Gemfile
deleted file mode 100644
index ffead19..0000000
--- a/docs/Gemfile
+++ /dev/null
@@ -1,25 +0,0 @@
-source "https://rubygems.org"
-ruby RUBY_VERSION
-
-# Hello! This is where you manage which Jekyll version is used to run.
-# When you want to use a different version, change it below, save the
-# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
-#
-# bundle exec jekyll serve
-#
-# This will help ensure the proper Jekyll version is running.
-# Happy Jekylling!
-gem "jekyll", "= 3.4.3"
-
-# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
-# uncomment the line below. To upgrade, run `bundle update github-pages`.
-# gem "github-pages", group: :jekyll_plugins
-
-# If you have any plugins, put them here!
-group :jekyll_plugins do
- gem "jekyll-assets"
-end
-
-# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
-gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
-
diff --git a/docs/Makefile b/docs/Makefile
index ebc28f2..dae7910 100755..100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -1,39 +1,44 @@
-#!/usr/bin/make -f
-#*****************************************************************************#
-# Target for the end user #
-#*****************************************************************************#
-# Make it.
-all: -all
-
-# Preview in local how it will render.
-preview prev: -all-watch
-
-# Upload it to production (only for maintainers).
-show: -all -install
-
-.PHONY: preview prev
-#*****************************************************************************#
-# Internal #
-#*****************************************************************************#
- JEK := bundle exec jekyll
- ROOT := libcasio.touhey.pro:libcasio_doc
-
-# Prepare the bundle.
- -prepare:
- bundle check || bundle install --path vendor/bundle
-
-# Make it all.
- -all: -prepare
- $(JEK) build $(JEKYLL_OPT)
-
-# Make and watch.
- -all-watch: -prepare
- $(JEK) serve --watch $(JEKYLL_OPT)
-
-# Upload.
- -install:
- find _site -type f -exec chmod 644 {} \;
- rsync -Prlt --delete _site/ "$(ROOT)"
-
-.PHONY: -prepare -all -all-watch -install
+# Minimal makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+
+PE = pipenv run
+SPHINXOPTS =
+SPHINXBUILD = $(PE) sphinx-build
+SPHINXWATCH = $(PE) sphinx-autobuild
+SOURCEDIR = .
+BUILDDIR = _build
+WEBROOT = libcasio.touhey.pro:libcasio_doc
+
+# Put it first so that "make" without argument is like "make help".
+help:
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+
+.PHONY: help Makefile
+
+# Catch-all target: route all unknown targets to Sphinx using the new
+# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
+%: Makefile
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+
+# Install everything with pipenv.
+prepare:
+ pipenv install
+
+.PHONY: prepare
+
+# Livehtml build.
+livehtml:
+ $(SPHINXWATCH) -b html $(SPHINXOPTS) . $(BUILDDIR)/html
+
+.PHONY: livehtml
+
+# Send the website content (Linux-only).
+show: clean html
+ find _build/html -type f -exec chmod 644 {} \;
+ rsync -Prlt --delete _build/html/ "$(WEBROOT)"
+
+.PHONY: show
+
# End of file.
diff --git a/docs/Pipfile b/docs/Pipfile
new file mode 100644
index 0000000..57a81a3
--- /dev/null
+++ b/docs/Pipfile
@@ -0,0 +1,13 @@
+[[source]]
+name = "pypi"
+url = "https://pypi.org/simple"
+verify_ssl = true
+
+[dev-packages]
+
+[packages]
+sphinx = "*"
+sphinx-rtd-theme = "*"
+
+[requires]
+python_version = "3.7"
diff --git a/docs/Pipfile.lock b/docs/Pipfile.lock
new file mode 100644
index 0000000..46bae79
--- /dev/null
+++ b/docs/Pipfile.lock
@@ -0,0 +1,225 @@
+{
+ "_meta": {
+ "hash": {
+ "sha256": "ad49cdffc75c09b6abfb00f80a96f9c4967858dfc7153f34febb993592308482"
+ },
+ "pipfile-spec": 6,
+ "requires": {
+ "python_version": "3.7"
+ },
+ "sources": [
+ {
+ "name": "pypi",
+ "url": "https://pypi.org/simple",
+ "verify_ssl": true
+ }
+ ]
+ },
+ "default": {
+ "alabaster": {
+ "hashes": [
+ "sha256:446438bdcca0e05bd45ea2de1668c1d9b032e1a9154c2c259092d77031ddd359",
+ "sha256:a661d72d58e6ea8a57f7a86e37d86716863ee5e92788398526d58b26a4e4dc02"
+ ],
+ "version": "==0.7.12"
+ },
+ "babel": {
+ "hashes": [
+ "sha256:6778d85147d5d85345c14a26aada5e478ab04e39b078b0745ee6870c2b5cf669",
+ "sha256:8cba50f48c529ca3fa18cf81fa9403be176d374ac4d60738b839122dfaaa3d23"
+ ],
+ "version": "==2.6.0"
+ },
+ "certifi": {
+ "hashes": [
+ "sha256:59b7658e26ca9c7339e00f8f4636cdfe59d34fa37b9b04f6f9e9926b3cece1a5",
+ "sha256:b26104d6835d1f5e49452a26eb2ff87fe7090b89dfcaee5ea2212697e1e1d7ae"
+ ],
+ "version": "==2019.3.9"
+ },
+ "chardet": {
+ "hashes": [
+ "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
+ "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
+ ],
+ "version": "==3.0.4"
+ },
+ "docutils": {
+ "hashes": [
+ "sha256:02aec4bd92ab067f6ff27a38a38a41173bf01bed8f89157768c1573f53e474a6",
+ "sha256:51e64ef2ebfb29cae1faa133b3710143496eca21c530f3f71424d77687764274",
+ "sha256:7a4bd47eaf6596e1295ecb11361139febe29b084a87bf005bf899f9a42edc3c6"
+ ],
+ "version": "==0.14"
+ },
+ "idna": {
+ "hashes": [
+ "sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407",
+ "sha256:ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c"
+ ],
+ "version": "==2.8"
+ },
+ "imagesize": {
+ "hashes": [
+ "sha256:3f349de3eb99145973fefb7dbe38554414e5c30abd0c8e4b970a7c9d09f3a1d8",
+ "sha256:f3832918bc3c66617f92e35f5d70729187676313caa60c187eb0f28b8fe5e3b5"
+ ],
+ "version": "==1.1.0"
+ },
+ "jinja2": {
+ "hashes": [
+ "sha256:065c4f02ebe7f7cf559e49ee5a95fb800a9e4528727aec6f24402a5374c65013",
+ "sha256:14dd6caf1527abb21f08f86c784eac40853ba93edb79552aa1e4b8aef1b61c7b"
+ ],
+ "version": "==2.10.1"
+ },
+ "markupsafe": {
+ "hashes": [
+ "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473",
+ "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161",
+ "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235",
+ "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5",
+ "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff",
+ "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b",
+ "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1",
+ "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e",
+ "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183",
+ "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66",
+ "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1",
+ "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1",
+ "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e",
+ "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b",
+ "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905",
+ "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735",
+ "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d",
+ "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e",
+ "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d",
+ "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c",
+ "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21",
+ "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2",
+ "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5",
+ "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b",
+ "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6",
+ "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f",
+ "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f",
+ "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7"
+ ],
+ "version": "==1.1.1"
+ },
+ "packaging": {
+ "hashes": [
+ "sha256:0c98a5d0be38ed775798ece1b9727178c4469d9c3b4ada66e8e6b7849f8732af",
+ "sha256:9e1cbf8c12b1f1ce0bb5344b8d7ecf66a6f8a6e91bcb0c84593ed6d3ab5c4ab3"
+ ],
+ "version": "==19.0"
+ },
+ "pygments": {
+ "hashes": [
+ "sha256:31cba6ffb739f099a85e243eff8cb717089fdd3c7300767d9fc34cb8e1b065f5",
+ "sha256:5ad302949b3c98dd73f8d9fcdc7e9cb592f120e32a18e23efd7f3dc51194472b"
+ ],
+ "version": "==2.4.0"
+ },
+ "pyparsing": {
+ "hashes": [
+ "sha256:1873c03321fc118f4e9746baf201ff990ceb915f433f23b395f5580d1840cb2a",
+ "sha256:9b6323ef4ab914af344ba97510e966d64ba91055d6b9afa6b30799340e89cc03"
+ ],
+ "version": "==2.4.0"
+ },
+ "pytz": {
+ "hashes": [
+ "sha256:303879e36b721603cc54604edcac9d20401bdbe31e1e4fdee5b9f98d5d31dfda",
+ "sha256:d747dd3d23d77ef44c6a3526e274af6efeb0a6f1afd5a69ba4d5be4098c8e141"
+ ],
+ "version": "==2019.1"
+ },
+ "requests": {
+ "hashes": [
+ "sha256:11e007a8a2aa0323f5a921e9e6a2d7e4e67d9877e85773fba9ba6419025cbeb4",
+ "sha256:9cf5292fcd0f598c671cfc1e0d7d1a7f13bb8085e9a590f48c010551dc6c4b31"
+ ],
+ "version": "==2.22.0"
+ },
+ "six": {
+ "hashes": [
+ "sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c",
+ "sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73"
+ ],
+ "version": "==1.12.0"
+ },
+ "snowballstemmer": {
+ "hashes": [
+ "sha256:919f26a68b2c17a7634da993d91339e288964f93c274f1343e3bbbe2096e1128",
+ "sha256:9f3bcd3c401c3e862ec0ebe6d2c069ebc012ce142cce209c098ccb5b09136e89"
+ ],
+ "version": "==1.2.1"
+ },
+ "sphinx": {
+ "hashes": [
+ "sha256:423280646fb37944dd3c85c58fb92a20d745793a9f6c511f59da82fa97cd404b",
+ "sha256:de930f42600a4fef993587633984cc5027dedba2464bcf00ddace26b40f8d9ce"
+ ],
+ "index": "pypi",
+ "version": "==2.0.1"
+ },
+ "sphinx-rtd-theme": {
+ "hashes": [
+ "sha256:00cf895504a7895ee433807c62094cf1e95f065843bf3acd17037c3e9a2becd4",
+ "sha256:728607e34d60456d736cc7991fd236afb828b21b82f956c5ea75f94c8414040a"
+ ],
+ "index": "pypi",
+ "version": "==0.4.3"
+ },
+ "sphinxcontrib-applehelp": {
+ "hashes": [
+ "sha256:edaa0ab2b2bc74403149cb0209d6775c96de797dfd5b5e2a71981309efab3897",
+ "sha256:fb8dee85af95e5c30c91f10e7eb3c8967308518e0f7488a2828ef7bc191d0d5d"
+ ],
+ "version": "==1.0.1"
+ },
+ "sphinxcontrib-devhelp": {
+ "hashes": [
+ "sha256:6c64b077937330a9128a4da74586e8c2130262f014689b4b89e2d08ee7294a34",
+ "sha256:9512ecb00a2b0821a146736b39f7aeb90759834b07e81e8cc23a9c70bacb9981"
+ ],
+ "version": "==1.0.1"
+ },
+ "sphinxcontrib-htmlhelp": {
+ "hashes": [
+ "sha256:4670f99f8951bd78cd4ad2ab962f798f5618b17675c35c5ac3b2132a14ea8422",
+ "sha256:d4fd39a65a625c9df86d7fa8a2d9f3cd8299a3a4b15db63b50aac9e161d8eff7"
+ ],
+ "version": "==1.0.2"
+ },
+ "sphinxcontrib-jsmath": {
+ "hashes": [
+ "sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178",
+ "sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8"
+ ],
+ "version": "==1.0.1"
+ },
+ "sphinxcontrib-qthelp": {
+ "hashes": [
+ "sha256:513049b93031beb1f57d4daea74068a4feb77aa5630f856fcff2e50de14e9a20",
+ "sha256:79465ce11ae5694ff165becda529a600c754f4bc459778778c7017374d4d406f"
+ ],
+ "version": "==1.0.2"
+ },
+ "sphinxcontrib-serializinghtml": {
+ "hashes": [
+ "sha256:c0efb33f8052c04fd7a26c0a07f1678e8512e0faec19f4aa8f2473a8b81d5227",
+ "sha256:db6615af393650bf1151a6cd39120c29abaf93cc60db8c48eb2dddbfdc3a9768"
+ ],
+ "version": "==1.1.3"
+ },
+ "urllib3": {
+ "hashes": [
+ "sha256:a53063d8b9210a7bdec15e7b272776b9d42b2fd6816401a0d43006ad2f9902db",
+ "sha256:d363e3607d8de0c220d31950a8f38b18d5ba7c0830facd71a1c6b1036b7ce06c"
+ ],
+ "version": "==1.25.2"
+ }
+ },
+ "develop": {}
+}
diff --git a/docs/_config.yml b/docs/_config.yml
deleted file mode 100644
index 2012bb1..0000000
--- a/docs/_config.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-#******************************************************************************
-# _config.yml -- Documentation variables definition.
-#
-# For technical reasons, this file is *NOT* reloaded automatically when
-# you use 'bundle exec jekyll serve'. If you change this file, please
-# restart the server process.
-#
-# The theme is based on the jekyll-docs-template theme:
-# https://github.com/bruth/jekyll-docs-template
-#******************************************************************************
-# Site settings.
-title: libcasio
-description: >-
- Documentation for libcasio.
-url: "https://libcasio.touhey.pro"
-baseurl: "/docs"
-
-# Build settings.
-output: web
-destination: _site
-gems:
-- jekyll-assets
-exclude:
-- Gemfile
-- Gemfile.lock
-- Makefile
-- README.md
-- vendor
-
-# Markdown settings.
-markdown: kramdown
-
-# SASS settings.
-sass:
- style: :expanded
-
-# End of file.
diff --git a/docs/_data/sections.yml b/docs/_data/sections.yml
deleted file mode 100644
index 3c9def2..0000000
--- a/docs/_data/sections.yml
+++ /dev/null
@@ -1,48 +0,0 @@
--
- name: Introduction
- uri: /
--
- name: Getting started
- uri: /getting-started.html
--
- sname: User documentation
- docs:
- -
- sname: The basics
- docs:
- -
- name: Logging
- uri: /logging.html
- -
- name: Error management
- uri: /errors.html
- -
- name: Chararacter encoding
- uri: /char.html
- -
- name: Streams
- uri: /streams.html
- -
- sname: The specifics
- docs:
- -
- name: Filesystems
- uri: /filesystems.html
- -
- name: Main filesystems
- uri: /mcs.html
- -
- name: Links and protocols
- uri: /link.html
- -
- name: Decoding files
- uri: /file.html
--
- sname: Developer documentation
- docs:
- -
- name: File organization
- uri: /file-organization.html
- -
- name: Logging internals
- uri: /logging-internals.html
diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html
deleted file mode 100644
index f5b5fbf..0000000
--- a/docs/_layouts/default.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE html>
-<html><head>
-<meta charset="utf-8">
-<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
-<meta name="viewport" content="width=device-width">
-
-<title>{{ site.title }}{% if page.title %} : {{ page.title }}{% endif %}</title>
-<meta name="description" content="{{ site.subtitle }}">
-<link rel="icon" href="favicon.png">
-<!--[if IE]>
-<link rel="shortcut icon" href="favicon.ico">
-<[endif]-->
-
-<link rel="stylesheet" href="assets/bootstrap.min.css?upd">
-<link rel="stylesheet" href="assets/syntax.css?upd">
-<link rel="stylesheet" href="assets/main.css?upd">
-</head><body>
-<div class="container">
-
-<div class="row"><div id="header" class="col-sm-12">
-<h4><a class="brand" href="{{ site.baseurl }}/">{{ site.title }}</a>
-{% if site.subtitle %}<small>{{ site.subtitle }}</small>{% endif %}
-</h4>
-</div></div>
-
-<div class="row">
-<div id="navigation" class="col-sm-2"><ul class="nav nav-list">
-{% for element in site.data.sections %}
-{% if element.name %}
- <li><a href="{{ site.baseurl }}{{ element.uri }}">{{ element.name }}</a></li>
-{% else %}
- <li><p>{{ element.sname }}</p></li>
-{% for document in element.docs %}
-{% if document.name %}
- <li><a href="{{ site.baseurl }}{{ document.uri }}">{{ document.name }}</a></li>
-{% else %}
- <li><p>ยป {{ document.sname }}</p></li>
-{% for sdoc in document.docs %}
- <li><a href="{{ site.baseurl }}{{ sdoc.uri }}">{{ sdoc.name }}</a></li>
-{% endfor %}
-{% endif %}
-{% endfor %}
-{% endif %}
-{% endfor %}
-</ul></div>
-
-<div id="content" class="col-sm-10">
- {{ content }}
-</div>
-</div>
-
-<div class="row"><div id="footer" class="col-sm-12">
-<p>Copyright (C) 2017 - {{ site.time | date: "%Y" }} Thomas Touhey &lt;<a href="mailto:thomas@touhey.fr">thomas@touhey.fr</a>&gt;</p>
-</div></div>
-</div></body></html>
diff --git a/docs/_layouts/page.html b/docs/_layouts/page.html
deleted file mode 100644
index 3500377..0000000
--- a/docs/_layouts/page.html
+++ /dev/null
@@ -1,11 +0,0 @@
----
-layout: default
----
-
-<div class="page-header">
- <h2>{{ page.title | capitalize }}
- {% if page.subtitle %}<small>{{ page.subtitle }}</small>{% endif %}
- </h2>
-</div>
-
-{{ content }}
diff --git a/docs/assets/bootstrap.min.css b/docs/assets/bootstrap.min.css
deleted file mode 100644
index d65c66b..0000000
--- a/docs/assets/bootstrap.min.css
+++ /dev/null
@@ -1,5 +0,0 @@
-/*!
- * Bootstrap v3.3.5 (http://getbootstrap.com)
- * Copyright 2011-2015 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- *//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,:after,:before{color:#000!important;text-shadow:none!important;background:0 0!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff2) format('woff2'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-eur:before,.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.glyphicon-cd:before{content:"\e201"}.glyphicon-save-file:before{content:"\e202"}.glyphicon-open-file:before{content:"\e203"}.glyphicon-level-up:before{content:"\e204"}.glyphicon-copy:before{content:"\e205"}.glyphicon-paste:before{content:"\e206"}.glyphicon-alert:before{content:"\e209"}.glyphicon-equalizer:before{content:"\e210"}.glyphicon-king:before{content:"\e211"}.glyphicon-queen:before{content:"\e212"}.glyphicon-pawn:before{content:"\e213"}.glyphicon-bishop:before{content:"\e214"}.glyphicon-knight:before{content:"\e215"}.glyphicon-baby-formula:before{content:"\e216"}.glyphicon-tent:before{content:"\26fa"}.glyphicon-blackboard:before{content:"\e218"}.glyphicon-bed:before{content:"\e219"}.glyphicon-apple:before{content:"\f8ff"}.glyphicon-erase:before{content:"\e221"}.glyphicon-hourglass:before{content:"\231b"}.glyphicon-lamp:before{content:"\e223"}.glyphicon-duplicate:before{content:"\e224"}.glyphicon-piggy-bank:before{content:"\e225"}.glyphicon-scissors:before{content:"\e226"}.glyphicon-bitcoin:before{content:"\e227"}.glyphicon-btc:before{content:"\e227"}.glyphicon-xbt:before{content:"\e227"}.glyphicon-yen:before{content:"\00a5"}.glyphicon-jpy:before{content:"\00a5"}.glyphicon-ruble:before{content:"\20bd"}.glyphicon-rub:before{content:"\20bd"}.glyphicon-scale:before{content:"\e230"}.glyphicon-ice-lolly:before{content:"\e231"}.glyphicon-ice-lolly-tasted:before{content:"\e232"}.glyphicon-education:before{content:"\e233"}.glyphicon-option-horizontal:before{content:"\e234"}.glyphicon-option-vertical:before{content:"\e235"}.glyphicon-menu-hamburger:before{content:"\e236"}.glyphicon-modal-window:before{content:"\e237"}.glyphicon-oil:before{content:"\e238"}.glyphicon-grain:before{content:"\e239"}.glyphicon-sunglasses:before{content:"\e240"}.glyphicon-text-size:before{content:"\e241"}.glyphicon-text-color:before{content:"\e242"}.glyphicon-text-background:before{content:"\e243"}.glyphicon-object-align-top:before{content:"\e244"}.glyphicon-object-align-bottom:before{content:"\e245"}.glyphicon-object-align-horizontal:before{content:"\e246"}.glyphicon-object-align-left:before{content:"\e247"}.glyphicon-object-align-vertical:before{content:"\e248"}.glyphicon-object-align-right:before{content:"\e249"}.glyphicon-triangle-right:before{content:"\e250"}.glyphicon-triangle-left:before{content:"\e251"}.glyphicon-triangle-bottom:before{content:"\e252"}.glyphicon-triangle-top:before{content:"\e253"}.glyphicon-console:before{content:"\e254"}.glyphicon-superscript:before{content:"\e255"}.glyphicon-subscript:before{content:"\e256"}.glyphicon-menu-left:before{content:"\e257"}.glyphicon-menu-right:before{content:"\e258"}.glyphicon-menu-down:before{content:"\e259"}.glyphicon-menu-up:before{content:"\e260"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:after,:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#337ab7;text-decoration:none}a:focus,a:hover{color:#23527c;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.carousel-inner>.item>a>img,.carousel-inner>.item>img,.img-responsive,.thumbnail a>img,.thumbnail>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}[role=button]{cursor:pointer}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-weight:400;line-height:1;color:#777}.h1,.h2,.h3,h1,h2,h3{margin-top:20px;margin-bottom:10px}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small{font-size:65%}.h4,.h5,.h6,h4,h5,h6{margin-top:10px;margin-bottom:10px}.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-size:75%}.h1,h1{font-size:36px}.h2,h2{font-size:30px}.h3,h3{font-size:24px}.h4,h4{font-size:18px}.h5,h5{font-size:14px}.h6,h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}.small,small{font-size:85%}.mark,mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#337ab7}a.text-primary:focus,a.text-primary:hover{color:#286090}.text-success{color:#3c763d}a.text-success:focus,a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:focus,a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:focus,a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:focus,a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#337ab7}a.bg-primary:focus,a.bg-primary:hover{background-color:#286090}.bg-success{background-color:#dff0d8}a.bg-success:focus,a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:focus,a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:focus,a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:focus,a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ol,ul{margin-top:0;margin-bottom:10px}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dd,dt{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[data-original-title],abbr[title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote ol:last-child,blockquote p:last-child,blockquote ul:last-child{margin-bottom:0}blockquote .small,blockquote footer,blockquote small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote .small:before,blockquote footer:before,blockquote small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse .small:before,.blockquote-reverse footer:before,.blockquote-reverse small:before,blockquote.pull-right .small:before,blockquote.pull-right footer:before,blockquote.pull-right small:before{content:''}.blockquote-reverse .small:after,.blockquote-reverse footer:after,.blockquote-reverse small:after,blockquote.pull-right .small:after,blockquote.pull-right footer:after,blockquote.pull-right small:after{content:'\00A0 \2014'}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;font-weight:700;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}caption{padding-top:8px;padding-bottom:8px;color:#777;text-align:left}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>tbody>tr>td,.table>tbody>tr>th,.table>tfoot>tr>td,.table>tfoot>tr>th,.table>thead>tr>td,.table>thead>tr>th{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>td,.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>td,.table>thead:first-child>tr:first-child>th{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>tbody>tr>td,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>td,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>thead>tr>th{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>tbody>tr>td,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>td,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border:1px solid #ddd}.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border-bottom-width:2px}.table-striped>tbody>tr:nth-of-type(odd){background-color:#f9f9f9}.table-hover>tbody>tr:hover{background-color:#f5f5f5}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}.table>tbody>tr.active>td,.table>tbody>tr.active>th,.table>tbody>tr>td.active,.table>tbody>tr>th.active,.table>tfoot>tr.active>td,.table>tfoot>tr.active>th,.table>tfoot>tr>td.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>thead>tr.active>th,.table>thead>tr>td.active,.table>thead>tr>th.active{background-color:#f5f5f5}.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr.active:hover>th,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover{background-color:#e8e8e8}.table>tbody>tr.success>td,.table>tbody>tr.success>th,.table>tbody>tr>td.success,.table>tbody>tr>th.success,.table>tfoot>tr.success>td,.table>tfoot>tr.success>th,.table>tfoot>tr>td.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>thead>tr.success>th,.table>thead>tr>td.success,.table>thead>tr>th.success{background-color:#dff0d8}.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover{background-color:#d0e9c6}.table>tbody>tr.info>td,.table>tbody>tr.info>th,.table>tbody>tr>td.info,.table>tbody>tr>th.info,.table>tfoot>tr.info>td,.table>tfoot>tr.info>th,.table>tfoot>tr>td.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>thead>tr.info>th,.table>thead>tr>td.info,.table>thead>tr>th.info{background-color:#d9edf7}.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr.info:hover>th,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover{background-color:#c4e3f3}.table>tbody>tr.warning>td,.table>tbody>tr.warning>th,.table>tbody>tr>td.warning,.table>tbody>tr>th.warning,.table>tfoot>tr.warning>td,.table>tfoot>tr.warning>th,.table>tfoot>tr>td.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>thead>tr.warning>th,.table>thead>tr>td.warning,.table>thead>tr>th.warning{background-color:#fcf8e3}.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover{background-color:#faf2cc}.table>tbody>tr.danger>td,.table>tbody>tr.danger>th,.table>tbody>tr>td.danger,.table>tbody>tr>th.danger,.table>tfoot>tr.danger>td,.table>tfoot>tr.danger>th,.table>tfoot>tr>td.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>thead>tr.danger>th,.table>thead>tr>td.danger,.table>thead>tr>th.danger{background-color:#f2dede}.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover{background-color:#ebcccc}.table-responsive{min-height:.01%;overflow-x:auto}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>td,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>thead>tr>th{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=checkbox],input[type=radio]{margin:4px 0 0;margin-top:1px\9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=checkbox]:focus,input[type=radio]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{background-color:#eee;opacity:1}.form-control[disabled],fieldset[disabled] .form-control{cursor:not-allowed}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}@media screen and (-webkit-min-device-pixel-ratio:0){input[type=date].form-control,input[type=time].form-control,input[type=datetime-local].form-control,input[type=month].form-control{line-height:34px}.input-group-sm input[type=date],.input-group-sm input[type=time],.input-group-sm input[type=datetime-local],.input-group-sm input[type=month],input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px}.input-group-lg input[type=date],.input-group-lg input[type=time],.input-group-lg input[type=datetime-local],.input-group-lg input[type=month],input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px}}.form-group{margin-bottom:15px}.checkbox,.radio{position:relative;display:block;margin-top:10px;margin-bottom:10px}.checkbox label,.radio label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox],.radio input[type=radio],.radio-inline input[type=radio]{position:absolute;margin-top:4px\9;margin-left:-20px}.checkbox+.checkbox,.radio+.radio{margin-top:-5px}.checkbox-inline,.radio-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.checkbox-inline+.checkbox-inline,.radio-inline+.radio-inline{margin-top:0;margin-left:10px}fieldset[disabled] input[type=checkbox],fieldset[disabled] input[type=radio],input[type=checkbox].disabled,input[type=checkbox][disabled],input[type=radio].disabled,input[type=radio][disabled]{cursor:not-allowed}.checkbox-inline.disabled,.radio-inline.disabled,fieldset[disabled] .checkbox-inline,fieldset[disabled] .radio-inline{cursor:not-allowed}.checkbox.disabled label,.radio.disabled label,fieldset[disabled] .checkbox label,fieldset[disabled] .radio label{cursor:not-allowed}.form-control-static{min-height:34px;padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}select[multiple].input-sm,textarea.input-sm{height:auto}.form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.form-group-sm select.form-control{height:30px;line-height:30px}.form-group-sm select[multiple].form-control,.form-group-sm textarea.form-control{height:auto}.form-group-sm .form-control-static{height:30px;min-height:32px;padding:6px 10px;font-size:12px;line-height:1.5}.input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-lg{height:46px;line-height:46px}select[multiple].input-lg,textarea.input-lg{height:auto}.form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.form-group-lg select.form-control{height:46px;line-height:46px}.form-group-lg select[multiple].form-control,.form-group-lg textarea.form-control{height:auto}.form-group-lg .form-control-static{height:46px;min-height:38px;padding:11px 16px;font-size:18px;line-height:1.3333333}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.form-group-lg .form-control+.form-control-feedback,.input-group-lg+.form-control-feedback,.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.form-group-sm .form-control+.form-control-feedback,.input-group-sm+.form-control-feedback,.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .checkbox,.has-success .checkbox-inline,.has-success .control-label,.has-success .help-block,.has-success .radio,.has-success .radio-inline,.has-success.checkbox label,.has-success.checkbox-inline label,.has-success.radio label,.has-success.radio-inline label{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .checkbox,.has-warning .checkbox-inline,.has-warning .control-label,.has-warning .help-block,.has-warning .radio,.has-warning .radio-inline,.has-warning.checkbox label,.has-warning.checkbox-inline label,.has-warning.radio label,.has-warning.radio-inline label{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .checkbox,.has-error .checkbox-inline,.has-error .control-label,.has-error .help-block,.has-error .radio,.has-error .radio-inline,.has-error.checkbox label,.has-error.checkbox-inline label,.has-error.radio label,.has-error.radio-inline label{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label~.form-control-feedback{top:25px}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-static{display:inline-block}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .form-control,.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .checkbox,.form-inline .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .checkbox label,.form-inline .radio label{padding-left:0}.form-inline .checkbox input[type=checkbox],.form-inline .radio input[type=radio]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .checkbox,.form-horizontal .checkbox-inline,.form-horizontal .radio,.form-horizontal .radio-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .checkbox,.form-horizontal .radio{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:14.33px;font-size:18px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px;font-size:12px}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:4px}.btn.active.focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn:active:focus,.btn:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.focus,.btn:focus,.btn:hover{color:#333;text-decoration:none}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{cursor:not-allowed;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;opacity:.65}a.btn.disabled,fieldset[disabled] a.btn{pointer-events:none}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default.focus,.btn-default:focus{color:#333;background-color:#e6e6e6;border-color:#8c8c8c}.btn-default:hover{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active.focus,.btn-default.active:focus,.btn-default.active:hover,.btn-default:active.focus,.btn-default:active:focus,.btn-default:active:hover,.open>.dropdown-toggle.btn-default.focus,.open>.dropdown-toggle.btn-default:focus,.open>.dropdown-toggle.btn-default:hover{color:#333;background-color:#d4d4d4;border-color:#8c8c8c}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default.disabled.active,.btn-default.disabled.focus,.btn-default.disabled:active,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled],.btn-default[disabled].active,.btn-default[disabled].focus,.btn-default[disabled]:active,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default,fieldset[disabled] .btn-default.active,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:active,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#337ab7;border-color:#2e6da4}.btn-primary.focus,.btn-primary:focus{color:#fff;background-color:#286090;border-color:#122b40}.btn-primary:hover{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active.focus,.btn-primary.active:focus,.btn-primary.active:hover,.btn-primary:active.focus,.btn-primary:active:focus,.btn-primary:active:hover,.open>.dropdown-toggle.btn-primary.focus,.open>.dropdown-toggle.btn-primary:focus,.open>.dropdown-toggle.btn-primary:hover{color:#fff;background-color:#204d74;border-color:#122b40}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary.disabled.active,.btn-primary.disabled.focus,.btn-primary.disabled:active,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled],.btn-primary[disabled].active,.btn-primary[disabled].focus,.btn-primary[disabled]:active,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-primary.active,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:active,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#337ab7;border-color:#2e6da4}.btn-primary .badge{color:#337ab7;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success.focus,.btn-success:focus{color:#fff;background-color:#449d44;border-color:#255625}.btn-success:hover{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active.focus,.btn-success.active:focus,.btn-success.active:hover,.btn-success:active.focus,.btn-success:active:focus,.btn-success:active:hover,.open>.dropdown-toggle.btn-success.focus,.open>.dropdown-toggle.btn-success:focus,.open>.dropdown-toggle.btn-success:hover{color:#fff;background-color:#398439;border-color:#255625}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success.disabled.active,.btn-success.disabled.focus,.btn-success.disabled:active,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled],.btn-success[disabled].active,.btn-success[disabled].focus,.btn-success[disabled]:active,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success,fieldset[disabled] .btn-success.active,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:active,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info.focus,.btn-info:focus{color:#fff;background-color:#31b0d5;border-color:#1b6d85}.btn-info:hover{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active.focus,.btn-info.active:focus,.btn-info.active:hover,.btn-info:active.focus,.btn-info:active:focus,.btn-info:active:hover,.open>.dropdown-toggle.btn-info.focus,.open>.dropdown-toggle.btn-info:focus,.open>.dropdown-toggle.btn-info:hover{color:#fff;background-color:#269abc;border-color:#1b6d85}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info.disabled.active,.btn-info.disabled.focus,.btn-info.disabled:active,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled],.btn-info[disabled].active,.btn-info[disabled].focus,.btn-info[disabled]:active,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info,fieldset[disabled] .btn-info.active,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:active,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning.focus,.btn-warning:focus{color:#fff;background-color:#ec971f;border-color:#985f0d}.btn-warning:hover{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active.focus,.btn-warning.active:focus,.btn-warning.active:hover,.btn-warning:active.focus,.btn-warning:active:focus,.btn-warning:active:hover,.open>.dropdown-toggle.btn-warning.focus,.open>.dropdown-toggle.btn-warning:focus,.open>.dropdown-toggle.btn-warning:hover{color:#fff;background-color:#d58512;border-color:#985f0d}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning.disabled.active,.btn-warning.disabled.focus,.btn-warning.disabled:active,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled],.btn-warning[disabled].active,.btn-warning[disabled].focus,.btn-warning[disabled]:active,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning,fieldset[disabled] .btn-warning.active,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:active,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger.focus,.btn-danger:focus{color:#fff;background-color:#c9302c;border-color:#761c19}.btn-danger:hover{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active.focus,.btn-danger.active:focus,.btn-danger.active:hover,.btn-danger:active.focus,.btn-danger:active:focus,.btn-danger:active:hover,.open>.dropdown-toggle.btn-danger.focus,.open>.dropdown-toggle.btn-danger:focus,.open>.dropdown-toggle.btn-danger:hover{color:#fff;background-color:#ac2925;border-color:#761c19}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger.disabled.active,.btn-danger.disabled.focus,.btn-danger.disabled:active,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled],.btn-danger[disabled].active,.btn-danger[disabled].focus,.btn-danger[disabled]:active,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger,fieldset[disabled] .btn-danger.active,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:active,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#337ab7;border-radius:0}.btn-link,.btn-link.active,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:active,.btn-link:focus,.btn-link:hover{border-color:transparent}.btn-link:focus,.btn-link:hover{color:#23527c;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover,fieldset[disabled] .btn-link:focus,fieldset[disabled] .btn-link:hover{color:#777;text-decoration:none}.btn-group-lg>.btn,.btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.btn-group-sm>.btn,.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-xs>.btn,.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition-timing-function:ease;-o-transition-timing-function:ease;transition-timing-function:ease;-webkit-transition-duration:.35s;-o-transition-duration:.35s;transition-duration:.35s;-webkit-transition-property:height,visibility;-o-transition-property:height,visibility;transition-property:height,visibility}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px dashed;border-top:4px solid\9;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown,.dropup{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{color:#fff;text-decoration:none;background-color:#337ab7;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{color:#777}.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px dashed;border-bottom:4px solid\9}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:2px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;float:left}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:hover,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus,.btn-group>.btn:hover{z-index:2}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn,.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn input[type=checkbox],[data-toggle=buttons]>.btn input[type=radio],[data-toggle=buttons]>.btn-group>.btn input[type=checkbox],[data-toggle=buttons]>.btn-group>.btn input[type=radio]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn,textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn,textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn{height:auto}.input-group .form-control,.input-group-addon,.input-group-btn{display:table-cell}.input-group .form-control:not(:first-child):not(:last-child),.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=checkbox],.input-group-addon input[type=radio]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn-group:not(:last-child)>.btn,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:active,.input-group-btn>.btn:focus,.input-group-btn>.btn:hover{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{z-index:2;margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:focus,.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:focus,.nav>li.disabled>a:hover{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:focus,.nav .open>a:hover{background-color:#eee;border-color:#337ab7}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:focus,.nav-tabs>li.active>a:hover{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:focus,.nav-pills>li.active>a:hover{color:#fff;background-color:#337ab7}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;-webkit-overflow-scrolling:touch;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1)}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:340px}@media (max-device-width:480px) and (orientation:landscape){.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:200px}}.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-bottom,.navbar-fixed-top{position:fixed;right:0;left:0;z-index:1030}@media (min-width:768px){.navbar-fixed-bottom,.navbar-fixed-top{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}.navbar-brand>img{display:block}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu .dropdown-header,.navbar-nav .open .dropdown-menu>li>a{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:focus,.navbar-nav .open .dropdown-menu>li>a:hover{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1)}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .form-control-static{display:inline-block}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .form-control,.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .checkbox,.navbar-form .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .checkbox label,.navbar-form .radio label{padding-left:0}.navbar-form .checkbox input[type=checkbox],.navbar-form .radio input[type=radio]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}.navbar-form .form-group:last-child{margin-bottom:0}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{margin-bottom:0;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important;margin-right:-15px}.navbar-right~.navbar-right{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:focus,.navbar-default .navbar-brand:hover{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:focus,.navbar-default .navbar-nav>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:focus,.navbar-default .navbar-nav>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:focus,.navbar-default .navbar-nav>.disabled>a:hover{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:focus,.navbar-default .navbar-toggle:hover{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:focus,.navbar-default .navbar-nav>.open>a:hover{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:focus,.navbar-default .btn-link:hover{color:#333}.navbar-default .btn-link[disabled]:focus,.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:focus,fieldset[disabled] .navbar-default .btn-link:hover{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#9d9d9d}.navbar-inverse .navbar-brand:focus,.navbar-inverse .navbar-brand:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a:focus,.navbar-inverse .navbar-nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:focus,.navbar-inverse .navbar-nav>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:focus,.navbar-inverse .navbar-nav>.disabled>a:hover{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:focus,.navbar-inverse .navbar-toggle:hover{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:focus,.navbar-inverse .navbar-nav>.open>a:hover{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#9d9d9d}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#9d9d9d}.navbar-inverse .btn-link:focus,.navbar-inverse .btn-link:hover{color:#fff}.navbar-inverse .btn-link[disabled]:focus,.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:focus,fieldset[disabled] .navbar-inverse .btn-link:hover{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#337ab7;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover{z-index:3;color:#23527c;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover{z-index:2;color:#fff;cursor:default;background-color:#337ab7;border-color:#337ab7}.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px;line-height:1.3333333}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px;line-height:1.5}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:focus,.pager li>a:hover{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:focus,.pager .disabled>a:hover,.pager .disabled>span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:focus,a.label:hover{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:focus,.label-default[href]:hover{background-color:#5e5e5e}.label-primary{background-color:#337ab7}.label-primary[href]:focus,.label-primary[href]:hover{background-color:#286090}.label-success{background-color:#5cb85c}.label-success[href]:focus,.label-success[href]:hover{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:focus,.label-info[href]:hover{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:focus,.label-warning[href]:hover{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:focus,.label-danger[href]:hover{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:middle;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-group-xs>.btn .badge,.btn-xs .badge{top:0;padding:1px 5px}a.badge:focus,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#337ab7;background-color:#fff}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding-top:30px;padding-bottom:30px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron .h1,.jumbotron h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron,.container-fluid .jumbotron{border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron,.container-fluid .jumbotron{padding-right:60px;padding-left:60px}.jumbotron .h1,.jumbotron h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:border .2s ease-in-out;-o-transition:border .2s ease-in-out;transition:border .2s ease-in-out}.thumbnail a>img,.thumbnail>img{margin-right:auto;margin-left:auto}a.thumbnail.active,a.thumbnail:focus,a.thumbnail:hover{border-color:#337ab7}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#337ab7;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-bar-striped,.progress-striped .progress-bar{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress-bar.active,.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media{margin-top:15px}.media:first-child{margin-top:0}.media,.media-body{overflow:hidden;zoom:1}.media-body{width:10000px}.media-object{display:block}.media-object.img-thumbnail{max-width:none}.media-right,.media>.pull-right{padding-left:10px}.media-left,.media>.pull-left{padding-right:10px}.media-body,.media-left,.media-right{display:table-cell;vertical-align:top}.media-middle{vertical-align:middle}.media-bottom{vertical-align:bottom}.media-heading{margin-top:0;margin-bottom:5px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}a.list-group-item,button.list-group-item{color:#555}a.list-group-item .list-group-item-heading,button.list-group-item .list-group-item-heading{color:#333}a.list-group-item:focus,a.list-group-item:hover,button.list-group-item:focus,button.list-group-item:hover{color:#555;text-decoration:none;background-color:#f5f5f5}button.list-group-item{width:100%;text-align:left}.list-group-item.disabled,.list-group-item.disabled:focus,.list-group-item.disabled:hover{color:#777;cursor:not-allowed;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{z-index:2;color:#fff;background-color:#337ab7;border-color:#337ab7}.list-group-item.active .list-group-item-heading,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:focus .list-group-item-text,.list-group-item.active:hover .list-group-item-text{color:#c7ddef}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success,button.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading,button.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:focus,a.list-group-item-success:hover,button.list-group-item-success:focus,button.list-group-item-success:hover{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:focus,a.list-group-item-success.active:hover,button.list-group-item-success.active,button.list-group-item-success.active:focus,button.list-group-item-success.active:hover{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info,button.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading,button.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:focus,a.list-group-item-info:hover,button.list-group-item-info:focus,button.list-group-item-info:hover{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:focus,a.list-group-item-info.active:hover,button.list-group-item-info.active,button.list-group-item-info.active:focus,button.list-group-item-info.active:hover{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning,button.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading,button.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:focus,a.list-group-item-warning:hover,button.list-group-item-warning:focus,button.list-group-item-warning:hover{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:focus,a.list-group-item-warning.active:hover,button.list-group-item-warning.active,button.list-group-item-warning.active:focus,button.list-group-item-warning.active:hover{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger,button.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading,button.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:focus,a.list-group-item-danger:hover,button.list-group-item-danger:focus,button.list-group-item-danger:hover{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:focus,a.list-group-item-danger.active:hover,button.list-group-item-danger.active,button.list-group-item-danger.active:focus,button.list-group-item-danger.active:hover{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>.small,.panel-title>.small>a,.panel-title>a,.panel-title>small,.panel-title>small>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group,.panel>.panel-collapse>.list-group{margin-bottom:0}.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.panel-heading+.panel-collapse>.list-group .list-group-item:first-child{border-top-left-radius:0;border-top-right-radius:0}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.panel-collapse>.table,.panel>.table,.panel>.table-responsive>.table{margin-bottom:0}.panel>.panel-collapse>.table caption,.panel>.table caption,.panel>.table-responsive>.table caption{padding-right:15px;padding-left:15px}.panel>.table-responsive:first-child>.table:first-child,.panel>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table:first-child>thead:first-child>tr:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table-responsive:last-child>.table:last-child,.panel>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child td,.panel>.table>tbody:first-child>tr:first-child th{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.list-group,.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#337ab7}.panel-primary>.panel-heading{color:#fff;background-color:#337ab7;border-color:#337ab7}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#337ab7}.panel-primary>.panel-heading .badge{color:#337ab7;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#337ab7}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive embed,.embed-responsive iframe,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:focus,.close:hover{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out;-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);-o-transform:translate(0,-25%);transform:translate(0,-25%)}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{min-height:16.43px;padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:12px;font-style:normal;font-weight:400;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;filter:alpha(opacity=0);opacity:0;line-break:auto}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{right:5px;bottom:0;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{bottom:0;left:5px;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;right:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;left:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);line-break:auto}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>a>img,.carousel-inner>.item>img{line-height:1}@media all and (transform-3d),(-webkit-transform-3d){.carousel-inner>.item{-webkit-transition:-webkit-transform .6s ease-in-out;-o-transition:-o-transform .6s ease-in-out;transition:transform .6s ease-in-out;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000px;perspective:1000px}.carousel-inner>.item.active.right,.carousel-inner>.item.next{left:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.carousel-inner>.item.active.left,.carousel-inner>.item.prev{left:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.carousel-inner>.item.active,.carousel-inner>.item.next.left,.carousel-inner>.item.prev.right{left:0;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:focus,.carousel-control:hover{color:#fff;text-decoration:none;filter:alpha(opacity=90);outline:0;opacity:.9}.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{position:absolute;top:50%;z-index:5;display:inline-block;margin-top:-10px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{left:50%;margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{right:50%;margin-right:-10px}.carousel-control .icon-next,.carousel-control .icon-prev{width:20px;height:20px;font-family:serif;line-height:1}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000\9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{width:30px;height:30px;margin-top:-15px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-15px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-15px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.btn-group-vertical>.btn-group:after,.btn-group-vertical>.btn-group:before,.btn-toolbar:after,.btn-toolbar:before,.clearfix:after,.clearfix:before,.container-fluid:after,.container-fluid:before,.container:after,.container:before,.dl-horizontal dd:after,.dl-horizontal dd:before,.form-horizontal .form-group:after,.form-horizontal .form-group:before,.modal-footer:after,.modal-footer:before,.nav:after,.nav:before,.navbar-collapse:after,.navbar-collapse:before,.navbar-header:after,.navbar-header:before,.navbar:after,.navbar:before,.pager:after,.pager:before,.panel-body:after,.panel-body:before,.row:after,.row:before{display:table;content:" "}.btn-group-vertical>.btn-group:after,.btn-toolbar:after,.clearfix:after,.container-fluid:after,.container:after,.dl-horizontal dd:after,.form-horizontal .form-group:after,.modal-footer:after,.nav:after,.navbar-collapse:after,.navbar-header:after,.navbar:after,.pager:after,.panel-body:after,.row:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-lg,.visible-md,.visible-sm,.visible-xs{display:none!important}.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table!important}tr.visible-xs{display:table-row!important}td.visible-xs,th.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table!important}tr.visible-sm{display:table-row!important}td.visible-sm,th.visible-sm{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table!important}tr.visible-md{display:table-row!important}td.visible-md,th.visible-md{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table!important}tr.visible-lg{display:table-row!important}td.visible-lg,th.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table!important}tr.visible-print{display:table-row!important}td.visible-print,th.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}} \ No newline at end of file
diff --git a/docs/assets/main.css b/docs/assets/main.css
deleted file mode 100755
index 39df95d..0000000
--- a/docs/assets/main.css
+++ /dev/null
@@ -1,121 +0,0 @@
-body {
- font-weight: 400;
- text-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
- overflow-y: scroll;
-}
-
-pre, code, pre code {
- border: none;
- border-radius: 0;
- background-color: #f9f9f9;
- font-size: 0.85em;
- tab-size: 4;
- -moz-tab-size: 4;
- -o-tab-size: 4;
-}
-.highlight {
- margin: 20px 0 10px;
-}
-.highlight > pre, .highlight > pre > code {
- background-color: transparent;
- padding: 0;
-}
-.highlight table {
- width: 100%;
-}
-.highlight table td.gl {
- width: 0;
-}
-.highlight table td {
- padding: 0;
-}
-.highlight table pre {
- margin: 0;
-}
-
-pre {
- font-size: 1em;
-}
-
-code {
- color: inherit;
-}
-
-#header {
- border-bottom: 1px solid #eee;
- margin-bottom: 20px;
-}
-
-#header a:hover {
- text-decoration: none;
-}
-
-#footer {
- margin: 20px 0;
- font-size: 0.85em;
- color: #999;
- text-align: center;
-}
-
-#content > .page-header:first-child {
- margin-top: 0;
-}
-
-#content > .page-header:first-child h2 {
- margin-top: 0;
-}
-
-
-#navigation {
- font-size: 0.9em;
-}
-
-#navigation li {
- padding-left: 0;
-}
-
-#navigation li p {
- font-weight: bold;
-}
-
-#navigation li a, #navigation li p {
- padding: 10px;
- margin: 0;
-}
-
-#navigation .nav-header {
- padding-left: 0;
- padding-right: 0;
-}
-
-body.rtl {
- direction: rtl;
-}
-
-body.rtl #header .brand {
- float: right;
- margin-left: 5px;
-}
-body.rtl .row-fluid [class*="span"] {
- float: right !important;
- margin-left: 0;
- margin-right: 2.564102564102564%;
-}
-body.rtl .row-fluid [class*="span"]:first-child {
- margin-right: 0;
-}
-
-body.rtl ul, body.rtl ol {
- margin: 0 25px 10px 0;
-}
-
-table {
- margin-bottom: 1rem;
- border: 1px solid #e5e5e5;
- border-collapse: collapse;
-}
-
-td, th {
- padding: .25rem .5rem;
- border: 1px solid #e5e5e5;
-}
diff --git a/docs/assets/syntax.css b/docs/assets/syntax.css
deleted file mode 100644
index 4877e41..0000000
--- a/docs/assets/syntax.css
+++ /dev/null
@@ -1,61 +0,0 @@
-.highlight .hll { background-color: #ffffcc }
-.highlight { background: #ffffff; }
-.highlight .c { color: #888888 } /* Comment */
-.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
-.highlight .k { color: #008800; font-weight: bold } /* Keyword */
-.highlight .cm { color: #888888 } /* Comment.Multiline */
-.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
-.highlight .c1 { color: #888888 } /* Comment.Single */
-.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
-.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
-.highlight .ge { font-style: italic } /* Generic.Emph */
-.highlight .gr { color: #aa0000 } /* Generic.Error */
-.highlight .gh { color: #333333 } /* Generic.Heading */
-.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
-.highlight .go { color: #888888 } /* Generic.Output */
-.highlight .gp { color: #555555 } /* Generic.Prompt */
-.highlight .gs { font-weight: bold } /* Generic.Strong */
-.highlight .gu { color: #666666 } /* Generic.Subheading */
-.highlight .gt { color: #aa0000 } /* Generic.Traceback */
-.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
-.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
-.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
-.highlight .kp { color: #008800 } /* Keyword.Pseudo */
-.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
-.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
-.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
-.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
-.highlight .na { color: #336699 } /* Name.Attribute */
-.highlight .nb { color: #003388 } /* Name.Builtin */
-.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
-.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
-.highlight .nd { color: #555555 } /* Name.Decorator */
-.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
-.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
-.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
-.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
-.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
-.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
-.highlight .nv { color: #336699 } /* Name.Variable */
-.highlight .ow { color: #008800 } /* Operator.Word */
-.highlight .w { color: #bbbbbb } /* Text.Whitespace */
-.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
-.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
-.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
-.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
-.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
-.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
-.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
-.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
-.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
-.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
-.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
-.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
-.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
-.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
-.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
-.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
-.highlight .vc { color: #336699 } /* Name.Variable.Class */
-.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
-.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
-.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
diff --git a/docs/char.md b/docs/char.md
deleted file mode 100644
index 1b9ccd6..0000000
--- a/docs/char.md
+++ /dev/null
@@ -1,92 +0,0 @@
----
-layout: page
-title: character encoding and conversions
----
-libcasio has its own portable character encoding conversion, resembling
-iconv. It supports Unicode transformation formats (UTF-8, UTF-16, UTF-32)
-and CASIO's proprietary character encoding named FONTCHARACTER according to
-the SDK it published in 2006 for the fx-9860G.
-
-The character conversion utilities are defined in `<libcasio/char.h>`,
-but as usual, including `<libcasio.h>` for everything is recommended.
-
-### Opening and closing a conversion descriptor
-The conversion descriptor is the main object that will keep track of
-the conversion steps and status. Here are the main functions to manage it:
-
-{% highlight c linenos %}
-int casio_open_conv(casio_conv_t *cd, const char *to, const char *from);
-int casio_close_conv(casio_conv_t cd);
-{% endhighlight %}
-
-The `to` and `from` parameters of the `casio_open_conv()` function are the
-string identifiers of the source and destination encodings for the conversion.
-For example, use `casio_open_conv(&cd, "utf-8", "utf-32")` to open a descriptor
-that will be able to convert UTF-32 encoded data into UTF-8 encoded data.
-
-### Converting formats
-Once the conversion descriptor is opened, you can use the `casio_conv()`
-function, defined this way:
-
-{% highlight c linenos %}
-int casio_conv(casio_conv_t cd,
- const char **in_buffer, size_t *in_left,
- const char **out_buffer, size_t *out_left);
-{% endhighlight %}
-
-In the same fashion than iconv, this function is made for being called
-several times, usually because you read from a stream and write to another
-stream โ€” although you can use it to convert data all at once.
-
-Here is a simple example using two buffers:
-
-{% highlight c linenos %}
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <libcasio.h>
-
-int main(void)
-{
- int err = 0; casio_conv_t cd = NULL;
- uint32_t buf0[] = {'H', 'e', 'l', 'l', 'o'};
- size_t buf0_size = 5 * sizeof(uint32_t);
- uint32_t buf1[] = {' ', 'w', 'o', 'r', 'l', 'd', '!'};
- size_t buf1_size = 7 * sizeof(uint32_t);
- char bufdata[30], *buf = &bufdata;
- size_t outsize = 29; /* let space for the end zero */
-
- /* Open the conversion descriptor. */
- err = casio_open_conv(&cd, "utf-8", "utf-32");
- if (err) {
- fprintf(stderr, "Could not open the conversion desc.: %s",
- casio_strerror(err));
- goto fail;
- }
-
- /* Convert the first buffer. */
- err = casio_conv(cd, &buf0, &buf0_size, &buf, &outsize);
- if (err) {
- fprintf(stderr, "Could not convert the first buffer: %s",
- casio_strerror(err));
- goto fail;
- }
-
- /* Convert the second buffer. */
- err = casio_conv(cd, &buf1, &buf1_size, &buf, &outsize);
- if (err) {
- fprintf(stderr, "Could not convert the second buffer: %s",
- casio_strerror(err));
- goto fail;
- }
-
- /* Print the buffer. */
- *buf = '\0';
- fputs(bufdata, stdout);
-
-fail:
- /* Close the conversion descriptor. */
- casio_close_conv(cd);
- return (err != 0);
-}
-{% endhighlight %}
diff --git a/docs/conf.py b/docs/conf.py
new file mode 100644
index 0000000..ddf67e7
--- /dev/null
+++ b/docs/conf.py
@@ -0,0 +1,78 @@
+# Configuration file for the Sphinx documentation builder.
+#
+# This file only contains a selection of the most common options. For a full
+# list see the documentation:
+# http://www.sphinx-doc.org/en/master/config
+
+# -- Path setup --------------------------------------------------------------
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#
+# import os
+# import sys
+# sys.path.insert(0, os.path.abspath('.'))
+
+
+# -- Project information -----------------------------------------------------
+
+project = 'libcasio'
+copyright = '2019, Thomas Touhey'
+author = 'Thomas Touhey'
+
+# The full version, including alpha/beta/rc tags
+
+def _get_release():
+ import re
+ from os.path import dirname, join
+
+ path = join(dirname(__file__), '..', 'Makefile.vars')
+ content = open(path).read()
+
+ major = re.search(r'\s*MAJOR\s* \:?\= [^\S\r\n]*([0-9]+)\s*', content,
+ re.I | re.X).group(1)
+ minor = re.search(r'\s*MINOR\s* \:?\= [^\S\r\n]*([0-9]+)\s*', content,
+ re.I | re.X).group(1)
+ indev = re.search(r'\s*INDEV\s* \:?\= [^\S\r\n]*([0-9a-z]*)\s*', content,
+ re.I | re.X).group(1)
+
+ release = f"{major}.{minor}{'-indev' if indev else ''}"
+ return release
+
+release = _get_release()
+
+# -- General configuration ---------------------------------------------------
+
+primary_domain = 'c'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+]
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+# This pattern also affects html_static_path and html_extra_path.
+exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
+
+
+# -- Options for HTML output -------------------------------------------------
+
+html_baseurl = "/docs"
+html_favicon = "favicon.png"
+html_logo = "logo.png"
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+#
+html_theme = 'sphinx_rtd_theme'
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
diff --git a/docs/devel.rst b/docs/devel.rst
new file mode 100644
index 0000000..97d8e31
--- /dev/null
+++ b/docs/devel.rst
@@ -0,0 +1,12 @@
+Developer documentation
+=======================
+
+You've read :ref:`user` and want to contribute the
+project? You're very welcome! This chapter regroups everything you need to
+know.
+
+.. toctree::
+ :maxdepth: 2
+
+ devel/concepts
+ devel/logging-internals
diff --git a/docs/devel/concepts.rst b/docs/devel/concepts.rst
new file mode 100644
index 0000000..4f4713b
--- /dev/null
+++ b/docs/devel/concepts.rst
@@ -0,0 +1,164 @@
+Development concepts for libcasio
+=================================
+
+As a follow-up for :ref:`user-concepts` in the user guide, here's a few
+concepts and decisions that have been taken for the development.
+
+File organization
+-----------------
+
+There are many, many files in libcasio, and that's because I try to keep the
+project clean and organized. This file is an attempt at describing how
+the files are organized and where you can find or should put anything here.
+
+There are a few main files and folders:
+
+``docs/``
+ The library documentation, written using Sphinx.
+
+``include/``
+ The public headers to use with the library (not including
+ internal headers).
+
+``src/``
+ The sources and internal headers.
+
+``tools/``, ``configure``, ``Makefile``, ``Makefile.vars``, ``Makefile.msg``
+ Build utilities.
+
+``README.md``, ``CONTRIBUTING.md``, ``LICENSE.md``
+ Basic to-read files.
+
+In the ``include/`` folder, there is the main header the user is supposed to
+include, ``libcasio.h``, and a subfolder, which contains all of the headers
+specific to modules. It is organized as in ``src/``, in modules which represent
+the abstraction the module defines. For example, ``src/stream/`` and
+``include/libcasio/stream.h`` are related to the libcasio-specific stream which
+defines platform-agnostic functions to the system-specific utilities.
+
+In the source folder, the ``internals.h`` header is the general internal header
+which is included in every source file in the project (sometimes using a
+module or submodule specific header which defines some more specific things
+afterwards). It contains general utilities such as reliable endian management
+macros, reliable integer types, and so on.
+
+Function declarations and definitions
+-------------------------------------
+
+For portability (e.g. call conventions and other compiler-specific mess),
+libcasio uses a few macros for declaring and defining functions that you are
+expected to use if you ought to add some stuff:
+
+.. function:: OF(ARGS)
+
+ This is a macro originally from `Zlib <https://www.zlib.net/>`_. It is
+ used on function declarations for compatibility with K&R (pre-ANSI) C,
+ which didn't support arguments definition for them. Without the macro,
+ you might have done:
+
+ .. code-block:: c
+
+ #if defined(__STDC__) && __STDC__
+ int my_function(int arg, char const *carg);
+ #else
+ int my_function(); /* K&R */
+ #endif
+
+ Instead, with this macro, you can just do:
+
+ .. code-block:: c
+
+ int my_function
+ OF((int arg, char const *carg));
+
+.. function:: CASIO_EXTERN(TYPE)
+
+ Declare or define a function exported or ought to be. For example, with
+ a declaration and a definition:
+
+ .. code-block:: c
+
+ CASIO_EXTERN(int) my_function
+ OF((int arg1, int arg2));
+
+ CASIO_EXTERN(int) my_function(int arg1, int arg2)
+ {
+ return (arg1 + arg2);
+ }
+
+ Which can be resolved as one of the following (not exhaustive):
+
+ .. code-block:: c
+
+ /* Within normal circumstances. */
+ extern int my_function(int arg1, int arg2);
+
+ /* Oh, we're on good ol' Windows! Let's set a call convention
+ * explicitely so we don't run into problems. */
+ extern int WINAPI my_function(int arg1, int arg2);
+
+.. function:: CASIO_NORETURN
+
+ Use instead of :c:func:`CASIO_EXTERN` for functions that are not supposed
+ to return, e.g. if they ``exit()`` or ``abort()``. For example:
+
+ .. code-block:: c
+
+ CASIO_NORETURN panic_and_set_fire_to_the_computer
+ OF((char const *msg));
+
+.. function:: CASIO_LOCAL(TYPE)
+
+ Use for defining a function internal to the file. For example, with
+ a declaration and a definition:
+
+ .. code-block:: c
+
+ CASIO_LOCAL(int) my_function(int arg1, int arg2);
+
+ CASIO_LOCAL(int) my_function(int arg1, int arg2)
+ {
+ return (arg1 - arg2);
+ }
+
+ Which can be resolved as one of the following (not exhaustive):
+
+ .. code-block:: c
+
+ /* Within normal circumstances. */
+ static int my_function(int arg1, int arg2);
+
+.. function:: CASIO_HOOK(TYPE)
+
+ Equivalent of :c:func:`CASIO_LOCAL` for functions that ought to be used
+ as hooks, i.e. callbacks for libcasio.
+
+.. function:: CASIO_HOOK_TYPE(TYPE)
+
+ Extern function as a type, for using hook functions as callbacks within
+ ``typedef`` or other type definitions. For example:
+
+ .. code-block:: c
+
+ typedef CASIO_EXTERN_TYPE(int) my_function_t
+ OF((int arg1, int arg2));
+
+.. function:: CASIO_EXTERN_TYPE(TYPE)
+
+ Equivalent of :c:func:`CASIO_HOOK_TYPE` for exported functions to be
+ used and stored as hooks.
+
+.. function:: CASIO_DEPRECATED
+
+ Prefix for function declarations and definitions which will be marked as
+ deprecated for the compiler (if it supports it). For example:
+
+ .. code-block:: c
+
+ CASIO_DEPRECATED CASIO_EXTERN(char const *) do_not_use_this_function
+ OF((char const *s));
+
+ CASIO_DEPRECATED CASIO_EXTERN(char const *) do_not_use_this_function(char const *s)
+ {
+ return (s + strlen(s));
+ }
diff --git a/docs/devel/logging-internals.rst b/docs/devel/logging-internals.rst
new file mode 100644
index 0000000..47a5ba0
--- /dev/null
+++ b/docs/devel/logging-internals.rst
@@ -0,0 +1,40 @@
+Logging internals
+=================
+
+To use the libcasio logging interface, just include ``internals.h`` at source
+root, or include something that ends up including it, directly or indirectly.
+If the interface looks weird to you, that may be because this has been an
+experiment to make a logging system compatible with K&R and ANSI C (which
+explains the double parenthesis).
+
+There are two different types of logging in libcasio: message logging, and
+memory logging (which end up being the same to the user).
+
+First, message logging. The main macro for this is
+``msg((LEVEL, FORMAT, ...))``. The level is of the form ``ll_<level>``,
+so ``ll_info``, ``ll_warn``, ``ll_error`` or ``ll_fatal``. The format and
+arguments are for the printf-like function behind, so you can use
+``msg((ll_info, "%d + %s", 5, "coucou"))`` for example.
+
+If you are doing a condition only for a logging instruction, with no
+``else if`` or ``else`` clause in the same state behind, you can use the
+``ifmsg``, ``elifmsg`` and ``elsemsg`` macros. ``ifmsg`` and ``elifmsg`` take
+the condition and the arguments for the ``msg`` function. For example:
+
+.. code-block:: c
+
+ if (something.cool > 0) {
+ /* do something because it is cool */
+ }
+ elifmsg(something.cool == 0, (ll_warn, "The thing is not cool."))
+ elsemsg((ll_error, "The thing has NEGATIVE coolness, that's not cool."))
+
+The memory logging family are organized the same, except the names are
+``mem``, ``ifmem``, ``elifmem`` and ``elsemem``, and instead of the format and
+format arguments, you have the pointer and the memory area size, e.g.:
+
+.. code-block:: c
+
+ char cooldude = "COOLDUD\x7F";
+ msg((ll_info, "Cool dude magic:"));
+ mem((ll_info, cooldude, 8));
diff --git a/docs/errors.md b/docs/errors.md
deleted file mode 100644
index 57cbce1..0000000
--- a/docs/errors.md
+++ /dev/null
@@ -1,30 +0,0 @@
----
-layout: page
-title: error management
----
-Almost all functions that can fail in libcasio return an `int`, even if
-they open a handle or descriptor of some kind (which is usually passed by
-using a pointer to it as a first argument). This integer corresponds to the
-error that occured in the function, or zero, representing the "everything
-went fine" error.
-
-The errors that can happen in libcasio are defined in `<libcasio/error.h>`,
-although as usual, you should include `<libcasio.h>` to access the code
-and utilities.
-
-Some errors are "relative", which means their significance depends on the
-function that returned it, when others are not. For example, `casio_error_op`
-means the function has received arguments that it doesn't manage (sometimes,
-yet), and it should not be transmitted as is, while `casio_error_read` can
-be transmitted without any risk.
-
-To get the full list of errors, you should read the header directly.
-If you simply want to get the error string, you can use the `casio_strerror()`
-function, which has the following prototype:
-
-{% highlight c linenos %}
-const char *casio_strerror(int err);
-{% endhighlight %}
-
-This string should only be used for displaying the error, as it could be
-translated in future versions of the library.
diff --git a/docs/favicon.ico b/docs/favicon.ico
deleted file mode 100644
index 88dc4c9..0000000
--- a/docs/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/docs/file-organization.md b/docs/file-organization.md
deleted file mode 100644
index 5c90151..0000000
--- a/docs/file-organization.md
+++ /dev/null
@@ -1,31 +0,0 @@
----
-layout: page
-title: file organization
----
-There are many, many files in libcasio, and that's because I try to keep the
-project clean and organized. This file is an attempt at describing how
-the files are organized and where you can find or should put anything here.
-
-There are a few main files and folders:
-
-- `docs/`: a statically generated website using Jekyll, in which the page
- you're currently reading is written;
-- `include/`: the public headers to use with the library (not including
- internal headers);
-- `src/`: the sources and internal headers;
-- `tools/`, `configure`, `Makefile`, `Makefile.vars`, `Makefile.msg`:
- build utilities;
-- `README.md`, `CONTRIBUTING.md`, `LICENSE.md`: basic to-read files.
-
-In the `include/` folder, there is the main header the user is supposed to
-include, `libcasio.h`, and a subfolder, which contains all of the headers
-specific to modules. It is organized as in `src/`, in modules which represent
-the abstraction the module defines. For example, `src/stream/` and
-`include/libcasio/stream.h` are related to the libcasio-specific stream which
-defines platform-agnostic functions to the system-specific utilities.
-
-In the source folder, the `internals.h` header is the general internal header
-which is included in every source file in the project (sometimes using a
-module or submodule specific header which defines some more specific things
-afterwards). It contains general utilities such as reliable endian management
-macros, reliable integer types, and so on.
diff --git a/docs/file.md b/docs/file.md
deleted file mode 100644
index bd0a045..0000000
--- a/docs/file.md
+++ /dev/null
@@ -1,4 +0,0 @@
----
-layout: page
-title: decoding files
----
diff --git a/docs/filesystems.md b/docs/filesystems.md
deleted file mode 100644
index 02804ff..0000000
--- a/docs/filesystems.md
+++ /dev/null
@@ -1,4 +0,0 @@
----
-layout: page
-title: filesystems
----
diff --git a/docs/getting-started.md b/docs/getting-started.md
deleted file mode 100644
index 6167d33..0000000
--- a/docs/getting-started.md
+++ /dev/null
@@ -1,35 +0,0 @@
----
-layout: page
-title: getting started
----
-The libcasio development happens [on the Touhey forge][gh].
-
-There is currently no mailing-list.
-
-The release tarballs are available [here][pub].
-
-libcasio is a development library, either shared or static.
-There are many configuration options for adapting the library to your
-platform and needs.
-
-To configure, use `./configure <options>`. Options are used as
-`--<name>=<value>`. The following are some build options:
-
-- `--target=<target>`: the target for which to produce the library (by default,
- native);
-- `--static`: produce a static library (by default, shared);
-- `--windows`: use the Windows versions of the final formats (dll instead of
- elf, lib instead of coff);
-- `--no-libusb`: do not use (and link against) libusb;
-- `--no-file`: do not use the standard I/O library (probably because there
- aren't any);
-- `--no-log`, `--loglevel=<level>`: if we should include debugging content
- (but keep the interface), and if yes, what the default library log level.
- See [Logging](logging.html) for more information;
-- `--maintainer`: alias for `--loglevel=info`, also introduces more
- compilation warnings.
-
-Other options are packaging options (todo: add info about them here).
-
-[gh]: https://forge.touhey.org/casio/libcasio.git/
-[pub]: https://libcasio.touhey.pro/pub/
diff --git a/docs/index.md b/docs/index.md
deleted file mode 100644
index 2543857..0000000
--- a/docs/index.md
+++ /dev/null
@@ -1,19 +0,0 @@
----
-layout: page
-title: introduction
----
-This is the libcasio documentation. It targets library users and library
-developers.
-
-libcasio ought to become the _de facto_ standard when it comes to manipulating
-protocols and file formats used with CASIO calculators. Most of it is
-platform-agnostic, although it contains stream and filesystem interfaces with
-the most common systems such as Microsoft Windows, GNU/Linux distributions
-or Apple's OS X.
-
-The C "namespace" the library reserves are `casio_`, `CASIO_`, `libcasio_`
-and `LIBCASIO_`; consider the use of anything starting with one of these
-prefixes as having an undefined behaviour (so you really shouldn't do that).
-
-There are many objects in libcasio. Choose what fits your need(s) in the
-sidebar!
diff --git a/docs/index.rst b/docs/index.rst
new file mode 100644
index 0000000..d15640b
--- /dev/null
+++ b/docs/index.rst
@@ -0,0 +1,26 @@
+Welcome to libcasio's documentation!
+====================================
+
+libcasio ought to become the *de facto* standard when it comes to manipulating
+protocols and file formats used with CASIO calculators. Most of it is
+platform-agnostic, although it contains stream and filesystem interfaces with
+the most common systems such as Microsoft Windows, GNU/Linux distributions
+or Apple's OS X.
+
+This is the libcasio documentation. It targets library users and library
+developers. The development happens on `the Touhey forge <libcasio source_>`_,
+and is distributed from the `libcasio distribution point`_. For more links,
+check out the `libcasio website`_.
+
+There is currently no mailing-list.
+
+.. toctree::
+ :maxdepth: 2
+
+ install
+ user
+ devel
+
+.. _libcasio source: https://forge.touhey.org/casio/libcasio.git/
+.. _libcasio website: https://libcasio.touhey.pro/
+.. _libcasio distribution point: https://libcasio.touhey.pro/pub/
diff --git a/docs/install.rst b/docs/install.rst
new file mode 100644
index 0000000..914e210
--- /dev/null
+++ b/docs/install.rst
@@ -0,0 +1,34 @@
+.. _installing:
+
+Installation guide
+==================
+
+libcasio is either built as a static or shared library, and is made to be
+interfaced with C programs. The method of installing or building depends on
+the system you're using: pick the one that fits yours!
+
+POSIX systems (manual build)
+----------------------------
+
+To configure, use ``./configure <options>``. Options are used as
+``--<name>=<value>``. The following are some build options:
+
+``--target=<target>``
+ The target for which to produce the library (by default, native).
+
+``--static``
+ Produce a static library (by default, shared).
+
+``--windows``
+ Use the Windows versions of the final formats (dll instead of elf,
+ lib instead of coff).
+
+``--no-log``, ``--loglevel=<level>``:
+ If we should include debugging content (but keep the interface), and if
+ yes, what the default library log level. See :ref:`logging` for more
+ information.
+
+``--maintainer``
+ Alias for ``--loglevel=info``, also introduces more compilation warnings.
+
+Other options are packaging options (todo: add more info about them here).
diff --git a/docs/link.md b/docs/link.md
deleted file mode 100644
index 54f74ed..0000000
--- a/docs/link.md
+++ /dev/null
@@ -1,4 +0,0 @@
----
-layout: page
-title: links and protocols
----
diff --git a/docs/logging-internals.md b/docs/logging-internals.md
deleted file mode 100644
index c5cc461..0000000
--- a/docs/logging-internals.md
+++ /dev/null
@@ -1,40 +0,0 @@
----
-layout: page
-title: logging internals
----
-To use the libcasio logging interface, just include `internals.h` at source
-root, or include something that ends up including it, directly or indirectly.
-If the interface looks weird to you, that may be because this has been an
-experiment to make a logging system compatible with K&R and ANSI C (which
-explains the double parenthesis).
-
-There are two different types of logging in libcasio: message logging, and
-memory logging (which end up being the same to the user).
-
-First, message logging. The main macro for this is `msg((LEVEL, FORMAT, ...))`.
-The level is of the form `ll_<level>`, so `ll_info`, `ll_warn`, `ll_error`
-or `ll_fatal`. The format and arguments are for the printf-like function
-behind, so you can use `msg((ll_info, "%d + %s", 5, "coucou"))` for example.
-
-If you are doing a condition only for a logging instruction, with no `else if`
-or `else` clause in the same state behind, you can use the `ifmsg`, `elifmsg`
-and `elsemsg` macros. `ifmsg` and `elifmsg` take the condition and the
-arguments for the `msg` function. For example:
-
-{% highlight c linenos %}
-if (something.cool > 0) {
- /* do something because it is cool */
-}
-elifmsg(something.cool == 0, (ll_warn, "The thing is not cool."))
-elsemsg((ll_error, "The thing has NEGATIVE coolness, that's not cool."))
-{% endhighlight %}
-
-The memory logging family are organized the same, except the names are
-`mem`, `ifmem`, `elifmem` and `elsemem`, and instead of the format and
-format arguments, you have the pointer and the memory area size, e.g.:
-
-{% highlight c linenos %}
-char cooldude = "COOLDUD\x7F";
-msg((ll_info, "Cool dude magic:"));
-mem((ll_info, cooldude, 8));
-{% endhighlight %}
diff --git a/docs/logging.md b/docs/logging.md
deleted file mode 100644
index e4adf67..0000000
--- a/docs/logging.md
+++ /dev/null
@@ -1,69 +0,0 @@
----
-layout: page
-title: logging
----
-**This document only describes the library user control interface, which**
-**doesn't cover the actual logging, aimed at library developers.**
-
-For debugging purposes, libcasio has a debugging interface that allows
-displaying messages in the debug stream (usually `stderr`) with four
-different levels (plus a special one):
-
-- `info` (debug information);
-- `warn` (warnings);
-- `error` (non-fatal errors);
-- `fatal` (fatal errors);
-- `none` (special log level to tell not to print messages).
-
-Each level includes the message from the levels below in the list.
-
-The log level used to be hardcoded into the library (with the configure
-script), but it appeared that some users wanted to be able to control it
-from the utilities using the library (with a `--log` option).
-
-This interface is declared in `<libcasio/log.h>`. For forward compatibility
-purposes, it works with strings.
-
-To set the loglevel, use `casio_setlog()`, and to get a pointer to the current
-loglevel, use `casio_getlog()`.
-
-{% highlight c linenos %}
-void casio_setlog(const char *level);
-const char *casio_getlog(void);
-{% endhighlight %}
-
-Setting an unknown log level will simply result in setting the log level
-to `none`.
-
-Before setting the log level, you should list the recognized log levels.
-For this, use the `casio_setlog()` function:
-
-{% highlight c linenos %}
-typedef void casio_log_list_t(void *cookie, const char *str);
-void casio_listlog(casio_log_list_t *callback, void *cookie);
-{% endhighlight %}
-
-The callback will be called for every recognized log level. It is possible
-for the function to call the callback only once (see the `--no-log` option
-in [Getting started](getting-started.html)).
-
-An example log level listing is the following:
-
-{% highlight c linenos %}
-#include <stdio.h>
-#include <stdlib.h>
-#include <libcasio.h>
-
-void callback(void *cookie, const char *str)
-{
- (void)cookie; /* no, cookie, we don't want to use you */
- printf("- %s\n", str);
-}
-
-int main(void)
-{
- printf("Available log levels:\n");
- casio_listlog(&callback, NULL);
- return (0);
-}
-{% endhighlight %}
diff --git a/docs/logo.png b/docs/logo.png
new file mode 100644
index 0000000..e3ab98a
--- /dev/null
+++ b/docs/logo.png
Binary files differ
diff --git a/docs/make.bat b/docs/make.bat
new file mode 100644
index 0000000..27f573b
--- /dev/null
+++ b/docs/make.bat
@@ -0,0 +1,35 @@
+@ECHO OFF
+
+pushd %~dp0
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+ set SPHINXBUILD=sphinx-build
+)
+set SOURCEDIR=.
+set BUILDDIR=_build
+
+if "%1" == "" goto help
+
+%SPHINXBUILD% >NUL 2>NUL
+if errorlevel 9009 (
+ echo.
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+ echo.installed, then set the SPHINXBUILD environment variable to point
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
+ echo.may add the Sphinx directory to PATH.
+ echo.
+ echo.If you don't have Sphinx installed, grab it from
+ echo.http://sphinx-doc.org/
+ exit /b 1
+)
+
+%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
+goto end
+
+:help
+%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
+
+:end
+popd
diff --git a/docs/mcs.md b/docs/mcs.md
deleted file mode 100644
index 053350f..0000000
--- a/docs/mcs.md
+++ /dev/null
@@ -1,4 +0,0 @@
----
-layout: page
-title: main filesystems
----
diff --git a/docs/streams.md b/docs/streams.md
deleted file mode 100644
index 8bb122a..0000000
--- a/docs/streams.md
+++ /dev/null
@@ -1,102 +0,0 @@
----
-layout: page
-title: streams
----
-Streams are the abstractions for exchanging data with anything: a local or
-distant file, a device through serial or USB communications, local memory
-(usually for simulation), etc.
-
-When it wasn't libcasio yet (at the time, communication-related objects were
-in libp7), libusb usage used to be hardcoded in the Protocol 7.00 management
-functions (sending, receiving); then, it used FILE streams from the GNU libc
-implementation, but that still wasn't platform-agnostic enough, so what has
-finally be decided is that the library would use its own stream object.
-
-The stream object is usable both by the library and the user. The library
-defines some useful platform-agnostic streams it uses itself, such as the
-checksum stream (which calculates the checksum as the file content is read),
-and some platform-specific streams for platforms defining a macro (for
-example, CASIOWIN doesn't).
-
-This document describes how to use and make a libcasio stream. Notice that
-for the examples in this document, you shall include `<libcasio.h>`, or
-the stream-specific header, `<libcasio/stream.h>`.
-
-### Opening and closing a stream
-There are three ways to open a stream:
-
-- with a specialized function, such as `casio_open_stream_streams()` for
- POSIX or `casio_opencom_windows()` for the Windows API;
-- with a multi-stream function, such as `casio_open_usb_stream()` for
- USB-connected calculators, or `casio_open_com_stream()` for
- serial-connected calculators;
-- with the core function, `casio_open_stream()`, which you will use when
- you will want to define your own streams.
-
-All of the stream opening functions shall take a reference to the stream
-pointer you'll use as the stream handle as the first parameter, and return
-the libcasio error code that occured (or 0 if no error has occured).
-
-Once you are done with the stream, you shall close it, so that all of the
-allocated resources can be free'd properly. In order to do this,
-you can simply use `casio_close()`.
-
-{% highlight c linenos %}
-int casio_open_any_stream(casio_stream_t **stream, ...);
-int casio_close(casio_stream_t *stream);
-{% endhighlight %}
-
-So here's a simple example using the `casio_open_memory()` function
-(which makes a stream out of memory), for opening a stream and directly
-closing it:
-
-{% highlight c linenos %}
-#include <libcasio.h>
-
-void do_something()
-{
- int err;
- casio_stream_t *stream = NULL;
- char zone[6];
-
- err = casio_open_memory(&stream, zone, 6);
- if (err) {
- /* an error has occured! */
- return ;
- }
-
- /* do something here, if an error occurs, make sure to
- close the stream anyway, or use the 'fail' label here */
-
-fail:
- err = casio_close(stream);
- /* you can check the error if you want, but the stream will always
- be closed at this point, more or less properly */
-}
-{% endhighlight %}
-
-### Opening modes
-libcasio streams have different features that are activated by a flag in the
-open mode. Here are the existing ones:
-
-- `CASIO_OPENMODE_READ`: reading bytes from the stream is allowed (the
- `casio_read()` and `casio_skip()` functions can be used);
-- `CASIO_OPENMODE_WRITE`: writing bytes to the stream is allowed (the
- `casio_write()` and `casio_write_char()` can be used);
-- `CASIO_OPENMODE_SEEK`: seeking in the stream is allowed (the
- `casio_seek()` can be used);
-- `CASIO_OPENMODE_SERIAL`: setting the serial properties of the stream is
- allowed (the `casio_streamfuncs_setattrs` callback will be used);
-- `CASIO_OPENMODE_SCSI`: SCSI operations on the stream are allowed (the
- `casio_streamfuncs_scsi` callback will be used);
-- `CASIO_OPENMODE_USB`: USB operations on the stream are allowed (no
- callback corresponding to this is done yet).
-
-Notice that even if `CASIO_OPENMODE_SEEK` is not allowed, `casio_tell()` will
-work and tell the
-
-There also are a few open modes that aren't used by the core functions
-themselves but that above opening functions can use when appropriate:
-
-- `CASIO_OPENMODE_TRUNC`: the file will be truncated;
-- `CASIO_OPENMODE_APPEND`: will append to the file.
diff --git a/docs/user.rst b/docs/user.rst
new file mode 100644
index 0000000..7a9e0cc
--- /dev/null
+++ b/docs/user.rst
@@ -0,0 +1,18 @@
+.. _user:
+
+User documentation
+==================
+
+This chapter describes the library interface and concepts, which library
+developers must also know in order to contribute to the project.
+
+.. toctree::
+ :maxdepth: 2
+
+ user/concepts
+ user/character
+ user/picture
+ user/link
+ user/mcs
+ user/file
+ user/logging
diff --git a/docs/user/character.rst b/docs/user/character.rst
new file mode 100644
index 0000000..35dc1fb
--- /dev/null
+++ b/docs/user/character.rst
@@ -0,0 +1,98 @@
+Character encoding and conversions
+==================================
+
+libcasio has its own portable character encoding conversion, resembling
+iconv. It supports Unicode transformation formats (UTF-8, UTF-16, UTF-32)
+and CASIO's proprietary character encoding named FONTCHARACTER according to
+the SDK it published in 2006 for the fx-9860G.
+
+The character conversion utilities are defined in ``<libcasio/char.h>``,
+but as usual, including ``<libcasio.h>`` for everything is recommended.
+
+Opening and closing a conversion descriptor
+-------------------------------------------
+
+The conversion descriptor is the main object that will keep track of
+the conversion steps and status. Here are the main functions to manage it:
+
+.. c:type:: casio_conv_t
+
+ The conversion descriptor type.
+
+.. c:function:: int casio_open_conv(casio_conv_t *cd, char const *to, \
+ char const *from)
+
+ Open the conversion descriptor.
+
+ The ``to`` and ``from`` parameters are the string identifiers of the
+ source and destination encodings for the conversion.
+ For example, use ``casio_open_conv(&cd, "utf-8", "utf-32")`` to open a
+ descriptor that will be able to convert UTF-32 encoded data into UTF-8
+ encoded data.
+
+Converting formats
+------------------
+
+Once the conversion descriptor is opened, you can use the following
+function:
+
+.. c:function:: int casio_conv(casio_conv_t cd, \
+ char const **in_buffer, size_t *in_left, \
+ char **out_buffer, size_t *out_left)
+
+ In the same fashion than iconv, this function is made for being called
+ several times, usually because you read from a stream and write to another
+ stream โ€” although you can use it to convert data all at once.
+
+ Here is a simple example using two buffers:
+
+ .. code-block:: c
+
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <stdint.h>
+ #include <libcasio.h>
+
+ int main(void)
+ {
+ int err = 0; casio_conv_t cd = NULL;
+ uint32_t buf0[] = {'H', 'e', 'l', 'l', 'o'};
+ size_t buf0_size = 5 * sizeof(uint32_t);
+ uint32_t buf1[] = {' ', 'w', 'o', 'r', 'l', 'd', '!'};
+ size_t buf1_size = 7 * sizeof(uint32_t);
+ char bufdata[30], *buf = &bufdata;
+ size_t outsize = 29; /* let space for the end zero */
+
+ /* Open the conversion descriptor. */
+ err = casio_open_conv(&cd, "utf-8", "utf-32");
+ if (err) {
+ fprintf(stderr, "Could not open the conversion desc.: %s",
+ casio_strerror(err));
+ goto fail;
+ }
+
+ /* Convert the first buffer. */
+ err = casio_conv(cd, &buf0, &buf0_size, &buf, &outsize);
+ if (err) {
+ fprintf(stderr, "Could not convert the first buffer: %s",
+ casio_strerror(err));
+ goto fail;
+ }
+
+ /* Convert the second buffer. */
+ err = casio_conv(cd, &buf1, &buf1_size, &buf, &outsize);
+ if (err) {
+ fprintf(stderr, "Could not convert the second buffer: %s",
+ casio_strerror(err));
+ goto fail;
+ }
+
+ /* Print the buffer. */
+ *buf = '\0';
+ fputs(bufdata, stdout);
+
+ fail:
+ /* Close the conversion descriptor. */
+ casio_close_conv(cd);
+ return (err != 0);
+ }
diff --git a/docs/user/concepts.rst b/docs/user/concepts.rst
new file mode 100644
index 0000000..4afdd6e
--- /dev/null
+++ b/docs/user/concepts.rst
@@ -0,0 +1,80 @@
+.. _user-concepts:
+
+libcasio concepts
+=================
+
+The library interface follows a certain amount of concepts which makes it
+consistent.
+
+Namespace
+---------
+
+In order to interfere as little as possible with user definitions, the library
+uses a โ€œnamespaceโ€ which is represented by prefixes for all of its
+external declarations, definitions and macros. Even for code that uses
+libcasio, avoid defining anything with any of these prefixes or you'll get
+an undefined behaviour.
+
+The reserved prefixes are ``casio_``, ``CASIO_``, ``libcasio_`` and
+``LIBCASIO_``.
+
+Structure namespaces
+--------------------
+
+For structures you can access the members, these have as prefixes the
+structure name in order, once again, to not interfere with user code.
+
+For example, if a ``struct casio_my_type`` is defined, all member names will
+start with ``casio_my_type_``, for example:
+
+.. code-block:: c
+
+ #include <libcasio/cdefs.h>
+ CASIO_STRUCT(casio_my_type, casio_my_type_t)
+
+ struct casio_my_type {
+ int casio_my_type_a;
+ char const *casio_my_type_b;
+ };
+
+Objects
+-------
+
+The library is based around objects and functions for using and managing them.
+The objects are defined as anonymous structures, which means you can't access
+the content of these objects directly, you need to use some getters
+for compatibility.
+
+Errors
+------
+
+Almost all functions that can fail in libcasio return an :c:type:`int`, even if
+they open a handle or descriptor of some kind (which is usually passed by
+using a pointer to it as a first argument). This integer corresponds to the
+error that occured in the function, or zero, representing the "everything
+went fine" error.
+
+The errors that can happen in libcasio are defined in ``<libcasio/error.h>``,
+although as usual, you should include ``<libcasio.h>`` to access the code
+and utilities.
+
+Some errors are "relative", which means their significance depends on the
+function that returned it, when others are not. For example, ``casio_error_op``
+means the function has received arguments that it doesn't manage (sometimes,
+yet), and it should not be transmitted as is, while ``casio_error_unknown`` can
+be transmitted without any risk.
+
+To get the full list of errors, you should read the header directly.
+If you simply want to get the error name or description, you can use the
+following functions:
+
+.. c:function:: char const *casio_error_name(int code)
+
+ Get a pointer to the error name (which you shall not free).
+
+.. c:function:: char const *casio_error_desc(int code)
+
+ Get a pointer to the error description (which you shall not free).
+
+The description string should only be used for displaying the error, as it
+could be translated in future versions of the library.
diff --git a/docs/user/file.rst b/docs/user/file.rst
new file mode 100644
index 0000000..5cc6fc2
--- /dev/null
+++ b/docs/user/file.rst
@@ -0,0 +1,164 @@
+File management
+===============
+
+libcasio manages the file formats through a file API where you can open and
+decode a file, and export data into a file. A file is primarily represented
+by its type and platform:
+
+.. c:type:: casio_filetype_t
+
+ An enumeration defining various file types that file formats libcasio
+ can read and write can represent. The values in this enumeration are
+ defined as flags so that such a value can also represent multiple
+ file types with no ambiguity.
+
+ .. c:macro:: casio_filetype_addin
+
+ An add-in, i.e. a binary application which executes natively onto
+ the calculator from the storage filesystem(s). The platform cannot
+ be :c:macro:`casio_filefor_none` for this type.
+
+ .. c:macro:: casio_filetype_add_in
+
+ An alias for :c:macro:`casio_filetype_addin`.
+
+ .. c:macro:: casio_filetype_mcs
+
+ A main memory backup, see :ref:`mcs` for more details about
+ what a main memory is.
+
+ .. c:macro:: casio_filetype_eact
+
+ An e-activity, i.e. rich document for storing courses for example.
+
+ .. c:macro:: casio_filetype_e_activity
+
+ An alias for :c:macro:`casio_filetype_eact`.
+
+ .. c:macro:: casio_filetype_eactivity
+
+ An alias for :c:macro:`casio_filetype_eact`.
+
+ .. c:macro:: casio_filetype_picture
+
+ A picture, e.g. ``*.g3p`` files.
+
+ .. c:macro:: casio_filetype_pict
+
+ An alias for :c:macro:`casio_filetype_picture`.
+
+ .. c:macro:: casio_filetype_lang
+
+ A language file, which contains message translations with IDs,
+ e.g. ``*.g1l`` or ``*.g3l`` files.
+
+ .. c:macro:: casio_filetype_fkey
+
+ A function key file, which contains function key pictures with IDs
+ in the same fashion than language files, e.g. ``*.g1n`` files.
+
+ .. c:macro:: casio_filetype_storage
+
+ A storage filesystem backup, typically ``*.g1s`` files.
+
+.. c:type:: casio_filefor_t
+
+ An enumeration defining various platforms for which the file formats
+ libcasio can read and write can be made for. The values in this enumeration
+ are defined as flags so that such a value can also represent multiple
+ file platforms with no ambiguity.
+
+ .. c:macro:: casio_filefor_none
+
+ No platform in particular; this value always evaluates as zero, so
+ that any other value in this enumeration can make it precise.
+
+ .. c:macro:: casio_filefor_fx
+
+ The fx-9860G family of calculators, OS 1.x and OS 2.x.
+
+ .. c:macro:: casio_filefor_cp
+
+ The Classpad family of calculators, e.g. the fx-CP400.
+
+ .. c:macro:: casio_filefor_cg
+
+ The Prizm family of calculators, including the fx-CG10, fx-CG20
+ and fx-CG50 (Graph 90+E).
+
+ .. c:macro:: casio_filefor_cas
+
+ Ancient calculators supporting the CAS40 and CAS50 protocols.
+
+ .. c:macro:: casio_filefor_casemul
+
+ The CasEmul software.
+
+It is represented by the following object:
+
+.. c:type:: casio_file_t
+
+ A decoded file of one of the supported file formats by libcasio.
+
+Creating and freeing a file
+---------------------------
+
+A file can be created using one of the following functions:
+
+.. c:function:: int casio_make_picture(casio_file_t **filep, \
+ unsigned int width, unsigned int height)
+
+ Create a picture file using the given dimensions.
+
+.. c:function:: int casio_make_mcs(casio_file_t **filep)
+
+ Create a main memory backup file.
+
+.. c:function:: int casio_make_fkey(casio_file_t **filep, \
+ casio_filefor_t filefor, int count)
+
+ Create a function key file for the platform given in ``filefor``,
+ with ``count`` slots.
+
+.. c:function:: int casio_make_lang(casio_file_t **filep, \
+ casio_filefor_t filefor, int count)
+
+ Create a language file for the platform given in ``filefor``,
+ with ``count`` slots.
+
+.. c:function:: int casio_make_addin(casio_file_t **filep, \
+ casio_filefor_t filefor, size_t size, char const *name, \
+ char const *internal, casio_version_t const *versionp, \
+ time_t const *created)
+
+ Create an add-in file for the platform given in ``filefor``,
+ with ``size`` bytes for the code, ``name`` as the public name,
+ ``internal`` as the internal name (usually starting with ``@``),
+ ``versionp`` pointing to the version structure, and ``created``
+ being the time of creation.
+
+Once you're done using a file, you shall use the following function:
+
+.. c:function:: void casio_free_file(casio_file_t *file)
+
+ Free the file and all of its related resources.
+
+Decoding a file
+---------------
+
+A file is decoded from a generic stream, using the following function:
+
+.. c:function:: int casio_decode(casio_file_t **filep, \
+ char const *filename, tio_stream_t *buffer, \
+ casio_filetype_t expected_types)
+
+ Create a file from the stream in ``buffer``, into ``filep``. If you
+ have the filename, you shall pass it in ``filename`` (if not, just pass
+ ``NULL``), this function will also try to guess the file type using the
+ detected extension or filename (which has a significance for some
+ file formats, e.g. ancient file formats managed by CaS).
+
+ If you don't know what format you expect, pass zero to ``expected_types``.
+ Otherwise, use the types as flags, e.g.
+ ``casio_filetype_picture | casio_filetype_mcs | casio_filetype_storage``
+ if you expect to find some pictures (main memory can contain pictures).
diff --git a/docs/user/link.rst b/docs/user/link.rst
new file mode 100644
index 0000000..fa2a3ed
--- /dev/null
+++ b/docs/user/link.rst
@@ -0,0 +1,240 @@
+Calculator links
+================
+
+A link in libcasio represents a calculator over a stream, i.e. the application
+level. It is an abstraction which proposes everything the protocols CASIO
+calculator use offer, although some operations might not be implemented
+behind.
+
+Links can take the following callbacks:
+
+.. c:type:: int casio_link_confirm_t(void *cookie)
+
+ The process or the device on the other end requires a confirmation from
+ the user, for which such as function is called. It shall return ``0`` if
+ the user has not confirmed, or anything else if it is.
+
+.. c:type:: void casio_link_progress_t(void *cookie, unsigned int id, \
+ unsigned int total)
+
+ Is used for displaying the progress of an operation when it goes
+ further on.
+
+Managing a link
+---------------
+
+Only the library is able to implement link functions, in order to encourage
+users to contribute in the library development. Use the following functions to
+open and close a link:
+
+.. c:function:: int casio_open_link(casio_link_t **handlep, \
+ unsigned long flags, tio_stream_t *stream)
+
+ Open a link on the given stream. By default, uses the type of the stream
+ to find out what behaviour to adopt:
+
+ - if the stream is a generic stream, it will try to communicate using P7.
+ - if the stream is a serial stream, it will try to communicate using CAS50,
+ and if that failed, it will try to communicate using P7.
+ - if the stream is a USB stream, it will get the vendor, product,
+ class, subclass and protocol identifiers:
+
+ - if the protocol is found to be SCSI using the class/subclass/protocol,
+ then we shall try to communicate using SCSI.
+ - if the vendor identifier is ``0x07cf`` (โ€œCasio Computer Co., Ltdโ€),
+ the product identifier is ``0x6101`` (โ€œfx-9750gIIโ€) and the device
+ protocol is ``0`` (vendor-specific), then we shall try to communicate
+ using protocol 7 (P7).
+
+ All of these behaviours are tweakable through the following flags:
+
+ .. c:macro:: CASIO_LINKFLAG_P7
+
+ We want to enforce protocol 7 on generic and serial streams (and skip
+ the CAS40 check).
+
+ .. c:macro:: CASIO_LINKFLAG_CAS40
+
+ We want to speak CAS40 as we know it's an ancient calculator on the
+ other side (around 1990).
+
+ .. c:macro:: CASIO_LINKFLAG_CAS50
+
+ We only want to try out CAS50, and not skip to protocol 7 if it
+ doesn't work.
+
+ .. c:macro:: CASIO_LINKFLAG_CAS100
+
+ We want to speak CAS50 as we're guessing it's an AFX on the other
+ side.
+
+ .. c:macro:: CASIO_LINKFLAG_SCSI
+
+ We want to speak SCSI on all kind of devices, through bulk-only
+ transport on USB and plain SCSI writing on generic streams.
+ This flag will be ignored on serial streams.
+
+ For protocol 7 streams, by default:
+
+ - we start off as the active device, i.e. the one that will send commands
+ to the other one.
+ - we send a check then a discovery packet, in order to find out to what
+ device we're speaking to and trying to guess what commands are supported
+ or not.
+ - if the device is identified to be connected through USB, we shift
+ packets on data streams in order to go faster.
+ - we terminate the connection at the end.
+
+ All of these behaviours are tweakable through the following flags:
+
+ .. c:macro:: CASIO_LINKFLAG_PASSIVE
+
+ We want to start out as the passive device (emulate a calculator).
+
+ This will of course disable checks, discovery, packet shifting
+ and terminating connections as we depend on the other side to
+ make decisions.
+
+ .. c:macro:: CASIO_LINKFLAG_NOCHECK
+
+ We suppose the connection has already been made by a previous link
+ (possibly on a previous process) and do not issue the check.
+
+ .. c:macro:: CASIO_LINKFLAG_NODISC
+
+ We do not want to discover what kind of device we have on the other
+ side, and use fallbacks to guess what commands are supported. Notice
+ that you shall only use this flag for devices that do not support the
+ discovery command, as this can be made on an already established link.
+
+ .. c:macro:: CASIO_LINKFLAG_NOSHIFT
+
+ We do not want to do packet shifting on USB devices. This is usually
+ done for sensitive data packet exchanges, as packet shifting can
+ theoretically go really bad and make the link irrecoverable, but
+ that's yet to be seen in practice.
+
+ Packet shifting is not enabled on serial devices because it doesn't
+ speed up the process at all.
+
+ .. c:macro:: CASIO_LINKFLAG_TERM
+
+ We want to terminate the connection when the link is closed.
+
+.. c:function:: int casio_open_serial(casio_link_t **handlep, \
+ unsigned long flags, char const *name, tio_serial_attrs_t const *attrs)
+
+ Open a serial port using :c:func:`tio_open_serial_port` and the
+ given serial attributes, and open a link onto it.
+
+.. c:function:: int casio_open_usb(casio_link_t **handlep, \
+ unsigned long flags, int bus, int address)
+
+ Open a USB device using :c:func:`tio_open_usb`, and open a link onto it.
+
+.. c:function:: void casio_close_link(casio_link_t *handle)
+
+ Close the link and free all the related resources.
+
+Link-related operations
+-----------------------
+
+In order to get the link information, you shall use the following function:
+
+.. c:function:: casio_link_info_t const \
+ *casio_get_link_info(casio_link_t *handle)
+
+ Get the link information, i.e. the information on the device on the
+ other side. This function will return generic information in case the
+ discovery has been disabled.
+
+For managing serial settings, the following function has your back:
+
+.. c:function:: int casio_setlink(casio_link_t *handle, \
+ tio_serial_attrs_t const *attrs)
+
+ Agrees on serial settings with the device and changes the stream serial
+ properties on the underlying stream. Not all properties will be read,
+ generally only the speed, stop bits and parity.
+
+Screenstreaming
+---------------
+
+The logic for screenstreaming management in libcasio is kind of an infinite
+iterator, using the following function:
+
+.. c:function:: int casio_get_screen(casio_link_t *handle, \
+ casio_picture_t **screenp)
+
+ .. warning::
+
+ Initialize ``*screenp`` to either ``NULL`` or a valid picture
+ **before** calling this function!
+
+ Get the next screen that the calculator has sent us. Depending on
+ ``*screenp``:
+
+ - if it is ``NULL``, then the picture will be allocated and ``*screenp``
+ will be set to the newly allocated picture.
+ - if it is not ``NULL``, then it points to a valid picture which is
+ either modified if the dimensions of the received screen are the same
+ as its dimensions, or reallocated if not.
+
+System-related operations
+-------------------------
+
+CASIO calculators used to provide legit ways to backup different parts of the
+system on flash and upload and run special executables using protocol 7,
+although it has been removed on modern calculators. These functions implement
+these procedures:
+
+.. c:function:: int casio_backup_rom(casio_link_t *handle, \
+ tio_stream_t *buffer, casio_link_progress_t *progress, \
+ void *progress_cookie)
+
+ Backup the ROM into the given buffer.
+
+.. c:function:: int casio_upload_and_run(casio_link_t *handle, \
+ tio_stream_t *buffer, unsigned long loadaddr, unsigned long straddr, \
+ casio_link_progress_t *progress, void *progress_cookie)
+
+ Upload and run an executable from a stream. The stream is expected to
+ be a generic stream where the size can be determined by using
+ :c:func:`tio_get_size`.
+
+ ``loadaddr`` represents where in the calculator's memory the program
+ shall be loaded (e.g. ``0x88030000``), and ``straddr`` is where the
+ program shall be started (e.g. ``0x88030000``). Both should be on
+ 32-bits.
+
+ This function is usually used for uploading code that replaces the
+ flash's content, but the uploaded code can also serve other purposes
+ such as simply installing programs, displaying the calculator's info
+ or run a program to back up the calculator's memory. It is not
+ dangerous in itself, it's the uploaded code which can be, so as usual,
+ be careful with what you run on the calculator.
+
+Main memory-related operations
+------------------------------
+
+All CASIO calculators have at least a main memory, whatever its format is (for
+more about main memories, check out :ref:`mcs`). You can get the function that
+manages it through the link using the following:
+
+.. c:function:: int casio_get_link_mcs(casio_link_t *handle, \
+ casio_mcs_t **mcsp)
+
+ Get the main memory management object for the given link.
+
+Protocol-specific functions
+---------------------------
+
+While libcasio offers you an abstract interface to any calculator whatever
+protocol it is using, you can use the protocols directly for operations it
+does not manage. For this, see the following pages:
+
+.. toctree::
+ :maxdepth: 1
+
+ link/cas
+ link/seven
diff --git a/docs/user/link/cas.rst b/docs/user/link/cas.rst
new file mode 100644
index 0000000..9fba3fa
--- /dev/null
+++ b/docs/user/link/cas.rst
@@ -0,0 +1,5 @@
+Using the CAS protocols
+=======================
+
+You can't communicate directly with devices that use the CAS protocols. This
+will come very soon.
diff --git a/docs/user/link/seven.rst b/docs/user/link/seven.rst
new file mode 100644
index 0000000..15f670f
--- /dev/null
+++ b/docs/user/link/seven.rst
@@ -0,0 +1,177 @@
+Using protocol 7
+================
+
+You can communicate directly with your device on a link that uses protocol
+seven. This protocol is not linked directly to the file formats used on
+storage or main memories, on the contrary to the CAS protocols.
+
+This interface hides you some of the horrors the protocol uses, such as
+the escaping method, but you knowโ€ฆ it can't hide 'em all.
+
+Packet representation
+---------------------
+
+Everything starts with the packet representation:
+
+.. c:type:: casio_seven_packet_t
+
+ A protocol seven packet, as an abstract object.
+
+That packet can have several types:
+
+.. c:type:: casio_seven_type_t
+
+ A protocol seven packet type, as an enumeration with the following values:
+
+ .. c:macro:: casio_seven_type_cmd
+
+ Ask something to the passive device, and initialize a packet flow
+ relative to the issued command.
+
+ .. c:macro:: casio_seven_type_data
+
+ Send data as a flow.
+
+ .. c:macro:: casio_seven_type_swp
+
+ Swap roles between the active and passive device (but the device
+ which becomes active has a very specific role defined by the
+ previously issued command and its packet flow).
+
+ .. c:macro:: casio_seven_type_chk
+
+ Check if there's an interlocutor, and initiate the connection by
+ the way (as the passive device is not supposed to answer to any
+ command until it has received a check packet and responded to it).
+
+ .. c:macro:: casio_seven_type_ack
+
+ Acknowledge, i.e. say โ€œI have received and understood your messageโ€
+ and, in case of a command, โ€œI am willing to do what you're ordering
+ me toโ€.
+
+ .. c:macro:: casio_seven_type_ohp
+
+ Send a screen capture while in screenstreaming. The name โ€œohpโ€
+ comes from the original representation of such a mode, as the
+ โ€œoverhead projectorโ€ mode.
+
+ .. c:macro:: casio_seven_type_nak
+
+ Acknowledge negatively, i.e. say โ€œI have received but not understood
+ your messageโ€ or, in case of a command, โ€œI am not willing to do what
+ you're ordering me toโ€. Such a packet usually says a little bit more
+ about what the error is about.
+
+ .. c:macro:: casio_seven_type_end
+
+ Terminate the communication from the active side, to which, before
+ it is terminated, the passive side must acknowledge.
+
+There are several check types:
+
+.. c:type:: casio_seven_chk_t
+
+ The check packet subtype represents the context in which the check
+ packet is sent:
+
+ .. c:macro:: casio_seven_chk_ini
+
+ The check is the initial check to see if there is a device right
+ at the beginning of the communication.
+
+ .. c:macro:: casio_seven_chk_wait
+
+ The check is a timeout check, to see if the device is still there
+ and processing the command or if it has been disconnected. This
+ was made for serial lines where you could not see if there was
+ still a device on the other end or not, whether on USB you can
+ (but this type of check packets still exists on it).
+
+There also are several error types:
+
+.. c:type:: casio_seven_err_t
+
+ The error packet subtypes represents the errors.
+
+ .. c:macro:: casio_seven_err_default
+
+ The default error type (probably unused?).
+
+ .. c:macro:: casio_seven_err_resend
+
+ There was a checksum or timeout error, this packet is used for
+ asking a packet resend. Please don't use this packet directly, and
+ let the library manage this for you.
+
+ .. c:macro:: casio_seven_err_overwrite
+
+ The server wants a confirmation, either an ACK packet of type
+ :c:macro:`casio_seven_ack_ow` or an error packet of type
+ :c:macro:`casio_seven_error_dont_overwrite`.
+
+ .. c:macro:: casio_seven_err_dont_overwrite
+
+ When the passive device sends :c:macro:`casio_seven_err_overwrite`,
+ you can choose to say no by sending an error packet of this type.
+
+ .. c:macro:: casio_seven_err_other
+
+ This error type is the generic error type that can mean many things:
+ invalid or unsupported command, invalid argument, etc.
+
+ .. c:macro:: casio_seven_err_fullmem
+
+ When you try to create a file and the calculator hasn't got enough
+ memory left, it sends this error and immediately terminates the
+ connection (without the terminate packet).
+
+There also are several acknowledge types:
+
+.. c:type:: casio_seven_ack_t
+
+ The acknowledge type can be used in various contexts:
+
+ .. c:macro:: casio_seven_ack_normal
+
+ The normal acknowledge kind, accepts the command and report a
+ successful execution or respond to check, data, terminate or
+ role swap packets.
+
+ .. c:macro:: casio_seven_ack_ow
+
+ When the passive device has responded to a command with
+ :c:macro:`casio_seven_err_overwrite`, the active device sends the
+ passive device an acknowledge packet with such a subtype to confirm
+ the overwrite.
+
+ .. c:macro:: casio_seven_ack_ext
+
+ Respond to a discovery command with device information.
+
+ .. c:macro:: casio_seven_ack_term
+
+ Used to acknowledge a terminate packet.
+
+There also are several terminate types:
+
+.. c:type:: casio_seven_term_t
+
+ The terminate type is the reason why the connection was terminated:
+
+ .. c:macro:: casio_seven_term_default
+
+ Normal termination.
+
+ .. c:macro:: casio_seven_term_user
+
+ The user has terminated the connection (by pressing AC on the
+ calculator, usually).
+
+ .. c:macro:: casio_seven_term_timeouts
+
+ Terminated due to timeouts or checksums.
+
+ .. c:macro:: casio_seven_term_overwrite
+
+ In response to ``ow_terminate``.
diff --git a/docs/user/logging.rst b/docs/user/logging.rst
new file mode 100644
index 0000000..6b5c824
--- /dev/null
+++ b/docs/user/logging.rst
@@ -0,0 +1,78 @@
+.. _logging:
+
+Logging
+=======
+
+.. warning::
+
+ This document only describes the library user control interface, which
+ doesn't cover the actual logging, aimed at library developers.
+
+For debugging purposes, libcasio has a debugging interface that allows
+displaying messages in the debug stream (usually ``stderr``) with four
+different levels (plus a special one):
+
+``info``
+ Debug information.
+
+``warn``
+ Warnings.
+
+``error``
+ Non-fatal errors.
+
+``fatal``
+ Fatal errors.
+
+``none``
+ Special log level not to print messages.
+
+Each level includes the message from the levels below in the list.
+
+The log level used to be hardcoded into the library (with the configure
+script), but it appeared that some users wanted to be able to control it
+from the utilities using the library (with a ``--log`` option).
+
+This interface is declared in ``<libcasio/log.h>``. For forward compatibility
+purposes, it works with strings.
+
+.. c:function:: void casio_setlog(char const *level)
+
+ Set the log level using its name. Setting a log level unknown to the
+ library will result in setting the log level to ``none``.
+
+.. c:function:: char const *casio_getlog(void)
+
+ Get a pointer to the current log level (which you shall not free).
+
+Before setting the log level, you should list the recognized log levels. It
+is recommended to iterate on them using the following functions for this:
+
+.. c:function:: int casio_iter_log(tio_iter_t **iter)
+
+ Get a log level iterator.
+
+.. c:function:: int casio_next_log(tio_iter_t *iter, char const **ptr)
+
+ Get the next log level on the iterator.
+
+An example log level listing is the following:
+
+.. code-block:: c
+
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <libcasio.h>
+
+ void callback(void *cookie, const char *str)
+ {
+ (void)cookie; /* no, cookie, we don't want to use you */
+ printf("- %s\n", str);
+ }
+
+ int main(void)
+ {
+ printf("Available log levels:\n");
+ casio_listlog(&callback, NULL);
+ return (0);
+ }
diff --git a/docs/user/mcs.rst b/docs/user/mcs.rst
new file mode 100644
index 0000000..d39d240
--- /dev/null
+++ b/docs/user/mcs.rst
@@ -0,0 +1,9 @@
+.. _mcs:
+
+Main filesystems
+================
+
+CASIO calculators have a main filesystem, also called โ€œmain memoryโ€ and โ€œMCSโ€
+(for โ€œMain Control Structureโ€) that contains all the little files
+necessary to the main functions, such as programming, working on lists,
+matrixes, spreadsheets, pictures, strings, and so on.
diff --git a/docs/user/picture.rst b/docs/user/picture.rst
new file mode 100644
index 0000000..9ab209c
--- /dev/null
+++ b/docs/user/picture.rst
@@ -0,0 +1,252 @@
+Picture management
+==================
+
+libcasio manages picture formats.
+
+The pixel
+---------
+
+.. c:type:: casio_pixel_t
+
+ A pixel represented as a 32-bit integer, encoded as 0x00RRGGBB using
+ native endianness, which is used as the canonical form of representing
+ a picture in libcasio.
+
+.. c:function:: casio_pixel_t casio_pixel(int r, int g, int b)
+
+ Function-like macro to create a pixel.
+
+.. c:function:: casio_pixel_t casio_pixel_with_r(casio_pixel_t pix, int r)
+
+ Replace the red component of a pixel with the given value.
+
+.. c:function:: casio_pixel_t casio_pixel_with_g(casio_pixel_t pix, int g)
+
+ Replace the green component of a pixel with the given value.
+
+.. c:function:: casio_pixel_t casio_pixel_with_b(casio_pixel_t pix, int b)
+
+ Replace the blue component of a pixel with the given value.
+
+.. c:function:: int casio_pixel_r(casio_pixel_t pix)
+
+ Get the red component of a pixel.
+
+.. c:function:: int casio_pixel_g(casio_pixel_t pix)
+
+ Get the green component of a pixel.
+
+.. c:function:: int casio_pixel_b(casio_pixel_t pix)
+
+ Get the blue component of a pixel.
+
+Picture encodings
+-----------------
+
+.. c:type:: casio_colorcode_t
+
+ Color codes for the :c:macro:`casio_pictureformat_4bit_code` picture
+ encoding.
+
+ .. c:macro:: casio_colorcode_black
+
+ Black: 0x000000.
+
+ .. c:macro:: casio_colorcode_blue
+
+ Blue: 0x0000FF.
+
+ .. c:macro:: casio_colorcode_green
+
+ Green: 0x00FF00.
+
+ .. c:macro:: casio_colorcode_cyan
+
+ Cyan: 0x00FFFF.
+
+ .. c:macro:: casio_colorcode_red
+
+ Red: 0xFF0000.
+
+ .. c:macro:: casio_colorcode_magenta
+
+ Magenta: 0xFF00FF.
+
+ .. c:macro:: casio_colorcode_yellow
+
+ Yellow: 0xFFFF00.
+
+ .. c:macro:: casio_colorcode_white
+
+ White: 0xFFFFFF.
+
+.. c:type:: casio_pictureformat_t
+
+ The picture format type.
+
+ By default, the pixels of a picture are defined top to bottom, left to
+ right.
+
+ .. c:macro:: casio_pictureformat_1bit
+
+ In this format, each bit represents a pixel (so one byte contains
+ eight pixels). If the width is not divisible by eight, then the
+ last bits of the last byte of the line are unused (fill bits), and
+ the next line starts at the beginning of the next byte; this makes
+ the navigation between lines easier, but takes up more space.
+
+ An off bit (0b0) represents a white pixel, and an on bit (0b1)
+ represents a black pixel.
+
+ For calculating the size of such pictures, calculate the
+ number of bytes a line occupies (usually ``ceil(w / 8)``)
+ and multiply it by the number of lines.
+
+ .. c:macro:: casio_pictureformat_1bit_r
+
+ Same as :c:macro:`casio_pictureformat_1bit`, except an off bit (0b0)
+ represents a black pixel, and an on bit (0b1) represents a white
+ pixel.
+
+ .. c:macro:: casio_pictureformat_1bit_packed
+
+ Packed monochrome pictures are basically the same as the format
+ described for :c:macro:`casio_pictureformat_1bit`, except there
+ are no fill bits: if a picture width is 6 pixels, then the second
+ line will start at the seventh bit of the first byte (where it
+ would start at the first bit of the second byte with fill bits).
+
+ The navigation to a line is less easy as it takes at least one
+ division.
+
+ For calculating the size of such pictures, calculate the
+ total number ``P`` of pixels (``w * h``) and divide it by
+ the size of a byte (``ceil(p / 8)``).
+
+ .. c:macro:: casio_pictureformat_1bit_packed_r
+
+ Same as :c:macro:`casio_pictureformat_1bit_packed`, with the
+ differences described in :c:macro:`casio_pictureformat_1bit_r`.
+
+ .. c:macro:: casio_pictureformat_1bit_old
+
+ The old monochrome format used by CASIO is basically a normal
+ monochrome format (the width is usually 96 or 128, so no need for
+ fill bits), except that it starts with the last byte (where the
+ bits are in left to right), but it goes right to left,
+ bottom to top.
+
+ The size is the same as for :c:macro:`casio_pictureformat_1bit`,
+ except the byte order changes.
+
+ .. c:macro:: casio_pictureformat_2bit_dual
+
+ This is the format used for the Prizm's projector mode. It is
+ composed of two monochrome pictures (with sizes divisible by
+ eight). It is basically gray pictures, with white, gray, dark gray
+ and black.
+
+ To calculate the size, well, just multiply the size of such a
+ picture in the :c:macro:`casio_pictureformat_1bit` per 2.
+
+ .. c:macro:: casio_pictureformat_4bit
+
+ This is a 4 bit per pixel format. There is no need for fill nibbles.
+ Each nibble (group of 4 bits) is made of the following:
+
+ - one bit for red (OR by 0xFF0000).
+ - one bit for green (OR by 0x00FF00).
+ - one bit for blue (OR by 0x0000FF).
+ - one alignment bit.
+
+ To calculate the size, divide the number of pixels (``w * h``) by 2.
+
+ .. c:macro:: casio_pictureformat_4bit_code
+
+ In this encoding, each nibble for a pixel represents one of the
+ colors defined in :c:type:`casio_colorcode_t` or, in case of an
+ illegal value (8 and above), plain black.
+
+ The size is calculated the same way as for
+ :c:macro:`casio_pictureformat_4bit`.
+
+ .. c:macro:: casio_pictureformat_4bit_color
+
+ This format is used by old CASIO models. It is made of four monochrome
+ pictures (no need for fill bits), where the palettes are orange,
+ green, blue, white (bg).
+
+ To get the size, just multiply the size of a VRAM (see
+ :c:macro:`casio_pictureformat_1bit`) by 4.
+
+ .. c:macro:: casio_pictureformat_4bit_mono
+
+ Same as :c:macro:`casio_pictureformat_4bit_color`, except the
+ palette are (unused), (unused), black, white (bg).
+
+ .. c:macro:: casio_pictureformat_casemul
+
+ This format is used by CasEmul. It is basically arbitrary color codes,
+ 1 byte per code, where, for example, 1 is orange. You can check the
+ full color codes in ``lib/picture.c``.
+
+ The size in bytes is the number of pixels.
+
+ .. c:macro:: casio_pictureformat_16bit
+
+ This format is used for the Prizm's VRAM. Each pixel is two bytes
+ long, where:
+
+ - the first five bytes represents the high five (clap!) bits of
+ the red part.
+ - the next six bits represent the high six bits of the green part.
+ - the last five bits represent the high five (re-clap!) bits of
+ the blue part.
+
+ The size in bytes is the number of pixels times 2.
+
+Managing a picture
+------------------
+
+You cannot make a picture directly, you have to decode it.
+
+.. c:function:: void casio_free_picture(casio_picture_t *picture)
+
+ Free the picture. Any related resource (such as the pixel matrix)
+ will also be free'd, so be careful.
+
+.. c:function:: int casio_get_picture_dimensions(casio_picture_t *picture, \
+ unsigned int *widthp, unsigned int *heightp)
+
+ Get the picture width and height.
+
+.. c:function:: int casio_access_pixels(casio_picture_t *picture, \
+ casio_pixel_t ***pixels)
+
+ Access the pixels as a pixel matrix.
+
+Encoding and decoding a picture
+-------------------------------
+
+.. c:function:: int casio_decode_picture(casio_picture_t **picturep, \
+ unsigned int width, unsigned int height, \
+ casio_pictureformat_t format, tio_stream_t *stream)
+
+ Create a picture out of a readable stream, with the width and height.
+
+.. c:function:: int casio_decode_picture_buffer(casio_picture_t **picturep, \
+ unsigned int width, unsigned int height, \
+ casio_pictureformat_t format, void const *data, size_t data_size)
+
+ Create a picture out of raw data, with the width and height.
+
+.. c:function:: int casio_get_picture_encoded_size(casio_picture_t *picture, \
+ casio_pictureformat_t format, size_t *sizep)
+
+ Get the required size for encoding the picture in a given format.
+
+.. c:function:: int casio_encode_picture(casio_picture_t *picture, \
+ casio_pictureformat_t format, void *buf, size_t size)
+
+ Get the encoded form of a picture, using a given format and encoding
+ into the given buffer.
diff --git a/include/libcasio.h b/include/libcasio.h
index 39f8c99..76154d5 100644
--- a/include/libcasio.h
+++ b/include/libcasio.h
@@ -20,11 +20,9 @@
# define LIBCASIO_H
# include "libcasio/cdefs.h"
# include "libcasio/error.h"
-# include "libcasio/mutex.h"
# include "libcasio/log.h"
# include "libcasio/number.h"
-# include "libcasio/misc.h"
# include "libcasio/link.h"
# include "libcasio/file.h"
diff --git a/include/libcasio/cdefs.h b/include/libcasio/cdefs.h
index d00639b..af272bc 100644
--- a/include/libcasio/cdefs.h
+++ b/include/libcasio/cdefs.h
@@ -24,9 +24,9 @@
#if defined(OF)
#elif defined(__STDC__) && __STDC__
-# define OF(CASIO_ARGS) CASIO_ARGS
+# define OF(CASIO__ARGS) CASIO__ARGS
#else
-# define OF(CASIO_ARGS) ()
+# define OF(CASIO__ARGS) ()
#endif
/* "Normal start" of the file is here. */
@@ -67,66 +67,48 @@
# endif
/* ---
- * Check for subsystems.
+ * Extern functions.
* --- */
-/* Macros defined by the `libcasio/config.h` header:
- * - `LIBCASIO_DISABLED_FILE`: can we use the standard FILE operations?
- * - `LIBCASIO_DISABLED_LIBUSB`: can we use libusb? */
-
-/* Can we use the Linux and the MacOS/OS X listing?
- * XXX: what about Linux distributions not using the Linux standard
- * filesystem? */
-
-# if defined(__linux__)
-# else
-# define LIBCASIO_DISABLED_LINUX_SERIAL
-# endif
-
-# if defined(__APPLE__) && defined(__MACH__)
-# else
-# define LIBCASIO_DISABLED_MAC_SERIAL
-# endif
-
-/* Can we use the POSIX (STREAMS) interface? */
+/* Warn if the function is deprecated. */
-# if defined(__linux__) || (defined(__APPLE__) && defined(__MACH__))
+# if CASIO_GNUC_PREREQ(3, 0)
+# define CASIO_DEPRECATED __attribute__((deprecated))
# else
-# define LIBCASIO_DISABLED_STREAMS
+# define CASIO_DEPRECATED
# endif
-/* Can we use the Windows (Win32/Win64) API? */
+/* Warn if the result is unused.
+ * To do that, we'll use the `CASIO_WUR` attribute. */
-# if defined(_WIN16) || defined(_WIN32) || defined(_WIN64) \
- || defined(__WINDOWS__)
+# if CASIO_GNUC_PREREQ(4, 0)
+# define CASIO_WUR __attribute__((warn_unused_result))
+# elif CASIO_MSC_PREREQ(17, 0)
+# include <sal.h>
+# define CASIO_WUR _Check_return_
# else
-# define LIBCASIO_DISABLED_WINDOWS
+# define CASIO_WUR
# endif
-/* ---
- * Extern functions.
- * --- */
-
/* Some platforms require more than simply 'extern'.
* Here are macros to control this. */
-# define CASIO_EXTERN extern
-# define CASIO_EXPORT
-# define CASIO_LOCAL static
+# define CASIO_EXTERN(TYPE) \
+ extern TYPE
+# define CASIO_NORETURN \
+ __attribute__((noreturn)) extern void
+# define CASIO_LOCAL(TYPE) \
+ static TYPE
+# define CASIO_HOOK(TYPE) \
+ static TYPE
-/* ---
- * Enumerations.
- * --- */
+# define CASIO_EXTERN_TYPE(TYPE) \
+ TYPE
+# define CASIO_HOOK_TYPE(TYPE) \
+ TYPE
-/* Enumerations can be great thanks to the compiler: better warnings,
- * better debug, better coding! */
-
-# if defined(LIBCASIO_USE_ENUMS)
-# elif defined(__STDC__) && __STDC__
-# define LIBCASIO_USE_ENUMS 1
-# else /* K&R C, no enums! */
-# define LIBCASIO_USE_ENUMS 0
-# endif
+# define CASIO_LOCAL_DATA(TYPE) \
+ static TYPE
/* ---
* C++ declarations and namespaces management.
@@ -134,16 +116,11 @@
/* libcasio is made in C. */
-# if 0 /* hey, what about this? */
-# define CASIO_BEGIN_NAMESPACE namespace casio {
-# define CASIO_END_NAMESPACE }
-# endif
-
# ifdef __cplusplus
-# define CASIO_BEGIN_NAMESPACE
+# define CASIO_BEGIN_NAMESPACE namespace "libcasio" {
# define CASIO_BEGIN_DECLS extern "C" {
# define CASIO_END_DECLS }
-# define CASIO_END_NAMESPACE
+# define CASIO_END_NAMESPACE }
# else
# define CASIO_BEGIN_NAMESPACE
# define CASIO_BEGIN_DECLS
@@ -151,29 +128,28 @@
# define CASIO_END_NAMESPACE
# endif
+/* Forward declare a structure. */
+
+# define CASIO_STRUCT(CASIO__STRUCT_NAME, CASIO__STRUCT_TYPEDEF) \
+struct CASIO__STRUCT_NAME; \
+typedef struct CASIO__STRUCT_NAME CASIO__STRUCT_TYPEDEF;
+
/* ---
- * Various function attributes.
+ * Utilities.
* --- */
-/* Warn if the result is unused.
- * To do that, we'll use the `CASIO_WUR` attribute. */
+CASIO_BEGIN_NAMESPACE
+CASIO_BEGIN_DECLS
-# if CASIO_GNUC_PREREQ(4, 0)
-# define CASIO_WUR __attribute__((warn_unused_result))
-# elif CASIO_MSC_PREREQ(17, 0)
-# include <sal.h>
-# define CASIO_WUR _Check_return_
-# else
-# define CASIO_WUR
-# endif
+/* Cross-platform allocation functions. They are defined just in case. */
-/* Warn if the function is deprecated. */
+CASIO_EXTERN(void *) casio_alloc
+ OF((size_t casio__num_elements, size_t casio__element_size));
+CASIO_EXTERN(void) casio_free
+ OF((void *casio__ptr));
-# if CASIO_GNUC_PREREQ(3, 0)
-# define CASIO_DEPRECATED __attribute__((deprecated))
-# else
-# define CASIO_DEPRECATED
-# endif
+CASIO_END_DECLS
+CASIO_END_NAMESPACE
# include "cdefs/integers.h"
# include "cdefs/endian.h"
diff --git a/include/libcasio/cdefs/endian.h b/include/libcasio/cdefs/endian.h
index 57122ec..3711291 100644
--- a/include/libcasio/cdefs/endian.h
+++ b/include/libcasio/cdefs/endian.h
@@ -24,22 +24,22 @@
* does not have any equivalent function (or has one but indicates that
* fact badly). */
-CASIO_EXTERN casio_uint16_t CASIO_EXPORT casio_be16toh
+CASIO_EXTERN(casio_uint16_t) casio_be16toh
OF((casio_uint16_t casio__x));
-CASIO_EXTERN casio_uint16_t CASIO_EXPORT casio_le16toh
+CASIO_EXTERN(casio_uint16_t) casio_le16toh
OF((casio_uint16_t casio__x));
-CASIO_EXTERN casio_uint32_t CASIO_EXPORT casio_be32toh
+CASIO_EXTERN(casio_uint32_t) casio_be32toh
OF((casio_uint32_t casio__x));
-CASIO_EXTERN casio_uint32_t CASIO_EXPORT casio_le32toh
+CASIO_EXTERN(casio_uint32_t) casio_le32toh
OF((casio_uint32_t casio__x));
-CASIO_EXTERN casio_uint16_t CASIO_EXPORT casio_htobe16
+CASIO_EXTERN(casio_uint16_t) casio_htobe16
OF((casio_uint16_t casio__x));
-CASIO_EXTERN casio_uint16_t CASIO_EXPORT casio_htole16
+CASIO_EXTERN(casio_uint16_t) casio_htole16
OF((casio_uint16_t casio__x));
-CASIO_EXTERN casio_uint32_t CASIO_EXPORT casio_htobe32
+CASIO_EXTERN(casio_uint32_t) casio_htobe32
OF((casio_uint32_t casio__x));
-CASIO_EXTERN casio_uint32_t CASIO_EXPORT casio_htole32
+CASIO_EXTERN(casio_uint32_t) casio_htole32
OF((casio_uint32_t casio__x));
# if defined(__APPLE__)
diff --git a/include/libcasio/char.h b/include/libcasio/char.h
index 71809b8..d2f9a21 100644
--- a/include/libcasio/char.h
+++ b/include/libcasio/char.h
@@ -62,19 +62,19 @@
* character length (1 to 2 bytes) and FONTCHAR-16 is the FONTCHARACTER
* encoding with fixed-width big-endian 16-bit characters. */
-CASIO_EXTERN int CASIO_EXPORT casio_fontchar8_to_utf32
+CASIO_EXTERN(int) casio_fontchar8_to_utf32
OF((casio_uint8_t **casio__inbuf, size_t *casio__inleft,
casio_uint32_t **casio__outbuf, size_t *casio__outleft));
-CASIO_EXTERN int CASIO_EXPORT casio_fontchar16_to_utf32
+CASIO_EXTERN(int) casio_fontchar16_to_utf32
OF((FONTCHARACTER **casio__inbuf, size_t *casio__inleft,
casio_uint32_t **casio__outbuf, size_t *casio__outleft));
-CASIO_EXTERN int CASIO_EXPORT casio_utf32_to_fontchar8
+CASIO_EXTERN(int) casio_utf32_to_fontchar8
OF((casio_uint32_t **casio__inbuf, size_t *casio__inleft,
casio_uint8_t **casio__outbuf, size_t *casio__outleft));
-CASIO_EXTERN int CASIO_EXPORT casio_utf32_to_fontchar16
+CASIO_EXTERN(int) casio_utf32_to_fontchar16
OF((casio_uint32_t **casio__inbuf, size_t *casio__inleft,
FONTCHARACTER **casio__outbuf, size_t *casio__outleft));
diff --git a/include/libcasio/date.h b/include/libcasio/date.h
index f8eb817..fdeed3d 100644
--- a/include/libcasio/date.h
+++ b/include/libcasio/date.h
@@ -27,9 +27,9 @@ CASIO_BEGIN_NAMESPACE
CASIO_BEGIN_DECLS
-CASIO_EXTERN int CASIO_EXPORT casio_decode_date
+CASIO_EXTERN(int) casio_decode_date
OF((time_t *casio__date, char const *casio__raw));
-CASIO_EXTERN int CASIO_EXPORT casio_encode_date
+CASIO_EXTERN(int) casio_encode_date
OF((char *casio__raw, time_t const *casio__date));
CASIO_END_DECLS
diff --git a/include/libcasio/error.h b/include/libcasio/error.h
index 323d2da..62c7d45 100644
--- a/include/libcasio/error.h
+++ b/include/libcasio/error.h
@@ -104,14 +104,14 @@ typedef int casio_error_t;
/* Get a string describing the error. */
-CASIO_EXTERN char const* CASIO_EXPORT casio_error_strings[];
+CASIO_BEGIN_DECLS
-CASIO_EXTERN char const* CASIO_EXPORT casio_strerror
+CASIO_EXTERN(char const *) casio_error_name
+ OF((int casio__error));
+CASIO_EXTERN(char const *) casio_error_desc
OF((int casio__error));
-# ifndef LIBCASIO_NO_STRERROR
-# define casio_strerror(CASIO_N) casio_error_strings[(CASIO_N)]
-# endif
+CASIO_END_DECLS
CASIO_END_NAMESPACE
#endif /* LIBCASIO_ERROR_H */
diff --git a/include/libcasio/file.h b/include/libcasio/file.h
index 8c02ad7..26eee96 100644
--- a/include/libcasio/file.h
+++ b/include/libcasio/file.h
@@ -23,6 +23,9 @@
# include "version.h"
# include "date.h"
+CASIO_BEGIN_NAMESPACE
+CASIO_STRUCT(casio_file, casio_file_t)
+
/* ---
* Description.
* --- */
@@ -43,6 +46,7 @@ typedef unsigned int casio_filetype_t;
# define casio_filetype_storage 0x0040
/* (with aliases) */
+
# define casio_filetype_pict casio_filetype_picture
# define casio_filetype_eactivity casio_filetype_eact
# define casio_filetype_e_activity casio_filetype_eact
@@ -65,26 +69,31 @@ typedef unsigned int casio_filefor_t;
* The elements can be initialized or uninitialized depending on the
* file type. */
-typedef struct casio_file_s {
+struct casio_file {
/* file type, destination platform */
+
casio_filetype_t casio_file_type;
casio_filefor_t casio_file_for;
/* Add-in related data */
+
time_t casio_file_creation_date;
unsigned char *casio_file_content;
size_t casio_file_size;
/* Lists for various purposes */
+
int casio_file_count;
int casio_file__size;
char **casio_file_messages;
casio_pixel_t ***casio_file_fkeys;
/* Main memory */
+
casio_mcs_t *casio_file_mcs;
/* Picture-related data (also used for add-in icons) */
+
int casio_file_width;
int casio_file_height;
casio_pixel_t **casio_file_pixels; /* 0x0RGB */
@@ -92,33 +101,36 @@ typedef struct casio_file_s {
casio_pixel_t **casio_file_icon_sel; /* 0x0RGB */
/* Other string data */
+
char casio_file_title[17];
char casio_file_intname[12];
casio_version_t casio_file_version;
-} casio_file_t;
+};
/* ---
* Methods.
* --- */
+CASIO_BEGIN_DECLS
+
/* Make a file. */
-CASIO_EXTERN int CASIO_EXPORT casio_make_picture
+CASIO_EXTERN(int) casio_make_picture
OF((casio_file_t **casio__handle,
unsigned int casio__width, unsigned int casio__height));
-CASIO_EXTERN int CASIO_EXPORT casio_make_mcs
- OF((casio_file_t **casio__handle, int casio__count));
+CASIO_EXTERN(int) casio_make_mcs
+ OF((casio_file_t **casio__handle));
-CASIO_EXTERN int CASIO_EXPORT casio_make_fkey
+CASIO_EXTERN(int) casio_make_fkey
OF((casio_file_t **casio__handle,
casio_filefor_t casio__for, int casio__count));
-CASIO_EXTERN int CASIO_EXPORT casio_make_lang
+CASIO_EXTERN(int) casio_make_lang
OF((casio_file_t **casio__handle,
casio_filefor_t casio__for, int casio__count));
-CASIO_EXTERN int CASIO_EXPORT casio_make_addin
+CASIO_EXTERN(int) casio_make_addin
OF((casio_file_t **casio__handle,
casio_filefor_t casio__for, size_t casio__size,
char const *casio__name, char const *casio__internal,
@@ -126,20 +138,66 @@ CASIO_EXTERN int CASIO_EXPORT casio_make_addin
/* Free a file. */
-CASIO_EXTERN void CASIO_EXPORT casio_free_file
+CASIO_EXTERN(void) casio_free_file
OF((casio_file_t *casio__handle));
/* Decode a file. */
-CASIO_EXTERN int CASIO_EXPORT casio_decode
+CASIO_EXTERN(int) casio_decode
OF((casio_file_t **casio__handle,
- char const *casio__path, tio_stream_t *casio__buffer,
+ char const *casio__filename, tio_stream_t *casio__buffer,
casio_filetype_t casio__expected_types));
-/* Open and decode a file. */
+/* General management functions for files */
-CASIO_EXTERN int CASIO_EXPORT casio_open_file
- OF((casio_file_t **casio__handle,
- char const *casio__path, casio_filetype_t casio__expected_types));
+CASIO_EXTERN(int) casio_get_file_type
+ OF((casio_file_t *casio__handle, casio_filetype_t *casio__type));
+CASIO_EXTERN(int) casio_get_file_for
+ OF((casio_file_t *casio__handle, casio_filefor_t *casio__for));
+
+/* Management functions for add-in functions. */
+
+CASIO_EXTERN(int) casio_get_addin_code
+ OF((casio_file_t *casio__handle, void **casio__codep,
+ size_t *casio__sizep));
+CASIO_EXTERN(int) casio_set_addin_code
+ OF((casio_file_t *casio__handle, void *casio__code, size_t casio__size));
+
+CASIO_EXTERN(int) casio_get_addin_time
+ OF((casio_file_t *casio__handle, time_t *casio__timep));
+CASIO_EXTERN(int) casio_set_addin_time
+ OF((casio_file_t *casio__handle, time_t const *casio__timep));
+
+CASIO_EXTERN(int) casio_get_addin_name
+ OF((casio_file_t *casio__handle, char const **casio__name));
+CASIO_EXTERN(int) casio_set_addin_name
+ OF((casio_file_t *casio__handle, char const *casio__name));
+
+CASIO_EXTERN(int) casio_get_addin_internal_name
+ OF((casio_file_t *casio__handle, char const **casio__intname));
+CASIO_EXTERN(int) casio_set_addin_internal_name
+ OF((casio_file_t *casio__handle, char const *casio__intname));
+
+CASIO_EXTERN(int) casio_get_addin_version
+ OF((casio_file_t *casio__handle, casio_version_t const **casio__version));
+CASIO_EXTERN(int) casio_set_addin_version
+ OF((casio_file_t *casio__handle, casio_version_t const *casio__version));
+
+/* Management functions for main memory files. */
+
+CASIO_EXTERN(int) casio_get_file_mcs
+ OF((casio_file_t *casio__handle, casio_mcs_t **casio__mcs));
+CASIO_EXTERN(int) casio_set_file_mcs
+ OF((casio_file_t *casio__handle, casio_mcs_t *casio__mcs));
+
+/* Management functions for e-activities.
+ * TODO */
+
+/* Management functions for pictures. */
+
+CASIO_EXTERN(int) casio_get_file_picture
+
+CASIO_END_DECLS
+CASIO_END_NAMESPACE
#endif /* LIBCASIO_FILE_H */
diff --git a/include/libcasio/fontchar.h b/include/libcasio/fontchar.h
index 5170244..94a6ff9 100644
--- a/include/libcasio/fontchar.h
+++ b/include/libcasio/fontchar.h
@@ -20,17 +20,24 @@
# define LIBCASIO_FONTCHAR_H
# include "cdefs.h"
+CASIO_BEGIN_NAMESPACE
+
typedef casio_uint16_t FONTCHARACTER;
/* A multi-character should resolve as a maximum of 16 characters. */
# define CASIO_FONTCHAR_MULTI_MAX 16
-CASIO_EXTERN int CASIO_EXPORT casio_is_fontchar_lead
+CASIO_BEGIN_DECLS
+
+CASIO_EXTERN(int) casio_is_fontchar_lead
OF((int casio__code));
-CASIO_EXTERN int CASIO_EXPORT casio_fontchar_to_uni
+CASIO_EXTERN(int) casio_fontchar_to_uni
OF((casio_uint16_t casio__code, casio_uint32_t *casio__uni));
-CASIO_EXTERN int CASIO_EXPORT casio_uni_to_fontchar
+CASIO_EXTERN(int) casio_uni_to_fontchar
OF((casio_uint32_t const *casio__uni, casio_uint16_t casio__code));
+CASIO_END_DECLS
+CASIO_END_NAMESPACE
+
#endif /* LIBCASIO_CHAR_H */
diff --git a/include/libcasio/iter.h b/include/libcasio/iter.h
index 65087dd..6ab0114 100644
--- a/include/libcasio/iter.h
+++ b/include/libcasio/iter.h
@@ -20,80 +20,7 @@
# define LIBCASIO_ITER_H 2018050901
# include "cdefs.h"
-CASIO_BEGIN_NAMESPACE
-
-/* Many things in libcasio work with iterators. This is the centralized
- * iterator interface. */
-
-struct casio_iter_s;
-typedef struct casio_iter_s casio_iter_t;
-
-/* ---
- * Define something.
- * --- */
-
-/* The way this is done:
- *
- * When `casio_next()` is called, if there was a previous element,
- * the `casio_nextfree_t` callback, if not NULL, will be called to free
- * it, then in all cases, the `casio_next_t` callback will be called to
- * get the next element. If the `casio_next_t` callback returns
- * `casio_error_iter`, all following calls to `casio_next()` with this
- * iterator won't call the callbacks and directly return the same error.
- *
- * When `casio_end()` is called, the `casio_end_t` callback, if not NULL,
- * will be called. */
-
-typedef int CASIO_EXPORT casio_next_t
- OF((void *casio__cookie, void **casio__ptr));
-typedef void CASIO_EXPORT casio_nextfree_t
- OF((void *casio__cookie, void *casio__ptr));
-typedef void CASIO_EXPORT casio_end_t
- OF((void *casio__cookie));
-
-typedef struct casio_iter_funcs_s {
- casio_next_t *casio_iterfunc_next;
- casio_nextfree_t *casio_iterfunc_nextfree;
- casio_end_t *casio_iterfunc_end;
-} casio_iter_funcs_t;
-
-/* ---
- * Functions.
- * --- */
-
-CASIO_BEGIN_DECLS
-
-/* Start an iterator with `casio_iter_<whatever>(&iter, <other data>)`,
- * with `iter` being of the `casio_iter_t *` type.
- * Get the next element through `casio_next_<whatever>(iter, &ptr)`,
- * which is usually a macro or function defined as
- * `casio_next(iter, (void **)(PTRP))`.
- * Then end the iterator using `casio_end(iter)`.
- *
- * Beware: any time you use `casio_next()` or `casio_end()`, the previous
- * element might be free'd or re-used, so if you are interested in what is
- * in it, copy the data before using one of the previous functions. */
-
-CASIO_EXTERN int CASIO_EXPORT casio_iter
- OF((casio_iter_t **casio__iterp, void *casio__cookie,
- casio_iter_funcs_t const *casio__funcs));
-
-CASIO_EXTERN int CASIO_EXPORT casio_next
- OF((casio_iter_t *casio__iter, void **casio__ptr));
-
-CASIO_EXTERN void CASIO_EXPORT casio_end
- OF((casio_iter_t *casio__iter));
-
-/* You can make a โ€œsuper iteratorโ€ that makes an iterator out of two
- * iterators! It will empty the first one, then the second one.
- * It will also take care of closing them. */
-
-CASIO_EXTERN int CASIO_EXPORT casio_combine_iterators
- OF((casio_iter_t **casio__iterp,
- casio_iter_t *casio__first,
- casio_iter_t *casio__second));
-
-CASIO_END_DECLS
-CASIO_END_NAMESPACE
+/* Actually libcasio uses libtio's iterators. */
+# include <libtio.h>
#endif
diff --git a/include/libcasio/link.h b/include/libcasio/link.h
index 2c6155e..77ffee7 100644
--- a/include/libcasio/link.h
+++ b/include/libcasio/link.h
@@ -30,6 +30,9 @@
# endif
CASIO_BEGIN_NAMESPACE
+CASIO_STRUCT(casio_link, casio_link_t)
+CASIO_STRUCT(casio_link_info, casio_link_info_t)
+CASIO_STRUCT(casio_screen, casio_screen_t)
/* ---
* Link and link information.
@@ -39,9 +42,6 @@ CASIO_BEGIN_NAMESPACE
* You should only manipulate pointers to it (unless you're contributing
* to libcasio). */
-struct casio_link_s;
-typedef struct casio_link_s casio_link_t;
-
/* Link information.
* This is basically the identification information sent by the calculator,
* only in Protocol 7.00 (Graph 85 and following) and CAS100 (AFX,
@@ -53,7 +53,7 @@ typedef struct casio_link_s casio_link_t;
# define casio_link_info_flag_bootcode 0x0002
# define casio_link_info_flag_os 0x0004
-typedef struct casio_link_info_s {
+struct casio_link_info {
unsigned long casio_link_info_flags;
/* Preprogrammed ROM information. */
@@ -84,7 +84,7 @@ typedef struct casio_link_info_s {
char casio_link_info_username[17];
char casio_link_info_hwid[9];
char casio_link_info_cpuid[17];
-} casio_link_info_t;
+};
/* ---
* Basic callbacks.
@@ -92,7 +92,7 @@ typedef struct casio_link_info_s {
/* The user shall confirm or not a link action. */
-typedef int CASIO_EXPORT casio_link_confirm_t
+typedef CASIO_HOOK_TYPE(int) casio_link_confirm_t
OF((void *casio__cookie));
/* This callback is for displaying the progress of an operation (usually
@@ -100,47 +100,16 @@ typedef int CASIO_EXPORT casio_link_confirm_t
* packets. For initialization of the display, this callback is called
* with a packet ID superior to the number of packets. */
-typedef void CASIO_EXPORT casio_link_progress_t
+typedef CASIO_HOOK_TYPE(void) casio_link_progress_t
OF((void *casio__cookie, unsigned int casio__id,
unsigned int casio__total));
-/* List files. */
-
-typedef void CASIO_EXPORT casio_link_list_t
- OF((void *casio__cookie, char const *casio__path,
- const casio_stat_t *casio__stat));
-
-/* ---
- * Other structures.
- * --- */
-
-/* Screen. */
-
-typedef struct casio_screen_s {
- unsigned int casio_screen_width;
- unsigned int casio_screen_height;
-
- unsigned int casio_screen_realwidth;
- unsigned int casio_screen_realheight;
-
- casio_pixel_t **casio_screen_pixels;
-} casio_screen_t;
-
/* ---
* Basic link handle operations.
* --- */
/* Useful flags for when opening a link.
*
- * Here are the various transport protocols, which isn't given by the available
- * operations on the stream (as it could be USB but we may not be able
- * to do USB operations because of drivers such as the CESG502 driver
- * on Microsoft Windows):
- *
- * `CASIO_LINKFLAG_SERIAL`: serial connexion.
- * `CASIO_LINKFLAG_USB`: USB.
- * `CASIO_LINKFLAG_SCSI`: SCSI operations.
- *
* These are read if the connexion is serial (which means that the
* protocol cannot be determined and that the user needs to say which one
* they want to use):
@@ -152,65 +121,56 @@ typedef struct casio_screen_s {
*
* These are read if the protocol is protocol 7.00:
*
- * `CASIO_LINKFLAG_ACTIVE`: start off as active.
- * `CASIO_LINKFLAG_CHECK`: check (initial packet).
- * `CASIO_LINKFLAG_TERM`: terminate.
- * `CASIO_LINKFLAG_NODISC`: if we are checking, no environment discovery. */
-
-# define CASIO_LINKFLAG_SERIAL 0x00000000
-# define CASIO_LINKFLAG_USB 0x00001000
-# define CASIO_LINKFLAG_SCSI 0x00002000
-
-# define CASIO_LINKFLAG_P7 0x00000000
-# define CASIO_LINKFLAG_CAS40 0x00000100
-# define CASIO_LINKFLAG_CAS50 0x00000200
-# define CASIO_LINKFLAG_CAS100 0x00000300
-
-# define CASIO_LINKFLAG_ACTIVE 0x00000001
-# define CASIO_LINKFLAG_CHECK 0x00000002
-# define CASIO_LINKFLAG_TERM 0x00000004
-# define CASIO_LINKFLAG_NODISC 0x00000008
+ * `CASIO_LINKFLAG_PASSIVE`: start off as active.
+ * `CASIO_LINKFLAG_NOCHECK`: check (initial packet).
+ * `CASIO_LINKFLAG_NODISC`: if we are checking, no environment discovery.
+ * `CASIO_LINKFLAG_TERM`: terminate. */
+
+# define CASIO_LINKFLAG_P7 0x00000100
+# define CASIO_LINKFLAG_CAS40 0x00000200
+# define CASIO_LINKFLAG_CAS50 0x00000400
+# define CASIO_LINKFLAG_CAS100 0x00000600
+# define CASIO_LINKFLAG_SCSI 0x00000800
+
+# define CASIO_LINKFLAG_PASSIVE 0x00000001
+# define CASIO_LINKFLAG_NOCHECK 0x00000002
+# define CASIO_LINKFLAG_NODISC 0x00000004
+# define CASIO_LINKFLAG_NOSHIFT 0x00000008
+# define CASIO_LINKFLAG_TERM 0x00000010
CASIO_BEGIN_DECLS
-/* Open a serial link. */
+/* Open a link. */
-CASIO_EXTERN int CASIO_EXPORT casio_open_serial
+CASIO_EXTERN(int) casio_open_link
OF((casio_link_t **casio__h, unsigned long casio__flags,
- char const *casio__path,
- tio_serial_attrs_t const *casio__attributes));
-
-/* Open a USB link. */
+ tio_stream_t *casio__stream));
-CASIO_EXTERN int CASIO_EXPORT casio_open_usb
+CASIO_EXTERN(int) casio_open_serial
OF((casio_link_t **casio__h, unsigned long casio__flags,
- int casio__bus, int casio__address));
+ char const *casio__path, tio_serial_attrs_t const *casio__attributes));
-/* Initialize a handle using a custom stream.
- * This function will check if the stream is a USB stream by looking
- * at the open mode of the stream. */
-
-CASIO_EXTERN int CASIO_EXPORT casio_open_link
+CASIO_EXTERN(int) casio_open_usb
OF((casio_link_t **casio__h, unsigned long casio__flags,
- tio_stream_t *casio__stream));
+ int casio__bus, int casio__address));
/* De-initialize. */
-CASIO_EXTERN void CASIO_EXPORT casio_close_link
+CASIO_EXTERN(void) casio_close_link
OF((casio_link_t *casio__h));
/* Lock and unlock the associated mutex. */
-CASIO_EXTERN int CASIO_EXPORT casio_lock_link
+CASIO_EXTERN(int) casio_lock_link
OF((casio_link_t *casio__h));
-CASIO_EXTERN int CASIO_EXPORT casio_trylock_link
+CASIO_EXTERN(int) casio_trylock_link
OF((casio_link_t *casio__h));
-CASIO_EXTERN void CASIO_EXPORT casio_unlock_link
+CASIO_EXTERN(void) casio_unlock_link
OF((casio_link_t *casio__h));
/* Getters. */
-CASIO_EXTERN const casio_link_info_t* CASIO_EXPORT casio_get_link_info
+CASIO_EXTERN(casio_link_info_t const *) casio_get_link_info
OF((casio_link_t *casio__handle));
/* ---
@@ -219,46 +179,37 @@ CASIO_EXTERN const casio_link_info_t* CASIO_EXPORT casio_get_link_info
/* Set the link settings. */
-CASIO_EXTERN int CASIO_EXPORT casio_setlink
- OF((casio_link_t *casio__handle, const tio_serial_attrs_t *casio__attrs));
+CASIO_EXTERN(int) casio_setlink
+ OF((casio_link_t *casio__handle, tio_serial_attrs_t const *casio__attrs));
/* Receive and free a screen streaming frame.
* The screen is a double pointer because it is allocated or reallocated
* when required only. */
-CASIO_EXTERN int CASIO_EXPORT casio_get_screen
- OF((casio_link_t *casio__handle, casio_screen_t **casio__screen));
-
-CASIO_EXTERN int CASIO_EXPORT casio_make_screen
- OF((casio_screen_t **casio__screen, unsigned int casio__width,
- unsigned int casio__height));
-CASIO_EXTERN int CASIO_EXPORT casio_free_screen
- OF((casio_screen_t *casio__screen));
+CASIO_EXTERN(int) casio_get_screen
+ OF((casio_link_t *casio__handle, casio_picture_t **casio__screen));
/* Backup the ROM. */
-CASIO_EXTERN int CASIO_EXPORT casio_backup_rom
- OF((casio_link_t *casio__handle,
- tio_stream_t *casio__buffer, casio_link_progress_t *casio__progress,
- void *casio__pcookie));
+CASIO_EXTERN(int) casio_backup_rom
+ OF((casio_link_t *casio__handle, tio_stream_t *casio__buffer,
+ casio_link_progress_t *casio__progress, void *casio__pcookie));
-# ifndef LIBCASIO_DISABLED_FILE
-CASIO_EXTERN int CASIO_EXPORT casio_backup_rom_file
- OF((casio_link_t *casio__handle,
- FILE *casio__file, casio_link_progress_t *casio__progress,
- void *casio__pcookie));
+# ifndef LIBTIO_DISABLED_FILE
+CASIO_EXTERN(int) casio_backup_rom_file
+ OF((casio_link_t *casio__handle, FILE *casio__file,
+ casio_link_progress_t *casio__progress, void *casio__pcookie));
# endif
/* Upload and run an executable. */
-CASIO_EXTERN int CASIO_EXPORT casio_upload_and_run
- OF((casio_link_t *casio__handle,
- tio_stream_t *casio__buffer, tio_off_t casio__size,
+CASIO_EXTERN(int) casio_upload_and_run
+ OF((casio_link_t *casio__handle, tio_stream_t *casio__buffer,
unsigned long casio__loadaddr, unsigned long casio__straddr,
casio_link_progress_t *casio__disp, void *casio__pcookie));
-# ifndef LIBCASIO_DISABLED_FILE
-CASIO_EXTERN int CASIO_EXPORT casio_upload_and_run_file
+# ifndef LIBTIO_DISABLED_FILE
+CASIO_EXTERN(int) casio_upload_and_run_file
OF((casio_link_t *casio__handle, FILE *casio__program,
unsigned long casio__loadaddr, unsigned long casio__straddr,
casio_link_progress_t *casio__disp, void *casio__pcookie));
diff --git a/include/libcasio/log.h b/include/libcasio/log.h
index d51c47b..9f5202d 100644
--- a/include/libcasio/log.h
+++ b/include/libcasio/log.h
@@ -25,25 +25,26 @@ CASIO_BEGIN_DECLS
/* Get and set the log level at runtime. */
-CASIO_EXTERN void CASIO_EXPORT casio_setlog
+CASIO_EXTERN(void) casio_setlog
OF((const char *casio__level));
-CASIO_EXTERN char const* CASIO_EXPORT casio_getlog
+CASIO_EXTERN(char const *) casio_getlog
OF((void));
/* List log levels (deprecated interface) */
-typedef void casio_log_list_t OF((void *casio__cookie,
- char const *casio__str));
+typedef CASIO_HOOK_TYPE(void) casio_log_list_t
+ OF((void *casio__cookie, char const *casio__str));
-CASIO_EXTERN CASIO_DEPRECATED void CASIO_EXPORT casio_listlog
+CASIO_DEPRECATED CASIO_EXTERN(void) casio_listlog
OF((casio_log_list_t *casio__callback, void *casio__cookie));
/* List log levels (new interface).
* This iterator yields strings (`const char *`). */
-CASIO_EXTERN int CASIO_EXPORT casio_iter_log
- OF((casio_iter_t **casio__iter));
-# define casio_next_log(ITER, PTRP) (casio_next((ITER), (void **)(PTRP)))
+CASIO_EXTERN(int) casio_iter_log
+ OF((tio_iter_t **casio__iter));
+# define casio_next_log(ITER, PTRP) \
+ (tio_next((ITER), (void **)(char const **)(PTRP)))
CASIO_END_DECLS
CASIO_END_NAMESPACE
diff --git a/include/libcasio/mcs.h b/include/libcasio/mcs.h
index fdef747..17483bc 100644
--- a/include/libcasio/mcs.h
+++ b/include/libcasio/mcs.h
@@ -21,14 +21,10 @@
# include "cdefs.h"
# include "mcsfile.h"
# include "iter.h"
-CASIO_BEGIN_NAMESPACE
-
-/* Forward structure declarations (don't mind). */
-struct casio_mcs_s;
-typedef struct casio_mcs_s casio_mcs_t;
-struct casio_mcsfuncs_s;
-typedef struct casio_mcsfuncs_s casio_mcsfuncs_t;
+CASIO_BEGIN_NAMESPACE
+CASIO_STRUCT(casio_mcs, casio_mcs_t)
+CASIO_STRUCT(casio_mcsfuncs, casio_mcsfuncs_t)
/* ---
* Main Memory filesystem description.
@@ -45,23 +41,23 @@ typedef struct casio_mcsfuncs_s casio_mcsfuncs_t;
*
* Here are the callbacks you should set: */
-typedef int CASIO_EXPORT casio_mcs_get_t
+typedef CASIO_HOOK_TYPE(int) casio_mcs_get_t
OF((void *casio__cookie, casio_mcsfile_t **casio__mcsfile,
casio_mcshead_t *casio__mcshead));
-typedef int CASIO_EXPORT casio_mcs_put_t
+typedef CASIO_HOOK_TYPE(int) casio_mcs_put_t
OF((void *casio__cookie, casio_mcsfile_t *casio__mcsfile));
-typedef int CASIO_EXPORT casio_mcs_delete_t
+typedef CASIO_HOOK_TYPE(int) casio_mcs_delete_t
OF((void *casio__cookie, casio_mcshead_t *casio__mcshead));
-typedef int CASIO_EXPORT casio_mcs_iter_t
+typedef CASIO_HOOK_TYPE(int) casio_mcs_iter_t
OF((void *casio__cookie, casio_iter_t **casio__iter));
-typedef int CASIO_EXPORT casio_mcs_close_t
+typedef CASIO_HOOK_TYPE(int) casio_mcs_close_t
OF((void *casio__cookie));
-struct casio_mcsfuncs_s {
+struct casio_mcsfuncs {
casio_mcs_get_t *casio_mcsfuncs_get;
casio_mcs_put_t *casio_mcsfuncs_put;
casio_mcs_delete_t *casio_mcsfuncs_delete;
@@ -77,55 +73,57 @@ CASIO_BEGIN_DECLS
/* Open and close. */
-CASIO_EXTERN int CASIO_EXPORT casio_open_mcs
+CASIO_EXTERN(int) casio_open_mcs
OF((casio_mcs_t **casio__mcs, void *casio__cookie,
casio_mcsfuncs_t const *casio__funcs));
-CASIO_EXTERN int CASIO_EXPORT casio_close_mcs
+CASIO_EXTERN(int) casio_close_mcs
OF((casio_mcs_t *casio__mcs));
/* Get and put an MCS file. */
-CASIO_EXTERN int CASIO_EXPORT casio_get_mcsfile
+CASIO_EXTERN(int) casio_get_mcsfile
OF((casio_mcs_t *casio__mcs, casio_mcsfile_t **casio__mcsfile,
casio_mcshead_t *casio__mcshead));
-CASIO_EXTERN int CASIO_EXPORT casio_put_mcsfile
+CASIO_EXTERN(int) casio_put_mcsfile
OF((casio_mcs_t *casio__mcs, casio_mcsfile_t *casio__mcsfile,
int casio__change_ownership));
/* Transfer an MCS file. */
-CASIO_EXTERN int CASIO_EXPORT casio_transfer_mcsfile
+CASIO_EXTERN(int) casio_transfer_mcsfile
OF((casio_mcs_t *casio__dest, casio_mcs_t *casio__source,
casio_mcshead_t *casio__mcshead));
/* Delete an MCS file. */
-CASIO_EXTERN int CASIO_EXPORT casio_delete_mcsfile
+CASIO_EXTERN(int) casio_delete_mcsfile
OF((casio_mcs_t *casio__mcs, casio_mcshead_t *casio__mcshead));
/* List MCS files (the deprecated way). */
-typedef void CASIO_EXPORT casio_mcslist_t
+typedef CASIO_HOOK_TYPE(void) casio_mcslist_t
OF((void *casio__cookie, casio_mcshead_t const *casio__mcshead));
-CASIO_EXTERN CASIO_DEPRECATED int CASIO_EXPORT casio_list_mcsfiles
+CASIO_DEPRECATED CASIO_EXTERN(int) casio_list_mcsfiles
OF((casio_mcs_t *casio__mcs, casio_mcslist_t *casio__mcslist,
void *casio__mcookie));
/* Iterate on MCS entries. */
-CASIO_EXTERN int CASIO_EXPORT casio_iter_mcsfiles
- OF((casio_iter_t **casio__iter, casio_mcs_t *casio__mcs));
-
+CASIO_EXTERN(int) casio_iter_mcsfiles
+ OF((tio_iter_t **casio__iter, casio_mcs_t *casio__mcs));
# define casio_next_mcshead(ITER, MCSFILEP) \
- (casio_next((ITER), (void **)(casio_mcshead_t **)(MCSFILEP)))
+ (tio_next((ITER), (void **)(casio_mcshead_t **)(MCSFILEP)))
-/* Make a temporary main memory. */
+/* Make a temporary main memory or copy an existing main memory into
+ * one. */
-CASIO_EXTERN int CASIO_EXPORT casio_open_local_mcs
+CASIO_EXTERN(int) casio_open_local_mcs
OF((casio_mcs_t **casio__mcs));
+CASIO_EXTERN(int) casio_copy_mcs
+ OF((casio_mcs_t **casio__mcs, casio_mcs_t *casio__source_mcs));
CASIO_END_DECLS
CASIO_END_NAMESPACE
diff --git a/include/libcasio/mcsfile.h b/include/libcasio/mcsfile.h
index e1b1600..35860fa 100644
--- a/include/libcasio/mcsfile.h
+++ b/include/libcasio/mcsfile.h
@@ -26,7 +26,11 @@
# define casio_theta 27
# define casio_r 28
# define casio_ans 29
+
CASIO_BEGIN_NAMESPACE
+CASIO_STRUCT(casio_mcscell, casio_mcscell_t)
+CASIO_STRUCT(casio_mcshead, casio_mcshead_t)
+CASIO_STRUCT(casio_mcsfile, casio_mcsfile_t)
/* A lot of CASIO calculators (like the fx-9xxx, fx-CGxx, fx-CPxxx) have
* a main memory, also called MCS (for Main Control Structure).
@@ -166,11 +170,11 @@ typedef unsigned int casio_mcsinfo_t;
/* And the main structure: */
-typedef struct casio_mcscell_s {
+struct casio_mcscell {
unsigned int casio_mcscell_flags;
casio_bcd_t casio_mcscell_real;
casio_bcd_t casio_mcscell_imgn;
-} casio_mcscell_t;
+};
/* ---
* Main Memory file head.
@@ -191,7 +195,7 @@ typedef struct casio_mcscell_s {
*
* Here is the main structure. Don't be afraid, it doesn't bite. */
-typedef struct casio_mcshead_s {
+struct casio_mcshead {
# define casio_mcshead_for casio_mcshead_flags
unsigned long casio_mcshead_flags;
@@ -217,7 +221,7 @@ typedef struct casio_mcshead_s {
char casio_mcshead_dirname[9];
char casio_mcshead_cas_app[4];
char casio_mcshead_datatype[3];
-} casio_mcshead_t;
+};
/* ---
* Main Memory file.
@@ -225,7 +229,7 @@ typedef struct casio_mcshead_s {
/* Here is the file data. Its content depends on what's in the head. */
-typedef struct casio_mcsfile_s {
+struct casio_mcsfile {
/* head */
casio_mcshead_t casio_mcsfile_head;
@@ -243,7 +247,7 @@ typedef struct casio_mcsfile_s {
/* for settings */
casio_setup_t casio_mcsfile_setup;
-} casio_mcsfile_t;
+};
/* Some macros to manipulate the password. */
@@ -260,65 +264,66 @@ CASIO_BEGIN_DECLS
/* Make a main memory file, prepare it, and free it. */
-CASIO_EXTERN int CASIO_EXPORT casio_make_mcsfile
+CASIO_EXTERN(int) casio_make_mcsfile
OF((casio_mcsfile_t **casio__handle, casio_mcshead_t const *casio__head));
-CASIO_EXTERN int CASIO_EXPORT casio_prepare_mcsfile
+CASIO_EXTERN(int) casio_prepare_mcsfile
OF((casio_mcsfile_t *casio__handle, casio_mcshead_t const *casio__head));
-CASIO_EXTERN void CASIO_EXPORT casio_free_mcsfile
+CASIO_EXTERN(void) casio_free_mcsfile
OF((casio_mcsfile_t *casio__handle));
/* Copy or duplicate a main memory file. */
-CASIO_EXTERN int CASIO_EXPORT casio_duplicate_mcsfile
+CASIO_EXTERN(int) casio_duplicate_mcsfile
OF((casio_mcsfile_t **casio__handle, casio_mcsfile_t *casio__old));
-CASIO_EXTERN int CASIO_EXPORT casio_copy_mcsfile
+CASIO_EXTERN(int) casio_copy_mcsfile
OF((casio_mcsfile_t *casio__handle, casio_mcsfile_t *casio__old));
/* Decode and encode an MCS file from an MCS archive. */
-CASIO_EXTERN int CASIO_EXPORT casio_decode_mcsfile_head
+CASIO_EXTERN(int) casio_decode_mcsfile_head
OF((casio_mcshead_t *casio__head, int casio__raw_type,
unsigned char const *casio__groupname,
unsigned char const *casio__dirname,
unsigned char const *casio__filename,
unsigned long casio__filesize));
-CASIO_EXTERN int CASIO_EXPORT casio_decode_mcsfile
+CASIO_EXTERN(int) casio_decode_mcsfile
OF((casio_mcsfile_t **casio__handle,
casio_mcshead_t const *casio__head,
tio_stream_t *casio__buffer));
-CASIO_EXTERN int CASIO_EXPORT casio_decode_mcsfile_data
+CASIO_EXTERN(int) casio_decode_mcsfile_data
OF((casio_mcsfile_t **casio__handle,
casio_mcshead_t const *casio__head,
void const *casio__data, size_t casio__size));
-CASIO_EXTERN int CASIO_EXPORT casio_encode_mcsfile
+CASIO_EXTERN(int) casio_encode_mcsfile
OF((casio_mcsfile_t *casio__handle, tio_stream_t *casio__buffer));
/* Decode and encode an MCS file from a CASIOLINK environment. */
-CASIO_EXTERN int CASIO_EXPORT casio_decode_casfile_head
+CASIO_EXTERN(int) casio_decode_casfile_head
OF((casio_mcshead_t *casio__head, tio_stream_t *casio__buffer));
-CASIO_EXTERN int CASIO_EXPORT casio_decode_casfile_part
+CASIO_EXTERN(int) casio_decode_casfile_part
OF((casio_mcsfile_t *casio__file, tio_stream_t *casio__stream));
-CASIO_EXTERN int CASIO_EXPORT casio_encode_casfile_head
+CASIO_EXTERN(int) casio_encode_casfile_head
OF((casio_mcshead_t *casio__head, tio_stream_t *casio__buffer));
-CASIO_EXTERN int CASIO_EXPORT casio_encode_casfile_part
+CASIO_EXTERN(int) casio_encode_casfile_part
OF((casio_mcsfile_t *casio__file, tio_stream_t *casio__buffer));
/* Correct a head (add raw data). */
-CASIO_EXTERN int CASIO_EXPORT casio_correct_mcshead
+CASIO_EXTERN(int) casio_correct_mcshead
OF((casio_mcshead_t *casio__head, unsigned long casio__mcsfor));
/* Compare MCS files (for ordering). */
-CASIO_EXTERN int CASIO_EXPORT casio_match_mcsfiles
+CASIO_EXTERN(int) casio_match_mcsfiles
OF((casio_mcshead_t *casio__first, casio_mcshead_t *casio__second));
-CASIO_EXTERN int CASIO_EXPORT casio_compare_mcsfiles
+CASIO_EXTERN(int) casio_compare_mcsfiles
OF((casio_mcshead_t *casio__first, casio_mcshead_t *casio__second));
CASIO_END_DECLS
CASIO_END_NAMESPACE
+
#endif /* LIBCASIO_MCSFILE_H */
diff --git a/include/libcasio/misc.h b/include/libcasio/misc.h
deleted file mode 100644
index fcfd0a2..0000000
--- a/include/libcasio/misc.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* ****************************************************************************
- * libcasio/misc.h -- libcasio miscallaneous utilities.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcasio.
- * libcasio is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcasio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with libcasio; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-#ifndef LIBCASIO_MISC_H
-# define LIBCASIO_MISC_H 2018051601
-# include "cdefs.h"
-# include "stream.h"
-# include "fs.h"
-
-CASIO_BEGIN_NAMESPACE
-CASIO_BEGIN_DECLS
-
-/* As there is no portable sleep function, libcasio implements one.
- * It takes a callback, of the following form: */
-
-CASIO_EXTERN int CASIO_EXPORT casio_sleep
- OF((unsigned long casio__ms));
-
-/* If the default function is not good enough for you, just change it
- * using the following function. */
-
-typedef void casio_sleep_t OF((unsigned long casio__ms));
-
-CASIO_EXTERN void CASIO_EXPORT casio_set_sleep_func
- OF((casio_sleep_t *casio__func));
-
-/* As for time and timeouts management, here are functions to time
- * anything in libcasio. Times are expressed in milliseconds. */
-
-struct casio_timer_s;
-typedef struct casio_timer_s casio_timer_t;
-
-CASIO_EXTERN int CASIO_EXPORT casio_get_timer
- OF((casio_timer_t **casio__timer));
-CASIO_EXTERN void CASIO_EXPORT casio_free_timer
- OF((casio_timer_t *casio__timer));
-
-CASIO_EXTERN int CASIO_EXPORT casio_get_spent_time
- OF((casio_timer_t *casio__timer, unsigned long *casio__spent));
-
-/* You can change these functions too! */
-
-typedef int CASIO_EXPORT casio_get_timer_t
- OF((casio_timer_t **casio__timer));
-typedef void CASIO_EXPORT casio_free_timer_t
- OF((casio_timer_t *casio__timer));
-typedef int CASIO_EXPORT casio_get_spent_time_t
- OF((casio_timer_t *casio__timer, unsigned long *casio__spent));
-
-CASIO_EXTERN int CASIO_EXPORT casio_set_timer_funcs
- OF((casio_get_timer_t *casio__get_timer,
- casio_free_timer_t *casio__free_timer,
- casio_get_spent_time_t *casio__get_spent_time));
-
-/* And here are cross-platform allocation functions.
- * They are defined just in case. */
-
-CASIO_EXTERN void* CASIO_EXPORT casio_alloc
- OF((size_t casio__num_elements, size_t casio__element_size));
-CASIO_EXTERN void CASIO_EXPORT casio_free
- OF((void *casio__ptr));
-
-CASIO_END_DECLS
-CASIO_END_NAMESPACE
-
-#endif /* LIBCASIO_MISC_H */
diff --git a/include/libcasio/mutex.h b/include/libcasio/mutex.h
deleted file mode 100644
index 2d89cc6..0000000
--- a/include/libcasio/mutex.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* ****************************************************************************
- * libcasio/mutex.h -- libcasio mutexes.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcasio.
- * libcasio is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcasio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with libcasio; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-#ifndef LIBCASIO_MUTEX_H
-# define LIBCASIO_MUTEX_H 1
-# include <libcasio/cdefs.h>
-
-typedef int casio_mutex_t;
-
-CASIO_EXTERN void CASIO_EXPORT casio_init_lock
- OF((casio_mutex_t *casio__mutex));
-
-CASIO_EXTERN int CASIO_EXPORT casio_lock
- OF((casio_mutex_t *casio__mutex));
-CASIO_EXTERN int CASIO_EXPORT casio_trylock
- OF((casio_mutex_t *casio__mutex));
-
-CASIO_EXTERN void CASIO_EXPORT casio_unlock
- OF((casio_mutex_t *casio__mutex));
-
-#endif /* LIBCASIO_MUTEX_H */
diff --git a/include/libcasio/number.h b/include/libcasio/number.h
index 4e179f5..3aa9dd1 100644
--- a/include/libcasio/number.h
+++ b/include/libcasio/number.h
@@ -25,7 +25,11 @@
#ifndef LIBCASIO_NUMBER_H
# define LIBCASIO_NUMBER_H
# include "cdefs.h"
+
CASIO_BEGIN_NAMESPACE
+CASIO_STRUCT(casio_bcd, casio_bcd_t)
+CASIO_STRUCT(casio_casbcd, casio_casbcd_t)
+CASIO_STRUCT(casio_mcsbcd, casio_mcsbcd_t)
# define CASIO_BCD_MANTISSA_SIZE 16
# define CASIO_BCD_EXPMIN -99
@@ -68,11 +72,11 @@ CASIO_BEGIN_NAMESPACE
# define casio_make_bcdflags(SPE, NEG, PREC) \
(((SPE) << 7) | ((NEG) << 6) | (PREC))
-typedef struct casio_bcd_s {
+struct casio_bcd {
unsigned char casio_bcd_flags;
char casio_bcd_exp;
char casio_bcd_mant[CASIO_BCD_MANTISSA_SIZE];
-} casio_bcd_t;
+};
/* ---
* Raw formats.
@@ -92,11 +96,11 @@ typedef struct casio_bcd_s {
# define casio_casbcdflag_negative 0x50
# define casio_casbcdflag_pow_neg 0x01
-typedef struct casio_casbcd_s {
+struct casio_casbcd {
unsigned char casio_casbcd_mant[8];
unsigned char casio_casbcd_flags;
unsigned char casio_casbcd_exp;
-} casio_casbcd_t;
+};
/* MCS BCD -- the most recent BCD format.
* Only the first 9 bytes are significant.
@@ -110,10 +114,10 @@ typedef struct casio_casbcd_s {
* The other values (from the fourth nibble) are the packed BCD mantissa.
* It starts at 10^0. */
-typedef struct casio_mcsbcd_s {
+struct casio_mcsbcd {
unsigned char casio_mcsbcd_BCDval[9];
unsigned char casio_mcsbcd__align[3];
-} casio_mcsbcd_t;
+};
/* ---
* Conversion utilities.
@@ -123,28 +127,28 @@ CASIO_BEGIN_DECLS
/* From and to MCS BCD. */
-CASIO_EXTERN int CASIO_EXPORT casio_bcd_frommcs
+CASIO_EXTERN(int) casio_bcd_frommcs
OF((casio_bcd_t *casio__bcd, casio_mcsbcd_t const *casio__raw));
-CASIO_EXTERN int CASIO_EXPORT casio_bcd_tomcs
+CASIO_EXTERN(int) casio_bcd_tomcs
OF((casio_mcsbcd_t *casio__raw, casio_bcd_t const *casio__bcd));
/* From and to CAS BCD. */
-CASIO_EXTERN int CASIO_EXPORT casio_bcd_fromcas
+CASIO_EXTERN(int) casio_bcd_fromcas
OF((casio_bcd_t *casio__bcd, casio_casbcd_t const *casio__raw));
-CASIO_EXTERN int CASIO_EXPORT casio_bcd_tocas
+CASIO_EXTERN(int) casio_bcd_tocas
OF((casio_casbcd_t *casio__raw, casio_bcd_t const *casio__bcd));
/* From and to C-double */
-CASIO_EXTERN void CASIO_EXPORT casio_bcd_fromdouble
+CASIO_EXTERN(void) casio_bcd_fromdouble
OF((casio_bcd_t *casio__bcd, double casio__raw));
-CASIO_EXTERN double CASIO_EXPORT casio_bcd_todouble
+CASIO_EXTERN(double) casio_bcd_todouble
OF((casio_bcd_t const *casio__bcd));
/* Make a string out of a BCD */
-CASIO_EXTERN size_t CASIO_EXPORT casio_bcdtoa
+CASIO_EXTERN(size_t) casio_bcdtoa
OF((char *casio__buf, size_t casio__len, casio_bcd_t const *casio__bcd));
CASIO_END_DECLS
diff --git a/include/libcasio/picture.h b/include/libcasio/picture.h
index 26d6e7b..d962595 100644
--- a/include/libcasio/picture.h
+++ b/include/libcasio/picture.h
@@ -19,19 +19,16 @@
#ifndef LIBCASIO_PICTURE_H
# define LIBCASIO_PICTURE_H
# include "cdefs.h"
+
CASIO_BEGIN_NAMESPACE
+CASIO_STRUCT(casio_picture, casio_picture_t)
-/* This file describes the picture formats CASIO has used for various purposes
- * (screenshots, pictures, screenstreaming), and that libcasio is able to
- * decode.
- *
- * libcasio decodes from, encodes to, and converts using 32-bit pixels, which
- * are basically 0x00RRGGBB. */
+/* Pixel definition, with utilities. */
typedef casio_uint32_t casio_pixel_t;
# define casio_pixel(CASIO__R, CASIO__G, CASIO__B) \
- ((((CASIO__R) & 0xFF) << 16) | (((CASIO__G) & 0xFF) << 8) \
+ ((casio_pixel_t)(((CASIO__R) & 0xFF) << 16) | (((CASIO__G) & 0xFF) << 8) \
| ((CASIO__B) & 0xFF))
# define casio_set_pixel(CASIO__PIX, CASIO__R, CASIO__G, CASIO__B) \
(CASIO__PIX = casio_pixel(CASIO__R, CASIO__G, CASIO__B))
@@ -50,186 +47,86 @@ typedef casio_uint32_t casio_pixel_t;
# define casio_set_pixel_b(CASIO__PIX, CASIO__VAL) \
(CASIO__PIX = casio_pixel_with_b(CASIO__PIX, CASIO__VAL))
-# define casio_get_pixel_r(CASIO__PIX, CASIO__VAL) \
- (((CASIO__PIX) >> 16) & 0xFF)
-# define casio_get_pixel_g(CASIO__PIX, CASIO__VAL) \
- (((CASIO__PIX) >> 8) & 0xFF)
-# define casio_get_pixel_b(CASIO__PIX, CASIO__VAL) \
- ( (CASIO__PIX) & 0xFF)
-
-/* The format pictures this file describes fit in a `casio_pictureformat_t`.
- * The (arbitrary) codes for them is more or less 0xBBVS, where 'BB' is the
- * number of bits each pixel occupy (in total), 'V' is the variation for
- * this number of bits, and 'S' is the special hex digit (e.g. reverse).
- *
- * Do not use the format described above other than to define your own
- * formats, as it might change! */
-
-typedef unsigned int casio_pictureformat_t;
+# define casio_pixel_r(CASIO__PIX) \
+ ((int)((CASIO__PIX) >> 16) & 0xFF)
+# define casio_pixel_g(CASIO__PIX) \
+ ((int)((CASIO__PIX) >> 8) & 0xFF)
+# define casio_pixel_b(CASIO__PIX) \
+ ((int) (CASIO__PIX) & 0xFF)
-/* ---
- * Monochrome pictures with fill bits.
- * --- */
+/* Color code definitions. */
-/* In this format, each bit represents a pixel (so one byte contains eight
- * pixels). If the width is not divisible by eight, then the last bits of the
- * last byte of the line are unused (fill bits), and the next line starts at
- * the beginning of the next byte ; this makes the navigation between lines
- * easier, but takes up more space.
- *
- * An off bit (0b0) represents a white pixel, and an on bit (0b1) represents
- * a black pixel. Reverse white and black in the `_r` special type. */
+typedef int casio_colorcode_t;
-# define casio_pictureformat_1bit 0x0100
-# define casio_pictureformat_1bit_r 0x0101
+# define casio_colorcode_black 0x0 /* 0x000000 */
+# define casio_colorcode_blue 0x1 /* 0x0000FF */
+# define casio_colorcode_green 0x2 /* 0x00FF00 */
+# define casio_colorcode_cyan 0x3 /* 0x00FFFF */
+# define casio_colorcode_red 0x4 /* 0xFF0000 */
+# define casio_colorcode_magenta 0x5 /* 0xFF00FF */
+# define casio_colorcode_yellow 0x6 /* 0xFFFF00 */
+# define casio_colorcode_white 0x7 /* 0xFFFFFF */
-/* To calculate the size, it's simple: just calculate the number of bytes
- * a line occupies, then multiply it by the number of lines. */
-
-/* ---
- * Packed monochrome pictures.
- * --- */
-
-/* Packed monochrome pictures is basically the same than the previous format,
- * except there are no fill bits: if a picture width is 6 pixels, then the
- * second line will start at the seventh bit of the first byte (where it would
- * start at the first bit of the second byte with fill bits).
+/* Picture format definitions.
*
- * The navigation to a line is less easy as it takes at least one division. */
+ * The rule of thumb for the values defined here is that they should be more
+ * or less `0xBBVS`, where `BB` is the number of bits each pixel
+ * occupy (in total), `V` is the variation for this number of bits,
+ * and `S` is the special hex digit (e.g. reverse); this rule might change
+ * later, so don't rely on it. */
+typedef unsigned int casio_pictureformat_t;
+
+# define casio_pictureformat_1bit 0x0100
+# define casio_pictureformat_1bit_r 0x0101
# define casio_pictureformat_1bit_packed 0x0110
# define casio_pictureformat_1bit_packed_r 0x0111
-
-/* To calculate the size, find out the number of occupied bits, divide by
- * eight to get the bytes, and make sure to keep an extra byte if there are
- * left bits. */
+# define casio_pictureformat_1bit_old 0x0120
+# define casio_pictureformat_2bit_dual 0x0200
+# define casio_pictureformat_4bit 0x0400
+# define casio_pictureformat_4bit_rgb 0x0400
+# define casio_pictureformat_4bit_code 0x0410
+# define casio_pictureformat_4bit_color 0x0420
+# define casio_pictureformat_4bit_mono 0x0421
+# define casio_pictureformat_casemul 0x0800
+# define casio_pictureformat_16bit 0x1000
/* ---
- * Old monochrome format.
- * --- */
-
-/* The old monochrome format used by CASIO is basically a normal monochrome
- * format (the width is usually 96 or 128, so no need for fill bits), except
- * that it starts with the last byte (where the bits are in left to right
- * order), but then it goes from right to left, and from bottom to top. */
-
-# define casio_pictureformat_1bit_old 0x0120
-
-/* The size is the same as for normal 1-bit monochrome pictures, only the
- * byte order changes. */
-
-/* ---
- * Dual monochrome format.
- * --- */
-
-/* This is the format used for the Prizm's projector mode. It is composed of
- * two monochrome pictures (with sizes divisible by eight).
- * It is basically gray pictures, with white, light gray, dark gray and
- * black. */
-
-# define casio_pictureformat_2bit_dual 0x0200
-
-/* To calculate the size, well, we just have two monochrome screens. */
-
-/* ---
- * 4-bit RGB_ format.
- * --- */
-
-/* This is a 4 bit per pixel format. There is no need for fill nibbles.
- * Each nibble (group of 4 bits) is made of the following:
- * - one bit for red (OR by 0xFF0000);
- * - one bit for green (OR by 0x00FF00);
- * - one bit for blue (OR by 0x0000FF);
- * - one alignment bit. */
-
-# define casio_pictureformat_4bit 0x0400
-# define casio_pictureformat_4bit_rgb 0x0400
-
-/* Calculating the size is trivial: just divide the number of pixels by two. */
-
-/* ---
- * 4-bit code format.
- * --- */
-
-/* In this encoding, each nibble for a pixel represents one of these colors: */
-
-# define casio_color_black 0x0 /* 0x000000 */
-# define casio_color_blue 0x1 /* 0x0000FF */
-# define casio_color_green 0x2 /* 0x00FF00 */
-# define casio_color_cyan 0x3 /* 0x00FFFF */
-# define casio_color_red 0x4 /* 0xFF0000 */
-# define casio_color_magenta 0x5 /* 0xFF00FF */
-# define casio_color_yellow 0x6 /* 0xFFFF00 */
-# define casio_color_white 0x7 /* 0xFFFFFF */
-
-/* Here is the encoding code: */
-
-# define casio_pictureformat_4bit_code 0x0410
-
-/* The size is calculated the same way as previously. */
-
-/* ---
- * Quad-monochrome VRAM formats.
- * --- */
-
-/* This format is used by old CASIO models. It is made of four monochrome
- * pictures (no need for fill bits), where the palettes are:
- * - for the `color` variant: [orange, green, blue, white (bg)]
- * - for the `mono` variant: [(unused), (unused), black, white (bg)] */
-
-# define casio_pictureformat_4bit_color 0x0420
-# define casio_pictureformat_4bit_mono 0x0421
-
-/* To get the size, just multiply the size of a VRAM by four. */
-
-/* ---
- * Casemul format.
- * --- */
-
-/* This format is used by Casemul.
- * It is basically arbitrary color codes, where, for example, 1 is orange.
- * You can check the full color codes in `src/picture.c`. */
-
-# define casio_pictureformat_casemul 0x0800
-
-/* Each pixel takes one byte. */
-
-/* ---
- * 16-bit R5G6B5 format.
+ * Utilities.
* --- */
-/* This is the format of the Prizm's VRAM. Each pixel is two bytes long,
- * the first five bits represent the high five (clap!) bits of the red part,
- * the next six bits represent the high six bits of the green part,
- * the last five bits represent the high five (re-clap!) bits of the blue
- * part. */
+CASIO_BEGIN_DECLS
-# define casio_pictureformat_16bit 0x1000
+/* Picture management. */
-/* Two bytes per pixel. */
+CASIO_EXTERN(void) casio_free_picture
+ OF((casio_picture_t *casio__picture));
-/* ---
- * Utilities.
- * --- */
+CASIO_EXTERN(int) casio_get_picture_dimensions
+ OF((casio_picture_t *casio__picture, unsigned int casio__widthp,
+ unsigned int casio__heightp));
-/* Here are the functions to decode/encode pictures using this format: */
+CASIO_EXTERN(int) casio_access_pixels
+ OF((casio_picture_t *casio__picture, casio_pixel_t ***casio__pixelsp));
-CASIO_BEGIN_DECLS
+/* Picture encoding and decoding. */
-CASIO_EXTERN size_t CASIO_EXPORT casio_get_picture_size
- OF((casio_pixel_t **casio__pixels,
- casio_pictureformat_t casio__format,
- unsigned int casio__width, unsigned int casio__height));
+CASIO_EXTERN(int) casio_decode_picture
+ OF((casio_picture_t **casio__picturep, unsigned int casio__width,
+ unsigned int casio__height, casio_pictureformat_t casio__format,
+ tio_stream_t *casio__buffer));
+CASIO_EXTERN(int) casio_decode_picture_buffer
+ OF((casio_picture_t **casio__picturep, unsigned int casio__width,
+ unsigned int casio__height, casio_pictureformat_t casio__format,
+ void const *casio__data, size_t casio__data_size));
-CASIO_EXTERN int CASIO_EXPORT casio_decode_picture
- OF((casio_pixel_t **casio__pixels,
- void const *casio__raw, casio_pictureformat_t casio__format,
- unsigned int casio__width, unsigned casio__height));
+CASIO_EXTERN(int) casio_get_picture_encoded_size
+ OF((casio_picture_t *casio__picture, casio_pictureformat_t casio__format,
+ size_t *casio__sizep));
-CASIO_EXTERN int CASIO_EXPORT casio_encode_picture
- OF((void *casio__raw, casio_pixel_t const * const *casio__pixels,
- casio_pictureformat_t casio__format,
- unsigned int casio__width, unsigned casio__height));
+CASIO_EXTERN(int) casio_encode_picture
+ OF((casio_picture_t *casio__picture,
+ void *casio__buf, size_t casio__buf_size));
CASIO_END_DECLS
CASIO_END_NAMESPACE
diff --git a/include/libcasio/protocol/legacy.h b/include/libcasio/protocol/legacy.h
index 02a91a7..10b2540 100644
--- a/include/libcasio/protocol/legacy.h
+++ b/include/libcasio/protocol/legacy.h
@@ -52,7 +52,7 @@
* The passive side then answers with either an ACK (0x06), or
* an overwrite error (0x21) if the file already exists.
*
- * If we, as te active side, are in an overwrite confirmation situation,
+ * If we, as the active side, are in an overwrite confirmation situation,
* we can either send an ABORT (0x15) to not overwrite, or an ACK if it
* accepts. If we have something else than an ACK after the overwrite
* confirmation, then this means that the passive side cannot overwrite.
diff --git a/include/libcasio/protocol/seven.h b/include/libcasio/protocol/seven.h
index add8104..4741782 100644
--- a/include/libcasio/protocol/seven.h
+++ b/include/libcasio/protocol/seven.h
@@ -21,6 +21,7 @@
# include "../cdefs.h"
# include "../link.h"
# include "typz.h"
+
CASIO_BEGIN_NAMESPACE
/* ---
@@ -33,7 +34,7 @@ CASIO_BEGIN_NAMESPACE
*
* Here are the known packet types: */
-typedef unsigned int casio_seven_type_t;
+typedef int casio_seven_type_t;
# define casio_seven_type_cmd 0x01 /* ask something (initiate packet flow) */
# define casio_seven_type_data 0x02 /* send some data */
@@ -47,11 +48,15 @@ typedef unsigned int casio_seven_type_t;
/* The subtype has a different meaning according to the type it is used with.
* For check packets, it can mean: */
+typedef int casio_seven_chk_t;
+
# define casio_seven_chk_ini 0x00 /* initial check */
# define casio_seven_chk_wait 0x01 /* in-communication check, while waiting */
/* For ACK packets: */
+typedef int casio_seven_ack_t;
+
# define casio_seven_ack_normal 0x00 /* normal ACK */
# define casio_seven_ack_ow 0x01 /* confirm overwrite */
# define casio_seven_ack_ext 0x02 /* extended ACK */
@@ -59,7 +64,7 @@ typedef unsigned int casio_seven_type_t;
/* For NAK packets (error packets): */
-typedef unsigned int casio_seven_err_t;
+typedef int casio_seven_err_t;
# define casio_seven_err_default 0x00 /* default error (unused?) */
# define casio_seven_err_resend 0x01 /* checksum/timeout error,
diff --git a/include/libcasio/protocol/typz.h b/include/libcasio/protocol/typz.h
index 834e84b..9ba743d 100644
--- a/include/libcasio/protocol/typz.h
+++ b/include/libcasio/protocol/typz.h
@@ -35,7 +35,7 @@ CASIO_BEGIN_NAMESPACE
* - RM2: 2-bit mode?
*
* Once the SIZE field (of 6 or 8 characters depending on the type) is
- * made of the following: */
+ * passed, the header is made of the following: */
typedef struct casio_typz_s {
/* Dimensions. */
@@ -43,7 +43,7 @@ typedef struct casio_typz_s {
unsigned char casio_typz_height[4];
unsigned char casio_typz_width[4];
- /* One: we are number one but it is in ascii (always "1") */
+ /* One: we are number one but it is in ascii (always '1') */
unsigned char casio_typz_one;
diff --git a/include/libcasio/setup.h b/include/libcasio/setup.h
index c27e578..957551e 100644
--- a/include/libcasio/setup.h
+++ b/include/libcasio/setup.h
@@ -19,7 +19,10 @@
#ifndef LIBCASIO_SETUP_H
# define LIBCASIO_SETUP_H
# include "cdefs.h"
+
CASIO_BEGIN_NAMESPACE
+CASIO_STRUCT(casio_setup, casio_setup_t)
+CASIO_STRUCT(casio_setup_export, casio_setup_export_t)
/* The real setup from the calculator is either a group of 100/200 byte
* register, or a string-byte map (e.g. "Axes" -> 0x01).
@@ -94,12 +97,12 @@ CASIO_BEGIN_NAMESPACE
/* Main structure. */
-typedef struct casio_setup_s {
+struct casio_setup {
unsigned int casio_setup_iflags;
unsigned int casio_setup_wflags;
unsigned int casio_setup_mflags;
unsigned char casio_setup_vals[casio_setup_nvals];
-} casio_setup_t;
+};
/* ---
* Utilities.
@@ -109,39 +112,26 @@ CASIO_BEGIN_DECLS
/* Initialize the structure. */
-CASIO_EXTERN void CASIO_EXPORT casio_init_setup
+CASIO_EXTERN(void) casio_init_setup
OF((casio_setup_t *casio__setup));
/* Feed the structure. */
-CASIO_EXTERN int CASIO_EXPORT casio_feed_setup_seven
+CASIO_EXTERN(int) casio_feed_setup_seven
OF((casio_setup_t *casio__setup, char const *casio__name, int casio__val));
-CASIO_EXTERN int CASIO_EXPORT casio_feed_setup_mcs
+CASIO_EXTERN(int) casio_feed_setup_mcs
OF((casio_setup_t *casio__setup, int casio__id, int casio__val));
/* Export settings into a map. */
-# if 0
-typedef void casio_setup_export_t
- OF((void *casio__cookie, const char *casio__name, int casio__value));
-
-CASIO_EXTERN void CASIO_EXPORT casio_export_setup
- OF((casio_setup_t *casio__setup, casio_setup_export_t *casio__export,
- void *casio__cookie));
-
--- or --
-
struct casio_setup_export {
char const *casio_setup_export_name;
int casio_setup_export_code;
int casio_setup_export_val;
};
-typedef struct casio_setup_export_seven casio_setup_export_seven_t;
-
-CASIO_EXTERN casio_iter_t *CASIO_EXPORT casio_export_setup_seven
+CASIO_EXTERN(tio_iter_t *) casio_export_setup_seven
OF((casio_setup_t *casio__setup));
-# endif
CASIO_END_DECLS
CASIO_END_NAMESPACE
diff --git a/include/libcasio/stream.h b/include/libcasio/stream.h
index e9fefa9..f09ebd8 100644
--- a/include/libcasio/stream.h
+++ b/include/libcasio/stream.h
@@ -34,26 +34,19 @@ CASIO_BEGIN_DECLS
/* Make a stream out of another, while calculating a 32-bit checksum. */
-CASIO_EXTERN int CASIO_EXPORT casio_open_csum32
+CASIO_EXTERN(int) casio_open_csum32
OF((tio_stream_t **casio__stream, tio_stream_t *casio__original,
casio_uint32_t *casio__csum));
-/* ---
- * Find devices.
- * --- */
-
-/* On serial buses. */
-
-typedef int CASIO_EXPORT casio_iter_serial_t
- OF((casio_iter_t **));
+/* Find devices on serial buses. */
# define casio_next_serial(ITER, NEXTP) \
casio_next((ITER), (void **)(char const **)(NEXTP))
-CASIO_EXTERN int CASIO_EXPORT casio_iter_serial
+CASIO_EXTERN(int) casio_iter_serial
OF((casio_iter_t **casio__iterp));
-/* On USB buses. */
+/* Find devices on USB buses. */
# define CASIO_USB_TYPE_UNKNOWN 0 /* Unknown type (not a calculator?) */
# define CASIO_USB_TYPE_LEGACY 1 /* Protocol 7.00 over bulk transfers */
@@ -69,21 +62,9 @@ typedef struct casio_usb_entry_s {
# define casio_next_usb(ITER, NEXTP) \
casio_next((ITER), (void **)(casio_usb_entry_t **)(NEXTP))
-CASIO_EXTERN int CASIO_EXPORT casio_iter_usb
+CASIO_EXTERN(int) casio_iter_usb
OF((casio_iter_t **casio__iterp));
-/* ---
- * Open streams.
- * --- */
-
-CASIO_EXTERN int CASIO_EXPORT casio_open_serial_stream
- OF((tio_stream_t **casio__stream, char const *casio__path,
- tio_serial_attrs_t const *casio__attributes));
-
-CASIO_EXTERN int CASIO_EXPORT casio_open_usb_stream
- OF((tio_stream_t **casio__stream,
- int casio__bus, int casio__address));
-
CASIO_END_DECLS
CASIO_END_NAMESPACE
diff --git a/lib/error.c b/lib/error.c
new file mode 100644
index 0000000..155a354
--- /dev/null
+++ b/lib/error.c
@@ -0,0 +1,118 @@
+/* ****************************************************************************
+ * errors.c -- error strings.
+ * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
+ *
+ * This file is part of libcasio.
+ * libcasio is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 3.0 of the License,
+ * or (at your option) any later version.
+ *
+ * libcasio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libcasio; if not, see <http://www.gnu.org/licenses/>.
+ * ************************************************************************* */
+#define LIBCASIO_NO_STRERROR
+#include "internals.h"
+
+#define ARR_SIZE 0x74
+#define UNKNOWN NULL, NULL
+
+const char* CASIO_EXPORT casio_error_strings[128] = {
+ /* Miscallaneous errors. */
+
+ "casio_error_none", "no error has occured",
+ "casio_error_unknown", "an unknown error has occured",
+ "casio_error_alloc", "a memory allocation has failed",
+ "casio_error_op", "this operation is unsupported",
+ "casio_error_arg", "an argument was invalid",
+ "casio_error_lock", "mutex is locked",
+ "casio_error_iter", "no more elements in the iterator",
+
+ UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,
+ UNKNOWN, UNKNOWN, UNKNOWN,
+
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+ /* Stream errors. */
+
+ "casio_error_stream", "the stream is invalid/no (more) stream",
+ "casio_error_read", "a read operation on the stream has failed",
+ "casio_error_write", "a write operation on the stream has failed",
+ "casio_error_seek", "a seek operation on the stream has failed",
+ "casio_error_timeout", "a timeout has occurred",
+ "casio_error_access", "could not get access to the device",
+ "casio_error_eof", "an end of file event has occured",
+ "casio_error_scsi", "a SCSI operation on the stream has failed",
+ "casio_error_usb", "a USB operation on the stream has failed",
+
+ UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,
+ UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,
+ UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,
+ UNKNOWN, UNKNOWN,
+
+ /* Link errors. */
+
+ "casio_error_init", "the link was uninitialized",
+ "casio_error_shift", "illegal double shifting",
+ "casio_error_damned", "irrecoverable link error",
+ "casio_error_int", "interrupted by user",
+ "casio_error_active", "not in active/passive mode",
+ "casio_error_noow", "denied overwrite",
+ "casio_error_command", "unsupported command",
+
+ UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,
+ UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,
+ UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,
+ UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,
+
+ /* Filesystem errors. */
+
+ "casio_error_device", "unsupported storage device",
+ "casio_error_fullmem", "full memory",
+ "casio_error_notfound", "file not found",
+ "casio_error_empty", "empty files aren't allowed",
+
+ UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,
+ UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,
+ UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,
+ UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,
+
+ /* Decoding errors. */
+
+ "casio_error_magic", "corrupted or unknown file format",
+ "casio_error_csum", "invalid checksum",
+ "casio_error_wrong", "not one of the allowed file types",
+ "casio_error_seq", "sequence error",
+ "casio_error_noeq", "character does not translate"
+};
+
+/* ---
+ * Public functions.
+ * --- */
+
+/* `casio_error_name()`: get the error name. */
+
+CASIO_EXTERN(char const *) casio_error_name(int code)
+{
+ char const *nm;
+
+ if (code >= ARR_SIZE || !(nm = errors[code + code]))
+ return ("(unknown libcasio error)");
+ return (nm);
+}
+
+/* `casio_error_desc()`: get the error description. */
+
+CASIO_EXTERN(char const *) casio_error_desc(int code)
+{
+ char const *ds;
+
+ if (code >= ARR_SIZE || !(ds = errors[code + code + 1]))
+ return ("(unknown libcasio error)");
+ return (ds);
+}
diff --git a/lib/errors.c b/lib/errors.c
deleted file mode 100644
index fd565f8..0000000
--- a/lib/errors.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* ****************************************************************************
- * errors.c -- error strings.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcasio.
- * libcasio is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcasio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with libcasio; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-#define LIBCASIO_NO_STRERROR
-#include "internals.h"
-
-const char* CASIO_EXPORT casio_error_strings[128] = {
-/* Miscallaneous errors. */
-
- "no error has occured",
- "an unknown error has occured",
- "a memory allocation has failed",
- "this operation is unsupported",
- "an argument was invalid",
- "no more elements in the iterator",
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-
-/* Stream errors. */
-
- "the stream is invalid/no (more) stream",
- "a read operation on the stream has failed",
- "a write operation on the stream has failed",
- "a seek operation on the stream has failed",
- "a timeout has occurred",
- "could not get access to the device",
- "an end of file event has occured",
- "a SCSI operation on the stream has failed",
- "a USB operation on the stream has failed",
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL,
-
-/* Link errors. */
-
- "the link was uninitialized",
- "illegal double shifting",
- "irrecoverable link error",
- "interrupted by user",
- "not in active/passive mode",
- "denied overwrite",
- "unsupported command",
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL,
-
-/* Filesystem errors. */
-
- "unsupported storage device",
- "full memory",
- "file not found",
- "empty files aren't allowed",
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL,
-
-/* Decoding errors. */
-
- "corrupted or unknown file format",
- "invalid checksum",
- "was recognized but not one of the allowed file types."
-};
-
-/**
- * casio_strerror:
- * Get the error string.
- *
- * @arg error the error code.
- * @return the error string.
- */
-
-const char* CASIO_EXPORT casio_strerror(int error)
-{
- return (casio_error_strings[error]);
-}
diff --git a/lib/file/manage.c b/lib/file/manage.c
index 291fda9..fb8b404 100644
--- a/lib/file/manage.c
+++ b/lib/file/manage.c
@@ -61,14 +61,12 @@ int CASIO_EXPORT casio_make_picture(casio_file_t **h,
* Make an MCS file.
*
* @arg h pointer to the handle to create.
- * @arg count the number of slots in the index.
* @return the error code (0 if ok).
*/
-int CASIO_EXPORT casio_make_mcs(casio_file_t **h, int count)
+int CASIO_EXPORT casio_make_mcs(casio_file_t **h)
{
int err; casio_file_t *handle;
- (void)count; /* TODO: use this parameter? */
/* make the handle */
mkhandle();
diff --git a/lib/iter/iter.c b/lib/iter/iter.c
deleted file mode 100644
index 5e83de0..0000000
--- a/lib/iter/iter.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/* ****************************************************************************
- * iter/iter.c -- iterator internals.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcasio.
- * libcasio is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcasio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with libcasio; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-#include "../internals.h"
-
-/* Internal structure of an iterator. */
-
-struct casio_iter_s {
- int stopped, has_last;
- void *last;
- void *cookie;
- casio_next_t *next;
- casio_nextfree_t *nextfree;
- casio_end_t *end;
-};
-
-/* `default_next()`: default next function. */
-
-CASIO_LOCAL int default_next(void *cookie, void **ptr)
-{
- (void)cookie;
- (void)ptr;
- return (casio_error_iter);
-}
-
-/* `default_nextfree()`: default nextfree function. */
-
-CASIO_LOCAL void default_nextfree(void *cookie, void *ptr)
-{
- /* Do not free. */
-
- (void)cookie;
- (void)ptr;
-}
-
-/* `default_end()`: default iterator end function. */
-
-CASIO_LOCAL void default_end(void *cookie)
-{
- (void)cookie;
-}
-
-/* `casio_iter()`: create an iterator. */
-
-int CASIO_EXPORT casio_iter(casio_iter_t **iterp, void *cookie,
- casio_iter_funcs_t const *funcs)
-{
- casio_iter_t *iter;
-
- /* Allocate the iterator. */
-
- iter = casio_alloc(1, sizeof(*iter));
- if (!iter) {
- if (funcs->casio_iterfunc_end)
- (*funcs->casio_iterfunc_end)(cookie);
- return (casio_error_alloc);
- }
-
- /* Prepare the iterator. */
-
- iter->stopped = 0;
- iter->has_last = 0;
- iter->cookie = cookie;
- iter->next = funcs->casio_iterfunc_next;
- if (!iter->next)
- iter->next = &default_next;
- iter->nextfree = funcs->casio_iterfunc_nextfree;
- if (!iter->nextfree)
- iter->nextfree = &default_nextfree;
- iter->end = funcs->casio_iterfunc_end;
- if (!iter->end)
- iter->end = &default_end;
-
- *iterp = iter;
- return (0);
-}
-
-/* `casio_next()`: get the next element from an iterator. */
-
-int CASIO_EXPORT casio_next(casio_iter_t *iter, void **ptrp)
-{
- int err;
-
- if (iter->stopped)
- return (casio_error_iter);
- if (iter->has_last) {
- (*iter->nextfree)(iter->cookie, iter->last);
- iter->has_last = 0;
- }
-
- err = (*iter->next)(iter->cookie, ptrp);
- if (err == casio_error_iter) {
- iter->stopped = 1;
- return (err);
- } else if (err)
- return (err);
-
- iter->has_last = 1;
- iter->last = *ptrp;
-
- return (0);
-}
-
-/* `casio_end()`: end and free the iterator. */
-
-void CASIO_EXPORT casio_end(casio_iter_t *iter)
-{
- if (iter->has_last) {
- (*iter->nextfree)(iter->cookie, iter->last);
- iter->has_last = 0;
- }
-
- (*iter->end)(iter->cookie);
- casio_free(iter);
-}
diff --git a/lib/iter/super.c b/lib/iter/super.c
deleted file mode 100644
index 57c8742..0000000
--- a/lib/iter/super.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* ****************************************************************************
- * iter/super.c -- super-iterator, for super-iterating.
- * Copyright (C) 2018 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcasio.
- * libcasio is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcasio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with libcasio; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-#include "../internals.h"
-
-typedef struct {
- int i, len;
- casio_iter_t *its[2];
-} supercookie_t;
-
-/* `next_super()`: next element from the super iterator. */
-
-CASIO_LOCAL int next_super(supercookie_t *cookie, void **ptr)
-{
- int err;
-
- if (cookie->i == cookie->len)
- return (casio_error_iter);
-
- while (cookie->i < cookie->len - 1) {
- if ((err = casio_next(cookie->its[cookie->i], ptr))
- != casio_error_iter)
- return (err);
-
- casio_end(cookie->its[cookie->i++]);
- }
-
- if ((err = casio_next(cookie->its[cookie->i], ptr)) != casio_error_iter)
- return (err);
-
- casio_end(cookie->its[cookie->i++]);
- return (casio_error_iter);
-}
-
-/* `end_super()`: end the super-iterator. */
-
-CASIO_LOCAL void end_super(supercookie_t *cookie)
-{
- int i;
-
- for (i = cookie->i; i < cookie->len; i++)
- casio_end(cookie->its[i]);
- free(cookie);
-}
-
-/* Callbacks. */
-
-CASIO_LOCAL casio_iter_funcs_t const super_funcs = {
- (casio_next_t *)next_super,
- NULL,
- (casio_end_t *)end_super
-};
-
-/**
- * casio_combine_iterator:
- * Make a super iterator.
- *
- * @arg iterp the super-iterator to create.
- * @arg first the first iterator to put into the super-iterator.
- * @arg second the second one.
- * @return the error code (0 if ok).
- */
-
-int CASIO_EXPORT casio_combine_iterators(casio_iter_t **iterp,
- casio_iter_t *first, casio_iter_t *second)
-{
- supercookie_t *cookie;
-
- if (!(cookie = malloc(sizeof(supercookie_t)))) {
- casio_end(first);
- casio_end(second);
- return (casio_error_alloc);
- }
-
- cookie->len = 2;
- cookie->i = 0;
- cookie->its[0] = first;
- cookie->its[1] = second;
-
- return (casio_iter(iterp, cookie, &super_funcs));
-}
diff --git a/lib/mcsfile/mcsfile.h b/lib/mcsfile/mcsfile.h
index 3812256..461e174 100644
--- a/lib/mcsfile/mcsfile.h
+++ b/lib/mcsfile/mcsfile.h
@@ -62,19 +62,4 @@
# define DWRITE(CASIO__OBJECT) \
WRITE(&(CASIO__OBJECT), sizeof(CASIO__OBJECT))
-/* ---
- * Picture utilities.
- * --- */
-
-# define alloc_pixels(W, H) \
- casio_alloc(sizeof(casio_pixel_t*) \
- * (H) + sizeof(casio_pixel_t) * (W) * (H), 1)
-# define prepare_pixels(I, W, H) { \
- unsigned int PIXPREP_y; \
- casio_pixel_t *PIXPREP_line = (casio_pixel_t*)&(I)[(H)]; \
- for (PIXPREP_y = 0; PIXPREP_y < (H); PIXPREP_y++) { \
- (I)[PIXPREP_y] = PIXPREP_line; \
- PIXPREP_line += (W); \
- }}
-
#endif
diff --git a/lib/picture/decode.c b/lib/picture/decode.c
index 92fa9dd..5da6a85 100644
--- a/lib/picture/decode.c
+++ b/lib/picture/decode.c
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with libcasio; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************* */
-#include "picture.h"
+#include "internals.h"
/* The dual 2-bit format colors. */
@@ -51,26 +51,28 @@ CASIO_LOCAL const casio_uint32_t casemul_colors[256] = {
/* other colours are black, i.e. casio_pixel(0, 0, 0) == 0x000000 */
};
-/**
- * casio_decode_picture:
- * Decode a picture.
- *
- * @arg pixels the pixels to fill.
- * @arg format the format to use.
- * @arg raw the raw bytes to decode from.
- * @arg width the width.
- * @arg height the height.
- * @return the error code (0 if ok).
- */
-
-int CASIO_EXPORT casio_decode_picture(casio_pixel_t **pixels,
- const void *vraw, casio_pictureformat_t format,
- unsigned int width, unsigned int height)
+/* `casio_decode_picture()`: decode a picture out of a buffer.
+ * Reads while checking the required size. */
+
+CASIO_EXTERN(int) casio_decode_picture(casio_picture_t **picturep,
+ unsigned int width, unsigned int height, casio_pictureformat_t format,
+ tio_stream_t *buffer)
{
- const unsigned char *raw = (const void*)vraw;
+ unsigned char *raw;
const unsigned char *o, *g, *b, *r2; /* pointers on the data */
int msk, bit; size_t off; /* mask and offset */
unsigned int y, x, bx; /* coordinates */
+ size_t size; int err = casio_ok;
+
+ if ((err = casio_get_picture_estimated_size(format, width, height,
+ &size)))
+ return (err);
+ if (!(raw = casio_alloc(size, 1)))
+ return (casio_error_alloc);
+ if ((terr = (tio_read(buffer, raw, size)))) {
+ casio_free(raw);
+ return (casio_error_read);
+ }
switch (format) {
case casio_pictureformat_1bit:
@@ -260,9 +262,34 @@ int CASIO_EXPORT casio_decode_picture(casio_pixel_t **pixels,
default:
/* unknown format! */
- return (casio_error_op);
+ err = casio_error_op;
}
/* everything went well :) */
- return (0);
+ casio_free(raw);
+ return (err);
+}
+
+/* `casio_decode_picture_buffer()`: decode a picture out of a buffer.
+ * Reads while checking the required size. */
+
+CASIO_EXTERN(int) casio_decode_picture_buffer(casio_picture_t **picturep,
+ unsigned int width, unsigned int height, casio_pictureformat_t format,
+ void const *data, size_t data_size)
+{
+ tio_stream_t *stream;
+ int err, terr;
+
+ if ((terr = tio_open_memory(&stream, data, data_size))) switch (terr) {
+ case tio_error_alloc:
+ return (casio_error_alloc);
+ case tio_error_arg:
+ return (casio_error_arg);
+ default:
+ return (casio_error_unknown);
+ }
+
+ err = casio_decode_picture(picturep, width, height, format, stream);
+ tio_close(stream);
+ return (err);
}
diff --git a/lib/picture/encode.c b/lib/picture/encode.c
index 2e91e8a..d8975f2 100644
--- a/lib/picture/encode.c
+++ b/lib/picture/encode.c
@@ -18,24 +18,35 @@
* ************************************************************************* */
#include "picture.h"
-/**
- * casio_encode_picture:
- * Encode the picture.
- *
- * @arg pixels the pixels to encode.
- * @arg format the format.
- * @arg raw the destination buffer.
- * @arg width the picture width.
- * @arg height the picture height.
- */
-
-int CASIO_EXPORT casio_encode_picture(void *vraw,
- casio_pixel_t const * const *pixels, casio_pictureformat_t format,
- unsigned int width, unsigned int height)
+/* `casio_get_picture_encoded_size()`: get the size in bytes of a picture
+ * encoded in a certain format. */
+
+CASIO_EXTERN(int) casio_get_picture_encoded_size(casio_picture_t *picture,
+ casio_pictureformat_t format, size_t *sizep)
+{
+ if (!sizep)
+ return (casio_error_arg);
+
+ return (casio_get_picture_estimated_size(format, picture->width,
+ picture->height, sizep));
+}
+
+/* `casio_encode_picture()`: encode a picture. */
+
+CASIO_EXTERN(int) casio_encode_picture(casio_picture_t *picture,
+ casio_pictureformat_t format, void *buf, size_t size)
{
int msk;
unsigned int y, x;
unsigned char *raw = (void*)vraw;
+ size_t estim;
+
+ casio_get_picture_estimated_size(format, picture->width,
+ picture->height, &estim);
+ if (size < estim) {
+ msg((ll_error, "too little space to write"));
+ return (casio_error_arg);
+ }
switch (format) {
case casio_pictureformat_1bit:
@@ -116,5 +127,5 @@ int CASIO_EXPORT casio_encode_picture(void *vraw,
}
/* everything went well :) */
- return (0);
+ return (casio_ok);
}
diff --git a/lib/picture/picture.h b/lib/picture/internals.h
index f1a45ac..f0873f2 100644
--- a/lib/picture/picture.h
+++ b/lib/picture/internals.h
@@ -16,4 +16,21 @@
* You should have received a copy of the GNU Lesser General Public License
* along with libcasio; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************* */
-#include "../internals.h"
+#ifndef LOCAL_PICTURE_H
+# define LOCAL_PICTURE_H 20190523
+# include "../internals.h"
+
+struct casio_picture {
+ unsigned int width, height;
+ casio_pixel_t **pixels;
+};
+
+/* Get the expected size out of a width, a height and a picture format. */
+
+CASIO_EXTERN(int) casio_prepare_picture
+ OF((casio_picture_t **picturep, unsigned int width, unsigned int height));
+CASIO_EXTERN(int) casio_get_picture_estimated_size
+ OF((casio_pictureformat_t format,
+ unsigned int width, unsigned int height, size_t *sizep));
+
+#endif /* LOCAL_PICTURE_H */
diff --git a/lib/picture/manage.c b/lib/picture/manage.c
new file mode 100644
index 0000000..11e5b24
--- /dev/null
+++ b/lib/picture/manage.c
@@ -0,0 +1,75 @@
+/* ****************************************************************************
+ * picture/manage.c -- picture management.
+ * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
+ *
+ * This file is part of libcasio.
+ * libcasio is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 3.0 of the License,
+ * or (at your option) any later version.
+ *
+ * libcasio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libcasio; if not, see <http://www.gnu.org/licenses/>.
+ * ************************************************************************* */
+#include "internals.h"
+# define alloc_pixels(W, H) \
+ casio_alloc(sizeof(casio_pixel_t*) \
+ * (H) + sizeof(casio_pixel_t) * (W) * (H), 1)
+# define prepare_pixels(I, W, H) { \
+ unsigned int PIXPREP_y; \
+ casio_pixel_t *PIXPREP_line = (casio_pixel_t*)&(I)[(H)]; \
+ for (PIXPREP_y = 0; PIXPREP_y < (H); PIXPREP_y++) { \
+ (I)[PIXPREP_y] = PIXPREP_line; \
+ PIXPREP_line += (W); \
+ }}
+
+CASIO_EXTERN(int) casio_prepare_picture(casio_picture_t **picturep,
+ unsigned int width, unsigned int height)
+{
+ casio_pixel_t **pixels;
+ casio_picture_t *picture;
+
+ if (!(pixels = alloc_pixels(width, height)))
+ return (casio_error_alloc);
+ if (!(*picturep = (picture = (casio_alloc(1, sizeof(casio_picture_t)))))) {
+ casio_free(pixels);
+ return (casio_error_alloc);
+ }
+
+ picture->width = width;
+ picture->height = height;
+ picture->pixels = pixels;
+
+ prepare_pixels(pixels, width, height)
+
+ return (casio_ok);
+}
+
+CASIO_EXTERN(void) casio_free_picture(casio_picture_t *picture)
+{
+ if (!picture)
+ return ;
+
+ casio_free(picture->pixels);
+ casio_free(picture);
+}
+
+CASIO_EXTERN(int) casio_get_picture_dimensions(casio_picture_t *picture,
+ unsigned int *widthp, unsigned int *heightp)
+{
+ *widthp = picture->width;
+ *heightp = picture->height;
+ return (casio_ok);
+}
+
+CASIO_EXTERN(int) casio_access_pixels(casio_picture_t *picture,
+ casio_pixel_t ***pixelsp)
+{
+ *pixelsp = picture->pixels;
+ return (casio_ok);
+}
diff --git a/lib/picture/size.c b/lib/picture/size.c
index 8304995..2f4b771 100644
--- a/lib/picture/size.c
+++ b/lib/picture/size.c
@@ -18,49 +18,42 @@
* ************************************************************************* */
#include "picture.h"
-/**
- * casio_get_picture_size:
- * Get a 'raw' picture size.
- *
- * @arg pixels the picture.
- * @arg fmt the picture format.
- * @arg width the picture width.
- * @arg height the picture height.
- * @return the raw size.
- */
+/* `casio_get_picture_estimated_size()`: get the estimated size of a picture
+ * in bytes out of its format and dimensions. */
-size_t CASIO_EXPORT casio_get_picture_size(casio_pixel_t **pixels,
- casio_pictureformat_t fmt, unsigned int width, unsigned int height)
+CASIO_EXTERN(int) casio_get_picture_estimated_size(casio_pictureformat_t fmt,
+ unsigned int width, unsigned int height, size_t *sizep)
{
- (void)pixels;
-
switch (fmt) {
case casio_pictureformat_1bit: /* FALLTHRU */
case casio_pictureformat_1bit_r: /* FALLTHRU */
case casio_pictureformat_1bit_old:
- return (((width / 8) + !!(width % 8)) * height);
+ *sizep = ((width / 8) + !!(width % 8)) * height;
case casio_pictureformat_1bit_packed: /* FALLTHRU */
case casio_pictureformat_1bit_packed_r:
- return ((width * height / 8) + !!(width * height % 8));
+ *sizep = (width * height / 8) + !!(width * height % 8);
case casio_pictureformat_2bit_dual:
- return (((width / 8) + !!(width % 8)) * height * 2);
+ *sizep = ((width / 8) + !!(width % 8)) * height * 2;
case casio_pictureformat_4bit: /* FALLTHRU */
case casio_pictureformat_4bit_code:
- return (width * height / 2);
+ *sizep = width * height / 2;
case casio_pictureformat_4bit_color: /* FALLTHRU */
case casio_pictureformat_4bit_mono:
- return (((width / 8) + !!(width % 8)) * height * 4);
+ *sizep = ((width / 8) + !!(width % 8)) * height * 4;
case casio_pictureformat_casemul:
- return (width * height);
+ *sizep = width * height;
case casio_pictureformat_16bit:
- return (width * height * 2);
+ *sizep = width * height * 2;
+
+ default:
+ return (casio_error_op);
}
- return (0);
+ return (casio_ok);
}
diff --git a/lib/stream/csum32.c b/lib/stream/csum32.c
index 9df15ee..39dc245 100644
--- a/lib/stream/csum32.c
+++ b/lib/stream/csum32.c
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with libcasio; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************* */
-#include "builtin.h"
+#include "stream.h"
/* ---
* Cookie structure.
diff --git a/lib/stream/open_usb.c b/lib/stream/open_usb.c
index e5e2350..a266b75 100644
--- a/lib/stream/open_usb.c
+++ b/lib/stream/open_usb.c
@@ -16,34 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with libcasio; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************* */
-#include "../stream.h"
-
-#if !defined(LIBCASIO_DISABLED_LIBUSB)
-# define OUF &casio_open_libusb_usb
-#elif !defined(LIBCASIO_DISABLED_WINDOWS)
-# define OUF &casio_open_windows_usb
-#else
-# define OUF NULL
-#endif
-
-CASIO_LOCAL casio_open_native_usb_stream_t *open_native_usb_stream_func = OUF;
-
-/**
- * casio_set_open_native_usb_stream_func:
- * Set the USB streams opener.
- *
- * NULL rests the function to its default.
- *
- * @arg function the function pointer to set.
- * @return the error code (0 if ok).
- */
-
-int CASIO_EXPORT casio_set_open_native_usb_stream_func(
- casio_open_native_usb_stream_t *func)
-{
- open_native_usb_stream_func = func ? func : OUF;
- return (0);
-}
+#include "stream.h"
/**
* casio_open_native_usb_stream:
diff --git a/lib/stream/usb_stream.c b/lib/stream/usb_stream.c
index b464c86..33c35a8 100644
--- a/lib/stream/usb_stream.c
+++ b/lib/stream/usb_stream.c
@@ -19,4 +19,47 @@
* ************************************************************************* */
#include "stream.h"
-/* TODO */
+TIO_HOOK(void) serial_usb_close(void *cookie)
+{
+ /* Nothing. */
+}
+
+TIO_HOOK(int) serial_usb_read(void *cookie, unsigned char *buffer, size_t size)
+{
+ /* Nothing. */
+}
+
+TIO_HOOK(int) serial_usb_write(void *cookie,
+ unsigned char const *buffer, size_t size)
+{
+ /* Nothing. */
+}
+
+CASIO_LOCAL tio_functions_t const serial_usb_funcs = {
+ (tio_close_t *)&serial_usb_close,
+
+ (tio_read_t *)&serial_usb_read,
+ (tio_write_t *)&serial_usb_write,
+ NULL
+};
+
+int CASIO_EXPORT casio_open_serial_usb_stream(tio_stream_t **streamp,
+ tio_stream_t *original)
+{
+ int terr;
+
+ if (tio_get_type(original) != TIO_TYPE_USB) {
+ msg((ll_error, "original stream wasn't a usb stream"));
+ return (casio_error_arg);
+ }
+
+ terr = tio_open(streamp, original, NULL,
+ TIO_OPENFLAG_READ | TIO_OPENFLAG_WRITE, &serial_usb_funcs, 0);
+ if (terr) {
+ msg((ll_error, "tio_open failed with error %s: %s",
+ tio_error_name(terr), tio_error_desc(terr)));
+ return (casio_error_unknown);
+ }
+
+ return (0);
+}
diff --git a/lib/utils/mutex.c b/lib/utils/mutex.c
deleted file mode 100644
index 4bdb3e6..0000000
--- a/lib/utils/mutex.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* ****************************************************************************
- * utils/mutex.c -- mutex internals.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcasio.
- * libcasio is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcasio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with libcasio; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-#include "../internals.h"
-
-/**
- * casio_init_lock:
- * Initialize a mutex.
- *
- * @arg mutex the mutex to initialize.
- */
-
-void CASIO_EXPORT casio_init_lock(casio_mutex_t *mutex)
-{
- *mutex = 0;
-}
-
-/**
- * casio_lock:
- * Lock a mutex.
- *
- * @arg mutex the mutex to lock.
- * @return the error code (0 if ok).
- */
-
-int CASIO_EXPORT casio_lock(casio_mutex_t *mutex)
-{
- int err;
-
- if (!*mutex) goto unlocked;
- if ((err = casio_sleep(0))) return (err);
- while (*(volatile casio_mutex_t*)mutex)
- casio_sleep(5);
-
-unlocked:
- *mutex = 1;
- return (0);
-}
-
-/**
- * casio_trylock:
- * Try to lock a mutex.
- *
- * @arg mutex the mutex to lock.
- * @return the error code (0 if ok).
- */
-
-int CASIO_EXPORT casio_trylock(casio_mutex_t *mutex)
-{
- if (*mutex) return (casio_error_lock);
- *mutex = 1;
- return (0);
-}
-
-/**
- * casio_unlock_mutex:
- * Unlock a mutex.
- *
- * @arg mutex the mutex to unlock.
- */
-
-void CASIO_EXPORT casio_unlock(casio_mutex_t *mutex)
-{
- *mutex = 0;
-}
diff --git a/lib/utils/sleep.c b/lib/utils/sleep.c
deleted file mode 100644
index 97a2f17..0000000
--- a/lib/utils/sleep.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* ****************************************************************************
- * utils/sleep.c -- Sleep in a cross-platform way.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcasio.
- * libcasio is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcasio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with libcasio; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-#include "../internals.h"
-
-/* ---
- * Microsoft Windows environment.
- * --- */
-
-#if defined(__WINDOWS__)
-# define default_callback &casio_winsleep
-# include <windows.h>
-
-CASIO_LOCAL void casio_winsleep(unsigned long ms)
-{
- Sleep(ms);
-}
-
-/* ---
- * UNIX-like environments.
- * --- */
-
-#elif defined(__unix__) || defined(__unix)
-# define default_callback &casio_unixsleep
-# include <unistd.h>
-# include <time.h>
-
-CASIO_LOCAL void casio_unixsleep(unsigned long ms)
-{
- struct timespec requested_timestamp;
-
- requested_timestamp.tv_sec = ms / 1000;
- requested_timestamp.tv_nsec = (ms % 1000) * 1000000;
- nanosleep(&requested_timestamp, NULL);
-}
-
-/* ---
- * Default and main function.
- * --- */
-
-#else
-# define default_callback NULL
-#endif
-
-CASIO_LOCAL casio_sleep_t *casio_sleep_callback = default_callback;
-
-/**
- * casio_set_sleep_func:
- * Set the sleep function.
- *
- * @arg func the function to set.
- */
-
-void CASIO_EXPORT casio_set_sleep_func(casio_sleep_t *func)
-{
- casio_sleep_callback = func;
-}
-
-/**
- * casio_sleep:
- * Sleep.
- *
- * @arg ms the milliseconds.
- */
-
-int CASIO_EXPORT casio_sleep(unsigned long ms)
-{
- if (!casio_sleep_callback)
- return (casio_error_op);
- if (!ms) return (0);
-
- (*casio_sleep_callback)(ms);
- return (0);
-}
diff --git a/lib/utils/timer.c b/lib/utils/timer.c
deleted file mode 100644
index f6612ce..0000000
--- a/lib/utils/timer.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/* ****************************************************************************
- * utils/timer.c -- timer internals.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcasio.
- * libcasio is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcasio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with libcasio; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-#include "../internals.h"
-
-/* ---
- * Default functions for UNIX.
- * --- */
-
-#if _POSIX_C_SOURCE >= 199309L
-# include <time.h>
-
-struct casio_timer_s {
- clockid_t clk_id;
- struct timespec initial;
-};
-
-CASIO_LOCAL int default_get_timer(casio_timer_t **timerp)
-{
- casio_timer_t *timer;
-
- if (!(timer = casio_alloc(sizeof(*timer), 1)))
- return (casio_error_alloc);
-
-#ifdef __linux__
- timer->clk_id = CLOCK_MONOTONIC_COARSE;
-#else
- timer->clk_id = CLOCK_MONOTONIC;
-#endif
-
- if (clock_gettime(timer->clk_id, &timer->initial) < 0) {
- casio_free(timer);
- return (casio_error_unknown);
- }
-
- *timerp = timer;
- return (0);
-}
-
-CASIO_LOCAL void default_free_timer(casio_timer_t *timer)
-{
- casio_free(timer);
-}
-
-CASIO_LOCAL int default_get_spent_time(casio_timer_t *timer,
- unsigned long *spent)
-{
- struct timespec ts;
-
- if (clock_gettime(timer->clk_id, &ts) < 0)
- return (casio_error_unknown);
-
- *spent = (ts.tv_sec - timer->initial.tv_sec) * 1000
- + (ts.tv_nsec - timer->initial.tv_nsec) / 1000000;
- return (0);
-}
-
-#else
-# define NO_DEFAULTS 1
-#endif
-
-/* ---
- * Public API functions.
- * --- */
-
-#if NO_DEFAULTS
-CASIO_LOCAL casio_get_timer_t *gettimer = NULL;
-CASIO_LOCAL casio_get_spent_time_t *getspenttime = NULL;
-#else
-CASIO_LOCAL casio_get_timer_t *gettimer = &default_get_timer;
-CASIO_LOCAL casio_get_spent_time_t *getspenttime = &default_get_spent_time;
-#endif
-
-#if NO_DEFAULTS || NO_TIMERFREE
-CASIO_LOCAL casio_free_timer_t *freetimer = NULL;
-#else
-CASIO_LOCAL casio_free_timer_t *freetimer = &default_free_timer;
-#endif
-
-int CASIO_EXPORT casio_get_timer(casio_timer_t **timerp)
-{
- if (!gettimer)
- return (casio_error_op);
- return ((*gettimer)(timerp));
-}
-
-void CASIO_EXPORT casio_free_timer(casio_timer_t *timer)
-{
- if (!freetimer)
- return ;
- (*freetimer)(timer);
-}
-
-int CASIO_EXPORT casio_get_spent_time(casio_timer_t *timer,
- unsigned long *spent)
-{
- if (!getspenttime)
- return (casio_error_op);
- return ((*getspenttime)(timer, spent));
-}