1 divert(-1)dnl -*- m4 -*-
2 # Optical Character Recognition of AOC fonts, using maps learned at
3 # https://hackage.haskell.org/package/advent-of-code-ocr-0.1.2.0/docs/src/Advent.OCR.LetterMap.html
4 # assumes common.m4 is already loaded
6 define(`_ocr', `pushdef(`ocr_', ``$2',``$1''')')
7 # small font: 2016d8, 2019d8, 2019d11, 2021d13, 2022d10
135 # large font: 2018d10
302 define(`ocr_l', `ifelse(`$1',$2)')
303 define(`_ocr', `ifelse(len(`$1'), 1, ``$1'',
304 `errprintn(`ocr map incomplete')forloop(0, $3, `nl`'substr(`$2', eval(',
306 define(`ocr', `_$0(_stack_foreach(`$0_', `ocr_l(`$1',', `)', `t'), `$1',
307 ifelse(len(`$1'), 30, `6,5', `10,6'))')