commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r4854 - in gnuradio/branches/developers/eb/ibu: . conf


From: eb
Subject: [Commit-gnuradio] r4854 - in gnuradio/branches/developers/eb/ibu: . config mblock/src mblock/src/scheme mblock/src/scheme/gnuradio pmt/src pmt/src/lib pmt/src/scheme pmt/src/scheme/gnuradio
Date: Tue, 3 Apr 2007 02:08:43 -0600 (MDT)

Author: eb
Date: 2007-04-03 02:08:43 -0600 (Tue, 03 Apr 2007)
New Revision: 4854

Added:
   gnuradio/branches/developers/eb/ibu/mblock/src/scheme/
   gnuradio/branches/developers/eb/ibu/mblock/src/scheme/Makefile.am
   gnuradio/branches/developers/eb/ibu/mblock/src/scheme/gnuradio/
   gnuradio/branches/developers/eb/ibu/mblock/src/scheme/gnuradio/Makefile.am
   
gnuradio/branches/developers/eb/ibu/mblock/src/scheme/gnuradio/compile-mbh.scm
   gnuradio/branches/developers/eb/ibu/pmt/src/scheme/Makefile.am
   gnuradio/branches/developers/eb/ibu/pmt/src/scheme/gnuradio/Makefile.am
   
gnuradio/branches/developers/eb/ibu/pmt/src/scheme/gnuradio/gen-serial-tags.scm
Removed:
   gnuradio/branches/developers/eb/ibu/mblock/src/scheme/gnuradio/Makefile.am
   gnuradio/branches/developers/eb/ibu/mblock/src/tools/
   
gnuradio/branches/developers/eb/ibu/pmt/src/scheme/gnuradio/gen_serial_tags.scm
Modified:
   gnuradio/branches/developers/eb/ibu/Makefile.common
   gnuradio/branches/developers/eb/ibu/config/grc_mblock.m4
   gnuradio/branches/developers/eb/ibu/config/grc_pmt.m4
   gnuradio/branches/developers/eb/ibu/mblock/src/Makefile.am
   gnuradio/branches/developers/eb/ibu/pmt/src/Makefile.am
   gnuradio/branches/developers/eb/ibu/pmt/src/lib/Makefile.am
   gnuradio/branches/developers/eb/ibu/pmt/src/scheme/
   gnuradio/branches/developers/eb/ibu/pmt/src/scheme/gnuradio/
   
gnuradio/branches/developers/eb/ibu/pmt/src/scheme/gnuradio/pmt-serial-tags.scm
Log:
work-in-progress

Modified: gnuradio/branches/developers/eb/ibu/Makefile.common
===================================================================
--- gnuradio/branches/developers/eb/ibu/Makefile.common 2007-04-03 05:58:29 UTC 
(rev 4853)
+++ gnuradio/branches/developers/eb/ibu/Makefile.common 2007-04-03 08:08:43 UTC 
(rev 4854)
@@ -93,3 +93,5 @@
 # Fix for BSD make not defining $(RM).  We define it now in configure.ac
 # using AM_PATH_PROG, but now here have to add a -f to be like GNU make
 RM=$(RM_PROG) -f
+
+RUN_GUILE = 
GUILE_LOAD_PATH="$(abs_top_srcdir)/pmt/src/scheme/gnuradio:$(abs_top_srcdir)/mblock/src/scheme/gnuradio"
 @GUILE@ -e main -s

Modified: gnuradio/branches/developers/eb/ibu/config/grc_mblock.m4
===================================================================
--- gnuradio/branches/developers/eb/ibu/config/grc_mblock.m4    2007-04-03 
05:58:29 UTC (rev 4853)
+++ gnuradio/branches/developers/eb/ibu/config/grc_mblock.m4    2007-04-03 
08:08:43 UTC (rev 4854)
@@ -25,7 +25,8 @@
        mblock/doc/Makefile \
        mblock/src/Makefile \
        mblock/src/lib/Makefile \
-       mblock/src/tools/Makefile
+       mblock/src/scheme/Makefile \
+       mblock/src/scheme/gnuradio/Makefile \
     ])
 
     passed=yes
@@ -49,6 +50,12 @@
        fi
     done
 
+    AC_PATH_PROG(GUILE,guile)
+    if test "$GUILE" = "" ; then
+      AC_MSG_RESULT([Component mblock requires guile, which was not found.])
+      passed=no
+    fi
+
     GRC_BUILD_CONDITIONAL([mblock],[
         dnl run_tests is created from run_tests.in.  Make it executable.
        dnl AC_CONFIG_COMMANDS([run_tests_mblock], [chmod +x 
mblock/src/python/run_tests])

Modified: gnuradio/branches/developers/eb/ibu/config/grc_pmt.m4
===================================================================
--- gnuradio/branches/developers/eb/ibu/config/grc_pmt.m4       2007-04-03 
05:58:29 UTC (rev 4853)
+++ gnuradio/branches/developers/eb/ibu/config/grc_pmt.m4       2007-04-03 
08:08:43 UTC (rev 4854)
@@ -24,10 +24,18 @@
        pmt/Makefile \
        pmt/doc/Makefile \
        pmt/src/Makefile \
-       pmt/src/lib/Makefile
+       pmt/src/lib/Makefile \
+       pmt/src/scheme/Makefile \
+       pmt/src/scheme/gnuradio/Makefile \
     ])
 
     passed=yes
+    AC_PATH_PROG(GUILE,guile)
+    if test "$GUILE" = "" ; then
+      AC_MSG_RESULT([Component pmt requires guile, which was not found.])
+      passed=no
+    fi
+
     GRC_BUILD_CONDITIONAL([pmt],[
         dnl run_tests is created from run_tests.in.  Make it executable.
        dnl AC_CONFIG_COMMANDS([run_tests_pmt], [chmod +x 
pmt/src/python/run_tests])

Modified: gnuradio/branches/developers/eb/ibu/mblock/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/ibu/mblock/src/Makefile.am  2007-04-03 
05:58:29 UTC (rev 4853)
+++ gnuradio/branches/developers/eb/ibu/mblock/src/Makefile.am  2007-04-03 
08:08:43 UTC (rev 4854)
@@ -19,4 +19,4 @@
 # Boston, MA 02110-1301, USA.
 # 
 
-SUBDIRS = tools lib
+SUBDIRS = lib scheme


Property changes on: gnuradio/branches/developers/eb/ibu/mblock/src/scheme
___________________________________________________________________
Name: svn:ignore
   + Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo


Added: gnuradio/branches/developers/eb/ibu/mblock/src/scheme/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/ibu/mblock/src/scheme/Makefile.am           
                (rev 0)
+++ gnuradio/branches/developers/eb/ibu/mblock/src/scheme/Makefile.am   
2007-04-03 08:08:43 UTC (rev 4854)
@@ -0,0 +1,21 @@
+#
+# Copyright 2007 Free Software Foundation, Inc.
+# 
+# This file is part of GNU Radio
+# 
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+# 
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+SUBDIRS = gnuradio

Copied: gnuradio/branches/developers/eb/ibu/mblock/src/scheme/gnuradio (from 
rev 4825, gnuradio/branches/developers/eb/ibu/mblock/src/tools)

Deleted: 
gnuradio/branches/developers/eb/ibu/mblock/src/scheme/gnuradio/Makefile.am

Copied: 
gnuradio/branches/developers/eb/ibu/mblock/src/scheme/gnuradio/Makefile.am 
(from rev 4853, 
gnuradio/branches/developers/eb/ibu/mblock/src/tools/Makefile.am)
===================================================================
--- gnuradio/branches/developers/eb/ibu/mblock/src/scheme/gnuradio/Makefile.am  
                        (rev 0)
+++ gnuradio/branches/developers/eb/ibu/mblock/src/scheme/gnuradio/Makefile.am  
2007-04-03 08:08:43 UTC (rev 4854)
@@ -0,0 +1,19 @@
+#
+# Copyright 2007 Free Software Foundation, Inc.
+# 
+# This file is part of GNU Radio
+# 
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+# 
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#

Copied: 
gnuradio/branches/developers/eb/ibu/mblock/src/scheme/gnuradio/compile-mbh.scm 
(from rev 4853, 
gnuradio/branches/developers/eb/ibu/mblock/src/tools/compile-mbh.scm)
===================================================================
--- 
gnuradio/branches/developers/eb/ibu/mblock/src/scheme/gnuradio/compile-mbh.scm  
                            (rev 0)
+++ 
gnuradio/branches/developers/eb/ibu/mblock/src/scheme/gnuradio/compile-mbh.scm  
    2007-04-03 08:08:43 UTC (rev 4854)
@@ -0,0 +1,200 @@
+#!/usr/bin/guile \
+-e main -s
+!#
+;; -*-scheme-*-
+;;
+;; Copyright 2007 Free Software Foundation, Inc.
+;; 
+;; This file is part of GNU Radio
+;; 
+;; GNU Radio is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;; 
+;; GNU Radio is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;; 
+;; You should have received a copy of the GNU General Public License along
+;; with this program; if not, write to the Free Software Foundation, Inc.,
+;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+;;
+
+;; usage: compile-mbh <input-file> <output-file>
+
+(use-modules (ice-9 getopt-long))
+(use-modules (ice-9 format))
+(use-modules (ice-9 pretty-print))
+;(use-modules (ice-9 slib))
+
+(debug-enable 'backtrace)
+
+(define (atom? obj)
+  (not (pair? obj)))
+
+(defmacro when (pred . body)
+  `(if ,pred (begin ,@body) #f))
+
+(defmacro unless (pred . body)
+  `(if (not ,pred) (begin ,@body) #f))
+
+;; ----------------------------------------------------------------
+
+(define (main args)
+
+  (define (usage)
+    (format 0 "usage: ~a input-file output-file~%" (car args)))
+
+  (when (not (= (length args) 3))
+       (usage)
+       (exit 1))
+      
+  (let ((input-filename (cadr args))
+       (output-filename (caddr args)))
+      (if (compile-mbh-file input-filename output-filename)
+         (exit 0)
+         (exit 1))))
+
+
+;; ----------------------------------------------------------------
+;; constructor and accessors for protocol-class
+
+(define %protocol-class-tag (string->symbol "[PROTOCOL-CLASS-TAG]"))
+
+(define (make-protocol-class name incoming outgoing)
+  (vector %protocol-class-tag name incoming outgoing))
+
+(define (protocol-class? obj)
+  (and (vector? obj) (eq? %protocol-class-tag (vector-ref obj 0))))
+
+(define (protocol-class-name pc)
+  (vector-ref pc 1))
+
+(define (protocol-class-incoming pc)
+  (vector-ref pc 2))
+
+(define (protocol-class-outgoing pc)
+  (vector-ref pc 3))
+
+
+;; ----------------------------------------------------------------
+
+(define (syntax-error msg e)
+  (throw 'syntax-error msg e))
+
+(define (unrecognized-form form)
+  (syntax-error "Unrecognized form" form))
+
+
+(define (mbh-chk-length= e y n)
+  (cond ((and (null? y)(zero? n))
+        #f)
+        ((null? y)
+         (syntax-error "Expression has too few subexpressions" e))
+        ((atom? y)
+         (syntax-error (if (atom? e)
+                           "List expected"
+                           "Expression ends with `dotted' atom")
+                       e))
+        ((zero? n)
+         (syntax-error "Expression has too many subexpressions" e))
+        (else
+          (mbh-chk-length= e (cdr y) (- n 1)))))
+
+(define (mbh-chk-length>= e y n)
+  (cond ((and (null? y)(< n 1))
+        #f)
+        ((atom? y)
+         (mbh-chk-length= e y -1))
+        (else
+          (mbh-chk-length>= e (cdr y) (- n 1)))))
+
+
+(define (compile-mbh-file input-filename output-filename)
+  (let ((i-port (open-input-file input-filename))
+       (o-port (open-output-file output-filename)))
+
+    (letrec
+      ((protocol-classes '())          ; alist
+
+       (lookup-protocol-class          ; returns protocol-class or #f
+       (lambda (name)
+         (cond ((assq name protocol-classes) => cdr)
+               (else #f))))
+
+       (register-protocol-class
+       (lambda (pc)
+         (set! protocol-classes (acons (protocol-class-name pc)
+                                         pc protocol-classes))
+         pc))
+                                         
+       (parse-top-level-form
+       (lambda (form)
+         (mbh-chk-length>= form form 1)
+         (case (car form)
+           ((define-protocol-class) (parse-define-protocol-class form))
+           (else (syntax-error form)))))
+
+       (parse-define-protocol-class
+       (lambda (form)               
+         (mbh-chk-length>= form form 2)
+           ;; form => (define-protocol-class name
+           ;;           (:include protocol-class-name)
+           ;;           (:incoming list-of-msgs)
+           ;;           (:outgoing list-of-msgs))
+           (let ((name (cadr form))
+                 (incoming '())
+                 (outgoing '()))
+             (if (lookup-protocol-class name)
+                 (syntax-error "Duplicate protocol-class name" name))
+             (for-each
+              (lambda (sub-form)
+                (mbh-chk-length>= sub-form sub-form 1)
+                (case (car sub-form)
+                  ((:include)
+                   (mbh-chk-length>= sub-form sub-form 2)
+                   (cond ((lookup-protocol-class (cadr sub-form)) =>
+                          (lambda (pc)
+                            (set! incoming (append incoming 
(protocol-class-incoming pc)))
+                            (set! outgoing (append outgoing 
(protocol-class-outgoing pc)))))
+                         (else
+                          (syntax-error "Unknown protocol-class-name" (cadr 
sub-form)))))
+                  ((:incoming)
+                   (set! incoming (append incoming (cdr sub-form))))
+                  ((:outgoing)
+                   (set! outgoing (append outgoing (cdr sub-form))))
+                  (else
+                   (unrecognized-form (car sub-form)))))
+              (cddr form))
+             
+             (register-protocol-class (make-protocol-class name incoming 
outgoing)))))
+
+       ) ; end of bindings
+
+      (for-each-in-file i-port parse-top-level-form)
+
+      ;; generate the output here...
+        
+      (pretty-print (map cdr protocol-classes) o-port)
+
+      #t)))
+
+
+(define (for-each-in-file file f)
+  (let ((port (if (port? file)
+                 file
+                 (open-input-file file))))
+    (letrec
+     ((loop
+       (lambda (port form)
+        (cond ((eof-object? form)
+               (when (not (eq? port file))
+                     (close-input-port port))
+               #t)
+              (else
+               (f form)
+               (set! form #f)          ; for GC
+               (loop port (read port)))))))
+     (loop port (read port)))))

Modified: gnuradio/branches/developers/eb/ibu/pmt/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/ibu/pmt/src/Makefile.am     2007-04-03 
05:58:29 UTC (rev 4853)
+++ gnuradio/branches/developers/eb/ibu/pmt/src/Makefile.am     2007-04-03 
08:08:43 UTC (rev 4854)
@@ -1,5 +1,5 @@
 #
-# Copyright 2004,2006 Free Software Foundation, Inc.
+# Copyright 2006,2007 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
@@ -19,4 +19,4 @@
 # Boston, MA 02110-1301, USA.
 # 
 
-SUBDIRS = lib
+SUBDIRS = lib scheme

Modified: gnuradio/branches/developers/eb/ibu/pmt/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/ibu/pmt/src/lib/Makefile.am 2007-04-03 
05:58:29 UTC (rev 4853)
+++ gnuradio/branches/developers/eb/ibu/pmt/src/lib/Makefile.am 2007-04-03 
08:08:43 UTC (rev 4854)
@@ -48,17 +48,15 @@
 $(GENERATED_H) $(GENERATED_I) $(GENERATED_CC): $(CODE_GENERATOR)
        PYTHONPATH=$(top_srcdir)/pmt/src/lib srcdir=$(srcdir) $(PYTHON) 
$(srcdir)/generate_unv.py
 
-pmt_serial_tags.h pmt_serial_tags.scm: gen_serial_tags.scm pmt_serial_tags.dat
-       $(srcdir)/gen_serial_tags.scm $(srcdir)/pmt_serial_tags.dat 
pmt_serial_tags.h pmt_serial_tags.scm
+pmt_serial_tags.h: $(srcdir)/../scheme/gnuradio/gen-serial-tags.scm 
$(srcdir)/../scheme/gnuradio/pmt-serial-tags.scm
+       $(RUN_GUILE) $(srcdir)/../scheme/gnuradio/gen-serial-tags.scm 
$(srcdir)/../scheme/gnuradio/pmt-serial-tags.scm pmt_serial_tags.h
 
-BUILT_SOURCES = $(GENERATED_H) $(GENERATED_CC) pmt_serial_tags.h 
pmt_serial_tags.scm
+BUILT_SOURCES = $(GENERATED_H) $(GENERATED_CC) pmt_serial_tags.h
 
 # ----------------------------------------------------------------
 
 EXTRA_DIST =                           \
-       $(CODE_GENERATOR)               \
-       gen_serial_tags.scm             \
-       pmt_serial_tags.dat             
+       $(CODE_GENERATOR)               
 
 # These are the source files that go into the pmt shared library
 libpmt_la_SOURCES =                    \


Property changes on: gnuradio/branches/developers/eb/ibu/pmt/src/scheme
___________________________________________________________________
Name: svn:ignore
   + Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo


Added: gnuradio/branches/developers/eb/ibu/pmt/src/scheme/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/ibu/pmt/src/scheme/Makefile.am              
                (rev 0)
+++ gnuradio/branches/developers/eb/ibu/pmt/src/scheme/Makefile.am      
2007-04-03 08:08:43 UTC (rev 4854)
@@ -0,0 +1,21 @@
+#
+# Copyright 2007 Free Software Foundation, Inc.
+# 
+# This file is part of GNU Radio
+# 
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+# 
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+SUBDIRS = gnuradio


Property changes on: gnuradio/branches/developers/eb/ibu/pmt/src/scheme/gnuradio
___________________________________________________________________
Name: svn:ignore
   + Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo


Added: gnuradio/branches/developers/eb/ibu/pmt/src/scheme/gnuradio/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/ibu/pmt/src/scheme/gnuradio/Makefile.am     
                        (rev 0)
+++ gnuradio/branches/developers/eb/ibu/pmt/src/scheme/gnuradio/Makefile.am     
2007-04-03 08:08:43 UTC (rev 4854)
@@ -0,0 +1,30 @@
+#
+# Copyright 2007 Free Software Foundation, Inc.
+# 
+# This file is part of GNU Radio
+# 
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+# 
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+#pkgdatadir = $(datadir)/gnuradio
+
+EXTRA_DIST =                           \
+       gen-serial-tags.scm             
+
+
+# really scheme source files
+pkgdata_DATA =                         \
+       pmt-serial-tags.scm             \
+       pmt-serialize.scm               

Copied: 
gnuradio/branches/developers/eb/ibu/pmt/src/scheme/gnuradio/gen-serial-tags.scm 
(from rev 4853, 
gnuradio/branches/developers/eb/ibu/pmt/src/scheme/gnuradio/gen_serial_tags.scm)
===================================================================
--- 
gnuradio/branches/developers/eb/ibu/pmt/src/scheme/gnuradio/gen-serial-tags.scm 
                            (rev 0)
+++ 
gnuradio/branches/developers/eb/ibu/pmt/src/scheme/gnuradio/gen-serial-tags.scm 
    2007-04-03 08:08:43 UTC (rev 4854)
@@ -0,0 +1,118 @@
+#!/usr/bin/guile \
+-e main -s
+!#
+;;; -*-scheme-*-
+;;;
+;;; Copyright 2007 Free Software Foundation, Inc.
+;;; 
+;;; This file is part of GNU Radio
+;;; 
+;;; GNU Radio is free software; you can redistribute it and/or modify
+;;; it under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 2, or (at your option)
+;;; any later version.
+;;; 
+;;; GNU Radio is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;; 
+;;; You should have received a copy of the GNU General Public License along
+;;; with this program; if not, write to the Free Software Foundation, Inc.,
+;;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+;;;
+
+(use-modules (ice-9 format))
+
+(defmacro when (pred . body)
+  `(if ,pred (begin ,@body) #f))
+
+;; ----------------------------------------------------------------
+
+(define (main args)
+
+  (define (usage)
+    (format 0
+           "usage: ~a <pmt-serial-tags.scm> <pmt_serial_tags.h>~%"
+           (car args)))
+
+  (when (not (= (length args) 3))
+       (usage)
+       (format 0 "args: ~s~%" args)
+       (exit 1))
+      
+  (let ((i-file (open-input-file (cadr args)))
+       (h-file (open-output-file (caddr args))))
+
+      (write-header-comment h-file "// ")
+      (display "#ifndef INCLUDED_PMT_SERIAL_TAGS_H\n" h-file)
+      (display "#define INCLUDED_PMT_SERIAL_TAGS_H\n" h-file)
+      (newline h-file)
+      (display "enum pst_tags {\n" h-file)
+
+      (for-each-in-file i-file
+       (lambda (form)
+        (let* ((name (cadr form))
+               (c-name (string-upcase (c-ify name)))
+               (value (caddr form)))
+          ;;(format h-file   "static const int ~a\t= 0x~x;~%" c-name value)
+          (format h-file   "  ~a\t= 0x~x,~%" c-name value))))
+
+      (display "};\n" h-file)
+      (display "#endif\n" h-file)))
+
+(define (c-ify name)
+  (list->string (map (lambda (c)
+                      (if (eqv? c #\-) #\_ c))
+                    (string->list (symbol->string name)))))
+
+
+(define (write-header-comment o-port prefix)
+  (for-each (lambda (comment)
+             (format o-port "~a~a~%" prefix comment))
+           header-comment))
+
+(define header-comment
+  '(
+    ""
+    "Copyright 2007 Free Software Foundation, Inc."
+    ""
+    "This file is part of GNU Radio"
+    ""
+    "GNU Radio is free software; you can redistribute it and/or modify"
+    "it under the terms of the GNU General Public License as published by"
+    "the Free Software Foundation; either version 2, or (at your option)"
+    "any later version."
+    ""
+    "GNU Radio is distributed in the hope that it will be useful,"
+    "but WITHOUT ANY WARRANTY; without even the implied warranty of"
+    "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the"
+    "GNU General Public License for more details."
+    ""
+    "You should have received a copy of the GNU General Public License along"
+    "with this program; if not, write to the Free Software Foundation, Inc.,"
+    "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
+    ""
+    ""
+    "THIS FILE IS MACHINE GENERATED FROM pmt-serial-tags.scm. DO NOT EDIT BY 
HAND."
+    "See pmt-serial-tags.scm for additional commentary."
+    ""))
+
+
+
+(define (for-each-in-file file f)
+  (let ((port (if (port? file)
+                 file
+                 (open-input-file file))))
+    (letrec
+     ((loop
+       (lambda (port form)
+        (cond ((eof-object? form)
+               (when (not (eq? port file))
+                     (close-input-port port))
+               #t)
+              (else
+               (f form)
+               (set! form #f)          ; for GC
+               (loop port (read port)))))))
+     (loop port (read port)))))

Deleted: 
gnuradio/branches/developers/eb/ibu/pmt/src/scheme/gnuradio/gen_serial_tags.scm

Modified: 
gnuradio/branches/developers/eb/ibu/pmt/src/scheme/gnuradio/pmt-serial-tags.scm
===================================================================
--- 
gnuradio/branches/developers/eb/ibu/pmt/src/scheme/gnuradio/pmt-serial-tags.scm 
    2007-04-03 05:58:29 UTC (rev 4853)
+++ 
gnuradio/branches/developers/eb/ibu/pmt/src/scheme/gnuradio/pmt-serial-tags.scm 
    2007-04-03 08:08:43 UTC (rev 4854)
@@ -6,7 +6,7 @@
 ;;; 
 ;;; GNU Radio is free software; you can redistribute it and/or modify
 ;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 2, or (at your option)
+;;; the Free Software Foundation; either version 2, or (define at your option)
 ;;; any later version.
 ;;; 
 ;;; GNU Radio is distributed in the hope that it will be useful,
@@ -21,23 +21,23 @@
 
 ;;; definitions of tag values used for marshalling pmt data
 
-(pst-true              #x00)
-(pst-false             #x01)
-(pst-symbol            #x02)   ; untagged-int16 n; followed by n bytes of 
symbol name
-(pst-int32             #x03)
-(pst-double            #x04)
-(pst-complex           #x05)   ; complex<double>: real, imag
-(pst-null              #x06)
-(pst-pair              #x07)   ; followed by two objects
-(pst-vector            #x08)   ; untagged-int32 n; followed by n objects
-(pst-dict              #x09)   ; untagged-int32 n; followed by n key/value 
tuples
+(define pst-true               #x00)
+(define pst-false              #x01)
+(define pst-symbol             #x02)   ; untagged-int16 n; followed by n bytes 
of symbol name
+(define pst-int32              #x03)
+(define pst-double             #x04)
+(define pst-complex            #x05)   ; complex<double>: real, imag
+(define pst-null               #x06)
+(define pst-pair               #x07)   ; followed by two objects
+(define pst-vector             #x08)   ; untagged-int32 n; followed by n 
objects
+(define pst-dict               #x09)   ; untagged-int32 n; followed by n 
key/value tuples
 
-(pst-uniform-vector    #x0a)
+(define pst-uniform-vector     #x0a)
 
 ;; u8, s8, u16, s16, u32, s32, u64, s64, f32, f64, c32, c64
 ;;
 ;;   untagged-uint8  tag
-;;   untagged-uint8  uvi (uniform vector info, see below)
+;;   untagged-uint8  uvi (define uniform vector info, see below)
 ;;   untagged-int32  n-items
 ;;   untagged-uint8  npad
 ;;   npad bytes of zeros to align binary data
@@ -51,26 +51,25 @@
 ;; B == 0, numeric data is little-endian.
 ;; B == 1, numeric data is big-endian.
 
-    (uvi-endian-mask    #x80)
-    (uvi-subtype-mask   #x7f)
+    (define uvi-endian-mask     #x80)
+    (define uvi-subtype-mask    #x7f)
 
-    (uvi-little-endian  #x00)
-    (uvi-big-endian     #x80)
+    (define uvi-little-endian   #x00)
+    (define uvi-big-endian      #x80)
 
-    (uvi-u8            #x00)
-    (uvi-s8            #x01)
-    (uvi-u16           #x02)
-    (uvi-s16           #x03)
-    (uvi-u32           #x04)
-    (uvi-s32           #x05)
-    (uvi-u64           #x06)
-    (uvi-s64           #x07)
-    (uvi-f32           #x08)
-    (uvi-f64           #x09)
-    (uvi-c32           #x0a)
-    (uvi-c64           #x0b)
+    (define uvi-u8             #x00)
+    (define uvi-s8             #x01)
+    (define uvi-u16            #x02)
+    (define uvi-s16            #x03)
+    (define uvi-u32            #x04)
+    (define uvi-s32            #x05)
+    (define uvi-u64            #x06)
+    (define uvi-s64            #x07)
+    (define uvi-f32            #x08)
+    (define uvi-f64            #x09)
+    (define uvi-c32            #x0a)
+    (define uvi-c64            #x0b)
 
 
-(pst-comment           #x3b)           ; ascii ';'
-(pst-comment-end       #x0a)           ; ascii '\n'
-
+(define pst-comment            #x3b)   ; ascii ';'
+(define pst-comment-end                #x0a)   ; ascii '\n'





reply via email to

[Prev in Thread] Current Thread [Next in Thread]