When dealing with files (reading or writing) you MUST ALWAYS return a STATUS CODE.
RETURN-CODE may will return this status code, but is OMITTED, just because the very same file (if it exists) may be locked (for whatever reason). Call me pessimist, but I've seen things.
Anyway, I belive that you'd not forget that !
And don't forget to do the math. Savefiles are 8K (at minimum, depending the windows size which is not always 80x25). It may reach much bigger sizes.
The minimum size will be 80x25x4=8K
Where:
80 - # columns
25 - # lines
4 - 'chtype' size used in GnuCOBOL (32bits)
So, 8,000 bytes (8Kb) must be provided (at least)
For a Window with 135x52x4 it will need 28,080 bytes (Aprox. 28Kb).
I can do that with "win32a" easly..
JUST WONDERING, FOR WHAT I SAW.
And I'm NOT "talking" about the non-standard 'chtypes' with 8 bytes, which are DOUBLE size.
Cheers,
MM
Conclusion:
Perhaps the ending has not yet been written (from MYST).
Last edit: Mário Matos 2016-10-26
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You'll have to be more specific :-)
I'm very outdated right now.
When did those CALLs were first introduced ? I mean, version
major+minor+patch.
To which compiler should I refer to ? Arnold's ?
MM
Last edit: Simon Sobisch 2020-06-10
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We discussed these end of 2016 and came up with a "design" for those (see the discussion board link), I'm asking you to implement those now in C and test them - I'll take then the work to polish them a bit and include these in GnuCOBOL.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Simon
I would suggest not to use scr_dump and scr_restore which save the whole screen to file.
I think it would be more efficient and even faster to save only a rectangular area of the screen (row and column to be specified from time to time) by reading the individual characters and attributes of the screen with a loop.
This can be done with the pdcurses mvinch () library function.
I had already done so many tests for this with a cobol program that makes a call to the mvinch () function. unfortunately this function returns incorrect values to me in some cases.
In a previous post I had published all the cobol source and sample screenshots.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've meant to upload a "separate" (not TUI-tools using) mouse test program in the contrib/samples containing some notes about the settings and how to query the mouse.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have been playing around with the notions put forth on this thread ... some of it works, some not. I do have a small question: why am I getting these warning messages during the compile:
The test program uses 'scr_dump' and 'scr_restore' which seem to work. However 'inch' does not even if I include a buffer purge loop before trying to acquire a single character. That is not a problem but I am curious about the warnings.
Thanks for your time.
Gregory
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I assume these method does NOT work when running under Linux or am I wrong?
Downloaded the contrib for this but compiles fail heavily but not using the latest version only at 1115. Too much to change code in call.c & config every time.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The methods for saving/restoring a curses window should work everywhere.
Vince, you accomplished that I've dropped my release plan for rc-2 for the next minutes. Congratulations!
I'll postpone the rc2 a little bit and add [feature-requests:#101] before (I'm away the next days, maybe get it in on Sunday). This issue is what you referred to, didn't you?
Can you post the link to the last discussion we had about this issue? I think we raised the maximum call numbers even more...
I am using 192 which hopefully is above any table I will be building and here is an example of one for 160 fields and it is only needed for the Fetch as insert/update just builds a long string containing the entire SQL entry pity cant do the same with fetch.
I'm working on a menu per profile and the screen is saved (scr_dump) at each choice and restored when returning to the previous item (scr_restore).
However, after returning (when a restore is performed) and after choosing a new item, there is a problem rendering the screen.
This problem only happens on windows (-lpdcurses), on linux using ncurses (-lncursesw) the problem does not happen.
Any suggestion?
Hi Marcos,
I'm glad you're using the TUI-TOOLS from the repository.
If you have problems or suggestions for improvement, feel free to write in this forum!
I have been doing some pdcursesmod programming in C as a learning experience.
it appears that on pdcursesmod, that scr_restore only updates the virtual screen, this does not affect the physical screen until a doupdate() function is executed (which is done by the refresh() function under the covers).
So if you could repeat your test and add a static call the the pdcursesmod refresh() function immediately after calling scr_restore() function and see if that changes the behavior..
also I would advise checking the return code after the cobol calls as pdcursesmod does return an integer which can be used to detect if pdcursesmod encountered an error or the function was executed successfully.
Note...
The user must use doupdate() to refresh the physical screen.
Description
getwin() reads window-related data previously stored in a file by putwin(). It then creates and initialises a new window using that data.
also if you could create a very small program which encounters this issue I could try to test it with GDB...
Chuck Haatvedt
putwin() writes all data associated with a window into a file, using an unspecified format. This information can be retrieved later using getwin().
scr_dump() writes the current contents of the virtual screen to the file named by filename in an unspecified format.
scr_restore() function sets the virtual screen to the contents of the file named by filename, which must have been written using scr_dump(). The next refresh operation restores the screen to the way it looked in the dump file.
In PDCurses, scr_init() does nothing, and scr_set() is a synonym for scr_restore(). Also, scr_dump() and scr_restore() save and load from curscr. This differs from some other implementations, where scr_init() works with curscr, and scr_restore() works with newscr; but the effect should be the same. (PDCurses has no newscr.)
Description
wrefresh() copies the named window to the physical terminal screen, taking into account what is already there in order to optimize cursor movement. refresh() does the same, using stdscr. These routines must be called to get any output on the terminal, as other routines only manipulate data structures. Unless leaveok() has been enabled, the physical cursor of the terminal is left at the location of the window's cursor.
wnoutrefresh() and doupdate() allow multiple updates with more efficiency than wrefresh() alone. wrefresh() works by first calling wnoutrefresh(), which copies the named window to the virtual screen. It then calls doupdate(), which compares the virtual screen to the physical screen and does the actual update. A series of calls to wrefresh() will result in alternating calls to wnoutrefresh() and doupdate(), causing several bursts of output to the screen. By first calling wnoutrefresh() for each window, it is then possible to call doupdate() only once.
In PDCurses, redrawwin() is equivalent to touchwin(), and wredrawln() is the same as touchline(). In some other curses implementations, there's a subtle distinction, but it has no meaning in PDCurses.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm in for that move.
As long as we don't break anything. ;-) ;-)
Cheers,
Brian
Simon,
You know? You are such a person!
When dealing with files (reading or writing) you MUST ALWAYS return a STATUS CODE.
RETURN-CODE may will return this status code, but is OMITTED, just because the very same file (if it exists) may be locked (for whatever reason). Call me pessimist, but I've seen things.
Anyway, I belive that you'd not forget that !
And don't forget to do the math. Savefiles are 8K (at minimum, depending the windows size which is not always 80x25). It may reach much bigger sizes.
The minimum size will be 80x25x4=8K
Where:
80 - # columns
25 - # lines
4 - 'chtype' size used in GnuCOBOL (32bits)
So, 8,000 bytes (8Kb) must be provided (at least)
For a Window with 135x52x4 it will need 28,080 bytes (Aprox. 28Kb).
I can do that with "win32a" easly..
JUST WONDERING, FOR WHAT I SAW.
And I'm NOT "talking" about the non-standard 'chtypes' with 8 bytes, which are DOUBLE size.
Cheers,
MM
Conclusion:
Perhaps the ending has not yet been written (from MYST).
Last edit: Mário Matos 2016-10-26
@matosma It's been a while, but can you provide the code for
CBL_GC_SCR_DUMP
andCBL_GC_SCR_RESTORE
in C?You'll have to be more specific :-)
I'm very outdated right now.
When did those CALLs were first introduced ? I mean, version
major+minor+patch.
To which compiler should I refer to ? Arnold's ?
MM
Last edit: Simon Sobisch 2020-06-10
We discussed these end of 2016 and came up with a "design" for those (see the discussion board link), I'm asking you to implement those now in C and test them - I'll take then the work to polish them a bit and include these in GnuCOBOL.
Hi Simon
I would suggest not to use scr_dump and scr_restore which save the whole screen to file.
I think it would be more efficient and even faster to save only a rectangular area of the screen (row and column to be specified from time to time) by reading the individual characters and attributes of the screen with a loop.
This can be done with the pdcurses mvinch () library function.
I had already done so many tests for this with a cobol program that makes a call to the mvinch () function. unfortunately this function returns incorrect values to me in some cases.
In a previous post I had published all the cobol source and sample screenshots.
I've meant to upload a "separate" (not TUI-tools using) mouse test program in the contrib/samples containing some notes about the settings and how to query the mouse.
Hi, Klaus
Please see:
http://man7.org/linux/man-pages/man3/curs_scr_dump.3x.html
Just to be sure... :-)
Cheers,
MM
I have been playing around with the notions put forth on this thread ... some of it works, some not. I do have a small question: why am I getting these warning messages during the compile:
The test program uses 'scr_dump' and 'scr_restore' which seem to work. However 'inch' does not even if I include a buffer purge loop before trying to acquire a single character. That is not a problem but I am curious about the warnings.
Thanks for your time.
Gregory
The C compiler warnings are fixed in the current svn version.
I assume these method does NOT work when running under Linux or am I wrong?
Downloaded the contrib for this but compiles fail heavily but not using the latest version only at 1115. Too much to change code in call.c & config every time.
The methods for saving/restoring a curses window should work everywhere.
Vince, you accomplished that I've dropped my release plan for rc-2 for the next minutes. Congratulations!
I'll postpone the rc2 a little bit and add [feature-requests:#101] before (I'm away the next days, maybe get it in on Sunday). This issue is what you referred to, didn't you?
Can you post the link to the last discussion we had about this issue? I think we raised the maximum call numbers even more...
Related
Wish List:
#101Found it here :
https://sourceforge.net/p/open-cobol/discussion/cobol/thread/66de2539/?limit=25#d2b7
I am using 192 which hopefully is above any table I will be building and here is an example of one for 160 fields and it is only needed for the Fetch as insert/update just builds a long string containing the entire SQL entry pity cant do the same with fetch.
Vince
Hey!
I'm working on a menu per profile and the screen is saved (scr_dump) at each choice and restored when returning to the previous item (scr_restore).
However, after returning (when a restore is performed) and after choosing a new item, there is a problem rendering the screen.
This problem only happens on windows (-lpdcurses), on linux using ncurses (-lncursesw) the problem does not happen.
Any suggestion?
Sorry for the bad english
(code based on Prof. Eugenio's TUI)
The texts on the screens are in Portuguese.
Hi Marcos,
I'm glad you're using the TUI-TOOLS from the repository.
If you have problems or suggestions for improvement, feel free to write in this forum!
You have the same problem that I reported with this post a while ago:
https://sourceforge.net/p/gnucobol/discussion/contrib/thread/f5934f0f/?limit=50#fd9f
Unfortunately, so far the problem also applies to me.
So far I haven't had any solution how to fix it!
Marcos & Eugenio,
I have been doing some pdcursesmod programming in C as a learning experience.
it appears that on pdcursesmod, that scr_restore only updates the virtual screen, this does not affect the physical screen until a doupdate() function is executed (which is done by the refresh() function under the covers).
So if you could repeat your test and add a static call the the pdcursesmod refresh() function immediately after calling scr_restore() function and see if that changes the behavior..
also I would advise checking the return code after the cobol calls as pdcursesmod does return an integer which can be used to detect if pdcursesmod encountered an error or the function was executed successfully.
Note...
The user must use doupdate() to refresh the physical screen.
Description
getwin() reads window-related data previously stored in a file by putwin(). It then creates and initialises a new window using that data.
===================================================
also if you could create a very small program which encounters this issue I could try to test it with GDB...
Chuck Haatvedt
putwin() writes all data associated with a window into a file, using an unspecified format. This information can be retrieved later using getwin().
scr_dump() writes the current contents of the virtual screen to the file named by filename in an unspecified format.
scr_restore() function sets the virtual screen to the contents of the file named by filename, which must have been written using scr_dump(). The next refresh operation restores the screen to the way it looked in the dump file.
In PDCurses, scr_init() does nothing, and scr_set() is a synonym for scr_restore(). Also, scr_dump() and scr_restore() save and load from curscr. This differs from some other implementations, where scr_init() works with curscr, and scr_restore() works with newscr; but the effect should be the same. (PDCurses has no newscr.)
Description
wrefresh() copies the named window to the physical terminal screen, taking into account what is already there in order to optimize cursor movement. refresh() does the same, using stdscr. These routines must be called to get any output on the terminal, as other routines only manipulate data structures. Unless leaveok() has been enabled, the physical cursor of the terminal is left at the location of the window's cursor.
wnoutrefresh() and doupdate() allow multiple updates with more efficiency than wrefresh() alone. wrefresh() works by first calling wnoutrefresh(), which copies the named window to the virtual screen. It then calls doupdate(), which compares the virtual screen to the physical screen and does the actual update. A series of calls to wrefresh() will result in alternating calls to wnoutrefresh() and doupdate(), causing several bursts of output to the screen. By first calling wnoutrefresh() for each window, it is then possible to call doupdate() only once.
In PDCurses, redrawwin() is equivalent to touchwin(), and wredrawln() is the same as touchline(). In some other curses implementations, there's a subtle distinction, but it has no meaning in PDCurses.