nanogui: some more questions


Previous by date: 30 Apr 2001 01:45:43 -0000 Re: some more questions, Alex Holden
Next by date: 30 Apr 2001 01:45:43 -0000 A problem about refresh, hongouyang
Previous in thread: 30 Apr 2001 01:45:43 -0000 Re: some more questions, Alex Holden
Next in thread:

Subject: Re: some more questions
From: Gary James ####@####.####
Date: 30 Apr 2001 01:45:43 -0000
Message-Id: <20010429214640.C11852@pc.twcny.rr.com>

On Sat, 28 Apr 2001 23:32:19 bob wrote:
> Hi
> Thank you for reply. I have some questions.
> If I linked nano-X to application, I should replace GrXXX functions by
> GdXXXs' in the application. Is that right?

No, absolutely not !!! If your writing a nano-X application you should only
have to call Gr*() functions.

The Gd*() functions are part of the device independent engine layer of
Microwindows. Gr*() functions are components of nano-X. I'll try to draw a
picture, excuse me if my ascii art is not too good.


  nano-X Client Server Mode     nano-X Linked To App Mode
  +------------------------+    +------------------------+
  |                        |    |                        |
  |    Your Application    |    |    Your Application    |
  |                        |    |                        |
  +------------------------+    +------------------------+
  |  nano-X client library |    |  nano-X server library |
  |       "client.c"       |    |       "srvfunc.c"      |
  |          Gr*()         |    |          Gr*()         |
  +------------------------+    +------------------------+
    ::::::::::::::::::::::      |   device independent   |
    : Unix domain socket :      |      engine layer      |
    ::::::::::::::::::::::      |          Gd*()         |
  +------------------------+    +------------------------+
  |  nano-X server library |
  |       "srvnet.c"       |
  |       GsSelect()       |
  |     GsHandleClient()   |
  |       Gr*Wrapper()     |
  +------------------------+
  |  nano-X server library |
  |       "srvfunc.c"      |
  |          Gr*()         |
  +------------------------+
  |   device independent   |
  |      engine layer      |
  |          Gd*()         |
  +------------------------+


> I noticed that there is a data structure "req" generated by the GrXXX
> function in client.c. How does this request be passed to the nano-X?

The req structure is what actually gets sent by the client through the unix
domain socket to the server. The server receives and processes this
structure in "srvnet.c" by calling the appropiate Gr*Wrapper() function.

One thing that you will notice is that for any Gr*() function there is one
function with that name in "client.c" and another function with that name
in "srvfunc.c". When you run in client-server mode your application calls
the Gr*() function in "client.c" and the server wrappers call the function
in "srvfunc.c". When you run in linked mode your application directly calls
the Gr*() function in "srvfunc.c".


> And then how does the nano-X handle this data? Does it directly call
> And corresponding function in srvfunc.c?

I'm going to sound like a scratched record now (I still have more records
than CDs)...

In linked mode:
Your application directly calls the Gr*() function in "srvfunc.c". The
Gr*() function calls the Gd*() function in the device independent engine.

In client server mode:
Look through "srvnet.c" you will have to understand this file to add your
function. Look at the "GrFunctions" table. Look at where it's invoked in
GsHandleClient().

Usually nano-X hangs out in it's select loop, GsSelect(), while it's
waiting for function call requests to come over the socket. When data is
received on the socket GsSelect() calls the function GsHandleClient().
GsHandleClient() reads the data from the socket and looks up the proper
wrapper function in the table "GrFunctions" based on a function ID that
came through the socket in the req structure. The wrapper function is
called in line 1636 of "srvnet.c":
   GrFunctions[req->reqType].func(req);
This calls the appropiate Gr*Wrapper() function with a pointer to the req
structure. The Gr*Wrapper() function calls the Gr*() function in
"srvfunc.c". The Gr*() function calls the Gd*() function in the device
independent engine.

If data is returned from the Gr*() function then the Gr*Wrapper() function
uses GsWriteType() and then GsWrite() to send the returned data to the
client through the unix domain socket.

Hope this helps...

Gary James
####@####.####
http://home.twcny.rr.com/embedded/





Previous by date: 30 Apr 2001 01:45:43 -0000 Re: some more questions, Alex Holden
Next by date: 30 Apr 2001 01:45:43 -0000 A problem about refresh, hongouyang
Previous in thread: 30 Apr 2001 01:45:43 -0000 Re: some more questions, Alex Holden
Next in thread:


Powered by ezmlm-browse 0.20.