Added API proposal about tied arrays and scalars.
authorHeiko Schlittermann <hs@schlittermann.de>
Thu, 25 Dec 2008 11:23:35 +0100
changeset 11 352d5517f1f2
parent 10 d32454497beb
child 12 ad264ee5d5ba
Added API proposal about tied arrays and scalars. And additionally I renamed the api proposal file.
doc/api
doc/api.txt
--- a/doc/api	Wed Dec 24 23:45:16 2008 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-What do we need?
-
-* outputs are addressed from 0..64
-* values for outputs are {"on", 1} or {"off", 0}
-    
-* set/clear single outputs (set_bit?)
-
-    # $state:	"on", "off", 0, 1
-    # $output:	0..63
-
-    set($state => $output, ...)
-    set($state => [$output, ...])
-
-    Examples
-
-    # setting single outputs
-    set(on => 0, off => 1, on => 2, off => 3, ....., off => 7);
-    set(on => [0, 2], off => [1, 3 .. 7]);
-
-    # alternate form of the above 
-    set(1 => 0, 0 => 1, 1 => 2, 0 => 3, ...., 0 => 7);
-    set(1 => [0, 2], on => [1, 3 ... 7]);
-
-
-    # explicitly switch on
-    on(0, 2);
-    # .. or off single values
-    off(1, 3 ... 7);
-
-* read a single output (get_bit?)
-
-    $result = get($output);
-    @result = get($output, ...);
-
-    Examples
-
-    $result = get(0);
-    @result = get(0 .. 7);
-	
-* setting several outputs in a row (set_block, write_block?)
-    
-    # $block: 0 .. 7
-    # $value: 8, 16, ... 64 bit integer
-
-    # setting several outputs in a row, $output has to be
-
-    write($value => $block);
-
-    Examples
-
-    write(0x05 => 0);
-    write(5 => 0);
-
-# get several outputs in a row (get_block, read_block?)
-
-    $result = read(0, 8);   # read 8 bit and return it as a number
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/api.txt	Thu Dec 25 11:23:35 2008 +0100
@@ -0,0 +1,77 @@
+What do we need?
+
+* outputs are addressed from 0..64
+* values for outputs are {"on", 1} or {"off", 0}
+    
+* set/clear single outputs (set_bit?)
+
+    # $state:	"on", "off", 0, 1
+    # $output:	0..63
+
+    set($state => $output, ...)
+    set($state => [$output, ...])
+
+    Examples
+
+    # setting single outputs
+    set(on => 0, off => 1, on => 2, off => 3, ....., off => 7);
+    set(on => [0, 2], off => [1, 3 .. 7]);
+
+    # alternate form of the above 
+    set(1 => 0, 0 => 1, 1 => 2, 0 => 3, ...., 0 => 7);
+    set(1 => [0, 2], on => [1, 3 ... 7]);
+
+
+    # explicitly switch on
+    on(0, 2);
+    # .. or off single values
+    off(1, 3 ... 7);
+
+* read a single output (get_bit?)
+
+    $result = get($output);
+    @result = get($output, ...);
+
+    Examples
+
+    $result = get(0);
+    @result = get(0 .. 7);
+	
+* setting several outputs in a row (set_block, write_block?)
+    
+    # $block: 0 .. 7
+    # $value: 8, 16, ... 64 bit integer
+
+    # setting several outputs in a row, $output has to be
+
+    write($value => $block);
+
+    Examples
+
+    write(0x05 => 0);
+    write(5 => 0);
+
+# get several outputs in a row (get_block, read_block?)
+
+    $result = read(0, 8);   # read 8 bit and return it as a number
+
+
+**** Other (or additional) proposal:
+
+
+    my @outputs;
+    tie @outputs => "Quancom" $ip_address;
+    # or: @outputs = Quancom::outputs($ip_address);
+
+    $outputs[0] = 1;
+    @outputs = (1, 0, 1, 0, 0, 0);
+
+    my $block0;
+    tie $block => "Quancom" $ip_address, $block, $len;
+    # or: $block = Quancom::block($ip_address, $block, $len);
+
+    $block = 0xFF;
+
+
+
+