diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-14 22:07:58 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-14 22:07:58 +0100 |
commit | 2ae74fe227a417d8c47b683650022c0db06c8bd6 (patch) | |
tree | dc5561c40252b4706da673c0ac35f87fb4a67451 | |
parent | 056e26a9c342b9064209813d184af5997c73b5af (diff) | |
download | uni-2ae74fe227a417d8c47b683650022c0db06c8bd6.tar uni-2ae74fe227a417d8c47b683650022c0db06c8bd6.tar.gz uni-2ae74fe227a417d8c47b683650022c0db06c8bd6.tar.bz2 uni-2ae74fe227a417d8c47b683650022c0db06c8bd6.tar.xz uni-2ae74fe227a417d8c47b683650022c0db06c8bd6.zip |
ffp prüfungsanmeldung
-rw-r--r-- | ws2015/ffp/anmeldung.md | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/ws2015/ffp/anmeldung.md b/ws2015/ffp/anmeldung.md new file mode 100644 index 0000000..eca1c27 --- /dev/null +++ b/ws2015/ffp/anmeldung.md | |||
@@ -0,0 +1,121 @@ | |||
1 | --- | ||
2 | title: A toolset for interacting with character-oriented printers | ||
3 | author: | ||
4 | - "[Gregor Kleen](mailto:gkleen@math.lmu.de)" | ||
5 | date: 2016-01-14 | ||
6 | tags: Thermoprint | ||
7 | header-includes: | ||
8 | - \usepackage{hyperref} | ||
9 | - \hypersetup{colorlinks=true} | ||
10 | - \usepackage{enumitem} | ||
11 | - \setlist[description]{style=nextline} | ||
12 | --- | ||
13 | |||
14 | This file is an updated version of the [original blog-post](https://dirty-haskell.org/posts/thermoprint-1.html). | ||
15 | |||
16 | # Project discription | ||
17 | |||
18 | ## Motivation | ||
19 | |||
20 | Some time ago I bought a cheap Chinese | ||
21 | [thermoprinter](https://en.wikipedia.org/wiki/Thermal_printing) off eBay. | ||
22 | As expected the printers firmware is really awkward to use (including binary | ||
23 | control codes used to switch between char sets such as bold, italic, underlined, | ||
24 | etc.). | ||
25 | The obvious solution was to write a library to parse a more sensible | ||
26 | representation and send it to be printed. | ||
27 | |||
28 | Since there might, at some point, be other users wanting to print to my | ||
29 | acquisition the architecture is intended to present a somewhat usable | ||
30 | interface to the uninitiated. | ||
31 | |||
32 | ## Implementation | ||
33 | |||
34 | ### Location | ||
35 | |||
36 | Recently I created a new branch in | ||
37 | [thermoprint](http://git.yggdrasil.li/thermoprint) called | ||
38 | [rewrite](http://git.yggdrasil.li/thermoprint?h=rewrite). | ||
39 | |||
40 | ### Architecture Overview | ||
41 | |||
42 | The new macroscopic architecture I´m currently aiming for is quite similar to | ||
43 | the old one: | ||
44 | |||
45 | * A server intended to run on the machine connected to my cheap printer talking | ||
46 | directly to the printer on one end and serving a | ||
47 | [json api](https://hackage.haskell.org/package/servant) on the other. | ||
48 | * A (hopefully) tiny cli tool for debugging and personal use. | ||
49 | * A website (it will probably end up being based on | ||
50 | [threepenny](https://hackage.haskell.org/package/threepenny-gui)) presenting a web interface | ||
51 | similar to the cli tool. | ||
52 | |||
53 | ### Features | ||
54 | |||
55 | Features I intend to implement include: | ||
56 | |||
57 | * A parser for a bbcode-dialect which should be used in both the cli tool and the | ||
58 | website (it will probably end up using | ||
59 | [attoparsec](https://hackage.haskell.org/package/attoparsec)) -- bbcode as | ||
60 | presented on [Wikipedia](https://en.wikipedia.org/wiki/BBCode) is a proper | ||
61 | superset of the feature-set of my cheap Chinese printer. | ||
62 | * Reasonable test coverage using | ||
63 | [QuickCheck](https://hackage.haskell.org/package/QuickCheck), | ||
64 | [HUnit](http://hackage.haskell.org/package/HUnit). | ||
65 | |||
66 | Automatic testing with [cabal](https://www.haskell.org/cabal/) facilitated by | ||
67 | [hspec](https://hackage.haskell.org/package/hspec). | ||
68 | * Support and server-side storage for drafts. | ||
69 | * The Website should provide some richer formats than bbcode which will | ||
70 | probably find inclusion in the payload datastructure such as lists, | ||
71 | checklists, tables, etc. | ||
72 | |||
73 | The cli-tool should be able to use these too (the input will probably end up | ||
74 | being json-formatted). | ||
75 | |||
76 | ### Connection to the lecture | ||
77 | |||
78 | We inted to implement: | ||
79 | |||
80 | * A parser using [attoparsec](https://hackage.haskell.org/package/attoparsec)) | ||
81 | * A graphical user interface/website using [threepenny](https://hackage.haskell.org/package/threepenny-gui) | ||
82 | * A CLI-tool using [optparse-applicative](https://hackage.haskell.org/package/optparse-applicative) | ||
83 | * A [servant](https://hackage.haskell.org/package/servant) based API | ||
84 | * Some parallelism using [stm](https://hackage.haskell.org/package/stm) for management of printer-queues and the like within the API-backend | ||
85 | |||
86 | Of which only the use of stm was discussed in the lecture. | ||
87 | |||
88 | # Work so far | ||
89 | |||
90 | ## Prototype | ||
91 | |||
92 | I already have a prototype. | ||
93 | It's quite bug-ridden and has recently developed serious problems actually | ||
94 | printing after working satisfactorily for a few weeks. | ||
95 | |||
96 | It also does not include a web-interface and I am quite unsatisfied with the | ||
97 | overall code quality. | ||
98 | |||
99 | The [685 lines of code](https://github.com/AlDanial/cloc) can be found in the | ||
100 | [repo](http://git.yggdrasil.li/thermoprint?h=master) as well. | ||
101 | |||
102 | ## Rewrite | ||
103 | |||
104 | Currently the [rewrite](http://git.yggdrasil.li/thermoprint?h=rewrite&id=1cc1bc4555d1ca7688920027b401ea94f3b82d5f) contains: | ||
105 | |||
106 | [Printout.hs](http://git.yggdrasil.li/thermoprint/tree/spec/src/Thermoprint/Printout.hs?h=rewrite&id=1cc1bc4555d1ca7688920027b401ea94f3b82d5f) | ||
107 | ~ A definition of the payload-datatype -- a structured document format meant to be translated into a printer specific representation at print-time | ||
108 | |||
109 | [API.hs](http://git.yggdrasil.li/thermoprint/tree/spec/src/Thermoprint/API.hs?h=rewrite&id=1cc1bc4555d1ca7688920027b401ea94f3b82d5f) | ||
110 | ~ A definition of the API. This already encompasses most of the work on the API due to the powerful derivation utilities provided by servant | ||
111 | |||
112 | [bbcode/src](http://git.yggdrasil.li/thermoprint/tree/bbcode/src/Text?h=rewrite&id=1cc1bc4555d1ca7688920027b401ea94f3b82d5f) | ||
113 | ~ An already complete parser for bbcode -- a format very closely related to xml | ||
114 | |||
115 | */test | ||
116 | ~ [Unit](https://hackage.haskell.org/package/hspec)- and [QuickCheck](https://hackage.haskell.org/package/QuickCheck)-tests for: | ||
117 | |||
118 | * The smart constructor [`text`](http://git.yggdrasil.li/thermoprint/tree/spec/src/Thermoprint/Printout.hs?h=rewrite&id=1cc1bc4555d1ca7688920027b401ea94f3b82d5f#n131) for [`Block`](http://git.yggdrasil.li/thermoprint/tree/spec/src/Thermoprint/Printout.hs?h=rewrite&id=1cc1bc4555d1ca7688920027b401ea94f3b82d5f#n83). | ||
119 | * The To- and FromJSON instances of `Printout` | ||
120 | * The [bbcode lexer](http://git.yggdrasil.li/thermoprint/tree/bbcode/src/Text/BBCode/Lexer.hs?h=rewrite) | ||
121 | * The entire [bbcode parser](http://git.yggdrasil.li/thermoprint/tree/bbcode/src/Text/BBCode.hs?h=rewrite) | ||