ah found one. This was for one instance of where mach was used. It
basically says if mach is used in a function, put a declaration of m at the
start of the function.

@mr exists@
typedef Mach; // only needed once per semantic patch
idexpression Mach *m;
function f;
position p;
identifier d;
@@
f@p(...){
<+...
m->d
...+>
}

@@
function mr.f;
position mr.p;
@@

f@p(...) {
++ Mach *m = machp();
...
}

spatch is pretty amazing.


On Tue, Oct 11, 2022 at 12:32 PM ron minnich <rminn...@gmail.com> wrote:

> we used the coccinnelle tool (spatch) to convert about 1.4M lines of Plan
> 9 code to C11 for harvey. It was not perfect, but it did get a lot right.
>
> This even got pretty complex: in amd64 Plan 9, r14 and r15 are dedicated
> to up and mach.
> This is not portable, so we wanted to make it explicit. So in any function
> that used up, for example, we had an spatch to add Proc *up = externup();
> declaration to those functions. spatch is powerful. references to m->
> where replaced with machp().
>
> We also removed the embedded lock structs, with spatches like this:
> @  @
> expression E;
> @@
> -incref(E)
> +incref(&E->ref)
>
> This actually *maybe* found a bug, in which there was an ambiguity when a
> struct contained two embedded lock (e.g. Lock and Qlock) types and the
> compiler had to pick the right one to apply the lock/unlock to. It looked
> to us like Plan 9 might have picked the wrong one, but we were never sure.
>
> anyway, this is one path to converting plan 9 code. Or you can just go to
> https://github.com/Harvey-OS/harvey/tree/GPL-C11, where it already is
> done.
>
>
>
> On Mon, Oct 10, 2022 at 1:52 AM Steve Simon <st...@quintile.net> wrote:
>
>> re: p9p for windows
>>
>> Sean Quinlan did a p9p-line port for windows called 9pm, It was seen (it
>> seems) as a port of sam with some simple command line tools
>> rather than a complete plan9 toolkit. its available here:
>> https://netlib.org/research/ as sam.exe
>>
>> There was an attempt at a p9p for windows by Russ Cox, it was a very
>> elegant solution having a p9p dll but suffererd from fragility
>> (a bug in the dll took all your p9p applications down), and split brain
>> problems (p9p applications understood plan9 style binds and mounts,
>> native windows applications did not. As a result development stalled.
>>
>> Its possible that this could be re-awakened using a windows IFS
>> (Installable File System) driver to allow windows applications to see a
>> plan9 style file structure (the 9: drive :-) and perhaps starting p9p as
>> a windows service. This sounds neat but would be a considerable
>> amount of work.
>>
>> This is available here:
>> https://web.archive.org/web/20070221202050/http://swtch.com/usr/local/plan9/9pm/README
>>
>> There was a later implementation by Michael Teichgräber which is a
>> complete port of plan9ports to windows, in a similar style to the
>> posix implementations, this works very well, though, like outher p9p
>> implementations it has a bit of a split brain feel to it.
>>
>> This is here: https://github.com/knieriem/pf9
>>
>> I took a rather different approach as I used plan9 as my desktop for
>> years but needed windows for some work related applications.
>>
>> I did a minimal port of the plan9 command line applications to wondows
>> and wrote a cpu(1) line client and server which allowed me to
>> warp a plan9 terminal to MS windows, in the same directory but running
>> rc(1); I also used remote desktop to get a modern web browser.
>> This was very comfortable environment for what i needed.
>>
>> This is here http://www.quintile.net/magic/webls?dir=/quintile.net/pkg
>>     9win.tbz
>>
>> These days I work on a Mac so plan9ports does all I need, and sadly I
>> hardly ever touch real plan9 any more :-(
>>
>> -Steve
>>
>>
>>
>> > I think there are two ports of plan 9 utilities to windows, one of them
>> includes old (2nd ed?), and other one is a more modern port.
>> >
>> > https://code.google.com/archive/p/plan9port-windows
>> 
>> 

------------------------------------------
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T422378fc25787720-Mef61e79840761b466a422d9a
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

Reply via email to