From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 From: "James A. Robinson" Date: Sat, 31 Aug 2013 10:23:55 -0700 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=001a11c23ee2f9775c04e5419c2c Subject: [9fans] reading addr always returns #0,#0? Topicbox-Message-UUID: 77d8958e-ead8-11e9-9d60-3106f5b1d025 --001a11c23ee2f9775c04e5419c2c Content-Type: text/plain; charset=UTF-8 Say I have an acme window with a $winid of 2. If I type the following commands: $ echo -n , | 9p write acme/2/addr $ echo dot=addr | 9p write acme/2/ctl I see the entire text of the window get selected. I had assumed that if I then read addr that I would get back two numbers, 0 and the final byte offset of the file (it is a non-zero length file). However, I get back two zeros: $ 9p read acme/2/addr 0 0 What am I missing? Jim --001a11c23ee2f9775c04e5419c2c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Say I have an acme window with a $winid of 2.
If I typ= e the following commands:

$ echo -n , | 9p writ= e acme/2/addr
$ echo dot=3Daddr | 9p write acme/2/ctl
<= br>
I see the entire text of the window get selected.
I ha= d assumed that if I then read addr that I would
get back two numb= ers, 0 and the final byte offset
of the file (it is a non-zero le= ngth file).

However, I get back two zeros:

$ 9p read acme/2/addr
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0=C2=A0

What= am I missing?

Jim

--001a11c23ee2f9775c04e5419c2c-- From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: From: "James A. Robinson" Date: Sat, 31 Aug 2013 10:29:31 -0700 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=f46d043c7e60f416f504e541b04e Subject: Re: [9fans] reading addr always returns #0,#0? Topicbox-Message-UUID: 77de9678-ead8-11e9-9d60-3106f5b1d025 --f46d043c7e60f416f504e541b04e Content-Type: text/plain; charset=UTF-8 On Sat, Aug 31, 2013 at 10:23 AM, James A. Robinson < jimr@highwire.stanford.edu> wrote: > I see the entire text of the window get selected. > I had assumed that if I then read addr that I would > get back two numbers, 0 and the final byte offset > of the file (it is a non-zero length file). > > However, I get back two zeros: > > $ 9p read acme/2/addr > 0 0 > > What am I missing? > I should have said character offset, not byte offset. I was also experimenting with using addr=dot, but didn't see any change in behavior. Jim --f46d043c7e60f416f504e541b04e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Sat, Aug 31, 2013 at 10:23 A= M, James A. Robinson <jimr@highwire.stanford.edu> w= rote:
I see t= he entire text of the window get selected.
I had assumed that if = I then read addr that I would
get back two numbers, 0 and the final byte offset
of the fil= e (it is a non-zero length file).

However, I get back two zeros:

$ 9p read acme/2/addr
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0=C2=A0

What= am I missing?

I should have said character off= set, not byte offset.
I was also experimenting with using addr=3Ddot, = but
didn't see any change in behavior.<= /div>

Jim

--f46d043c7e60f416f504e541b04e-- From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Mon, 2 Sep 2013 14:13:56 +0400 Message-ID: From: Alexander Sychev To: jimr@highwire.stanford.edu, Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=047d7ba9755c7eb91604e563d420 Subject: Re: [9fans] reading addr always returns #0,#0? Topicbox-Message-UUID: 78b6a6da-ead8-11e9-9d60-3106f5b1d025 --047d7ba9755c7eb91604e563d420 Content-Type: text/plain; charset=ISO-8859-1 Hi, The problem is the "addr" file is closed between your calls. When you open the "addr" file next time, an internal address is set to 0,0. But after the writing the address is actual and if you read "data" file you will see the text according to your address. I you write the code on C or Go without a closing a descriptor of "addr" file, everything will be ok :-) <-------------------------------------------------------------------------------------> santucco@santucco ~/work/go/src/test $ cat test.go package main import ( "bitbucket.org/santucco/goacme" "fmt" "io" ) func main() { w, err:=goacme.New() if err!=nil { panic(err) } defer w.Close() if _, err:=w.Write([]byte("test\ntest2\n")); err!=nil { panic(err) } if err:=w.WriteAddr("#5,#10"); err!=nil { panic(err) } f, err:=w.File("addr") if err!=nil { panic(err) } b:=make([]byte,100) if _, err:=f.Read(b); err!=nil&&err!=io.EOF { panic(err) } fmt.Println(string(b)) } santucco@santucco ~/work/go/src/test $ go build santucco@santucco ~/work/go/src/test $ ./test 5 10 <-------------------------------------------------------------------------------------> Best regards, santucco On Sat, Aug 31, 2013 at 9:29 PM, James A. Robinson < jimr@highwire.stanford.edu> wrote: > On Sat, Aug 31, 2013 at 10:23 AM, James A. Robinson < > jimr@highwire.stanford.edu> wrote: > >> I see the entire text of the window get selected. >> I had assumed that if I then read addr that I would >> get back two numbers, 0 and the final byte offset >> of the file (it is a non-zero length file). >> >> However, I get back two zeros: >> >> $ 9p read acme/2/addr >> 0 0 >> >> What am I missing? >> > > I should have said character offset, not byte offset. > I was also experimenting with using addr=dot, but > didn't see any change in behavior. > > Jim > > -- Best regards, santucco --047d7ba9755c7eb91604e563d420 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi,
The problem is the "addr" file is closed= between your calls. When you open the "addr" file next time, an = internal address is set to 0,0.
But after the writing the address= is actual and if you read "data" file you will see the text acco= rding to your address.
=A0
I you write the code on C or Go without a closing a desc= riptor of "addr" file, everything will be ok :-)
<--= ---------------------------------------------------------------------------= -------->
santucco@santucco ~/work/go/src/test $ cat test.go
pack= age main

import (
=A0 =A0 =A0 =A0 "fmt"
=A0 =A0 =A0 =A0 "io&quo= t;
)

func main() {
=A0 =A0 =A0= =A0 w, err:=3Dgoacme.New()
=A0 =A0 =A0 =A0 if err!=3Dnil {
=
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 panic(err)
=A0 =A0 =A0 =A0 }
=A0 =A0 =A0 =A0 defer w.Close()
= =A0 =A0 =A0 =A0 if _, err:=3Dw.Write([]byte("test\ntest2\n")); er= r!=3Dnil {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 panic(err)
= =A0 =A0 =A0 =A0 }
=A0 =A0 =A0 =A0 if err:=3Dw.WriteAddr("#5,= #10"); err!=3Dnil {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 panic(err)
=A0 =A0 =A0 =A0 }=
=A0 =A0 =A0 =A0 f, err:=3Dw.File("addr")
=A0= =A0 =A0 =A0 if err!=3Dnil {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pani= c(err)
=A0 =A0 =A0 =A0 }
=A0 =A0 =A0 =A0 b:=3Dmake([]by= te,100)
=A0 =A0 =A0 =A0 if _, err:=3Df.Read(b); err!=3Dnil&&err!=3Dio.= EOF {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 panic(err)
=A0 = =A0 =A0 =A0 }
=A0 =A0 =A0 =A0 fmt.Println(string(b))
}<= /div>
santucco@santucco ~/work/go/src/test $ go build
santucco@santucco ~/work/go/src/test $ ./test
=A0 =A0 =A0 = =A0 =A0 5 =A0 =A0 =A0 =A0 =A010=A0

<-----= ---------------------------------------------------------------------------= ----->
Best regards,
=A0 santucco


On Sat, Aug 31, 2013 at 9:29 PM, Jam= es A. Robinson <jimr@highwire.stanford.edu> wrote:<= br>
=
On Sat, Aug 31, 2013 at 10:23 AM, James A. Robinson <jimr@highwire.stanford.edu> wrote:
I see t= he entire text of the window get selected.
I had assumed that if = I then read addr that I would
get back two numbers, 0 and the final byte offset
of the fil= e (it is a non-zero length file).

However, I get back two zeros:

$ 9p read acme/2/addr
=A0 =A0 =A0 =A0 =A0 0 =A0 =A0 =A0 =A0 =A0 = 0=A0

What am I missing?

I should have said character offset, not byte offset.
I was also experimenting with using addr=3Ddot, = but
didn't see any change in behavior.<= /div>

Jim




--
Best regards= ,
=A0 santucco
--047d7ba9755c7eb91604e563d420-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: dexen deVries To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Date: Mon, 2 Sep 2013 12:38:26 +0200 Message-ID: <1909624.IyeLYgNJ9F@coil> User-Agent: KMail/4.10.5 (Linux/3.11.0-rc3-l52; KDE/4.10.5; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Subject: Re: [9fans] reading addr always returns #0,#0? Topicbox-Message-UUID: 78c5da88-ead8-11e9-9d60-3106f5b1d025 On Monday 02 of September 2013 14:13:56 Alexander Sychev wrote: > The problem is the "addr" file is closed between your calls. When you= open > the "addr" file next time, an internal address is set to 0,0. > But after the writing the address is actual and if you read "data" fi= le you > will see the text according to your address. >=20 > I you write the code on C or Go without a closing a descriptor of "ad= dr" > file, everything will be ok :-) or use 9p rdwr: echo -n , | 9p write acme/2/addr echo 'dot=3Daddr' | 9p rdwr acme/2/ctl=20 --=20 dexen deVries [[[=E2=86=93][=E2=86=92]]] Take care of the luxuries and the necessities will take care of themsel= ves. -- L. Long From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <1909624.IyeLYgNJ9F@coil> References: <1909624.IyeLYgNJ9F@coil> From: "James A. Robinson" Date: Mon, 2 Sep 2013 08:25:30 -0700 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=f46d043c7e60216e6b04e56831e9 Subject: Re: [9fans] reading addr always returns #0,#0? Topicbox-Message-UUID: 790697c6-ead8-11e9-9d60-3106f5b1d025 --f46d043c7e60216e6b04e56831e9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thank you both for the explanation! On Mon, Sep 2, 2013 at 3:38 AM, dexen deVries wrot= e: > On Monday 02 of September 2013 14:13:56 Alexander Sychev wrote: > > The problem is the "addr" file is closed between your calls. When you > open > > the "addr" file next time, an internal address is set to 0,0. > > But after the writing the address is actual and if you read "data" file > you > > will see the text according to your address. > > > > I you write the code on C or Go without a closing a descriptor of "addr= " > > file, everything will be ok :-) > > > or use 9p rdwr: > > > echo -n , | 9p write acme/2/addr > echo 'dot=3Daddr' | 9p rdwr acme/2/ctl > > -- > dexen deVries > > [[[=E2=86=93][=E2=86=92]]] > > Take care of the luxuries and the necessities will take care of themselve= s. > -- L. Long > > > --f46d043c7e60216e6b04e56831e9 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thank you both for the explanation!


On Mon, Sep 2, 2013 at 3:3= 8 AM, dexen deVries <dexen.devries@gmail.com> wrote:
On Monday 02 of September = 2013 14:13:56 Alexander Sychev wrote:
> The problem is the "addr" file is closed between your calls.= When you open
> the "addr" file next time, an internal address is set to 0,0= .
> But after the writing the address is actual and if you read "data= " file you
> will see the text according to your address.
>
> I you write the code on C or Go without a closing a descriptor of &quo= t;addr"
> file, everything will be ok :-)


or use 9p rdwr:


echo -n , | 9p write acme/2/addr
echo 'dot=3Daddr' | 9p rdwr acme/2/ctl

--
dexen deVries

[[[=E2=86=93][=E2=86=92]]]

Take care of the luxuries and the necessities will take care of themselves.=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -- L. Long



--f46d043c7e60216e6b04e56831e9--