commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r4832 - gnuradio/branches/developers/eb/ibu/pmt/src/li


From: eb
Subject: [Commit-gnuradio] r4832 - gnuradio/branches/developers/eb/ibu/pmt/src/lib
Date: Sat, 31 Mar 2007 15:18:27 -0600 (MDT)

Author: eb
Date: 2007-03-31 15:18:27 -0600 (Sat, 31 Mar 2007)
New Revision: 4832

Added:
   gnuradio/branches/developers/eb/ibu/pmt/src/lib/gen_serial_tags.scm
   gnuradio/branches/developers/eb/ibu/pmt/src/lib/pmt_serial_tags.dat
Modified:
   gnuradio/branches/developers/eb/ibu/pmt/src/lib/
Log:
work-in-progress on pmt marshalling


Property changes on: gnuradio/branches/developers/eb/ibu/pmt/src/lib
___________________________________________________________________
Name: svn:ignore
   - Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo
howto.cc
howto.py
test_pmt
pmt_unv_int.h
pmt_unv.cc
qa_pmt_unv.h
qa_pmt_unv.cc

   + Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo
howto.cc
howto.py
test_pmt
pmt_unv_int.h
pmt_unv.cc
qa_pmt_unv.h
qa_pmt_unv.cc
pmt_serial_tags.scm
pmt_serial_tags.h


Added: gnuradio/branches/developers/eb/ibu/pmt/src/lib/gen_serial_tags.scm
===================================================================
--- gnuradio/branches/developers/eb/ibu/pmt/src/lib/gen_serial_tags.scm         
                (rev 0)
+++ gnuradio/branches/developers/eb/ibu/pmt/src/lib/gen_serial_tags.scm 
2007-03-31 21:18:27 UTC (rev 4832)
@@ -0,0 +1,120 @@
+#!/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.dat> <pmt-serial-tags.h> 
<pmt-serial-tags.scm>~%"
+           (car args)))
+
+  (when (not (= (length args) 4))
+       (usage)
+       (exit 1))
+      
+  (let ((i-file (open-input-file (cadr args)))
+       (h-file (open-output-file (caddr args)))
+       (scm-file (open-output-file (cadddr args))))
+
+      (write-header-comment h-file "// ")
+      (display "#ifndef INCLUDED_SERIAL_TAGS_H\n" h-file)
+      (display "#define INCLUDED_SERIAL_TAGS_H\n" h-file)
+      (newline h-file)
+      (display "enum pst_tags {\n" h-file)
+
+      (write-header-comment scm-file ";;; ")
+
+      (for-each-in-file i-file
+       (lambda (form)
+        (let* ((name (car form))
+               (c-name (c-ify name))
+               (value (cadr form)))
+          ;;(format h-file   "static const int ~a\t= 0x~x;~%" c-name value)
+          (format h-file   "  ~a\t= 0x~x,~%" c-name value)
+          (format scm-file "(define ~a #x~x)~%" 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 gen-serial-tags.dat. DO NOT EDIT BY 
HAND"
+    ""))
+
+
+
+(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)))))


Property changes on: 
gnuradio/branches/developers/eb/ibu/pmt/src/lib/gen_serial_tags.scm
___________________________________________________________________
Name: svn:executable
   + *

Added: gnuradio/branches/developers/eb/ibu/pmt/src/lib/pmt_serial_tags.dat
===================================================================
--- gnuradio/branches/developers/eb/ibu/pmt/src/lib/pmt_serial_tags.dat         
                (rev 0)
+++ gnuradio/branches/developers/eb/ibu/pmt/src/lib/pmt_serial_tags.dat 
2007-03-31 21:18:27 UTC (rev 4832)
@@ -0,0 +1,72 @@
+;;; -*-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.
+;;;
+
+;;; 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
+
+(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-int32  n-items
+;;   untagged-uint8  npad
+;;   npad bytes of zeros to align binary data
+;;   followed by n-items binary numeric items
+;;
+;; uvi:
+;; +-+-+-+-+-+-+-+-+
+;; |B|   subtype   |
+;; +-+-+-+-+-+-+-+-+
+;;
+;; B == 0, numeric data is little-endian.
+;; B == 1, numeric data is big-endian.
+
+    (uvi-endian-mask    #x80)
+    (uvi-subtype-mask   #x7f)
+
+    (uvi-little-endian  #x00)
+    (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)
+





reply via email to

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