[Gridflow-cvs] [svn] commit: r4867 - in /trunk: doc/flow_classes/#io.grid-help.pd src/formats.cxx

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Sun Dec 6 19:55:00 EST 2009


Author: matju
Date: Sun Dec  6 19:54:58 2009
New Revision: 4867

Log:
add seek_byte method

Modified:
    trunk/doc/flow_classes/#io.grid-help.pd
    trunk/src/formats.cxx

Modified: trunk/doc/flow_classes/#io.grid-help.pd
==============================================================================
--- trunk/doc/flow_classes/#io.grid-help.pd (original)
+++ trunk/doc/flow_classes/#io.grid-help.pd Sun Dec  6 19:54:58 2009
@@ -1,39 +1,41 @@
-#N canvas 689 0 632 608 10;
+#N canvas 648 0 632 642 10;
 #X obj 0 0 doc_h;
-#X obj 3 160 doc_i 1;
+#X obj 3 163 doc_i 1;
 #X text 62 37 This is GridFlow's special file format. This is the only
 I/O format that can hold nearly anything that the [#store] object can.
 ;
 #X obj 3 92 doc_c ...;
 #X msg 62 127 open foo.grid;
-#X obj 14 190 doc_ii 0;
-#X obj 97 465 doc_m i0 type;
-#X text 232 465 type that the output will be written as. (#out only)
+#X obj 14 193 doc_ii 0;
+#X obj 97 490 doc_m i0 type;
+#X text 232 490 type that the output will be written as. (#out only)
 ;
-#X text 232 487 supported: uint8 int32 and perhaps some others;
-#X obj 97 369 doc_m i0 headerful;
-#X obj 97 404 doc_m i0 headerless;
-#X text 232 369 cancels "headerless" (and back to reading the real
+#X text 232 512 supported: uint8 int32 and perhaps some others;
+#X obj 97 372 doc_m i0 headerful;
+#X obj 97 407 doc_m i0 headerless;
+#X text 232 372 cancels "headerless" (and back to reading the real
 .grid format);
-#X text 232 404 instead of reading .grid files with header \, will
+#X text 232 407 instead of reading .grid files with header \, will
 read raw data \, faking a .grid header to itself. It will use the hereby
 specified dimension list \, as well as two other settings: type and
 endian.;
-#X obj 97 190 doc_m i0 endian;
-#X text 232 190 When writing "raw" data \, a file may be considered
+#X obj 97 193 doc_m i0 endian;
+#X text 232 193 When writing "raw" data \, a file may be considered
 a long string of base 256 digits (called bytes) \, but different computers
 have different conventions for dealing with them:;
-#X text 232 238 big: A number will be written starting with the biggest
+#X text 232 241 big: A number will be written starting with the biggest
 digit. This is the natural way on the Macintosh \, Sun \, Amiga \,
 and so on.;
-#X text 232 286 little: A number will be written starting with the
+#X text 232 289 little: A number will be written starting with the
 smallest digit. This is the natural way on the Intel 386/Pentium.;
-#X text 232 321 same: A number will be written in whichever way is
+#X text 232 324 same: A number will be written in whichever way is
 more natural on this computer. The natural way is slightly faster to
 handle. This is the default setting.;
-#X obj 0 579 doc_f;
-#X obj 3 519 doc_o 1;
-#X obj 14 549 doc_oo 0;
+#X obj 0 604 doc_f;
+#X obj 3 544 doc_o 1;
+#X obj 14 574 doc_oo 0;
+#X obj 97 468 doc_m i0 seek_byte;
+#X text 232 468 seek a particular position specified in bytes;
 #X connect 6 1 7 0;
 #X connect 6 1 8 0;
 #X connect 9 1 11 0;
@@ -42,3 +44,4 @@
 #X connect 13 1 15 0;
 #X connect 13 1 16 0;
 #X connect 13 1 17 0;
+#X connect 21 1 22 0;

Modified: trunk/src/formats.cxx
==============================================================================
--- trunk/src/formats.cxx (original)
+++ trunk/src/formats.cxx Sun Dec  6 19:54:58 2009
@@ -162,6 +162,7 @@
 	\decl 0 headerless (...);
 	\decl 0 headerful ();
 	\decl 0 type (NumberTypeE nt);
+	\decl 0 seek_byte (int64 bytepos);
 	~FormatGrid() {
 		//@stream.close if @stream
 		//GridFlow.hunt_zombies
@@ -173,6 +174,7 @@
 	//post("#io.grid 0 bang: ftell=%ld",ftell(f));
 	P<Dim> dim;
 	if (feof(f)) {outlet_bang(bself->te_outlet); return;}
+	//post("#in grid bang: offset %ld",ftell(f));
 	if (headerless_dim) {
 		dim = headerless_dim;
 	} else {
@@ -240,8 +242,7 @@
 	for (int i=0; i<argc; i++) v[i] = argv[i];
 	headerless_dim = new Dim(argc,v);
 }
-\def 0 headerful () { headerless_dim = 0; }
-//#!@#$ method name conflict ?
+\def 0 headerful () {headerless_dim = 0;}
 \def 0 type (NumberTypeE nt) {
 	//!@#$ bug: should not be able to modify this _during_ a transfer
 	switch (nt) {
@@ -252,6 +253,8 @@
 	}
 	this->nt = nt;
 }
+
+\def 0 seek_byte (int64 pos) {fseek(f,pos,SEEK_SET);}
 
 //\def void raw_open_gzip_in(string filename) {
 	//r,w = IO.pipe



More information about the Gridflow-cvs mailing list