seed r48 - trunk/examples



Author: racarr
Date: Sat Nov  1 09:57:27 2008
New Revision: 48
URL: http://svn.gnome.org/viewvc/seed?rev=48&view=rev

Log:
Add quine example. Gio works, sort of? No real out arguments yet, so 
until then you can use DataInputStream as a nasty hack to read lines out 
of files. This is still pretty much entirely invalid though, notably 
there is no way (that I see right now) to check for EOF. So you have to 
read_until the empty string.



Added:
   trunk/examples/quine.js   (contents, props changed)

Added: trunk/examples/quine.js
==============================================================================
--- (empty file)
+++ trunk/examples/quine.js	Sat Nov  1 09:57:27 2008
@@ -0,0 +1,9 @@
+#!/usr/local/bin/seed
+Seed.import_namespace("Gio");
+
+file = Gio.file_new_for_path(Seed.argv[1])
+input = file.read();
+stream = Gio.DataInputStream._new(input);
+
+line = stream.read_until("", 0);
+Seed.print(line);
\ No newline at end of file



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