Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
[[tags: egg]] [[toc:]] == edward An implementation of the [[https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ed.html|ed(1) text editor]] that can be extended with custom commands through a library component. Apart from the library, the Egg also ships a program component with a POSIX.1-2008 compatible ed editor which is implemented using the aforementioned library component. The library component itself leverages hygienic Scheme macros for the definition of custom editor commands and provides parser combinators for defining their input format. === Repository [[https://github.com/nmeum/edward]] === Requirements * [[r7rs]] * [[srfi-1]] * [[srfi-14]] * [[srfi-37]] * [[matchable]] * [[posix-regex]] === API The API documentation is available separately: [[https://files.8pit.net/edward/1.1.0/doc/]] This documentation is generated from Scheme source code comments using [[https://github.com/nmeum/scmdoc|scmdoc]]. If you find any errors in the API description, then please file a bug report in the aforementioned GitHub repository. === Example The following R7RS Scheme program utilizes the edward library component to create a custom version of the ed text editor which supports all POSIX commands, but additionally features a pipe command. The pipe command passes selected lines to a specified program via standard input and replace them with the standard output of this program. <enscript highlight=scheme> (import (scheme base) (chicken process) (srfi 14) (edward cli) (edward util) (edward parse) (edward ed cmd) (edward ed addr) (edward ed posix) (edward ed editor)) ;; Executor for the pipe command (define (exec-pipe editor range cmd) (let-values (((in out _) (process cmd)) ((lines) (editor-get-lines editor range))) (call-with-port out (lambda (port) (lines->port lines port))) (let ((recv (port->lines in))) (close-input-port in) (exec-delete editor range) (exec-insert editor (car range) (car recv))))) ;; Parser for the pipe command (define-file-cmd (pipe exec-pipe (make-range)) (parse-cmd-char #\|) (parse-token (char-set-complement (char-set #\newline)))) ;; Start the editor (edward-main) </enscript> Save this code in {{edward++.scm}} and compile it using: $ csc -R r7rs edward++.scm The resulting binary behaves like a normal ed(1) implementation but additionally supports the aforementioned custom pipe command. As an example, this command allows passing the contents of an opened file with [[https://pubs.opengroup.org/onlinepubs/9699919799/utilities/fold.html|fold(1)]] using: 1,$|fold -w 72 -s More examples are provided as part of the [[https://github.com/nmeum/edward-contrib|edward-contrib]] repository. === Version History ; 1.1.0 : POSIX compliance fixes, performance improvements, several API changes. ; 1.0.1 : Initial release for the CHICKEN Egg index. Prior releases are were not packaged as CHICKEN Eggs but are available on [[https://github.com/nmeum/edward/tags|GitHub]]. === License This module is licensed under [[https://spdx.org/licenses/GPL-3.0-or-later.html|GPL-3.0-or-later]].
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you multiply 4 by 5?