Updating the documentation method.

This commit is contained in:
Thomas Touhey 2017-09-02 20:22:50 +02:00
parent 855d625bbd
commit 5ff737722c
16 changed files with 397 additions and 245 deletions

6
docs/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
_site
.sass-cache
.jekyll-metadata
Gemfile.lock
/vendor
/.bundle

24
docs/Gemfile Normal file
View File

@ -0,0 +1,24 @@
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
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

27
docs/Makefile Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/make -f
#*****************************************************************************#
# Target for the end user #
#*****************************************************************************#
# Preview in local how it will render.
preview prev: -all-watch
.PHONY: preview prev
#*****************************************************************************#
# Internal #
#*****************************************************************************#
JEK := bundle exec jekyll
# 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)
.PHONY: -prepare -all -all-watch
# End of file.

36
docs/_config.yml Normal file
View File

@ -0,0 +1,36 @@
#******************************************************************************
# _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: ""
baseurl: "/docs"
# Build settings.
output: web
destination: _site
gems: []
exclude:
- Gemfile
- Gemfile.lock
- Makefile
- README.md
- vendor
# Markdown settings.
markdown: kramdown
# SASS settings.
sass:
style: :expanded
# End of file.

9
docs/_data/sections.yml Normal file
View File

@ -0,0 +1,9 @@
-
name: Introduction
uri: /
-
name: Getting started
uri: /getting-started.html
-
name: Streams
uri: /streams.html

View File

@ -0,0 +1,37 @@
<!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="stylesheet" href="{{ site.baseurl }}/assets/bootstrap.min.css">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/syntax.css">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/main.css">
</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 section in site.data.sections %}
<li><a href="{{ site.baseurl }}{{ section.uri }}">{{ section.name }}</a></li>
{% 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 The P7 Project Maintainers &lt;<a href="mailto:contact@p7.planet-casio.com">contact@p7.planet-casio.com</a>&gt;</p>
</div></div>
</div></body></html>

11
docs/_layouts/page.html Normal file
View File

@ -0,0 +1,11 @@
---
layout: default
---
<div class="page-header">
<h2>{{ page.title | capitalize }}
{% if page.subtitle %}<small>{{ page.subtitle }}</small>{% endif %}
</h2>
</div>
{{ content }}

5
docs/assets/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

94
docs/assets/main.css Executable file
View File

@ -0,0 +1,94 @@
body {
font-weight: 400;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
}
pre, code, pre code {
border: none;
border-radius: 0;
background-color: #f9f9f9;
font-size: 0.85em;
}
.highlight {
background-color: #f9f9f9;
}
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 a {
padding-left: 10px;
padding-right: 10px;
}
#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;
}

61
docs/assets/syntax.css Normal file
View File

@ -0,0 +1,61 @@
.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 */

View File

@ -1,169 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# libcasio documentation build configuration file, created by
# sphinx-quickstart on Fri Jul 7 02:37:36 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# 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('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# 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']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'libcasio'
copyright = '2017, Thomas "Cakeisalie5" Touhey'
author = 'Thomas "Cakeisalie5" Touhey'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.1'
# The full version, including alpha/beta/rc tags.
release = '0.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# 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']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
'donate.html',
]
}
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'libcasiodoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'libcasio.tex', 'libcasio docs',
'Thomas "Cakeisalie5" Touhey', 'manual'),
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'libcasio', 'libcasio docs',
[author], 1)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'libcasio', 'libcasio docs',
author, 'libcasio', 'Library for manipulating CASIO-related elements.',
'Miscellaneous'),
]

8
docs/getting-started.md Normal file
View File

@ -0,0 +1,8 @@
---
layout: page
title: getting started
---
The libcasio development happens [on Github][gh].
There is currently no mailing-list.
[gh]: https://github.com/PlaneteCasio/libcasio

18
docs/index.md Normal file
View File

@ -0,0 +1,18 @@
---
layout: page
title: introduction
---
This is the libcasio developer 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.
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!

View File

@ -1,23 +0,0 @@
Welcome to libcasio's documentation!
====================================
.. rubric:: Everything you need to know about libcasio.
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 commons systems such as Microsoft Windows,
GNU/Linux distributions or Apple's OS X.
.. note::
The C "namespace" the library reserves are `casio_`, `CASIO_`, `libcasio_`
and `LIBCASIO_`; consider the usage of anything starting with one of those
prefixes as having an undefined behaviour
(so you really shoundn't do that).
There are many objects in libcasio. Choose what fits your need!
.. toctree::
:maxdepth: 2
:caption: Contents:
stream.rst

View File

@ -1,53 +0,0 @@
libcasio streams
================
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.
This stream object is usable both by the library and by 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, related to POSIX or
the Windows API for example. It should only implement platform-specific
streams for platforms defining a macro (for example, CASIOWIN doesn't!).
This document describes how to use and make a libcasio stream.
Opening and closing
-------------------
There are three ways to open a stream:
- with a specialized function, such as :code:`casio_open_stream_streams()`
for POSIX or :code:`casio_opencom_windows()` for the Windows API;
- with a multi-stream function, such as :code:`casio_open_usb_stream()`
for USB-connected calculators, or :code:`casio_open_com_stream()` for
serial-connected calculators;
- with the core function, :code:`casio_open_stream()`, which you will use
when you will want to define your own streams.
All of the stream opening function 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 :code:`casio_close()`. So here's a simple example using
the :code:`casio_open_memory()` function (which makes a stream out of memory):
.. code-block:: c
:linenos:
int err;
casio_stream_t *stream;
err = casio_open_memory(&stream, my_memory_area, the_memory_area_size);
if (err) { /* oh no, things went wrong... */ }
/* make awesome things */
err = casio_close(stream);
if (err) { /* things went wrong, but that's alright */ }

61
docs/streams.md Normal file
View File

@ -0,0 +1,61 @@
---
layout: page
title: streams
---
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
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()`. So here's a simple example using the
`casio_open_memory()` function (which makes a stream out of memory):
#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 */
}