An open API service indexing awesome lists of open source software.

https://github.com/cobacdavid/hprpl

Emacs programming mode for HP 48/49/50 series calculators
https://github.com/cobacdavid/hprpl

hp hp48g hp48gx hp49g hp50g rpl rpn-calculator

Last synced: 9 days ago
JSON representation

Emacs programming mode for HP 48/49/50 series calculators

Awesome Lists containing this project

README

          

# HPRPL Mode for GNU Emacs

## Disclaimer

This mode was originally intended for personal use and created with the HP-48G in mind.

## Suffixes

Files with the `.hprpl`, `.hp48`, or `.hp50` extensions, or simply run `M-x hprpl-mode`.

## What You Get

These files provide:

* syntax highlighting, including special highlighting for HP-50G words
* auto-indentation
* ASCII/Unicode switching
* comments auto-insertion
* a 23-column warning bar in Unicode mode
* communication with emulators or real machines using `kermit` tool
* auto-detection of `x48` port (wire)

## Shortcuts

* `C-c h c` adds a comment colon to each non-comment line to keep track of the stack state
* `C-c h i` prints `x48` screen region to `"QL-700"` label printer
* `C-c h m` loads a module file containing new words
* `C-c h M` unloads a module file containing new words
* `C-c h n` captures `x48` screen region to a png file
* `C-c h p` sends HPRPL code to the `lpr` command using the Unicode version for my `"QL-700"` label printer, so prints !
* `C-c h r` receives data from a port (e.g. `/dev/ttyUSB0`, `/dev/pts/1`, etc.) using `kermit`
* `C-c h s` sends data to a port (e.g. `/dev/ttyUSB0`, `/dev/pts/1`, etc.) using `kermit`
* `C-c h u` toggles between Unicode and ASCII (e.g. `ΣLIST` switches to `\GSLIST`)
* `C-c h x` launches `x48` (the path is set to `/usr/bin/x48` using the `hprpl-x48-execpath` variable — see below)
* `C-c h y` launches `x50ng` (the path is set to `/usr/bin/x50ng` using the `hprpl-x50ng-execpath` variable — see below)

## Customizable Variables

Faces are cutomizable using `M-x customize`.

* `hprpl-x48-execpath`: full path to the `x48` emulator. Default: `"/usr/bin/x48"`
* `hprpl-x50ng-execpath`: full path to the `x50ng` emulator. Default: `"/usr/bin/x50ng"`
* `hprpl-x48-screencapture-bg-color`: background color of `x48` screen in screencapture. Default is `"#fefefe"`, `x48`'s original color is `"#c9dc5c"`.
* `hprpl-x48-screencapture-fg-color`:foreground color of `x48` screen in screencapture. Default is `"#000000"`, `x48`'s original color is `"#484e74"`.
* `hprpl-kermit-config`: a multiline string configuring `kermit` communication. Default:

```bash
"#!/usr/bin/kermit +
set line %s
set speed 9600
set carrier-watch off
set modem type direct
set flow none
set parity none
set block 1
set control prefix all
robust
"
```

This configuration can communicate with the `{ 9600 0 0 0 1 3 }` `IOPAR` variable.


* `hprpl-kermit-config-alt`: an alternative version of the previous configuration. This allows two configurations to coexist. The default is intended for use with HP-50G :
```bash
"#!/usr/bin/kermit +
set modem type direct
set prefixing all
set port %s
set speed 9600
set carrier-watch off
set flow none
set parity space
set send packet-length 80
set block 3
"
```
* `hprpl-default-port-node`: port used with `kermit`. Default: `"/dev/ttyUSB0"`. You may also be prompted to use the `"/dev/pts/1"` port corresponding to `x48`.
* `hprpl-printer-name`: `CUPS` printer name. Default: `"QL-700"`.
* `hprpl-label-width-mm`: width of the printer label in millimeters. Default: `62`.
* `hprpl-label-line-height-mm`: height in millimeters of a single line of code (depends on the font used). Default: `4.1`.
* `hprpl-module-files` : list of file paths containing new words to be loaded at start.

## Adding new words

You can add new words you use. For example, `ListExt` is a popular lib for the HP-50G.
It contains a lot of new words. You can add them in creating a file containing a word per line. Lines beginning with `#` and empty lines are ignored. A possible file for `ListExt` may begin with:

``` bash
# List Creation (CREAT menu)
LSEQ
LSEQR
LASEQ
LMSEQ
LDSEQ
LMRPT
LWHL
# List Editing (EDIT menu)
LDDUP
LPOP
...
...
```

For conversion words, you may add both unicode and ASCII versions, for example:

``` bash
S→SL
S\->SL
```

## Installation

No ELPA or MELPA package is currently available.

Add the following lines to your Emacs configuration file so Emacs can find `hprpl-mode.el`:

```elisp
(add-to-list 'load-path "/path/to/the/dir/you/have/installed/the/file/")
(require 'hprpl-mode)
```

Files `hprpl-ql700.el` and `hprpl-x48.el` have to be placed in the same directory.

In my configuration, I also use the `indent-bars` package, so I added:

```elisp
(use-package indent-bars
:ensure t
:hook (hprpl-mode . indent-bars-mode))
```

## TODO

* more RPL words

## License

GNU GPL v3 — [https://www.gnu.org/licenses/gpl-3.0.html](https://www.gnu.org/licenses/gpl-3.0.html)