#!/usr/bin/env gosh ;;; ;;; Convert SKK dictionary to `cdbmake' format. ;;; - Read from standard input and write to standard output. ;;; - Gauche script ;;; ;;; $Id: skktocdbm,v 1.2 2003/11/21 07:59:14 hos Exp $ ;;; (define (skk->cdbmake in) (cond ((rxmatch #/^[\x3b]/ in) ;comment line #f) ((rxmatch #/^([^ ]+) (.*)$/ in) => (lambda (m) (let ((key (rxmatch-substring m 1)) (val (rxmatch-substring m 2))) (format #t "+~d,~d:~a->~a\n" (string-size key) (string-size val) key val)))) (else (error "invalid format" in)))) (define (main args) (port-for-each skk->cdbmake read-line) (newline) 0) ;; Local variables: ;; mode: scheme ;; end: