f



windows in c

this is not oftopic becouse imagine there would be no windows 
systems yet made (like windows,linux,mac) and one would like to make it then would need to design small windows api for handling that - and i wonder what options are there and which one would be better

i present my thoughts which i thinki are practically interesting
and increase knowledge about c windows environments

1)  topic - how should behave such program in a windows environment 
  
  void main() {
   printf("hello world"); }

there is a problem 1) if such program should open a console 
window ? 2) should never print nothing? 3) should maybe print something if run from console only?

imo the options 1 or 3 are probably more good, hard to decide 
which one would be better, posibly maybe 3 (? )

right now afair this works different i mean this creates console  window or no based of compile/linkind switch (this seems bad )

[if someone is knowlegeable or has opinion on this - may comment]

2) how the simplest non console window program should like 
(excluding empty) i mean soreta real app suited to windows 

 void main() 
{
    for(;;)
     sleep(10); 
}

 this imo could be base as windows so called service, i constanlty mean runing program which not opens a window ,

such services may be usefull for something, though im not sure for what (got no experience coding services)
 
ofc it should poll on some info like for example current 
date and time etc 
(sleep is ofc not much good name, maybe it should be named 
like system(), give_cpu_to_system() or what

3) how minimal app with real window should look like
 
 void main()
 {
    SetupWindow("window1",500,400);

    for(;;)
    {
     sleep(10); 
    }
   
 }

 such windows could not react on events, like resize keypresses or mouse clicks - so polling or registering handler is needed

im not sure how polling would really work, probably same as handler,  some

 pull_event(&event); 

would be needed, im not sure if such filled queue of events
as in winapi is trong need or it could really look some
other way (?)

polling could really be maybe a bit less confusing than callback

this opens btw some more area for thinking as for example
this way of making windows seem at all a bit weird becouse in reality window belongs to system (like program body) it also makes all interchanges betwean desctop and those window and programmer program part is weirdly parted client of that window
(at least it gets me a bit thinking (in methaforic way, uh uh ))

Some thoughts?

could maybe someone write a quick how this windows handling looks on linux (and eventually mac)  (or at least maybe give some link to clear article?)
0
fir
12/16/2016 6:20:41 PM
comp.lang.c 30656 articles. 5 followers. spinoza1111 (3246) is leader. Post Follow

9 Replies
701 Views

Similar Articles

[PageSpeed] 42

W dniu pi=C4=85tek, 16 grudnia 2016 19:20:49 UTC+1 u=C5=BCytkownik fir napi=
sa=C5=82:
> this is not oftopic becouse imagine there would be no windows=20
> systems yet made (like windows,linux,mac) and one would like to make it t=
hen would need to design small windows api for handling that - and i wonder=
 what options are there and which one would be better
>=20
> i present my thoughts which i thinki are practically interesting
> and increase knowledge about c windows environments
>=20
> 1)  topic - how should behave such program in a windows environment=20
>  =20
>   void main() {
>    printf("hello world"); }
>=20
> there is a problem 1) if such program should open a console=20
> window ? 2) should never print nothing? 3) should maybe print something i=
f run from console only?
>=20
> imo the options 1 or 3 are probably more good, hard to decide=20
> which one would be better, posibly maybe 3 (? )
>=20
> right now afair this works different i mean this creates console  window =
or no based of compile/linkind switch (this seems bad )
>=20
> [if someone is knowlegeable or has opinion on this - may comment]
>=20
> 2) how the simplest non console window program should like=20
> (excluding empty) i mean soreta real app suited to windows=20
>=20
>  void main()=20
> {
>     for(;;)
>      sleep(10);=20
> }
>=20
>  this imo could be base as windows so called service, i constanlty mean r=
uning program which not opens a window ,
>=20
> such services may be usefull for something, though im not sure for what (=
got no experience coding services)
> =20
> ofc it should poll on some info like for example current=20
> date and time etc=20
> (sleep is ofc not much good name, maybe it should be named=20
> like system(), give_cpu_to_system() or what
>=20
> 3) how minimal app with real window should look like
> =20
>  void main()
>  {
>     SetupWindow("window1",500,400);
>=20
>     for(;;)
>     {
>      sleep(10);=20
>     }
>   =20
>  }
>=20
>  such windows could not react on events, like resize keypresses or mouse =
clicks - so polling or registering handler is needed
>=20
> im not sure how polling would really work, probably same as handler,  som=
e
>=20
>  pull_event(&event);=20
>=20
> would be needed, im not sure if such filled queue of events
> as in winapi is trong need or it could really look some
> other way (?)
>=20
> polling could really be maybe a bit less confusing than callback
>=20
> this opens btw some more area for thinking as for example
> this way of making windows seem at all a bit weird becouse in reality win=
dow belongs to system (like program body) it also makes all interchanges be=
twean desctop and those window and programmer program part is weirdly parte=
d client of that window
> (at least it gets me a bit thinking (in methaforic way, uh uh ))
>=20
> Some thoughts?
>=20
> could maybe someone write a quick how this windows handling looks on linu=
x (and eventually mac)  (or at least maybe give some link to clear article?=
)

BTW it seem to me that one could get rid loop sleep and event pulling if wo=
uld replace main by some "Reaction run(Event e) {} " (which would be called=
 in cyclic by os) but it would need also thinking up of some rules of a tim=
e share management given to the programs (but is maybe a coool option thoug=
h the present seems also not totally=20
bad (except winmain name and hidden setoup routines which i dislike)

0
fir
12/16/2016 6:38:51 PM
>=20
> BTW it seem to me that one could get rid loop sleep and event pulling if =
would replace main by some "Reaction run(Event e) {} " (which would be call=
ed in cyclic by os) but it would need also thinking up of some rules of a t=
ime share management given to the programs (but is maybe a coool option tho=
ugh the present seems also not totally=20
> bad (except winmain name and hidden setoup routines which i dislike)

this 1 is fine 4 me b-coz it relates to more general agent based environmen=
t (windows and services are agants but with poor culture of communication a=
nd environment)

but on this i will say tommorrow becoz terrible headache i got this evening=
 (4 unknown reason, 2 much punkrock today maybe)
0
fir
12/17/2016 12:43:54 AM
On Friday, December 16, 2016 at 12:20:49 PM UTC-6, fir wrote:
> this is not oftopic becouse imagine there would be no windows 
> systems yet made (like windows,linux,mac) and one would like to make it then would need to design small windows api for handling that - and i wonder what options are there and which one would be better
> 

Chapter 1 of the NeWS Book is a history of windows systems up to the mid-80s.
Smalltalk, InterlispD, Andrew, W, X.

http://bitsavers.trailing-edge.com/pdf/sun/NeWS/The_NeWS_Book_1989.pdf

Lots of old systems (at least manuals and stuff) are available to study.
0
luser
12/17/2016 3:29:09 AM
W dniu sobota, 17 grudnia 2016 04:29:24 UTC+1 u=C5=BCytkownik luser droog n=
apisa=C5=82:
> On Friday, December 16, 2016 at 12:20:49 PM UTC-6, fir wrote:
> > this is not oftopic becouse imagine there would be no windows=20
> > systems yet made (like windows,linux,mac) and one would like to make it=
 then would need to design small windows api for handling that - and i wond=
er what options are there and which one would be better
> >=20
>=20
> Chapter 1 of the NeWS Book is a history of windows systems up to the mid-=
80s.
> Smalltalk, InterlispD, Andrew, W, X.
>=20
> http://bitsavers.trailing-edge.com/pdf/sun/NeWS/The_NeWS_Book_1989.pdf
>=20
> Lots of old systems (at least manuals and stuff) are available to study.

this is somewhat on topic (as a bits of events there) but it is somewhat un=
effective to read 200 pages to find 5-10 ontopic sentences=20

overall though the topic im sain is very interesting imo,
it is about how to general design system environment for c apps where you n=
ot limit yurself for the frst era naked machine and one c program, now we g=
ot this second era imo
(many programs/processes at once)

will say more on this a bit later, some more opinions or informations are w=
elcome
0
fir
12/17/2016 1:58:59 PM
On Saturday, December 17, 2016 at 7:59:06 AM UTC-6, fir wrote:
> W dniu sobota, 17 grudnia 2016 04:29:24 UTC+1 u=C5=BCytkownik luser droog=
 napisa=C5=82:
> > On Friday, December 16, 2016 at 12:20:49 PM UTC-6, fir wrote:
> > > this is not oftopic becouse imagine there would be no windows=20
> > > systems yet made (like windows,linux,mac) and one would like to make =
it then would need to design small windows api for handling that - and i wo=
nder what options are there and which one would be better
> > >=20
> >=20
> > Chapter 1 of the NeWS Book is a history of windows systems up to the mi=
d-80s.
> > Smalltalk, InterlispD, Andrew, W, X.
> >=20
> > http://bitsavers.trailing-edge.com/pdf/sun/NeWS/The_NeWS_Book_1989.pdf
> >=20
> > Lots of old systems (at least manuals and stuff) are available to study=
..
>=20
> this is somewhat on topic (as a bits of events there) but it is somewhat =
uneffective to read 200 pages to find 5-10 ontopic sentences=20
>=20

I understand, but just chapter 1 from that pdf. It's 25
pages, but it really does cover what you need to know about the history of =
window systems before designing=20
another one.=20

The rest of the book describes the Postscript-based
window system which is my long-term goal for the Xpost
project.

But just look at chapter one in there. I think it will
really help. Smalltalk to X11. There have not really
been any substantive advances since then IMO.
0
luser
12/18/2016 5:04:44 AM
On 16/12/16 18:20, fir wrote:
> this is not oftopic becouse imagine there would be no windows
> systems yet made (like windows,linux,mac) and one would like to make it then would need to design small windows api for handling that - and i wonder what options are there and which one would be better
>
> i present my thoughts which i thinki are practically interesting
> and increase knowledge about c windows environments
>
> 1)  topic - how should behave such program in a windows environment
>
>   void main() {
>    printf("hello world"); }

fir it wont work bcos you got to get rid of any crap in the message que 
first like this

void main(){
fflush(stdin);
printf("hello world"); }

then it will work in windows dont you agree

0
Parity
12/18/2016 9:04:18 AM
W dniu niedziela, 18 grudnia 2016 10:04:30 UTC+1 u=C5=BCytkownik Parity Err=
or napisa=C5=82:
> On 16/12/16 18:20, fir wrote:
> > this is not oftopic becouse imagine there would be no windows
> > systems yet made (like windows,linux,mac) and one would like to make it=
 then would need to design small windows api for handling that - and i wond=
er what options are there and which one would be better
> >
> > i present my thoughts which i thinki are practically interesting
> > and increase knowledge about c windows environments
> >
> > 1)  topic - how should behave such program in a windows environment
> >
> >   void main() {
> >    printf("hello world"); }
>=20
> fir it wont work bcos you got to get rid of any crap in the message que=
=20
> first like this
>=20
> void main(){
> fflush(stdin);
> printf("hello world"); }
>=20
> then it will work in windows dont you agree

not really, problems here are more serious, but i must rethink it
0
fir
12/18/2016 12:33:47 PM
W dniu niedziela, 18 grudnia 2016 06:05:01 UTC+1 u=C5=BCytkownik luser droo=
g napisa=C5=82:
> On Saturday, December 17, 2016 at 7:59:06 AM UTC-6, fir wrote:
> > W dniu sobota, 17 grudnia 2016 04:29:24 UTC+1 u=C5=BCytkownik luser dro=
og napisa=C5=82:
> > > On Friday, December 16, 2016 at 12:20:49 PM UTC-6, fir wrote:
> > > > this is not oftopic becouse imagine there would be no windows=20
> > > > systems yet made (like windows,linux,mac) and one would like to mak=
e it then would need to design small windows api for handling that - and i =
wonder what options are there and which one would be better
> > > >=20
> > >=20
> > > Chapter 1 of the NeWS Book is a history of windows systems up to the =
mid-80s.
> > > Smalltalk, InterlispD, Andrew, W, X.
> > >=20
> > > http://bitsavers.trailing-edge.com/pdf/sun/NeWS/The_NeWS_Book_1989.pd=
f
> > >=20
> > > Lots of old systems (at least manuals and stuff) are available to stu=
dy.
> >=20
> > this is somewhat on topic (as a bits of events there) but it is somewha=
t uneffective to read 200 pages to find 5-10 ontopic sentences=20
> >=20
>=20
> I understand, but just chapter 1 from that pdf. It's 25
> pages, but it really does cover what you need to know about the history o=
f window systems before designing=20
> another one.=20
>=20
> The rest of the book describes the Postscript-based
> window system which is my long-term goal for the Xpost
> project.
>=20
> But just look at chapter one in there. I think it will
> really help. Smalltalk to X11. There have not really
> been any substantive advances since then IMO.

interesting is it emphasizes the role of events (events mechanic/events lay=
er) in windows system [this way it shows it should be simple]=20
- also talks on windows itself (it aslo should be simple i thin just some a=
rray of created windows
- and yet there are the programs itself and
- task scheduler (this is still sadlu obscure)

but anyway i was talking on some other aspect (not how its done but how it =
can be done at all in more general)
0
fir
12/18/2016 1:04:01 PM
W dniu niedziela, 18 grudnia 2016 14:04:08 UTC+1 u=C5=BCytkownik fir napisa=
=C5=82:
> W dniu niedziela, 18 grudnia 2016 06:05:01 UTC+1 u=C5=BCytkownik luser dr=
oog napisa=C5=82:
> > On Saturday, December 17, 2016 at 7:59:06 AM UTC-6, fir wrote:
> > > W dniu sobota, 17 grudnia 2016 04:29:24 UTC+1 u=C5=BCytkownik luser d=
roog napisa=C5=82:
> > > > On Friday, December 16, 2016 at 12:20:49 PM UTC-6, fir wrote:
> > > > > this is not oftopic becouse imagine there would be no windows=20
> > > > > systems yet made (like windows,linux,mac) and one would like to m=
ake it then would need to design small windows api for handling that - and =
i wonder what options are there and which one would be better
> > > > >=20
> > > >=20
> > > > Chapter 1 of the NeWS Book is a history of windows systems up to th=
e mid-80s.
> > > > Smalltalk, InterlispD, Andrew, W, X.
> > > >=20
> > > > http://bitsavers.trailing-edge.com/pdf/sun/NeWS/The_NeWS_Book_1989.=
pdf
> > > >=20
> > > > Lots of old systems (at least manuals and stuff) are available to s=
tudy.
> > >=20
> > > this is somewhat on topic (as a bits of events there) but it is somew=
hat uneffective to read 200 pages to find 5-10 ontopic sentences=20
> > >=20
> >=20
> > I understand, but just chapter 1 from that pdf. It's 25
> > pages, but it really does cover what you need to know about the history=
 of window systems before designing=20
> > another one.=20
> >=20
> > The rest of the book describes the Postscript-based
> > window system which is my long-term goal for the Xpost
> > project.
> >=20
> > But just look at chapter one in there. I think it will
> > really help. Smalltalk to X11. There have not really
> > been any substantive advances since then IMO.
>=20
> interesting is it emphasizes the role of events (events mechanic/events l=
ayer) in windows system [this way it shows it should be simple]=20
> - also talks on windows itself (it aslo should be simple i thin just some=
 array of created windows
> - and yet there are the programs itself and
> - task scheduler (this is still sadlu obscure)
>=20
> but anyway i was talking on some other aspect (not how its done but how i=
t can be done at all in more general)

it wd be probbly gd to take/imagine some simple case and
talk on that, but maybe i will do it a bit later
0
fir
12/18/2016 1:19:36 PM
Reply: