Re: [9fans] iOS drawterm

2020-03-31 Thread yy
On Wed, 25 Mar 2020 at 07:40, Anthony Sorace  wrote:
>
> With iOS getting first-class mouse pointer support, I’m looking at the iOS 
> drawterm port again. Has anyone touched this since the old GSoC project bit 
> rotted out?
>

In case there is any interest, I would be glad of helping to port
devwsys: https://bitbucket.org/yiyus/devwsys-prev/src/default/

Even if the goal is to have drawterm, this may be an easier middle
step, since it would allow you to get something working first, and
later you could use the same devices from drawterm.


-- 
- yiyus || JGL .

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T69dec3540d033863-M46cb79d3280452323f2ab0d7
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] gVisor - user space kernel in Go

2018-05-03 Thread yy
Maybe one of the most interesting aspects is that it includes a
9P2000.L implementation:

https://github.com/google/gvisor/tree/master/pkg/p9

On 2 May 2018 at 21:19, Skip Tavakkolian  wrote:
> Just saw this today; might be of interest to some 9fans. Apache open source
> from Google:
>
> https://github.com/google/gvisor
>
>



-- 
- yiyus || JGL .



Re: [9fans] acme tag bars stacking

2016-10-28 Thread yy
On 28 October 2016 at 16:23, Mathieu Lonjaret
 wrote:
> Anyway, does anyone know what the rationale was for choosing to stack
> them at the bottom? Or why it would be a a bad idea to make them stack
> at the top instead?

Let's suppose you have many windows in a column. When you work in one
of them, you B2 it and put it on the top of the stack. Then you work
on another one and it goes to the top, moving the previous one to the
second position, and so on. This way, your most recently used windows
are always on top, the least used ones go to the bottom of the stack.
I would find counterintuitive that the windows you used a longer time
ago stayed at the top, between your "working windows" and the column
and main tag lines.

But I would guess the main reason it works this way is that it seemed
more natural to move a window to the head than to the tail of a linked
list, and it just worked well enough.

I see how it may be more practical to stack them at the top when
working only with two or three windows, but it would be kind of weird
if you have ten. If you feel it will fit your workflow better, it is
probably not too difficult to get it done.


-- 
- yiyus || JGL .



Re: [9fans] libtask

2016-10-13 Thread yy
On 13 October 2016 at 18:03, Steve Simon  wrote:
> Anyone written or ported a small simple 9p library;

As part of a GSoC project I wrote
https://bitbucket.org/yiyus/devwsys-prev/src/tip/libninep/ (man pages
can be found in the same repo). There is a ninepserver but not a
ninepclient because the only client I wrote was to be used with p9p,
so I was using 9pclient(3), but it should be relatively easy to write
one if you need it.


-- 
- yiyus || JGL .



Re: [9fans] Porting 9front.net/go/draw to Plan 9

2015-07-10 Thread yy
On 9 July 2015 at 16:52, Friedrich Psiorz f.psi...@gmx.de wrote:
 Hi!

 I'm currently writing a graphical application in Go that I would like to
 be able to run both in Unix and Plan 9. Currently the 9fans.net/go/draw
 library only works in Unix, by connecting to p9p devdraw.

I am sorry I do not have answers to your questions. But here you have
a devdraw version which, instead of using Xlib, connects to a wsys
service using 9p:

https://bitbucket.org/yiyus/devwsys-prev/src/tip/util/9p-srv.c

I was using it from Unix, but porting to Plan 9 should be quite easy.
Then, go/draw would work without many changes. Of course, this
solution is far from optimal (the path will unnecessarily be go/draw
- devdraw.9p - wsys), but it should get the ball rolling.


-- 
- yiyus || JGL .



Re: [9fans] compiling 9vx on yosemite

2015-05-22 Thread yy
On 21 May 2015 at 21:39, David du Colombier 0in...@gmail.com wrote:
 Just to let you know. The current vx32 repository moved from
 Mercurial to Git and is now hosted on GitHub.

 https://github.com/0intro/vx32

When I have some time (this weekend, I hope), I will add a note to my
repo saying this, and will also sync with the last version, just in
case somebody miss the notice.


-- 
- yiyus || JGL .



Re: [9fans] small VFD display

2015-05-06 Thread yy
On 6 May 2015 at 11:52, Steve Simon st...@quintile.net wrote:
 Could I run the plan9 graphics subsystem in a stand alone app rather
 than involving the kernel?
 I think I can but are there any examples of this?

wsys: https://bitbucket.org/yiyus/devwsys-prev/

It runs in unix. If you have a way to control your screen from some
linux in the raspberry, it should not be too difficult to make it work
as a cons or win device.

 Though this sounds nice, is it worth the hassle of doing this?

Probably not, but it might be funny.


-- 
- yiyus || JGL .



Re: [9fans] sources?

2015-04-27 Thread yy
On 26 April 2015 at 19:04, Sergey Zhilkin szhil...@gmail.com wrote:
 Very good !

 Sape is in Cisco, Geoff is in Google.

 Who is in charge?

http://i.imgur.com/h2iNV2H.png


-- 
- yiyus || JGL .



Re: [9fans] easier refreshing of acme wins

2015-04-09 Thread yy
On 26 March 2015 at 17:02, Mathieu Lonjaret mathieu.lonja...@gmail.com wrote:
 However, I find it a bit tedious that I have to write (or paste)
 myself the Get tag for each of the wins I want to refresh. To the
 point that I'm thinking of hardcoding the Get tag as one of the
 permanent tags for a win.

One easy solution is to use as command something you already have in
the tag bar. I have used '|' as Edit (I think the patch is my contrib,
but I'm not sure), you may use it as Get. Or, since it looks like we
are talking about go files, you could use 'g' or 'o', which will
always be there.

It is not ideal, but it is something you can do in 5 minutes.


-- 
- yiyus || JGL .



Re: [9fans] drawterm sources

2015-03-02 Thread yy
On 2 March 2015 at 11:06, Giacomo Tesio giac...@tesio.it wrote:
 - where I can find the most updated sources of drawterm? (links from
 http://swtch.com/drawterm/ seem to be broken)

https://bitbucket.org/rsc/drawterm

 - Is there any simpler solution? Buying a three-button mouse is quite
 hard in Italy, and above all its usage is not viable on my couch...
 :-)

I like to use the wheel for chording (patched acme in contrib). This
works well with the trackpad in my laptop too. YMMV.


-- 
- yiyus || JGL .



Re: [9fans] once more: drawterm osx-x11 on x86-64

2015-02-27 Thread yy
On 28 February 2015 at 00:10, Jeff Sickel j...@corpus-callosum.com wrote:
 Some people prefer the X11 version as the refresh speed may be higher.  That’s
 fine, though I prefer having rio resize working so I can full screen the app
 on a second display with CONF=osx-cocoa.

Would it be possible to get working devwsys[1] in OSX with X11? I have
no idea how difficult this would be, probably more or less as
difficult as getting Inferno. Has anybody tried that?

[1] https://bitbucket.org/yiyus/devwsys-prev


-- 
- yiyus || JGL .



Re: [9fans] sam for Windows?

2014-12-21 Thread yy
On 3 June 2014 at 00:08, Steve Simon st...@quintile.net wrote:
 there is the pf9 package which would probably be the
 best starting point.

 https://bitbucket.org/knieriem/pf9

It looks like the repository is not there anymore. Does anybody keep a
copy of those binary files I could download? Thanks!


-- 
- yiyus || JGL .



Re: [9fans] acmetags

2014-12-03 Thread yy
On 30 November 2014 at 18:39, Mathieu Lonjaret
mathieu.lonja...@gmail.com wrote:
 On 30 November 2014 at 18:19, erik quanstrom quans...@quanstro.net wrote:
 it's pretty easy code to copy,
 i just haven't done it yet.  the other thing missing from p9p acme that
 i notice is the ability to middle click on the column blue square and have
 the column resize in width, as frames already do in height.  (only in
 9atom, not labs.)

 Wow, yes. I often wish I could do something like that and I didn't
 even know it existed in any of the acme versions. You have my thanks
 in advance if that makes it into p9p. :-)


The patched version of acme in my contrib does that too. It also
allows you to increase the size with B1 and maximize with B3 (both of
these I found more useful than the B2's one). There are other changes
too, which you can see at:
http://plan9.bell-labs.com/sources/contrib/yiyus/cmd/acme/README

Although it is a feature I miss sometimes, I did not miss it as much
as to port it to p9p's acme (which is the one I use most of the time).
But if you want to give it a try, it will probably be trivial.


-- 
- yiyus || JGL .



[9fans] gsoc reunion

2014-10-18 Thread yy
Is anybody going to the GSoC reunion organized by Google next weekend
in San Jose? I will be there from Thursday to Sunday. Let me know if
you want to meet.


-- 
- yiyus || JGL .



Re: [9fans] Mouse chording in Microsoft Windows

2014-08-07 Thread yy
On 6 August 2014 06:49, Chris Rokich chris.rok...@amcom.com.au wrote:
 Is anyone aware of a way to use mouse chording (Mb1-2 to cut, for example) in 
 Microsoft windows programs?

http://9fans.net/archive/2014/06/31

(I've never tried it)


-- 
- yiyus || JGL .



Re: [9fans] ODROID-W

2014-08-01 Thread yy
On 1 August 2014 16:18, Nicolas Bercher nberc...@yahoo.fr wrote:
 On 01/08/2014 04:16, Shane Morris wrote:

 There are cards available for it that give it wired ethernet and four
 USB ports


 Do you mean RPi+-compatible extension cards?  Because I didn't see any
 wired ethernet extension on the ODROID-W page.


It's right there, in the list of Optional accessories:
http://www.hardkernel.com/main/products/prdt_info.php?g_code=G140618854370


-- 
- yiyus || JGL .



Re: [9fans] anyone use 9vx with root from kenfs?

2013-04-27 Thread yy
The Plan 9 network stack and the work dho did was merged in my repo (and so
in ron's and others) a long time ago. It was one of the first things I did.

There are two options: to use a pcap-based ethernet device (which needs
root) or a tun/tap one (then you don't need root, but will probably want to
set up a virtual network). Though none of them are enabled by default, this
can be changed using command line arguments or a plan9.ini file. Everything
should be explained in the man page.


-- 
- yiyus || JGL .


Re: [9fans] [GSOC] graphics projects

2013-04-24 Thread yy
On 24 April 2013 07:55, David Hoskin r...@davidrhoskin.com wrote:

 Hello 9fans,

 I am interested in working on either of the graphics-related projects
 suggested on the GSOC wiki page.


Nice.


 For the window system enhancements, my immediate idea would be to
 implement title bars and dwm-style keyboard commands and tiling, but I
 fear that this would not be a large enough project for the whole
 summer.


Just porting dwm or some of its features to rio would probably be not
enough for a gsoc project. However, you have lots of interesting options to
expand on that.

First, whatever you do must have, at some point, the form of a file server,
and you will have to play with the design until you find the right one.
It's easy to think in wmii-like file servers where you copy a window to a
tag with cp (or bind) and remove it with rm. Maybe even some interesting
new feature comes up naturally (the rio design makes natural running rio
inside rio, maybe whatever you do makes natural to have tags inside tags or
whatever). You also have to keep in mind that most of the Plan 9 programs
were intended to be used with a mouse, so although key bindings may be
implemented it should be comfortable for mouse users too (you also have
interesting options here, just now I'm using a mouse-controlled dwm version
and works quite well).

Also, keep in mind that there is already a well known and popular tiling
environment in Plan 9. If you are able to make a window manager with an
acme feeling I'm sure many users would be interested. The challenge here is
to have the good taste required to come up with the right design, and
that's quite a challenge.


 I have the opposite concern about the Web /dev/draw; would it be
 acceptable to move some of the logic to the Go client rather than use
 it as a dumb proxy?  I am not sure what division of labour I would
 settle on here.


I don't think nobody is sure about anything. Certainly, there is a way to
have a drawterm in the browser, but it is not clear how to do it. I guess
figuring this out may be the first task. You will need some way to draw to
the screen and read input events, and you will need to provide a 9P servers
for applications to use. Drawing to the screen will probably involve the
HTML5 canvas and some dynamic language. The 9P server could be implemented
at different levels. There are many 9P libraries for different languages
and platforms which may be used, or you could use a custom protocol like
p9p's devdraw and then implement the 9P server in Inferno, Plan9 or some
program in the local host. And then, you need to glue both parts together.

There are many options here, I think many of us have our own opinion on the
best way to achieve this. You will have to discuss the details with your
mentor. In any case, I think if you are confident to implement the web
part of the project, serving 9P is not going to be a significant problem,
and you could easily get some help for that.

I think it is feasible to finish this project in a summer, but it won't be
easy.


Thanks,


 Good luck!


-- 
- yiyus || JGL .


Re: [9fans] Acme hack

2013-03-14 Thread yy
On 14 March 2013 14:44, dexen deVries dexen.devr...@gmail.com wrote:

 I like my +Errors window clean once in a while. Attached patch provides
  Edit ,d
 by default in +Errors window tagline.


Not that I have any problem with this but, isn't it easier to just Del the
window so that a new one is created when you need it?


-- 
- yiyus || JGL .


Re: [9fans] Using Acme Remotely

2012-10-26 Thread yy
On 26 October 2012 17:34, KevinK kevin.paul.k...@gmail.com wrote:
 I've used win to ssh into a remote machine, but this only seems to expose a 
 bash session and not all the functionality acme provides.

Since it looks like you can access your files through ssh, I would
suggest using sshfs to make the files available in your local fs, so
that they can be accessed by acme.


-- 
- yiyus || JGL .



Re: [9fans] devdrawserver

2012-04-24 Thread yy
pmarin pmarin.m...@gmail.com:
 http://summerofdevdraw.blogspot.com.es/2011/10/9p-srv-experimental-devdraw-for-p9p.html

Not quite the same thing, although it could be used to fix marius'
problem too. I will try to clarify what the possibilities are, because
it can be confusing.


In p9p, you usually have (in a X11 system):

application - devdraw - X


With devdrawserver (IIUC):

app - devdrawserver -(network)- dialdevdraw - devdraw - X


With 9p devdraw at
https://bitbucket.org/yiyus/devwsys-prev/src/tip/util/9p-srv.c:

app - devdraw - 9p files


So, in order to use 9p devdraw, you would need a 9p file server
providing the needed files. This can be done by rio(4) or cons(3),
draw(3) and mouse(3) in a Plan 9 system (including 9vx) or by wsys(4).
The complete picture using wsys would be:

app - devdraw -(9p)- wsys - X


Wsys and the 9p devdraw are a more general solution, but devdrawserver
is more direct and - since it completely avoids 9p - much simpler.

Another advantage of devdrawserver is the possibility to dettach and
reattach to running programs. I was toying with the idea of such a
file server for Plan 9 which could be used by rio and wsys. Although I
never started to write the code I still think it would be very
feasible.


-- 
- yiyus || JGL .



Re: [9fans] removing spaces from filenames

2012-03-21 Thread yy
2012/3/21 Peter A. Cejchan tyap...@gmail.com:
 for (old in `{9 ls *.$EXT}) {

Here you are iterating over the elements of `{9 ls *.$EXT}, sepparated
by $ifs. Therefore, spaces are breaking your lines into word fields.
This is not what you want.

Your second example directly process whole lines (uses sed), so it
works. I think you will get what you want if you replace this line
with:

ifs='
' for (old in `{9 ls *.$EXT}) {


-- 
- yiyus || JGL .



Re: [9fans] awk reading?

2011-12-19 Thread yy
2011/12/19 dexen deVries dexen.devr...@gmail.com:
 hi,

 just yesterday i've got a glimpse of awk's power and neatness. it's good, it's
 useful and i want to dig deeper. what's recommended online reading on awk?

awk.info is a good starting point.


-- 
- yiyus || JGL .



Re: [9fans] C compiler error?

2011-12-13 Thread yy
2011/12/13 erik quanstrom quans...@quanstro.net:
 On Tue Dec 13 08:53:25 EST 2011, noah.ev...@gmail.com wrote:
 Erik, are you looking at the tip? IIRC the webpage points to a stable
 version not the tip.

 well too bad, no option to peek at the tip either.


http://tip.golang.org/src/cmd/gc/reflect.c

(weekly.golang.org is there too)


-- 
- yiyus || JGL .



Re: [9fans] 9vx instability

2011-11-27 Thread yy
2011/11/21 Jens Staal staal1...@gmail.com:
 What I would like to know is if you can boot a plan9 system from iso via 9vx
 as persistent partition whereas changes are saved to another directory (so
 basically setting up a union mount between the iso and a directory) -
 alternatively specifying an alternative path for $home using 9vx booting
 from an iso.


I've written a small script to help with this. From the comments:

# Usage: 9vxi [9vx options]
#   If set, $localroot is used as root,
#   and $home as the home directory.
#   If localroot is not set. search for it:
#   first in the cwd, then at $HOME.
#   initrc is ignored. Other options are
#   just passed to 9vx.
#
#   If found, $home/lib/profile is used,
#   else a default profile is supplied.

If you have a plan9.iso file in your $HOME directory, running 9vxi
without arguments should be enough to boot from that iso file with an
usable environment: $HOME is used as your home directory, ramdisk
provides a writable /tmp and the plumber uses glenda's rules. If you
need something fancier (for example, binding a writable source tree
from a sysfromiso repository), create a lib/profile file.


-- 
- yiyus || JGL .


9vxi
Description: Binary data


Re: [9fans] 9vx instability

2011-11-21 Thread yy
2011/11/21 Anton fluffyl...@gmail.com:
 Linux hippo 3.0-ARCH #1 SMP PREEMPT Wed Oct 19 12:14:48 UTC 2011 i686
 Intel(R) Core(TM) Duo CPU T2600 @ 2.16GHz GenuineIntel GNU/Linux (Archlinux)

You may try booting an older kernel.

I've had similar problems since I updated my main arch system to linux
3.0, but I've not had the time to track it down. Since everything
freezes, it is indeed difficult to find out. I will try a 3.1 kernel
to see if that fixes the problem, as Anthony is suggesting, and will
let you know.

For the moment, what I do is using tinycore from an usb instead (by
the way, tc's linux 3.0 works just fine). I also keep another arch
system without updating just because of this.


 9vx-hg (checked out 2011.11.17) - cmd line (9vx -r 9front -u glenda)
 9front iso image - 9front-1131.664b953bfdde (I've copied it's contents and
 `chmod -R u+w`ed it)

If you are using a modern version of 9vx (rminnich's repository at
bitbucket) you don't need to copy the contents of the iso, you can
just run 9vx with -r 9front.iso.


-- 
- yiyus || JGL .



Re: [9fans] 9vx instability

2011-11-21 Thread yy
2011/11/21 Jens Staal staal1...@gmail.com:
 What I would like to know is if you can boot a plan9 system from iso via 9vx
 as persistent partition whereas changes are saved to another directory (so
 basically setting up a union mount between the iso and a directory) -
 alternatively specifying an alternative path for $home using 9vx booting
 from an iso.



I do something along those lines. I use a sh script to boot from the
iso and bind a sysfromiso repository and usr/ from my home directory.
You could use bin/9vxp in the repository if that's good enough for you
or, in any case, look at it for inspiration on how to use the -i flag.
If you prefer, you can use a .ini file and set initargs there, instead
of using -i.

Read the 9vx man page (included in the repository and also at
https://bytebucket.org/yiyus/vx32/wiki/9vx.html).


-- 
- yiyus || JGL .



Re: [9fans] 9vx instability

2011-11-21 Thread yy
2011/11/21 Anthony Martin al...@pbrane.org:
 I had this happen to me a few times but I never
 took the time to track it down.  I haven't had
 it happen since I upgraded my kernel to 3.1.

I can confirm this. I don't know how to be sure it is solved, but the
problem used to appear after a few minutes of use and, after updating
to 3.1, everything has been running fine for a few hours.

It would be interesting to know what has changed. I don't think it was
a bug in the kernel, since it only happened when running 9vx, but I
don't really have the time to investigate it now.

Thanks to Anthony for the tip!


-- 
- yiyus || JGL .



Re: [9fans] 9p devdraw

2011-11-09 Thread yy
During the last week there have been many improvements to the 9p
drawing device and wsys. I've been using it quite often these last
days and  I don't think there is any major bug left.

Even better, patching p9p is no longer needed, so if this was stopping
you from trying it out, now you have no excuse. It is also possible to
use it with only one wsys and one dev server, so you don't have to
occupy one port for every window.

The latest 9p-srv.c version is available at:

https://bitbucket.org/yiyus/devwsys-prev/src/tip/util/9p-srv.c

Instructions for installation and usage are included in the README
file in the same directory. Keep an eye on this repository for any
news concerning 9p-srv or wsys.


-- 
- yiyus || JGL .



Re: [9fans] 9p devdraw

2011-11-03 Thread yy
2011/11/3 Akshat Kumar aku...@mail.nanosouffle.net:
 Thanks for this  - I often wonder where to find
 the code behind the papers in IWP9 proceedings.

I did not want to worry about big changes and even total rewrites when
working on wsys, so I named the repository devwsys-prev (wsys was
initially named devwsys) to indicate that it was a preview version.

My intention was to create a new stable repository at some point, but
this has not happened yet, and I did not want to include a reference
to a provisional repository in a published paper.

However, I hoped anybody interested in wsys would try searching in
google. The 3 first results for wsys(4) are the iwp9 paper, the blog
and the man page in the bitbucket repo.

That said, having links in iwp9.org would make things a bit easier.
Not only to find the available code, but also to know which code is
not available yet, so that we don't bother trying to find it.


-- 
- yiyus || JGL .



[9fans] 9p devdraw

2011-11-02 Thread yy
Two attached files:

- 9p-srv.c is a devdraw(1) version which uses 9pclient(3) to talk with
Plan 9-like devices and use them for its windows.

- p9p.patch is a patch that has to be applied to the p9p tree to use
this devdraw version.

The drawing device expects to find draw(3), cons(3) and mouse(3) files
in the $WSYS directory, as can be found in /dev in a Plan 9 terminal
(including 9vx or drawterm) or /mnt/wsys when using rio. Then, those
devices are used to run p9p programs.

I wrote 9p-srv as an experiment to use wsys(4) [1] with p9p
applications, but have found it quite useful to open p9p programs -
like 9term or sam - in rio windows (for example, from 9vx).

Although it could be argued that this is not the most efficient thing
to do writing it was quite funny, and much easier than expected.

Installation (once the patch has been applied and p9p built):

cp 9p-srv.c $PLAN9/src/cmd/devdraw
cd $PLAN9/src/cmd/devdraw
9c 9p-srv.c  9l -o devdraw.9p 9p-srv.o
cp devdraw.9p $PLAN9/bin

Now, to run 9term in a rio window:

# From 9vx's rio:
; mount $wsys /n/w new
; bind -a '#i' /n/w
; aux/listen1 -t 'tcp!*!12345' /bin/exportfs -r /n/w

# From unix:
$ WSYS='tcp!127.0.0.1!12345'
$ DEVDRAW=devdraw.9p
$ 9term

These files are also included with wsys(4), in the util directory
(instructions are in the README). To use the drawing device with
wsys(4) just set WSYS to unix!/tmp/ns.$USERNAME.$DISPLAY/wsys.
However, it is not working so well as with rio. The reason is probably
some bug in wsys, and not in 9p-srv. I hope to fix it at some point,
but is not an easy bug to track.

If (after some more testing) the 9p drawing device could be included
with p9p that would be great. If it has to stay in the wsys repository
that is fine too but, could the p9p patch be applied at least? The two
small changes shouldn't be a problem for the other versions of
devdraw.

Comments are welcomed.


[1] http://bitbucket.org/yiyus/devwsys-prev/ (there is also a blog
about the development of wsys(4) at
http://summerofdevdraw.blogspot.com/ and a WIP short paper is included
in the proceedings of the last iwp9).

-- 
- yiyus || JGL .
/*
 * Window system protocol server.
 * Use thread(3) and 9pclient(3) to connect
 * to a wsys service as described in rio(4).
 */

#include u.h
#include libc.h
#include thread.h
#include 9pclient.h
#include draw.h
#include memdraw.h
#include memlayer.h
#include keyboard.h
#include mouse.h
#include cursor.h
#include drawfcall.h

#define STACK (32*1024)

void runmsg(Wsysmsg*);
void replymsg(Wsysmsg*);
void kbdthread(void*);
void mousethread(void*);

int chatty = 0;
int drawsleep;
int fd;

Channel *kbdchan;
Channel *mousechan;

void
usage(void)
{
	fprint(2, usage: devdraw (don't run directly)\n);
	threadexitsall(0);
}

void
bell(void *v, char *msg)
{
	if(strcmp(msg, alarm) == 0)
		drawsleep = drawsleep ? 0 : 1000;
	noted(NCONT);
}

void
threadmain(int argc, char **argv)
{
	char *addr, *defaddr, *ns;
	uchar buf[4], *mbuf;
	int nmbuf, n, nn;
	Ioproc *io;
	Wsysmsg m;

	/*
	 * Move the protocol off stdin/stdout so that
	 * any inadvertent prints don't screw things up.
	 */
	dup(0, 3);
	dup(1, 4);
	close(0);
	close(1);
	open(/dev/null, OREAD);
	open(/dev/null, OWRITE);

	fmtinstall('H', encodefmt);
	fmtinstall('W', drawfcallfmt);

	ARGBEGIN{
	case 'd':
		chatty9pclient++;
		break;
	case 'D':
		chatty++;
		break;
	default:
		usage();
	}ARGEND

	/*
	 * Ignore arguments.  They're only for good ps -a listings.
	 */
	
	notify(bell);

	/*
	 * Connect to 9P server defined by $WSYS
	 * or unix!$NAMESPACE/wsys.
	 */
	addr = getenv(WSYS);
	defaddr = nil;
	if(addr == 0){
		ns = getns();
		if(ns == nil)
			sysfatal(no name space);
		defaddr = smprint(unix!%s/wsys, ns);
		addr = defaddr;
	}
	fd = dial(addr, 0, 0, 0);
	if(fd  0)
		sysfatal(dial %s: %r, addr);
	if(addr == defaddr)
		free(addr);

	mbuf = nil;
	nmbuf = 0;
	io = ioproc();
	while((n = ioread(io, 3, buf, 4)) == 4){
		GET(buf, n);
		if(n  nmbuf){
			free(mbuf);
			mbuf = malloc(4+n);
			if(mbuf == nil)
sysfatal(malloc: %r);
			nmbuf = n;
		}
		memmove(mbuf, buf, 4);
		nn = readn(3, mbuf+4, n-4);
		if(nn != n-4)
			sysfatal(eof during message);

		/* pick off messages one by one */
		if(convM2W(mbuf, nn+4, m) = 0)
			sysfatal(cannot convert message);
		if(chatty) fprint(2, - %W\n, m);
		runmsg(m);
	}
	threadexitsall(0);
}

void
replyerror(Wsysmsg *m)
{
	char err[256];
	
	rerrstr(err, sizeof err);
	m-type = Rerror;
	m-error = err;
	replymsg(m);
}


/* 
 * Handle a single wsysmsg. 
 * Might queue for later (kbd, mouse read)
 */
void
runmsg(Wsysmsg *m)
{
	uchar buf[65536];
	int n;
	CFid *f;
	Rectangle r;
	static int border;
	static int id = -1;
	static CFid *fcons, *fmouse, *fctl, *fdata, *frddraw;
	static CFsys *fsys;

	switch(m-type){
	case Tinit:
		sprint((char*)buf, new %s, m-winsize);
		if((fsys = fsmount(fd, (char*)buf)) == nil)
			sysfatal(fsmount: %r);

		fcons = fsopen(fsys, 

Re: [9fans] 9vx - prerequisites

2011-10-25 Thread yy
In addition to what has been already said, if you need virtual
ethernet devices you will need libpcap-dev in order to build 9vx with
pcap support.


-- 
- yiyus || JGL .



Re: [9fans] acme multi-line tags (or maybe, efficient message stores)

2011-10-11 Thread yy
2011/10/11 hiro 23h...@googlemail.com:
 I'd rather make sam a bit more powerful. Then I can use multiple
 instances with my regular windows manager I can't find all the windows
 in windows in windows on my current multi display setup, acme sucks
 just like my web browser with it's tabs.
 Also virtual machines and 9vx suck on multi display. Workarounds and
 workarounds. Perhaps I can switch to notepad again some day...



That's the reason devwsys was written (soon to be renamed to wsys), see:
http://bytebucket.org/yiyus/devwsys-prev/wiki/devwsys.4.html

By the way, I patched acme so that | (the pipe symbol) can take an
argument using 2-1 chording, being equivalent to executing the
argument in that window. That way, I can have a window on top with the
commands I need and execute them in any window I want (the pipe symbol
is always visible in every acme window). It is a workaround, and does
not cover every situation (it does not let you to pass arguments to
those commands), but most of the time is good enough for me.


-- 
- yiyus || JGL .



Re: [9fans] acme multi-line tags (or maybe, efficient message stores)

2011-10-11 Thread yy
2011/10/11 Peter A. Cejchan tyap...@gmail.com:

   By the way, I patched acme so that | (the pipe symbol) can take an


 Is the patch on sources?


Only an older version, where the argument is sent to the Edit command.
This is easier when you just want to Edit, but does not work with
commands. This is the original patch:
http://9fans.net/archive/2009/08/571

The acme version in contrib/yiyus includes this and some other
patches. I can update it later today. The newer version of the patch
involved writing an executeargs function but was not much more
complicated.


-- 
- yiyus || JGL .



Re: [9fans] acme multi-line tags (or maybe, efficient message stores)

2011-10-11 Thread yy
I have updated the acme version in contrib/yiyus. It includes some
other changes, but only this is relevant to this thread:

term% diff /sys/src/cmd/acme/exec.c exec.c
70a71
   { Le, edit,   FALSE,  XXX,XXX 
 },
148a150,156
   if(runestrncmp(r, L|, 1) == 0  q1-q0 == 1){
   Text tt;
   tt = *t;
   tt.file = argt-file;
   execute(tt, argt-q0, argt-q1, FALSE, nil);
   return;
   }

The first change (new line 71) is to use a single e as an Edit
command, so you can always use the e in Del to do 2-1 chording with
Edit commands. The other change allows to execute any command using
2-1 chording on the pipe symbol.

There are many more tricks which you can use. For example, I have also
had scripts named as the letters of Snarf which I bind to bin before
running acme to build and test whatever I'm doing. The advantage of
this approach is that you don't even need to patch acme.

Yes, just hacky workarounds, but weren't multiline tags a hack too?


-- 
- yiyus || JGL .



Re: [9fans] Nemo book

2011-09-16 Thread yy
2011/9/16 Jens Staal staal1...@gmail.com:
 - One thing I wonder there about 9vx is - can you add a command line
 argument to start a script in the plan9 that boots?

Yes. See 9vxp in 9vx(1). Also, have a look at acmevx in the bin
directory as inspiration.


-- 
- yiyus || JGL .



Re: [9fans] NIX 64-bit kernel is available

2011-09-14 Thread yy
 BTW, can 9vx access fossil or kenfs from a separate partition?


It should work with fossil or kfs setting nobootprompt. Adding cwfs
would be trivial, but I don't know if anybody has tried with a proper
kenfs kernel. You could also use rcvx and mount whatever you want from
there.


-- 
- yiyus || JGL .



Re: [9fans] 9p hello world

2011-09-05 Thread yy
2011/9/5 s s leonardne...@gmail.com:
 It seems like there might be a hello world example for libixp ...

 http://www.anarchyinthetubes.com/src/hello_libixp

I wrote that, but is needing some attention. It is quite old, and
although is still valid, I should finish more examples. Extending it
to p9p's 9p(3) and Inferno's styxserver(10) is in my TODO list, but it
will still be there for a while.

If you write a p9p's hello world server, let me know and I can add it
to that page.

By the way, there probably are more 9p implementations than real
programs using them, but they are not very different. What you really
need to understand is how the protocol works. It's actually quite
simple. Nemo's book includes a very good explanation, which is
completed by the man pages. Also, try to find an existing file server
which matches what you need as much as possible and go on from there.


-- 
- yiyus || JGL .



Re: [9fans] interesting(?) widgets idea

2011-07-12 Thread yy
2011/7/12 dexen deVries dexen.devr...@gmail.com:
 on an unrelated note, it seems to me websites with large horizontal margins 
 are synonymous with bullet-point engineering and little to no useful content.


http://cm.bell-labs.com/plan9/


-- 
- yiyus || JGL .



Re: [9fans] in ed, how to do i do this?

2011-06-17 Thread yy
2011/6/17 Fernan Bolando fernanbola...@mailc.net:
 1. insert a character in a line? - I usually retype the whole line with .c

s/^/c/

 2. indent a line - i usually retype the whole line.

The same, where c == \t


-- 
- yiyus || JGL .



Re: [9fans] 9vx bootimage build instructions?

2011-05-26 Thread yy
2011/5/26 erik quanstrom quans...@quanstro.net:
 9vx uses plan9.ini?  last i checked, that assumption was false.

That depends where you checked. Ron's version (or mine, they are the
same now) has some support for plan9.ini files with the -f flag, as is
documented in the man page:
http://bytebucket.org/yiyus/vx32/wiki/9vx.html. However, although
plan9.ini is used to set some config values (as the root file system
or the memory limit mentioned in this thread), 9vx cannot load a
kernel file. So:

 i think you need to modify the 9vx kernel directly.

is right.

Modifying the 9vx kernel is not funny because of the bad state of the
.ed files in a/. I hope newer versions of gcc with plan9 extensions
make most of these scripts unnecessary, but as far as I know nobody
has tried.

-- 
- yiyus || JGL .



Re: [9fans] Plan 9 GSoC projects selected

2011-04-29 Thread yy
2011/4/29 Ethan Grammatikidis eeke...@fastmail.fm:

 On 27 Apr 2011, at 6:47 pm, Anthony Sorace wrote:

 • Unification of X11 code and wsys device, by Jesús Galán López [1]

 [...]

 [1]
 http://www.google-melange.com/gsoc/proposal/review/google/gsoc2011/yiyus/1

 I'm a bit curious about this one but all I get from the link is This
 proposal is not made public, and you are not the student who submitted the
 proposal, nor are you a mentor for the organization it was submitted to.




You can read a short abstract here:
http://www.google-melange.com/gsoc/project/google/gsoc2011/yiyus/22001

The main idea is to avoid the duplication of xlib dependent code in
inferno, p9p, 9vx and drawterm and write a wsys device to use the
window manager of the host system through a file server similar to
rio(4). If the new x11 code will be a library or some sort of p9p's
devdraw(1) and if the wsys device will be an inferno/drawterm/9vx
kernel device or an external program serving 9P are open questions
yet.

Feel free to ask if you want to know more.


-- 
- yiyus || JGL .



[9fans] 9vx: one less version to care about

2011-04-08 Thread yy
My 9vx tree and ron's one are exactly the same now. Ron has write
access to my repo now, which will be used for development from now on,
while the one at bitbucket.org/rminnich/vx32 will be more stable and
the only one most users will have to worry about.

I hope this helps to avoid some of the confussion generated by having
many similar-but-different 9vx versions around.


-- 
- yiyus || JGL .



Re: [9fans] Making read(1) an rc(1) builtin?

2011-04-05 Thread yy
2011/4/4  smi...@zenzebra.mv.com:
 Unfortunately, echon.c doesn't solve the problem either, because it
 doesn't output a trailing newline.  The crux of the problem is how to
 output -n on a line by itself, followed by a newline.  I don't think
 it can be done symmetrically without adding another option to echo.

This has been discussed before: http://9fans.net/archive/2008/03/491

Rob Pike gave an excellent answer to your question:

echo -n -n'
'

Lyndon's echon.c and echo.c are another solution, as many others which
have been discussed here and in the 2008 thread.

I'm really impressed of how much we can talk about such a simple
program as echo.


-- 
- yiyus || JGL .



Re: [9fans] problem with rminnich's 9vx

2011-03-29 Thread yy
ron's 9vx and mine are compiled differently in 64bits systems, so you
can try mine and see if there is any difference, but I don't really
know. I don't have any x86_64 system I can use to test 9vx, so please
let me know if things get better (or worse). If you don't want to
download the whole vx32 tree again you can just rollback the last
changes by ron and compile that, the result will be the same.

 what do you guys for a tree
 with ron's 9vx?

For testing, I always use a plan9.iso file (a full tree can solve some
problems but I don't think it will solve yours). When I need write
permissions I use a kfs file I filled with the contents of the iso.


-- 
- yiyus || JGL .



Re: [9fans] problem with rminnich's 9vx

2011-03-29 Thread yy
2011/3/29 ron minnich rminn...@gmail.com:
 On Tue, Mar 29, 2011 at 8:42 AM, Mathieu Lonjaret
 mathieu.lonja...@gmail.com wrote:
 Well, since Ron's tree is based on Yiyus', and Ron's doesn't have that
 patch, I think that means Yiyus' doesn't have it either. And yet,
 Yiyus' works for me, so I doubt this bug was the culprit for me. More
 like a 64 bits issue as Yiyus mentionned earlier, no?

 well, actually, it's more like yiyus forked mine long ago and then we
 trade patches ... so it's not clear what's going on here. Did you look
 to see if yiyus took that patch?


I didn't merge your last changes to force 32 bits. I planned to do it
but I didn't. That's the only difference between your repository and
mine, and somebody in irc said he had seen problems in 64 bits with
your last version, so I thought there could be something wrong.

I agree we have to arrange things better.


-- 
- yiyus || JGL .



[9fans] gsoc 2011

2011-03-04 Thread yy
From 
http://google-opensource.blogspot.com/2011/02/mentoring-organization-applications-now.html:
The deadline for applying to be a mentoring organization for Google
Summer of Code is Friday, March 11th at 23:00 UTC (3pm PST).

Any plans to participate this year?

-- 
- yiyus || JGL .



Re: [9fans] 9vx versions

2011-02-16 Thread yy
2011/2/16 ron minnich rminn...@gmail.com:
 On Wed, Feb 16, 2011 at 10:33 AM, Jacob Todd jaketodd...@gmail.com wrote:
 There's yiyus' and rminnichs' verions on bitbucket, just search for 9vx
 there and you should find them. I think ron's is a fork of yiyus', I'm not
 completely sufe how much the differ.

 ron is a fork of the original. yiyus forked me, according to
 bitbucket, and I have taken some but not all of his patches back.

 ron


Yes, I forked ron, but all my patches are in ron's tree now (after the
last merge, three months ago), and some new fixes I've not pulled yet.

My tree has been quite dead lately, but when I'm making changes you
can expect all kind of problems, and all the interesting stuff
finishes in ron's repo anyway. So, that's probably a safer bet.

-- 
- yiyus || JGL .



Re: [9fans] plan9 go output faults on 9vx with rfork

2011-02-07 Thread yy
2011/1/24 ron minnich rminn...@gmail.com:
 On Mon, Jan 24, 2011 at 9:18 AM, yy yiyu@gmail.com wrote:
 2011/1/23 ron minnich rminn...@gmail.com:
 change all sem* bits in a/sysproc.c to use uint32 not long
 change ed script so it won't do the wrong thing in future.

 Just for the records, the ed scripts are not working with current
 kernel sources, they need to be updated. I gave it a try, but
 sometimes I started from the ed script and sometimes from the .c file.


 well, that is a bit depressing. Given the choice between bringing in
 some code and having the ed scripts bring in the code, I guess the
 choice is clear, and I would be inclined not to bring code in until
 the script is fixed :-(

 Can you please send me a list of ed scripts that are 'not working'.


Hi ron, sorry for the late response, things have been busy around here.

The ed scripts in the a/ directory should work, and the resulting code
should compile, but that's it. Probably many things should be properly
fixed, I only tweaked it until it compiled. There are also ed scripts
in libdraw/, libmemdraw/, libmemlayer/ and libsec/ which I have not
looked at, and there should be scripts for the ip code too, but nobody
has written them yet.

I hope to have some time to look into this this week, although the
task is very big and surely I'm not going to be able to do everything
myself. Anyway, just wanted to be sure that you are not already
working on it.

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] plan9 go output faults on 9vx with rfork

2011-01-24 Thread yy
2011/1/23 ron minnich rminn...@gmail.com:
 change all sem* bits in a/sysproc.c to use uint32 not long
 change ed script so it won't do the wrong thing in future.

Just for the records, the ed scripts are not working with current
kernel sources, they need to be updated. I gave it a try, but
sometimes I started from the ed script and sometimes from the .c file.
I was just trying to make it work, but would be surprised if it worked
well (as a matter of fact, last time I tried to update the code using
the ed scripts I broke 9vx and it was a hassle for everyone, just see
this thread: http://9fans.net/archive/2010/09/190). In particular, the
use of uint32 or long is not uniform. The situation is even worse for
the ip code, there are no scripts at all. This is in my TODO list, but
I'm not working on it now and I don't know when (or if) I will.

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] p9p factotum available for plan 9

2010-11-09 Thread yy
2010/11/9 David Leimbach leim...@gmail.com:
 I'm wondering things like can I use p9p venti as a snapshot back end to a
 VMWare Plan 9 Fossil?

mycroftiv is doing it with qemu. He has writen about it and you can
download the whole thing from 9gridchan.org.

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] kw audio -- /dev/audio and friends

2010-10-28 Thread yy
2010/10/28 Anthony Sorace a...@9srv.net:
 the other problem with both volume and audioctl will come with multiple
 streams. in1 and out1 might work, but it starts to look ugly. usbaudio
 appears to ignore multiple inputs or outputs.

 i'm not entirely sure what you mean by streams in this context. multiple 
 inputs or outputs? if so, my first pass would be do something like what #l 
 does: #l0, #l1, c. Alternately, let any (theoretical future) driver for such 
 a thing implement /mnt/fancydriver/0/audio c, and bind as needed.


Wouldn't it be better to use #A0, #A1, ... for the case of multiple
audio devices instead of multiple in/outs in one device? I don't see
why control^(1 2 3 4 5 6) or in1, out1 are so ugly (specially
considering that this is just a potential problem).

-- 
- yiyus || JGL . 4l77.com



[9fans] crashing 9vx

2010-10-28 Thread yy
I keep hearing how 9vx is very unstable and have a lot of problems,
but after a few months working on it I have not received many bug
reports. Probably I won't know how to fix these problems, but at least
I'd like to have them documented. Also, I'm updating the autogenerated
kernel files and would like to check if this makes any difference.

So, if you are using the 9vx version at
http://bitbucket.org/yiyus/vx32/ (or ron's version, which is almost
the same) and you have a reproducible way to crash it, could you
please fill an issue in bitbucket or send me an email? Thanks.

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] So, why Plan 9?

2010-10-12 Thread yy
2010/10/12 Max E maxxed...@comcast.net:
 For any use-case I personally care about (and probably any
 workstation/server use case you care about as well,) the Linux kernel
 with the GNU userspace will blow anything out of the water, both in
 performance and usability.

I don't think the GNU userspace is more usable. Compare the bash and
rc man pages and tell me which one you find easier to use. From my
point of view consistency and simplicity increase usability. Both of
these qualities are difficult to find in GNU software.. If you don't
recognize this you're sticking your head in the sand.

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] diff3 for c source

2010-10-06 Thread yy
2010/10/6 Steve Simon st...@quintile.net:
 alternatively anyone known know of somthing which might be able to modify
 the plan9 source to make it acceptable to gcc

        • adding names for unused function parameters
        • adding names for blind structure members
        • adding apropriate names for auto structure member selection based 
 on type

Soon, you won't need to modify anything:
http://gcc.gnu.org/ml/gcc-patches/2010-09/msg02089.html

:-)

-- 
- yiyus || JGL . 4l77.com



[9fans] 9vx tutorial: running a cpu server from kfs (RFC)

2010-10-02 Thread yy
This tutorial is a work in progress (it will eventually be added to
the 9vx documentation and probably to the Plan 9 wiki). Please let me
know if you see anything I'm doing wrong (unfortunately I don't have
too much experience with real Plan 9 systems of more than one
machine). In particular, I don't know why I could not use mkfs instead
of dircp. The line

% disk/mkfs -s /n/9660 /sys/lib/sysconfig/proto/allproto

gave me this error:

mkfs: /sys/lib/sysconfig/proto/allproto:1: can't move tmp file to
/n/kfs/dist/replica/plan9.compressed.db: wstat -- unknown type/mode

Anyway, these instructions are working here. Please, let me know if
they work for you too.

By the way, this tutorial is only the first one, but I'd like to have
some more. For example, to run several 9vx instances in a private
network using the tap device and to run 9vx from fossil backed up by
p9p's venti. Contributions are welcomed ;-)


--


This is a brief tutorial on how to run a 9vx cpu server from a kfs
file system. You will need 9vx, a plan9.iso and some free disk space.

First, go to the destination directory and install 9vx:

$ hg clone http://bitbucket.org/yiyus/vx32/
$ cd vx32/src/
$ make 9vx/9vx  sudo make 9vx/install

(Commands run on the host are preceded by $, commands run from inside
9vx are preceded with %)

You can check that 9vx is working running the minimal system embedded
in the executable. The rcvx script should take you to a vx32% rc
prompt in the current directory. Once you have played a bit with a
rootless 9vx type exit to go back to your host system.

Rcvx is cool but you will want a full Plan 9 tree to have real fun.
Let's boot from the iso file:

$ 9vx -r plan9.iso -u glenda CWD=#Z`pwd` nvram=#Z`pwd`/plan9.nvr

You should be in rio now, have an acme and a rio window, stats,
faces... This is the live system in the iso that you probably already
know. The CWD=... and nvram=... arguments are interpreted as plan9.ini
lines and passed as environment variables, we will use them later.

Open a new rio window:

% cd $CWD
% dd -if /dev/random -of plan9.nvr -bs 512 -count 1
% dd -if /dev/zero -of plan9.kfs -bs 1024 -count 32

Those files will be our nvram and kfs partitions (check the size of
your kfs file, 320Mb is not too much, but will be enough). Nvram needs
to be initialized:

% auth/wrkey
authid: bootes
authdom: 9vx
secstore key:
password:

We can populate the file system now:

% 9660srv -f plan9.iso
% 9fs 9660
% disk/kfs -f plan9.kfs
File system main inconsistent
Would you like to ream it (y/n)? y
% 9fs kfs
% dircp /n/9660 /n/kfs

The system is now installed. You should be able to open a new 9vx
instance from your new root:

$ 9vx nvram=#Z`pwd`/plan9.nvr' -r plan9.kfs -u glenda

You can also boot a cpu server. We will use the canopenpath option, so
that only the files which begin with `pwd`/plan9 can be opened from
9vx, the -ic flags tell 9vx to pass -c to /386/init:

   $ 9vx -gic -r plan9.kfs nvram=#Z`pwd`/plan9.nvr
canopenpath=`pwd`/plan9 -u bootes

When you see the vx32# prompt add a key so that you can cpu as glenda:

vx32# echo 'key proto=p9sk1 dom=9vx user=glenda
!password=password' /mnt/factotum/ctl

Now you can cpu to your new server. From another 9vx instance (for
example, booted from the iso):

% cpu -h 127.0.0.1

If it worked we are done.

Now you will probably want to adjust to your needs the 9vxc script to
launch cpu servers (also, think about adding a /cfg/vx32/cpurc file).
You could be interested in the options localroot, canopenpath,
cpulimit and memsize. Or maybe you want to setup a virtual ethernet
device (have a look at the tap script and the 9vx man page).

Have fun! (and please, report bugs)


-- 
- yiyus || JGL . 4l77.com



Re: [9fans] 9vx mk install chokes on gs

2010-09-14 Thread yy
2010/9/12 yy yiyu@gmail.com:
 2010/9/12 ron minnich rminn...@gmail.com:
 Ah. It was 256 MB but Yiyus changed it 8 weeks ago to 64MB. Why?

 Sorry about that. It was after updating all the a/ files from the .ed
 scripts. It looks like I did not pay enough attention to mem.ed. There
 were other changes that could be causing problems too. I'm currently
 having another look at all the stuff in a/. It could take some time,
 but I will fix it. In the meantime, the old mem.h will probably work
 just fine.

The problem was in mem.ed. I have changed it and think it should work
well now, but the problem was in the original russ' file and all this
stuff is a bit over me. When you have some time, could you please have
a look at it and/or do some testing? For the moment I modified mem.ed
but not mem.h (just in case). To regenerate mem.h, run something like
this from src/9vx/a:

./AUTOGEN -r ~/sysfromiso/ /sys/src/9/pc/mem.h

Thanks

In other new: kfs support is in bootboot now, I'm currently running
9vx from a kfs file. It feels good.

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] 9vx/vx32 - Out of ignorance

2010-09-12 Thread yy
2010/9/12 Lucio De Re lu...@proxima.alt.za:
 My thinking is that 9vx could start up as root
 to install the TAP device (nothing else so far has alerted me to a need
 for root permissions), then switch user to the selected one (if it exists,
 nobody may be needed if there is no equivalent in the host repertoire)
 once setting up is complete.

The advantage of the tap device is precisely that it does not need
root permissions. You need those permissions to manage the devices,
but that will be normally done by tunctl or openvpn. Those are the
programs that have to worry about being run as root, not 9vx. In other
words: you need to be root to create the tap device, but not to use
it.

 And if anybody can arrange a short lesson on using networking under 9vx,
 that would also be greatly appreciated.

Inside 9vx, networking with tap devices is not different to using
physical devices. At the host system level, it works as it does in
qemu (there could be more bugs though). There are many qemu tutorials
with sample scripts and better explanations than what I could give.
The particular configuration I'm using is documented at:

http://wiki.archlinux.org/index.php/QEMU#Tap_Networking_with_QEMU

Based on the qemu-ifup/down scripts described there I wrote a 9vx-tap
script you can find at:

http://bitbucket.org/yiyus/vx32/src/tip/src/9vx/9vx-tap

Probably disecting that script is the best way to understand how the
bridge, the tap devices and 9vx play together.

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] 9vx mk install chokes on gs

2010-09-12 Thread yy
2010/9/12 ron minnich rminn...@gmail.com:
 Ah. It was 256 MB but Yiyus changed it 8 weeks ago to 64MB. Why?

Sorry about that. It was after updating all the a/ files from the .ed
scripts. It looks like I did not pay enough attention to mem.ed. There
were other changes that could be causing problems too. I'm currently
having another look at all the stuff in a/. It could take some time,
but I will fix it. In the meantime, the old mem.h will probably work
just fine.

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] 9vx/vx32 - Out of ignorance

2010-09-12 Thread yy
2010/9/12 Lucio De Re lu...@proxima.alt.za:
 It's very, very helpful.  I would, and almost certainly will, have
 split the tunnel and openvpn portions into two scripts (a selector
 of some type might be good enough, but isn't easily justified), because
 I'm sure that they don't overlap quite the way the present shape of the
 script suggests.  I found it after posting my request, I still haven't
 got everything working to my satisfaction, but I think the reference to
 qemu will help.

The 9vx-tap script is quite naive. I decided to leave it that way
because its purpose is more to serve as documentation than as
something you will actually use. It is the simplest script I could
come up with, but can be improved in many ways.

 There are still questions unanswered: (1) would switching userid be
 useful and practical, irrespective of the actual need for it?

I'm not sure why you would want to do that, but I'm with ron: if you
are interested, go ahead.

 and (2)
 would it make sense to migrate the virtual network devices to vx32?

Why? The network devices are actually quite simple, and I guess you
could move the core to libvx32, but I don't know what you gain with
that. As I see it, I like the current situation where vx32 is a
sandboxing library and 9vx takes care of providing the virtual
devices.

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] 9VX failure

2010-09-11 Thread yy
2010/9/11 Lucio De Re lu...@proxima.alt.za:
 That bit was easy, just move the leading # from nopcap to etherpcap:

From now on, this is the default in my 9vx version:
http://bitbucket.org/yiyus/vx32/
If anybody thinks pcap should be compiled by default, please let me know.

 Now, where do I find Charles' fix for the segmentation error?

I'm trying to find that one too.

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] 9vx and replica/pull on OS X

2010-09-11 Thread yy
2010/9/11 Paul Lalonde paul.a.lalo...@gmail.com:
 I'm getting essentially every file tagged as locally modified; will not
 update.

The option -s for replica could help you with that. I have used
replica from 9vx and it works (yes, a lot of warnings, but it works).
However, what I usually do is to keep a sysfromiso hg repository at
the root of the plan9 tree I'm using with 9vx and bind /sysfromiso to
/ in my profile.

If you really want to use replica, you better use 9vx with a plan9
filesystem. If you don't have a real fossil server you can run one
with  qemu (or download mycroftiv's gridtoolsplus from 9gridchan.org,
which includes ready to use images) and then, with my 9vx version (I
think this should work with ron's tree too), you can boot running:

$ cat /tmp/127.ini EOF
nobootprompt=tcp
fs=127.0.0.1
auth=127.0.0.1
user=glenda
EOF
$ 9vx -p /tmp/127.ini

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] regexp doubt

2010-07-13 Thread yy
2010/7/13 hugo rivera uai...@gmail.com:
 Hi,
 can someone tell me why the regular expression /stat[abc]?[ ;\-]/
 doesn't match the string stat- in acme? I expect it to match, where
 does my mistake lie?
 Saludos,

 --
 Hugo



It works here (both with B3 searches and Edit ,x commands). Maybe what
you have in your text is an unicode dash?

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] problems with tracing 9vx on os x (was: Re: ghostscript not finding LucidaSans

2010-06-29 Thread yy
2010/6/28 Pietro Gagliardi pietr...@mac.com:
 First I found a slight building problem on Mac OS X 10.5.8: ethertap.c needs
 to be changed to include sys/socket.h before net/if.h and to add a
 defined(__MACOSX__) or similar to the #elf defined(__FreeBSD__) so opentap()
 can be defined.

 However once this version was built, I got the following right after seeing
 the memory usage statistic line:


ethertap is part of the modifications I'm doing to 9vx as part of my
gsoc project. Since I don't have any machine running OS X, the darwin
version is far behind the linux one. I compile 9vx in FreeBSD from
time to time, but running it is another history. Eventually I'd like
to do something about this. For the time being, you can fill an issue
at http://bitbucket.org/yiyus/vx32/ or, even better, send me a patch.

By the way, you should be able to deactivate compilation of the tap
(or pcap) ether device with the variable PLAN9TAP (PLAN9PCAP) in
Makefrag.

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] Acme-sac integration with Windows NT

2010-05-20 Thread yy
If you are using cygwin, you can use sh from acme-sac:

win os C:\cygwin\bin\run.exe -p /bin sh -i

or if you do not need access to the rest of the cygwin commands:

win os C:\cygwin\bin\sh -i

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] sam language question

2010-04-22 Thread yy
2010/4/22 Rudolf Sykora rudolf.syk...@gmail.com:
 Hello,

 I have a file in which I wanted to insert an empty line just before
 any line on which a string, say '0.00' is present.


Edit ,x/^.*0\.00/i/\n/

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] updating 9vx root

2010-04-21 Thread yy
2010/4/21 EBo e...@sandien.com:

 what is the procedure for either updating the entire 9vx root, or setting up
 and building all the special customizations to build an up to date system?

See: http://9fans.net/archive/2008/07/118

I always start from the tree posted in that message, but you can also
follow the instructions to start from a cd.

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] Character CR in Plan9?

2010-04-20 Thread yy
2010/4/20 pmarin pmarin.m...@gmail.com:
 I wanted to remove this character from some files. I tried to do it with
 the p9p tr(1) and I noticed that It does not support '\r'.


You can use \x0d or probably sed 's/.$//'

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] GSOC proposal

2010-03-25 Thread yy
2009/3/28 Bruce Ellis bruce.el...@gmail.com:
 Just a suggestion,

 A good forth system using acme, probably based on fgb's 4th. The goal
 is to conquer the Seaforth chip.

 I know the dev kit is US$500 but their compiler and simulator, written
 in forth, doesn't need hardware.

 And at least two 9fans have a kit.

 brucee



Would such a project be interesting for this year gsoc? Is any mentor
interested in Forth?

I really think acme would make a great environment for Forth
development. I have not used 4th except to play a bit with it, but I
have spent the last months porting the Ngaro VM to Go [1], which is
used to run retroForth [2] images, and I think that could be a good
starting point too.

[1] http://hg.4l77.com/gonga/
[2] http://retroforth.org

PS: I'm CCing this to the GSoC list, but since the original message
appeared here I'm replying to 9fans too.

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] plan9 on qemu and 9vx

2010-03-12 Thread yy
2010/3/12 hugo rivera uai...@gmail.com:
 But the next step I want to take is to run just a terminal with qemu,

Since it looks like you have the option, I would not suggest to use a
qemu image as your terminal. Instead, make 9vx or drawterm your
terminal and you will have access to your host file system for free
(and to the clipboard!). I have not used qemu images extensively, but
the few times I have, I found much better to use drawterm or cpu into
it from 9vx than running rio inside qemu.

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] Shall we fix the use of Up/Dn arrows?

2010-01-26 Thread yy
2010/1/26 Rudolf Sykora rudolf.syk...@gmail.com:
  Not sure how the concept of a line delimited by newlines relates to
moving the cursor up one physical line on the screen.

 Working out where to move the cursor to

 Still I dare claim that moving a cursor up one visible line has
 nothing to do with the concept of a line delimited by newlines. For
 the movement, such delimited lines are completely irrelevant. For the
 movement there is no difference whether there is a newline on the
 previous visible line or the line was broken due to the width of the
 window.

 What I speak about is 'as if' clicking the mouse up one visible line.

 R



what if the current selection is a block of text? anyway, I don't
think acme really knows where your pointer is (in x,y coords). I could
be wrong, though

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] Drawterm Trouble

2009-11-25 Thread yy
2009/11/24 Martin Gansel ganselmar...@googlemail.com:
 Drawterm for Linux(I currently run Arch Linux) doesn't allow me to use
 the middle mouse button emulation(Shift + right mouse button).
 For example if I run Acme, I can't exec any command via middle button
 emulation. There is simply no reaction. Is there any known bug?
 Drawterm for Windows works perfectly.

 Martin Gansel



It is not implemented, but it  has an easy solution. I sent the fix
for 9vx to this list some time ago
(http://9fans.net/archive/2009/03/250). I will send to Russ patches
for 9vx and drawterm fixing this issue, but I cannot guarantee when
(or even if) they will be applied.

This was the fix for 9vx:
diff -r a18e9872164b src/9vx/x11/x11-itrans.c
--- a/src/9vx/x11/x11-itrans.c  Wed Dec 10 03:29:15 2008 -0800
+++ b/src/9vx/x11/x11-itrans.c  Mon Mar 09 16:29:39 2009 +0100
@@ -229,7 +229,7 @@
if(s  Button2Mask)
m-buttons |= 2;
if(s  Button3Mask)
-   m-buttons |= 4;
+   m-buttons |= s  ShiftMask ? 2 : 4;
if(s  Button4Mask)
m-buttons |= 8;
if(s  Button5Mask)

You want to apply a similar patch to gui-x11/screen.c

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] awk help; not plan9 matter

2009-09-17 Thread yy
if you want to preserve white-space, you better forget about fields
and work with indexes on the string, match is your friend:

% echo '1  3 4   8' | awk '{match($0, /[ \t]*[^ \t]+[
\t]+/);a=RLENGTH+1;match(substr($0, a), /[ \t]/);print
substr($0,0,a-1) hell substr($0,RSTART+a)}'
1  hell 4   8

this is indeed a bit OT here, maybe next time you prefer trying in
#awk at freenode, where this kind of problems are welcomed

-- 
- yiyus || JGL . 4l77.com



[9fans] [acme] growing columns

2009-09-12 Thread yy
After a long time seeing how nothing happened after clicking on column
tags I have finally patched acme so that its columns grow as windows
do. You can see how it works in this video:
http://4l77.com/pub/acme-growcol.mpeg
If you want to try it yourself the only thing you will need is the
file /n/sources/contrib/yiyus/cmd/acme/rows.c
Now that I have seen it feels good I will rewrite it in a more
consistent way with cols.c (the rowgrow function is a mess now), but I
don't know when that will happen.
Have fun,

PS: thanks to fgb for his consistency.

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] Using Guide Files

2009-08-14 Thread yy
2009/8/12  6o205z...@sneakemail.com:
 Given how useful and important it is to have Edit in the tag of text
 windows, is there some reason that it isn't there automatically?

After this discussion, I wrote a little patch, which somebody else
might find useful:

; diff /sys/src/cmd/acme/exec.c src/acme/exec.c
70a71
   { L|, edit,   FALSE,  XXX,XXX 
 },
149c150,152
   e = lookup(r, q1-q0);
---
   e = nil;
   if(runestrncmp(r, L|, 1) != 0 || q1-q0 == 1)
   e = lookup(r, q1-q0);

What it does is to interpret the pipe symbol '|' like the Edit command
when that is the only selection. That way, you can make the 2-1 chord
with Edit commands in every text window. I know it is a bit too
obscure, but very convenient, since the symbol is *always* in the
window - around the middle of the tag bar surrounded by spaces - and
it does not have any other use (you won't be using it to name
executable files). Maybe somebody else wants to give it a try.

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] Acme Configuration

2009-08-07 Thread yy
2009/8/7 yy yiyu@gmail.com:
 2009/8/7 roger peppe rogpe...@gmail.com:
 the Include path.
 contents of win buffers.
 Undo/Redo history.

 Contents of all the taglines

 i have lost precious one-liners in column headers.

 while i'm about it, there are a few other dump
 features i'd like to see:
 - automatic dumping every 30s or so in case of a crash.

 could this be done with a script?

 - Dump would dump to the restored-from file rather than
 $home/acme.dump by default.

 i did this once. unfortunately, i cannot find that code.


I forgot to mention that I lost the code because it got deprecated by
this rc function, which somebody else could find useful:

fn ad { #acme dump
dumpfile = $home/lib/dump/$1
touch $dumpfile
bind $dumpfile $home/acme.dump
acme -l acme.dump
}


-- 
- yiyus || JGL . 4l77.com



[9fans] contrib dir

2009-08-06 Thread yy
Hello Geoff,
I wanted to ask you for a directory in sources/contrib. I sent an
email to cont...@plan9.bell-labs.com some time ago, but it looks like
it got lost and some people on #9fans told me to contact with you. I
just want to store there some rio and acme patches I have. Thanks in
advance (and thank you too for keeping sources up!).

Regards,


-- 
- yiyus || JGL . 4l77.com



Re: [9fans] 9vx and AWK

2009-07-24 Thread yy
2009/7/24 Sergey Zhilkin szhil...@gmail.com:

 Any known issues with 9vx and AWK ?

The awk system() built-in does not work in 9vx out of the box. I think
the reason is awk uses the ape shell to execute system commands and
ape is not included (it uses the stdlib.h system() function, that's
for sure). I have not found any more issues, but ymmv. Anyway, *this*
problem is solved downloading a full plan9 image to use with 9vx (you
can find several ones around). I don't know if it will solve yours.


PS: I have read old logs where it was discussed that awk should be a
native plan9 application and not an ape port (or, at least, it should
use rc instead of the ape shell). Is there any reason this was not
done? or was it not worth the trouble?

-- 
- yiyus || JGL . 4l77.com



Re: [9fans] troff and ps related

2009-07-09 Thread yy
2009/7/9 hiro 23h...@googlemail.com:
 Perhaps we should use troff and just convert it to tex?
 Because I also hate to write/read tex.


I have an awk script to write latex in plain text, with a syntax
similar to markdown. It is an ad-hoc solution I am using to write my
thesis, but if you are interested drop me a line off-list.


-- 
- yiyus || JGL .



Re: [9fans] Guide to using Acme effectively?

2009-07-01 Thread yy
2009/7/1 Aaron W. Hsu arcf...@sacrideo.us:
 how to
 quickly navigate through to specific parts of a file and how to reduce
 redundancy of typing and movement.


Maybe I'm alone doing this, but I tend to avoid movement inside a file
abusing of the Zerox command. I keep the function definitions at the
top of the file and to go to a function I Zerox that window and then
go to there with the right button. I also Zerox windows to do small
tasks, like fixing a typo, for example.
To reduce typing I use mouse chords (and Snarf in the tag, when more
convenient), some Edit commands and a bit too much |awk.
I think a guide of using Acme effectively would be different for every
user, just give it some time, and you will create your own habits.

hth,


-- 
- yiyus || JGL .



Re: [9fans] Proposal*: A Cousin for man(1)

2009-06-28 Thread yy
When I started reading Plan9 documentation some years ago I noticed a
lack of examples (a simple 9P file server being the most notorious
one), until nemo's book appeared and I started to really play with the
system. Then, I realized how naive^Wstupid I had been: Plan9 is *full*
of examples. The source is there, grep is there (and src too!), what
else do you need? I don't think any written-on-purpose example can
explain file servers better than ramfs.c and its friends.
That said, more and better documentation is always welcomed, of course.

Regards,


-- 
- yiyus || JGL .



Re: [9fans] Sam commands in acme

2009-06-26 Thread yy
2009/6/26 hugo rivera uai...@gmail.com:
 Hi,
 I am trying to select all c comments from within a file using acme,
 but I am unable to do it properly. The command x/\/\*.*\*\// is the
 closest I could get, but it doesn't work with comments that span over
 more than one line. This raises a question for me: somewhere, I cannot
 recall where, I read that commands in sam (and therefore acme) aren't
 line oriented but selection oriented, so, shouldn't '.*' match newline
 characters also? why it doesn't? I expected '.*' to work with newline
 characters since it works for spaces and tabs, and the three of them
 are white space, among others.

You could use (\n|.) to match any character including newlines
(regex(6) says that a new line is not cosidered any character, and
as a matter of fact, \n is part of the sam language, not of regex
itself). However, since the longest possible regex will be matched,
then you will also match the end of the comment, so for example in:
/* comment 1 */
bar
/* comment 2 */
you will match everything, I don't think that is what you want.

 And finally, what command I should use to select c comments without
 regard if they are several lines long or just one?

Edit ,x/\/\*/.,/\*\//c/COMMENT/

The possibility of modifying the dot is powerful. Many times it is
much easier than finding an huge regex.

 Saludos
 --
 Hugo



Un saludo,


-- 
- yiyus || JGL .



Re: [9fans] acme programming questions

2009-06-18 Thread yy
2009/6/18 Tim Newsham news...@lava.net:
 I've been trying my hand at some very simple acme programming
 tasks and have some questions.  I'm interested in a utility
 that translate dot into a filename:line-line range

I think Edit = is what you want.


-- 
- yiyus || JGL .



Re: [9fans] plan 9 regexp

2009-06-03 Thread yy
2009/6/3 hugo rivera uai...@gmail.com:
 But then, how exactly the '?' operator is useful for grep? I was
 thinking that it was good to filter lines that contain more characters
 that desired, but it is not.
 Saludos

Some common use cases are https? and plurals?


-- 
- yiyus || JGL .



Re: [9fans] Acme column layout box and buttons

2009-04-27 Thread yy
2009/4/27 Balwinder S Dheeman bsd.sans...@cto.homelinux.net:
 That's a lot of good actions attached to all the three buttons for
 handling vertical layouts. How about adding similar actions to all the
 three buttons for managing horizontal layouts to a column /layout box/.


I had a patched version of acme to do this. It is not such a trivial
thing as it looks like, but it is not difficult. However, it doesn't
work so good in practice as in theory. I found disturbing that after
pressing the right button the column was moved to the first place, and
doing it without moving the column was a mess because of the mouse
events (at the end I think I just moved the column to the first place
and then back to its previous position). Other problem I had was that
I didn't have very clear what to do with the middle button (taking the
maximum space and having small columns is not a practical thing). On
the other hands, growing columns with the left button is an easier
thing (once you decide all your heuristics).
Anyway, it was my first look into acme code and there probably are
better ways to do it.
What did you have in mind?


-- 
- yiyus || JGL .



[9fans] Borderless rio

2009-04-26 Thread yy
I'm sending this to the list because I don't remember who was talking
about it in #plan9 some days ago. Somebody suggested to modify rio to
open all the windows at fullscreen, this way you could run several
rios as if they were workspaces.

I have found more practical to add an -I option to run rio in non
interactive mode, which means: windows have no borders, there is no
button3 menu and new windows are open by default at full screen size.
Very few modifications were needed. If the person from the irc channel
or somebody else is interested I can send the code (I asked for a
contrib dir some time ago, btw).

I also have a question. I'm running this script to open rio with workspaces :
%vx ; cat bin/rc/riows
#!/bin/rc

labels=$*
if(test $#labels -lt 1)
labels=(1 2 3 4)

rio.b -I -i'\
for(label in $labels)
window -miny 40 ''rio -i label ''$label
# give time to set all the labels
sleep 0.5
window -dy 39 ''winwatch -e ^(winwatch|stats|faces)'''

My question is: what is the better way to avoid that lot of quotes? I
can think of variables or functions, but I wonder what is the idiom
for nested quotes.

Kind regards,


-- 
- yiyus || JGL .



Re: [9fans] Adventures of a home user

2009-04-19 Thread yy
2009/4/19 Jim Habegger jimhabeg...@gmail.com:
 ... I did learn that I have to press buttons 1 and 3 together, instead of
 shift-3, to simulate button 2.

IMO, this is a bug. The Shift+Button3 = Button2 behaviour is
documented in the man page. I sent a (one-line) patch to Russ, but it
looks like it hasn't been applied. If you are in unix and you plan to
use 9vx (with shift and a 2 buttons mouse), just change this line in
src/9vx/x11/x11-itrans.c:

232c232
   m-buttons |= 4;
---
   m-buttons |= s  ShiftMask ? 2 : 4;

hth,


-- 
- yiyus || JGL .



Re: [9fans] what features would you like in a shell?

2009-04-01 Thread yy
2009/4/1 matt mattmob...@proweb.co.uk:

 you think the idea of reloading a crashed program is not a good one?
 for example, what if it's a web browser?



 crash reload crash reload crash reload agghh make it stop

 btw. Windows uses this mechanism for running Explorer, as a stop gap to
 fixing it they just made it auto-respawn.



If somebody wants to do such a thing (which all we agree is a bad
idea) you need no new features in the shell, eg:
while() firefox


-- 
- yiyus || JGL .



Re: [9fans] GSOC: Drawterm for the iPhone

2009-03-31 Thread yy
2009/3/31 André Günther andr...@gmx.de:
 The only thing I personally see to make remote access on devices such as the
 iPhone an useful and enjoyable experience is to work with the multitouch
 capabilities. Thus providing an easy way for mouse chording and also certain
 gesture support for managing the screen space (like zooming, maximizing a
 certain window, scrolling etc.)
 All these things are not possible with the VNC, because VNC doesn't know
 about content, drawterm can.


Indeed, multitouch support in Plan9 would be *very _useful_*. Not only
iPhone like devices, but also synaptics touchpads available in most
laptops (Asus and all these new netbooks being the most obivious
example) support multitouch. Being able to use these devices as a
portable terminal without the need to carry around an extra mouse
would be great. 2 and 3 fingers gestures as a button chording
replacement looks like a natural and logical thing to me, YMMV.
3 mouse button are becoming more difficult to find every day, while
synaptics devices are the new standard input device.

OTOH, I don't really know how difficult would be to port iPhone
multitouch to synaptics touchpads, but only the user interface
research would be an advancement in this direction.

hth,


-- 
- yiyus || JGL .



[9fans] Plan9 from Outer Space strikes again

2009-03-29 Thread yy
I just found this:
http://www.bluewaterprod.com/news/Plan_9_is_back_12-17-08.php and
wanted to share it with you.


-- 
- yiyus || JGL .



Re: [9fans] GSOC: Gitfs

2009-03-26 Thread yy
2009/3/26 Devon H. O'Dell devon.od...@gmail.com:
 The GSoC traffic is misdirected. The GSoC emails *SHOULD* be going to
 the plan9-gsoc list, which is hosted by Google.


I hope the plan9-gsoc list gets more attention. I sent my project
ideas there a week ago and you were the only person who replied my
message. Maybe that's why people is directing their emails to 9fans.

Since I would really like to hear some comments before writting my
application, I will explain here what I have in mind (there's also
some alternative ideas in my original message:
http://groups.google.com/group/plan9-gsoc/browse_frm/thread/52d77f27a3f5645b):
1. Cleaning up drawterm and 9vx draw devices in unix (I don't have a
windows or macos dev environment, or any experience FWIW). I have seen
several small TODOs in the code, and in particular all the Xlib code
should be isolated. I don't know if a complete merge would be
possible, or if p9p could be included in the group.
2. As suggested in drawterm TODO, replace the console with 9term (in 9vx too).
3. Write a wctl device which speaks directly with Xlib, this way rio
wouldn't have to (but could) be used in 9vx/drawterm, and windows
could be managed with the X wm.
4. I have seen the A-term proposition in gsoc.cat-v.org and I could do
it. I'm quite familiar with acme code and in fact is something I had
in mind (to be used with the wctl described above).
I don't think any of these projects is enough for gsoc, but more than
one of the ideas could be combined. I'd like to know your opinions
about what could/should be done.

Regards,


-- 
- yiyus || JGL .



Re: [9fans] Porter-Duff alpha blending

2009-03-09 Thread yy
2009/3/9 erik quanstrom quans...@quanstro.net:
 i leave it as an exercize to the reader to port
 this to 9vx. ☺


There you are. Easy exercises are also good from time to time :)
The patch also allows to use Shift+Button3 as Button2 (as documented
in the man page).

Regards,


-- 
- yiyus || JGL .
diff -r a18e9872164b src/9vx/libmemdraw/draw.c
--- a/src/9vx/libmemdraw/draw.c	Wed Dec 10 03:29:15 2008 -0800
+++ b/src/9vx/libmemdraw/draw.c	Mon Mar 09 16:29:39 2009 +0100
@@ -10,22 +10,32 @@
 #define RGB2K(r,g,b)	((156763*(r)+307758*(g)+59769*(b))19)
 
 /*
- * for 0 ≤ x ≤ 255*255, (x*0x0101+0x100)16 is a perfect approximation.
- * for 0 ≤ x  (116), x/255 = ((x+1)*0x0101)16 is a perfect approximation.
- * the last one is perfect for all up to 116, avoids a multiply, but requires a rathole.
+ * For 16-bit values, x / 255 == (t = x+1, (t+(t8))  8).
+ * We add another 127 to round to the nearest value rather
+ * than truncate.
+ *
+ * CALCxy does x bytewise calculations on y input images (x=1,4; y=1,2).
+ * CALC2x does two parallel 16-bit calculations on y input images (y=1,2).
  */
-/* #define DIV255(x) (((x)*257+256)16)  */
-#define DIV255(x) x)+1)*257)16)
-/* #define DIV255(x) (tmp=(x)+1, (tmp+(tmp8))8) */
+#define CALC11(a, v, tmp) \
+ (tmp=(a)*(v)+128, (tmp+(tmp8))8)
+#define CALC12(a1, v1, a2, v2, tmp) \
+ (tmp=(a1)*(v1)+(a2)*(v2)+128, (tmp+(tmp8))8)
+#define MASK 0xFF00FF
 
-#define MUL(x, y, t)	(t = (x)*(y)+128, (t+(t8))8)
-#define MASK13	0xFF00FF00
-#define MASK02	0x00FF00FF
-#define MUL13(a, x, t)		(t = (a)*(((x)MASK13)8)+128, ((t+((t8)MASK02))8)MASK02)
-#define MUL02(a, x, t)		(t = (a)*(((x)MASK02)0)+128, ((t+((t8)MASK02))8)MASK02)
-#define MUL0123(a, x, s, t)	((MUL13(a, x, s)8)|MUL02(a, x, t))
+#define CALC21(a, vvuu, tmp) \
+ (tmp=(a)*(vvuu)+0x00800080, ((tmp+((tmp8)MASK))8)MASK)
 
-#define MUL2(u, v, x, y)	(t = (u)*(v)+(x)*(y)+256, (t+(t8))8)
+#define CALC41(a, rgba, tmp1, tmp2) \
+ (CALC21(a, rgba  MASK, tmp1) | \
+ (CALC21(a, (rgba8)MASK, tmp2)8))
+
+#define CALC22(a1, vvuu1, a2, vvuu2, tmp) \
+ (tmp=(a1)*(vvuu1)+(a2)*(vvuu2)+0x00800080, ((tmp+((tmp8)MASK))8)MASK)
+
+#define CALC42(a1, rgba1, a2, rgba2, tmp1, tmp2) \
+ (CALC22(a1, rgba1  MASK, a2, rgba2  MASK, tmp1) | \
+ (CALC22(a1, (rgba18)  MASK, a2, (rgba28)  MASK, tmp2)8))
 
 static void mktables(void);
 typedef int Subdraw(Memdrawparam*);
@@ -803,41 +813,85 @@
 	return bdst;
 }
 
+/*
+ * Do the channels in the buffers match enough
+ * that we can do word-at-a-time operations
+ * on the pixels?
+ */
+static int
+chanmatch(Buffer *bdst, Buffer *bsrc)
+{
+	uchar *drgb, *srgb;
+	
+	/*
+	 * first, r, g, b must be in the same place
+	 * in the rgba word.
+	 */
+	drgb = (uchar*)bdst-rgba;
+	srgb = (uchar*)bsrc-rgba;
+	if(bdst-red - drgb != bsrc-red - srgb
+	|| bdst-blu - drgb != bsrc-blu - srgb
+	|| bdst-grn - drgb != bsrc-grn - srgb)
+		return 0;
+	
+	/*
+	 * that implies alpha is in the same place,
+	 * if it is there at all (it might be == ones).
+	 * if the destination is ones, we can scribble
+	 * over the rgba slot just fine.
+	 */
+	if(bdst-alpha == ones)
+		return 1;
+	
+	/*
+	 * if the destination is not ones but the src is,
+	 * then the simultaneous calculation will use
+	 * bogus bytes from the src's rgba.  no good.
+	 */
+	if(bsrc-alpha == ones)
+		return 0;
+	
+	/*
+	 * otherwise, alphas are in the same place.
+	 */
+	return 1;
+}
+
 static Buffer
 alphacalc14(Buffer bdst, Buffer bsrc, Buffer bmask, int dx, int grey, int op)
 {
 	Buffer obdst;
 	int fd, sadelta;
 	int i, sa, ma, q;
-	uint32 s, t;
+	uint32 t, t1;
 
 	obdst = bdst;
 	sadelta = bsrc.alpha == ones ? 0 : bsrc.delta;
-	q = bsrc.delta == 4  bdst.delta == 4;
+	q = bsrc.delta == 4  bdst.delta == 4  chanmatch(bdst, bsrc);
 
 	for(i=0; idx; i++){
 		sa = *bsrc.alpha;
 		ma = *bmask.alpha;
-		fd = MUL(sa, ma, t);
+		fd = CALC11(sa, ma, t);
 		if(op == DoutS)
 			fd = 255-fd;
 
 		if(grey){
-			*bdst.grey = MUL(fd, *bdst.grey, t);
+			*bdst.grey = CALC11(fd, *bdst.grey, t);
 			bsrc.grey += bsrc.delta;
 			bdst.grey += bdst.delta;
 		}else{
 			if(q){
-*bdst.rgba = MUL0123(fd, *bdst.rgba, s, t);
+*bdst.rgba = CALC41(fd, *bdst.rgba, t, t1);
 bsrc.rgba++;
 bdst.rgba++;
 bsrc.alpha += sadelta;
 bmask.alpha += bmask.delta;
 continue;
 			}
-			*bdst.red = MUL(fd, *bdst.red, t);
-			*bdst.grn = MUL(fd, *bdst.grn, t);
-			*bdst.blu = MUL(fd, *bdst.blu, t);
+			*bdst.red = CALC11(fd, *bdst.red, t);
+			*bdst.grn = CALC11(fd, *bdst.grn, t);
+			*bdst.blu = CALC11(fd, *bdst.blu, t);
 			bsrc.red += bsrc.delta;
 			bsrc.blu += bsrc.delta;
 			bsrc.grn += bsrc.delta;
@@ -846,7 +900,7 @@
 			bdst.grn += bdst.delta;
 		}
 		if(bdst.alpha != ones){
-			*bdst.alpha = MUL(fd, *bdst.alpha, t);
+			*bdst.alpha = CALC11(fd, *bdst.alpha, t);
 			bdst.alpha += bdst.delta;
 		}
 		bmask.alpha += bmask.delta;
@@ -861,11 +915,11 @@
 	Buffer obdst;
 	int fs, sadelta;
 	int i, ma, da, q;
-	uint32 s, t;
+	uint32 t, t1;
 
 	obdst = bdst;
 	sadelta = bsrc.alpha == ones ? 0 

Re: [9fans] acme Put doesn't save

2009-03-07 Thread yy
2009/3/4 roger peppe rogpe...@gmail.com:
 personally, i think that Put should work on any non-application
 window, and that re-columnation should only take place if
 the textual content hasn't been modified by the user. (and
 probably also that if you change the name of a window to a directory
 name and do Get, that it would get a directory listing).

 but YMMV as always.


I think the attached patch is what you are proposing. If you apply it,
when you edit dir windows, the file menu will be added (Undo, Put will
only appear when the window name changes), and columnate won't be
called for that window. If you execute Put in that window it will be
saved, if the window name is a directory there will be an error.
Another changes I did is that now if you edit the title of +Error
windows the file menu will appear, and Get will appear when the window
name finishes with '/'. I haven't tested it too much, but it is
working here.



-- 
- yiyus || JGL .
diff /sys/src/cmd/acme/exec.c .
643c643
 	if(et==nil || et-w==nil || et-w-isdir)
---
 	if(et==nil || et-w==nil)
645a646
 	w-isdir = FALSE;
diff /sys/src/cmd/acme/look.c .
109c109
 while(q1t-file-nc  (c=tgetc(t, q1))!=' '  c!='\t'  c!='\n')
---
 while(q1t-file-nc  (c=tgetc(t, q1))!=' '  c!='\t'  c!='\n'  c!='/')
449c449
 		while(q1t-file-nc  isfilec(c=textreadc(t, q1))){
---
 		while(q1t-file-nc  isfilec(c=textreadc(t, q1))  c!='/'){
diff /sys/src/cmd/acme/text.c .
58c58
 	if(t-what==Body  t-w-isdir  odx!=Dx(t-all)){
---
 	if(t-what==Body  t-w-isdir  !t-w-dirty  odx!=Dx(t-all)){
215d214
 		t-w-filemenu = FALSE;
251d249
 		t-w-filemenu = TRUE;
945c943
 		if((b1)  (b6)){
---
 		if((b1)  (b30)){
950c948
 			if(b  2){
---
 			if(b  10){
diff /sys/src/cmd/acme/wind.c .
100c100
 		if(w-body.file-mod  !w-isdir  !w-isscratch)
---
 		if(!w-isscratch  w-dirty)
262a263
 	w-isdir = FALSE;
266a268,270
 	else if(n=1  runeeq(L/, 1, name+(n-1), 1))
 		w-isdir = TRUE;
 	w-filemenu = !w-isscratch;
347a352,355
 	if(w-isdir){
 		runemove(new+i, L Get, 4);
 		i += 4;
 	}
358c366
 		if(!w-isdir  dirty){
---
 		if(!w-isdir  !w-isscratch  dirty){
363,366d370
 	if(w-isdir){
 		runemove(new+i, L Get, 4);
 		i += 4;
 	}
411c415
 	if(!w-isdir  !w-isscratch  (w-body.file-mod || w-body.ncache))
---
 	if(!w-isscratch  w-dirty)
diff /sys/src/cmd/acme/xfid.c .
117c117
 if(!w-isdir  w-col!=nil){
---
 if(w-col!=nil){
rc 2461: diff 2462: some


Re: [9fans] acme Put doesn't save

2009-03-07 Thread yy
Sorry, but I included some not related changes in the previous patch
(I will stop sending patches to the list as soon as I get a contrib
dir...)


-- 
- yiyus || JGL .
diff /sys/src/cmd/acme/exec.c .
643c643
 	if(et==nil || et-w==nil || et-w-isdir)
---
 	if(et==nil || et-w==nil)
645a646
 	w-isdir = FALSE;
diff /sys/src/cmd/acme/text.c .
58c58
 	if(t-what==Body  t-w-isdir  odx!=Dx(t-all)){
---
 	if(t-what==Body  t-w-isdir  !t-w-dirty  odx!=Dx(t-all)){
215d214
 		t-w-filemenu = FALSE;
251d249
 		t-w-filemenu = TRUE;
diff /sys/src/cmd/acme/wind.c .
100c100
 		if(w-body.file-mod  !w-isdir  !w-isscratch)
---
 		if(!w-isscratch  w-dirty)
262a263
 	w-isdir = FALSE;
266a268,270
 	else if(n=1  runeeq(L/, 1, name+(n-1), 1))
 		w-isdir = TRUE;
 	w-filemenu = !w-isscratch;
347a352,355
 	if(w-isdir){
 		runemove(new+i, L Get, 4);
 		i += 4;
 	}
358c366
 		if(!w-isdir  dirty){
---
 		if(!w-isdir  !w-isscratch  dirty){
363,366d370
 	if(w-isdir){
 		runemove(new+i, L Get, 4);
 		i += 4;
 	}
411c415
 	if(!w-isdir  !w-isscratch  (w-body.file-mod || w-body.ncache))
---
 	if(!w-isscratch  w-dirty)
diff /sys/src/cmd/acme/xfid.c .
117c117
 if(!w-isdir  w-col!=nil){
---
 if(w-col!=nil){


Re: [9fans] acme Put doesn't save

2009-03-04 Thread yy
2009/3/4 Rudolf Sykora rudolf.syk...@gmail.com:
 Hello

 I am running p9p acme. I open a directory, so in the tag line I have
 sth. ending with '/' and in the window I have the list of files in
 that directory. Now I go to the tag line and append a name, say 'a',
 to the existing path, i.e. now I have there e.g. '/home/ruda/a'. Then
 I write Put somewhere and try to middle click it thinking the window
 contents gets saved to '/home/ruda/a'. But it does not. Why?

 Thanks
 Ruda


Because at the beginning of the put function in exec.c you have:
if(et==nil || et-w==nil || et-w-isdir)
return;
and et-w-isdir is true. But there are workarounds if you want to
save the contents of the window.



-- 
- yiyus || JGL .



Re: [9fans] acme Put doesn't save

2009-03-04 Thread yy
2009/3/4 Rudolf Sykora rudolf.syk...@gmail.com:
 So is there a workaround other than 1) make a new window, 2) copy 
 past the text there 3) save from the new window?


The easier solution that comes to my mind now is Edit w filename.
I haven't looked into it, but I think you lost the content of your
window because when directory windows are resized acme columnates them
again (which is a nice thing, if you ask me).
It would be good that the isdir flag of a window changed when you edit
its name. I will have a look (playing with acme source is like my new
hobby...). It is not too consistent now: you can remove the basename
and then do 'Get', but you cannot add it again and do 'Put' (I'm
talking by memory. BTW, everything works as expected in acme-sac, the
only acme I can use at work).


-- 
- yiyus || JGL .



Re: [9fans] command repetition in sam/acme

2009-03-03 Thread yy
2009/3/3 roger peppe rogpe...@gmail.com:
 2009/3/3 Rudolf Sykora rudolf.syk...@gmail.com:
 I would do it with awk myself, Much depends on what you want to
 do to the 1000'th word on the line.

 Say I really want to get there, so that I can manually edit the place.

 if i really had to do this (as a one-off), i'd probably do it in a
 few stages:

 copy  paste the line to a New blank window.
 in the new window:
 Edit ,x/[       ]+/a/\n/
 :1000

 edit as desired
 Edit ,x/\n/d

 copy and paste back to the original window.

 if you were going to do this a lot, you could easily make a little
 script to tell you the offset of the 1000th word.


Or you could also substitute the newline for whatever you want, so you
don't have to copy/paste to another window, eg:

Edit ,x/[\n]+/a/ENDOFLINE/
Edit ,x/[   ]+/a/\n/

Now you can go to the 1000 word with
:/ENDOFLINE/+1000

and once you are done:
Edit ,x/\n/d
Edit ,x/ENDOFLINE/c/\n/

If you are sure you don't have blank fields you don't need ENDOFLINE
and can use ^$ instead (don't forget to use the g command when you
remove the new lines). A bit awkward, but I don't think there is
(there should be?) a simple way to do such a weird task.

hth,


-- 
- yiyus || JGL .



[9fans] Wrong email address in patch

2009-02-23 Thread yy
I submitted a patch for acme this morning, wheel-chording, and I'm
sorry but I wrote the wrong email address, is there any way I could
change it? My system time was also wrong. (This is my first patch and,
I promise, the last one I submit before breakfast...)
I should also have written in the description that I'm not sure this
patch will work for you, I sent it to Russ some time ago, when I had
tested it only in plan9port's acme, and this was his response:

2008/3/19, Russ Cox r...@swtch.com:
i don't think this is a good idea, for two reasons.
the first is that pushing most mouse wheels down
emits a middle button click already (at least on the
microsoft and logitech mice).  the second is more
fundamental: wheel mice don't send up/down events
for the scroll wheel like they do for normal buttons,
so it doesn't work to treat those button bits the
same way as a normal button.  with your code,
if i highlight and then push the scroll wheel more
than one click, it will cut and then scroll.  that's
pretty weird.

do you have a mouse without a clickable scroll wheel?

russ

I have been using the patch in 9vx.Linux (and plan9ports's acme) with
different mouses and it has worked so far without any problem, YMMV. I
find it more comfortable in general and very convenient to chord with
touchpads, where many times you have a wheel, but not a middle button.

Regards,

-- 


- yiyus || JGL .



Re: [9fans] Very Off-Topic: Anybody here reads Sci-Fi? :)

2008-12-03 Thread yy
2008/12/3 Fernan Bolando [EMAIL PROTECTED]:
 Hi all

 I am not sure if anybody here reads Sci-Fi novels. Any recommendations?


 --
 http://www.fernski.com



I'm not a big fan of sci-fi, but Do Androids Dream of Electric
Sheep? is worth a read.


-- 


- yiyus || JGL .