[9fans] C question on struct Biobuf in bio.h

2014-10-07 Thread Carsten Kunze
Hello,

in bio.h there is a

struct  Biobuf
{
Biobufhdr;
uchar   b[Bungetsize+Bsize];
};

where Biobufhdr is declared as

typedef struct  Biobufhdr   Biobufhdr;

To make it compile with gcc under UNIX I changed the struct to

struct  Biobuf
{
Biobufhdr Biobufhdr;
uchar   b[Bungetsize+Bsize];
};

but is that what is meant by the original description above?

   Carsten



Re: [9fans] C question on struct Biobuf in bio.h

2014-10-07 Thread Bence Fábián
hi,

no, it is an anonym field.  and it is used in a way that is not part
of ansi c.  there is an extension in newer versions of gcc which
supports it, but if you wan't to port plan 9 c to unix you can use the
libs from plan9port.  that's far more easier.

bence

2014-10-07 17:24 GMT+02:00 Carsten Kunze carsten.ku...@arcor.de:

 Hello,

 in bio.h there is a

 struct  Biobuf
 {
 Biobufhdr;
 uchar   b[Bungetsize+Bsize];
 };

 where Biobufhdr is declared as

 typedef struct  Biobufhdr   Biobufhdr;

 To make it compile with gcc under UNIX I changed the struct to

 struct  Biobuf
 {
 Biobufhdr Biobufhdr;
 uchar   b[Bungetsize+Bsize];
 };

 but is that what is meant by the original description above?

Carsten




Re: [9fans] C question on struct Biobuf in bio.h

2014-10-07 Thread David du Colombier
 in bio.h there is a

 struct  Biobuf
 {
 Biobufhdr;
 uchar   b[Bungetsize+Bsize];
 };

 where Biobufhdr is declared as

 typedef struct  Biobufhdr   Biobufhdr;

This is an unnamed structure. Recent versions of GCC
should be able to handle them when setting the
-fplan9-extension flag.

Otherwise, your change is fine, but hdr would probably be
a better name than Biobufhdr. Also, don't forget to update
your code to use b-hdr.fid instead of b-fid, and so on.

-- 
David du Colombier



Re: [9fans] C question on struct Biobuf in bio.h

2014-10-07 Thread Carsten Kunze
 Otherwise, your change is fine, but hdr would probably be
 a better name than Biobufhdr. Also, don't forget to update
 your code to use b-hdr.fid instead of b-fid, and so on.

Thanks for all answers!

(They also helped to find a short documentation in /sys/doc/compiler)

   Carsten



Re: [9fans] Clean desktop on Raspberry Pi using Plan 9.

2014-10-07 Thread Mats Olsson
Thanks Skip!

I get the idea but how do I save the changes in the file? Sorry for
being such a NEWBIE.

Kind Regards,
Mats



-Ursprungligt Meddelande-

From: Skip Tavakkolian [skip.tavakkol...@gmail.com]
Sent: 6/10/2014 10:51:42 PM
To: 9fans@9fans.net
Subject: Re: [9fans] Clean desktop on Raspberry Pi using Plan 9. 


from the shell window take a look at bin/rc/riostart (i.e.
$home/bin/rc/riostart). remove the startup windows you don't want (like
first.window, etc)

term% cat bin/rc/riostart
#!/bin/rc

scr=(`{cat /dev/draw/new [2]/dev/null || status=''})
wid=$scr(11)
ht=$scr(12)

window 0,0,161,117 stats -lmisce
window 161,0,560,117 faces -i

if(~ `{screensize} small)
dump=acme.dump.small
if not
dump=acme.dump

a=`{echo $wid-35 | hoc }
window 60,90,$a,$ht acme -l lib/$dump
window 20,140,610,450 /usr/glenda/lib/first.window
term% 

On Mon, Oct 6, 2014 at 1:19 PM, Mats Olsson  m...@spray.se
mailto:m...@spray.se  wrote:


Hi guys!

How can I get a clean desktop at bootup on the Raspberry Pi
using Plan 9? No tutorials starting etc. Would highly appreciate to know
how to know how to configure the Raspberry Pi to start clean. Thanks
beforehand!

Kind Greetings,
Mats





Re: [9fans] Clean desktop on Raspberry Pi using Plan 9.

2014-10-07 Thread Skip Tavakkolian
use acme to open/save it. 'man acme' or search for youtube videos on how to
navigate in acme.


On Tue, Oct 7, 2014 at 9:42 AM, Mats Olsson m...@spray.se wrote:

  Thanks Skip!

 I get the idea but how do I save the changes in the file? Sorry for being
 such a NEWBIE.

 Kind Regards,
 Mats


 -Ursprungligt Meddelande-
   *From: Skip Tavakkolian [skip.tavakkol...@gmail.com
 skip.tavakkol...@gmail.com]*
 Sent: 6/10/2014 10:51:42 PM
 To: 9fans@9fans.net
 Subject: Re: [9fans] Clean desktop on Raspberry Pi using Plan 9.


 from the shell window take a look at bin/rc/riostart (i.e.
 $home/bin/rc/riostart). remove the startup windows you don't want (like
 first.window, etc)

 term% cat bin/rc/riostart
 #!/bin/rc

 scr=(`{cat /dev/draw/new [2]/dev/null || status=''})
 wid=$scr(11)
 ht=$scr(12)

 window 0,0,161,117 stats -lmisce
 window 161,0,560,117 faces -i

 if(~ `{screensize} small)
 dump=acme.dump.small
 if not
 dump=acme.dump

 a=`{echo $wid-35 | hoc }
 window 60,90,$a,$ht acme -l lib/$dump
 window 20,140,610,450 /usr/glenda/lib/first.window
 term%

 On Mon, Oct 6, 2014 at 1:19 PM, Mats Olsson m...@spray.se wrote:

  Hi guys!

 How can I get a clean desktop at bootup on the Raspberry Pi using Plan 9?
 No tutorials starting etc. Would highly appreciate to know how to know how
 to configure the Raspberry Pi to start clean. Thanks beforehand!

 Kind Greetings,
 Mats





Re: [9fans] C question on struct Biobuf in bio.h

2014-10-07 Thread Álvaro Jurado
I'm using gcc to compile plan9 code from some time (4.7/4.8) and that
option are masking real behaviour. Do not warns or put out an error about
anonymous structs, but you will have a conflict if to structs in the same
source are including a, for example, Lock; element, and ld could not
assign right the values if declarations are not specified ansi style
(variable initialization it's made by ld, not by the compiler): you will
get some dragons in some cases.
Look at LP49 source code and you will see that authors used your second way.

Álvaro Jurado Cuevas
colmenar.biz.tm

2014-10-07 17:58 GMT+02:00 Carsten Kunze carsten.ku...@arcor.de:

  Otherwise, your change is fine, but hdr would probably be
  a better name than Biobufhdr. Also, don't forget to update
  your code to use b-hdr.fid instead of b-fid, and so on.

 Thanks for all answers!

 (They also helped to find a short documentation in /sys/doc/compiler)

Carsten




Re: [9fans] Clean desktop on Raspberry Pi using Plan 9.

2014-10-07 Thread Mats Olsson
Thanka again for your help! Now I got it. Looked for the file in Acme
and edited the file and pressed the middle button on Put.

Kind Greetings,
Mats



-Ursprungligt Meddelande-

From: Skip Tavakkolian [skip.tavakkol...@gmail.com]
Sent: 6/10/2014 10:51:42 PM
To: 9fans@9fans.net
Subject: Re: [9fans] Clean desktop on Raspberry Pi using Plan 9. 


from the shell window take a look at bin/rc/riostart (i.e.
$home/bin/rc/riostart). remove the startup windows you don't want (like
first.window, etc)

term% cat bin/rc/riostart
#!/bin/rc

scr=(`{cat /dev/draw/new [2]/dev/null || status=''})
wid=$scr(11)
ht=$scr(12)

window 0,0,161,117 stats -lmisce
window 161,0,560,117 faces -i

if(~ `{screensize} small)
dump=acme.dump.small
if not
dump=acme.dump

a=`{echo $wid-35 | hoc }
window 60,90,$a,$ht acme -l lib/$dump
window 20,140,610,450 /usr/glenda/lib/first.window
term% 

On Mon, Oct 6, 2014 at 1:19 PM, Mats Olsson  m...@spray.se
mailto:m...@spray.se  wrote:


Hi guys!

How can I get a clean desktop at bootup on the Raspberry Pi
using Plan 9? No tutorials starting etc. Would highly appreciate to know
how to know how to configure the Raspberry Pi to start clean. Thanks
beforehand!

Kind Greetings,
Mats





Re: [9fans] Clean desktop on Raspberry Pi using Plan 9.

2014-10-07 Thread Aram Hăvărneanu
The startup file is there exactly to teach you about these things, you
should read it.

-- 
Aram Hăvărneanu


[9fans] [OFF-TOPIC] For most programmers, it is foolish currently develop in machine code, hexadecimal and assembly?

2014-10-07 Thread françai s
It is written in the introduction C - A programming language
Ansi standard written by Brian Kernighan and Dennis Ritchie:

For most programmers, the most important change is a
new syntax for declaring and defining functions.

For most programmers, it is foolish currently develop in
machine code, hexadecimal and assembly?

There are different opinions on this?


Re: [9fans] [OFF-TOPIC] For most programmers, it is foolish currently develop in machine code, hexadecimal and assembly?

2014-10-07 Thread erik quanstrom
 For most programmers, it is foolish currently develop in
 machine code, hexadecimal and assembly?

you forgot octal.  i think this is more a function of the
(a) problem,
(b) machine
than something one can make sweeping generalizations about.  but in general,
yes, programming in machine code (octal or hex or whatever) doesn't make much
sense, but i have done it rather than writing an assembler for a small project.
it turns out that this is easier with some machines than others.  and that 
currently
popular machines tend to be on the difficult side.

programming in assembly makes a lot of sense if the problem cannot be expressed
in another language, such as accessing MSRs.  bootstrapping code is frequently 
in
assembly.

- erik