Yes, Lim... you need to keep a buffer of the screen (you'd have to do this if you were writing a 5250 emulator, too.) no question about that.

But, there's only one screen. You don't want to keep a separate buffer in every subprocedure, that wouldn't make sense. So it makes absolutely no sense for it to be static.

Copying the data from subprocedure to subprocedure would be inefficient, to put it mildly. Instead, you want to have one copy of the data that can be referenced by all of the subprocedures. This would either be done by having one "screen object" that you pass as a parameter to every subrocedure, or else you'd make it global to the VT100 handling module.

Does a return value return a pointer to a static variable? No. It copies the entire contents of the variable from the subprocedure to it's caller. That's why it's inefficient, and why I wouldn't do things that way.

---
Scott Klement  http://www.scottklement.com



On Fri, 17 Mar 2006, Lim Hock-Chai wrote:

Some background of what I'm doing:
1) I'm trying to write a program to programmatically execute a manual
option on a paging terminal console screen.
2) I'm using Albert's TNAPI program as an example for this.
3) Instead of writing a program that do everything, I'm trying to create
all the VT100 function into a service program.  One of the procedure in
this service program is to convert the VT100 data stream from the server
into a regular readable form.  Apparently, VT100 protocol doesn't send
the entire screen back to the client every time the client requests
something from the server.  Instead, it only sends what need to overlay
on the current screen (It could also send esc sequence to clear screen.)

Because of #3, I need the array (VT100 screen) in this procedure to be
static.  This will allow me to overlay the data from each response that
client gets back from the server.

Yes, VT100 allow different screen mode.  But because I'm the client, I
choose 24x80.

The only thing the I'm not sure of on the return value is below:
4) If a local variable is declared as static.  What is the effect to use
that as the return value?  Is return value return the pointer of this
static variable?  If so, I don't really want that because that means the
caller can change the value of this static variable.  That is the reason
that I create a non-static variable and use it to return the data.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.