From 3521ad64ef664f8303fa93ac237212b97dd0f69c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 4 Oct 2019 00:01:27 +0200 Subject: Remove debug prints.. --- module/vcomponent.scm | 16 ---------------- module/vcomponent/base.scm | 29 ++++------------------------- module/vcomponent/recurrence/generate.scm | 21 +++++---------------- src/parse.c | 16 ---------------- 4 files changed, 9 insertions(+), 73 deletions(-) diff --git a/module/vcomponent.scm b/module/vcomponent.scm index 9bd70689..e7ffb785 100644 --- a/module/vcomponent.scm +++ b/module/vcomponent.scm @@ -27,8 +27,6 @@ "Parse all start times into scheme date objects." (for tz in (filter (lambda (o) (eq? 'VTIMEZONE (type o))) (children cal)) - (format #t "TZ = ~a~%" tz) - (for-each (lambda (p) (mod! (attr p "DTSTART") string->time-utc)) (children tz)) @@ -49,7 +47,6 @@ (define date (parse-datetime (value dptr))) (define end-date (cond [(not eptr) - (format #t "date = ~a~%" date) (let ((d (set (date-hour date) = (+ 1)))) (set! (attr ev 'DTEND) d eptr (attr* ev 'DTEND)) @@ -57,19 +54,12 @@ )] [(value eptr) => parse-datetime] [else - (format #t "date = ~a~%" date) (set (date-hour date) = (+ 1))]) ) - (format #t "ev = ~a~%file = ~a~%" ev (attr ev 'X-HNH-FILENAME)) - - ;; (format #t "ev = ~a~%file = ~a~%" ev (attr ev 'X-HNH-FILENAME)) - (set! (value dptr) (date->time-utc date) (value eptr) (date->time-utc end-date)) - (format #t "After first set") - (when (prop (attr* ev 'DTSTART) 'TZID) (set! (zone-offset date) (get-tz-offset ev) (value dptr) (date->time-utc date) @@ -99,7 +89,6 @@ (if (not path) (primitive-make-vcomponent) (let ((root (parse-cal-path path))) - (format #t "root = ~a~%" root ) (let* ((component (case (string->symbol (or (attr root "X-HNH-SOURCETYPE") "no-type")) ;; == Single ICS file == @@ -107,7 +96,6 @@ ;; returning the wanted VCALENDAR component ((file) ;; TODO test this when an empty file is given. - (display "Hello\n") (car (children root))) ;; == Assume vdir == @@ -123,11 +111,9 @@ ;; What does this even do? (unless (null? ch) - (format #t "Looping over attributes~%") (for key in (attributes (car ch)) (set! (attr accum key) (attr (car ch) key)))) - (format #t "Looping over children, again") (for cal in ch (for component in (children cal) (case (type component) @@ -143,9 +129,7 @@ ((no-type) (throw 'no-type))))) - (display "Here?\n") (parse-dates! component) - (display "Theren") (unless (attr component "NAME") (set! (attr component "NAME") diff --git a/module/vcomponent/base.scm b/module/vcomponent/base.scm index 38034a81..399f7af9 100644 --- a/module/vcomponent/base.scm +++ b/module/vcomponent/base.scm @@ -5,18 +5,6 @@ :use-module (vcomponent primitive) :use-module ((ice-9 optargs) :select (define*-public))) -;; (define og-struct-ref struct-ref) -;; (define (struct-ref struct field) -;; (format #t "struct = ~a, field = ~a~%" struct field) -;; (og-struct-ref struct field)) - -(use-modules (system vm trap-state)) - -(install-trap-handler! (lambda args (format #t "args = ~a~%" args))) - -(add-trace-at-procedure-call! struct-ref) -(add-trap-at-procedure-call! struct-ref) - ;; vline → value (define-public value (make-procedure-with-setter @@ -34,20 +22,11 @@ value)) (define (set-attr! component attr value) - (format #t "attr = ~a~%" attr) (aif (attr* component attr) - (begin (format #t "Existed~%") (struct-set! it 0 value)) - (begin (format #t "Creating, component = ~a, attr = ~a, value = ~a~%" component attr value) - (format #t "map = ~a~%" (struct-ref component 3)) - (let ((return (hash-set! (struct-ref component 3) - (as-string attr) - (make-vline value)))) - - (format #t "Return = ~a~%" return) - return - ) - - ))) + (struct-set! it 0 value) + (hash-set! (struct-ref component 3) + (as-string attr) + (make-vline value)))) ;; (define-public (values-left-count attr-list) ;; (length (take-while identity attr-list))) diff --git a/module/vcomponent/recurrence/generate.scm b/module/vcomponent/recurrence/generate.scm index a274ecfa..c2863954 100644 --- a/module/vcomponent/recurrence/generate.scm +++ b/module/vcomponent/recurrence/generate.scm @@ -73,10 +73,8 @@ (date->time-utc d)) (when (attr e 'DTEND) - (format #t "file = ~a~%dtstart = ~a~%duration = ~a~%" - (attr e 'X-HNH-FILENAME) (attr e 'DTSTART) (attr e 'DURATION)) - (set! (attr e 'DTEND) - (add-duration (attr e 'DTSTART) (attr e 'DURATION)))) + (set! (attr e 'DTEND) + (add-duration (attr e 'DTSTART) (attr e 'DURATION)))) ;; Return e)) @@ -126,21 +124,12 @@ (if (not (attr event 'RRULE)) (stream event) (begin - (format #t "!!! DURATION = ~a~%" (attr event 'DURATION)) (when (and (attr event 'DTEND) (not (attr event 'DURATION))) - (let ((dt (time-difference (attr event "DTEND") (attr event "DTSTART") ))) - (format #t "duration = ~a~%start = ~a, end = ~a~%diff = ~a~%" - (attr event "DURATION") - (attr event "DTSTART") (attr event "DTEND") - dt) - (set! (attr event "DURATION") - dt - #; - (time-difference + (set! (attr event "DURATION") + (time-difference (attr event "DTEND") - (attr event "DTSTART"))))) - (format #t "||| DURATION = ~a~%" (attr* event "DURATION")) + (attr event "DTSTART")))) (if (attr event "RRULE") (recur-event-stream event (parse-recurrence-rule (attr event "RRULE"))) ;; TODO some events STANDARD and DAYLIGT doesn't have RRULE's, but rather diff --git a/src/parse.c b/src/parse.c index 8c370958..996c0a92 100644 --- a/src/parse.c +++ b/src/parse.c @@ -73,16 +73,10 @@ int parse_file(char* filename, FILE* f, SCM root) { SCM attr_key; /* string */ SCM line_key = scm_from_utf8_string(""); /* string */ - INFO_F("Parsing [%s]", filename); - char c; while ( (c = fgetc(f)) != EOF) { - // INFO_F("LOOP %c", c); - /* We have a linebreak */ if (c == '\r' || c == '\n') { - // INFO("EOL"); - if (fold(&ctx, c) > 0) { /* Actuall end of line, handle value */ // TRANSFER(CLINE_CUR_VAL(&cline), &ctx.str); @@ -91,7 +85,6 @@ int parse_file(char* filename, FILE* f, SCM root) { */ if (string_eq(line_key, scm_from_utf8_string("BEGIN"))) { /* key \in { VCALENDAR, VEVENT, VALARM, VTODO, VTIMEZONE, ... } */ - INFO("Creating child"); SCM child = scm_make_vcomponent(scm_string_to_symbol(scm_from_strbuf(&str))); scm_add_child_x (component, child); @@ -107,7 +100,6 @@ int parse_file(char* filename, FILE* f, SCM root) { } else if (string_eq(line_key, scm_from_utf8_string("END"))) { // TODO make current component be parent of current component? - INFO("back to parent"); component = scm_component_parent(component); /* @@ -115,8 +107,6 @@ int parse_file(char* filename, FILE* f, SCM root) { * component. */ } else { - strbuf_cap(&str); // TODO remove - INFO_F("Adding attribute [%s]", str.mem); scm_struct_set_x(line, vline_value, scm_from_strbuf(&str)); scm_add_line_x(component, line_key, line); line = scm_make_vline(SCM_UNDEFINED); @@ -135,9 +125,6 @@ int parse_file(char* filename, FILE* f, SCM root) { } else if (p_ctx == p_param_name && c == '=') { /* Save the current parameter key */ - // TODO - // TRANSFER (¶m_key, &ctx.str); - INFO_F("Param key [%s]", str.mem); attr_key = scm_from_strbuf(&str); p_ctx = p_param_value; strbuf_soft_reset (&str); @@ -154,7 +141,6 @@ int parse_file(char* filename, FILE* f, SCM root) { /* We got a parameter value, push the current string to * the current parameter set. */ if (p_ctx == p_param_value) { - INFO_F("param value [%s]", str.mem); /* save current parameter value. */ scm_add_attribute_x(line, attr_key, scm_from_strbuf(&str)); strbuf_soft_reset (&str); @@ -168,8 +154,6 @@ int parse_file(char* filename, FILE* f, SCM root) { */ if (p_ctx == p_key) { - strbuf_cap(&str); // TODO remove - INFO_F("key [%s]", str.mem); // TRANSFER(&cline_key, &ctx.str); // NEW(content_set, p); -- cgit v1.2.3