;; -*- scheme -*-
;; Store the version for the reflective operations and the build and
;; packaging process. All version numbers and reflective references
;; are derived from the planet version number.

(define planet-version '(1 3))

(define info
  '((define name "Staapl")
    (define blurb
      '("A collection of abstractions for metaprogramming microcontrollers."))
    (define repositories '("4.x"))
    (define primary-file "prj/pic18.ss") ;; Reflective PIC18 compiler.
    (define homepage "http://zwizwa.be/staapl")
    (define categories '(devtools metaprogramming))

    (define release-notes
      '("Staapl is a collection of abstractions for metaprogramming microcontrollers from within PLT Scheme. The core of the system is a programmable code generator structured around a functional concatenative macro language. On top of this it includes a syntax frontend for creating Forth-style languages, a backend code generator for Microchip's PIC18 microcontroller architecture, and interaction tools for shortening the edit-compile-test cycle."))))
    

;; -----------------------------------------------------------------

(require scheme/pretty)

(define staapl-version
  (format "0.~a.~a"
          (+ 4 (car planet-version))
          (cadr planet-version)))

(define-syntax-rule (patch filename . body)
  (begin
    (with-handlers ((void void))
      (delete-file filename))
    (with-output-to-file filename
      (lambda () . body))))
    
(patch "planet-version.txt" (apply printf "~a ~a\n" planet-version))
(patch "staapl-version.txt" (printf "~a\n" staapl-version))

(patch "staapl/info.ss"
       (printf "#lang setup/infotab\n")
       (for-each pretty-print info)
       (pretty-print `(define version ,staapl-version)))

(printf "updated versions:\n staapl ~a\n planet ~a\n"
        staapl-version
        planet-version)
