|
30 | 30 | (loop for line = (read-line stream nil nil) for index from 0
|
31 | 31 | while line
|
32 | 32 | do (progn
|
33 |
| - (if (= 0 index) |
34 |
| - (checkICS line)) |
35 |
| - (if (and (checkForBEGINEVENT line) |
36 |
| - (not inVEVENT)) |
37 |
| - (setf inVEVENT t)) |
38 |
| - (if (and (checkForStart line) inVEVENT) |
39 |
| - (progn |
40 |
| - (setf startTimeFound t) |
41 |
| - (setf startTime (getStartTime line)))) |
42 |
| - (if (and (checkForEndOrDuration line) inVEVENT) |
43 |
| - (progn |
44 |
| - (setf endTimeFound t) |
45 |
| - (setf endTime (getEndTime startTime line)))) |
46 |
| - (if (and (checkForSummary line) inVEVENT) |
47 |
| - (progn |
48 |
| - (setf summaryFound t) |
49 |
| - (setf summary (getSummaryDesc line)))) |
50 |
| - (if (and (checkForDesc line) inVEVENT) |
51 |
| - (progn |
52 |
| - (setf descFound t) |
53 |
| - (setf desc (getSummaryDesc line)))) |
54 |
| - (if (and (checkForENDEVENT line) inVEVENT) |
55 |
| - (progn |
56 |
| - (if (and startTimeFound endTimeFound summaryFound) |
57 |
| - (progn |
58 |
| - (with-standard-io-syntax |
59 |
| - (if descFound |
60 |
| - (setf output (format nil "~$::~$::~$::~$" startTime endTime summary desc)) |
61 |
| - (setf output (format nil "~$::~$::~$" startTime endTime summary))) |
62 |
| - (addEvent output) |
63 |
| - (format t "Imported event (start, end, summary): ~a, ~a, ~a~%" startTime endTime summary)))) |
64 |
| - (setf inVEVENT nil) |
65 |
| - (setf startTimeFound nil) |
66 |
| - (setf endTimeFound nil) |
67 |
| - (setf summaryFound nil) |
68 |
| - (setf descFound nil)))))) |
| 33 | + (cond ((= 0 index) |
| 34 | + (checkICS line)) |
| 35 | + ((and (checkForBEGINEVENT line) (not inVEVENT)) |
| 36 | + (setf inVEVENT t)) |
| 37 | + ((and (checkForStart line) inVEVENT) |
| 38 | + (setf startTimeFound t) |
| 39 | + (setf startTime (getStartTime line))) |
| 40 | + ((and (checkForEndOrDuration line) inVEVENT) |
| 41 | + (setf endTimeFound t) |
| 42 | + (setf endTime (getEndTime startTime line))) |
| 43 | + ((and (checkForSummary line) inVEVENT) |
| 44 | + (setf summaryFound t) |
| 45 | + (setf summary (getSummaryDesc line))) |
| 46 | + ((and (checkForDesc line) inVEVENT) |
| 47 | + (setf descFound t) |
| 48 | + (setf desc (getSummaryDesc line))) |
| 49 | + ((and (checkForENDEVENT line) inVEVENT) |
| 50 | + (cond ((not startTimeFound) |
| 51 | + (format t "Found an event with missing start time ending at line ~a, skipping import.~%" index)) |
| 52 | + ((not endTimeFound) |
| 53 | + (format t "Found an event with missing end time ending at line ~a, skipping import.~%" index)) |
| 54 | + ((not summaryFound) |
| 55 | + (format t "Found an event with missing summary ending at line ~a, skipping import.~%" index)) |
| 56 | + (t |
| 57 | + (with-standard-io-syntax |
| 58 | + (if descFound |
| 59 | + (setf output (format nil "~$::~$::~$::~$" startTime endTime summary desc)) |
| 60 | + (setf output (format nil "~$::~$::~$" startTime endTime summary))) |
| 61 | + (addEvent output) |
| 62 | + (format t "Imported event (start, end, summary): ~a, ~a, ~a~%" startTime endTime summary)))) |
| 63 | + (setf inVEVENT nil) |
| 64 | + (setf startTimeFound nil) |
| 65 | + (setf endTimeFound nil) |
| 66 | + (setf summaryFound nil) |
| 67 | + (setf descFound nil)))))) |
69 | 68 | (format t "Import finished.~%")))
|
70 | 69 |
|
71 | 70 | (defun import/command ()
|
|
0 commit comments