changelog shortlog graph tags branches changeset files file revisions raw help

Mercurial > core / annotate lisp/lib/organ/util.lisp

changeset 263: b7183bfd7107
parent: 7ca4cdbd52c2
child: 78ef6145e272
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 05 Apr 2024 19:47:17 -0400
permissions: -rw-r--r--
description: add doc/readme.txt, more doc upgrades
127
960c010a23ce replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents: 126
diff changeset
1
 ;;; lib/organ/util.lisp --- Organ Utils
960c010a23ce replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents: 126
diff changeset
2
 
960c010a23ce replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents: 126
diff changeset
3
 ;;
960c010a23ce replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents: 126
diff changeset
4
 
960c010a23ce replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents: 126
diff changeset
5
 ;;; Code:
129
80a56483f9b5 more organ work
ellis <ellis@rwest.io>
parents: 127
diff changeset
6
 (in-package :organ)
127
960c010a23ce replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents: 126
diff changeset
7
 
136
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 129
diff changeset
8
 (defun peek-line (stream)
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 129
diff changeset
9
   (concatenate 
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 129
diff changeset
10
    'string 
263
b7183bfd7107 add doc/readme.txt, more doc upgrades
Richard Westhaver <ellis@rwest.io>
parents: 229
diff changeset
11
    (loop for c = (peek-char nil stream nil nil)
229
7ca4cdbd52c2 bug fixes
Richard Westhaver <ellis@rwest.io>
parents: 136
diff changeset
12
          until (or (not c) (char= c #\newline))
136
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 129
diff changeset
13
          collect c)))
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 129
diff changeset
14
 
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 129
diff changeset
15
 (defun read-until-end (stream)
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 129
diff changeset
16
   (with-output-to-string (s)
229
7ca4cdbd52c2 bug fixes
Richard Westhaver <ellis@rwest.io>
parents: 136
diff changeset
17
     (loop for c = (read-char stream nil)
7ca4cdbd52c2 bug fixes
Richard Westhaver <ellis@rwest.io>
parents: 136
diff changeset
18
           until (not c)
136
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 129
diff changeset
19
           do (write-char c s))))
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 129
diff changeset
20
 
127
960c010a23ce replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents: 126
diff changeset
21
 (defun read-org-lines (&optional stream)
960c010a23ce replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents: 126
diff changeset
22
   (apply #'vector
229
7ca4cdbd52c2 bug fixes
Richard Westhaver <ellis@rwest.io>
parents: 136
diff changeset
23
 	 (loop for l = (read-line stream nil)
7ca4cdbd52c2 bug fixes
Richard Westhaver <ellis@rwest.io>
parents: 136
diff changeset
24
 	       until (not l)
127
960c010a23ce replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents: 126
diff changeset
25
 	       collect l)))
960c010a23ce replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents: 126
diff changeset
26
 
960c010a23ce replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents: 126
diff changeset
27
 (defun read-org-lines-from-string (str)
960c010a23ce replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents: 126
diff changeset
28
   (with-input-from-string (s str) (read-org-lines s)))