View previous topic :: View next topic |
Author |
Message |
Ralf
Joined: 30 Aug 2007 Posts: 38 Location: munich
|
Posted: Wed Mar 13, 2019 7:40 am Post subject: %eb with edit information |
|
|
I am using %`eb with edit informations. Do I have to define the edit_info-array with type integer(kind=7) ?
Ralf |
|
Back to top |
|
 |
PaulLaidler Site Admin

Joined: 21 Feb 2005 Posts: 6088 Location: Salford, UK
|
Posted: Wed Mar 13, 2019 8:43 am Post subject: |
|
|
The safest way is to use the TYPE edit_info that is defined in clearwin.ins and the corresponding module.
You can find further information in the document NotesOn64BitFtn95.txt and in FTN95.chm. |
|
Back to top |
|
 |
Ralf
Joined: 30 Aug 2007 Posts: 38 Location: munich
|
Posted: Wed Mar 13, 2019 5:04 pm Post subject: |
|
|
I tried to use the TYPE edit_info, but have still program crashes.
See the following example:
Code: | Program Test_EditBox
use eb_module
integer :: winio@, iw, ierr
real*4 :: xyz(4)
allocate(xyz_save(4),stat = ierr)
xyz_save = 1.
xyz = xyz_save
iw = winio@ ('%pv%20.10`eb[read_only]&','*',0,info_eb)
xyz = xyz_save
iw = winio@ (' ')
stop
end
|
with module:
Code: | module eb_module
INCLUDE <clearwin.ins>
TYPE(edit_info) info_eb
real*4,ALLOCATABLE,DIMENSION(:) :: xyz_save
end module eb_module
|
When I debug this program, the values of array xyz_save are changed to "Illegal Pointer" when the edit box is created |
|
Back to top |
|
 |
Ralf
Joined: 30 Aug 2007 Posts: 38 Location: munich
|
Posted: Tue Mar 19, 2019 8:17 am Post subject: |
|
|
Paul,
I debugged my Problem once again and checked the edit_info-structure.
The program runs fine, when I increase the size of the structure, by defining the last entry ("reserved") as an Array. I can see, that the first 8 items of the integer*2-array "reserved" are changed when %eb is called. So I changed the type structure of edit_info to:
Code: | TYPE edit_info
SEQUENCE
INTEGER*4 ::h_position
INTEGER*4 ::v_position
INTEGER*4 ::last_line
INTEGER(7)::buffer
INTEGER*4 ::buffer_size
INTEGER*4 ::max_buffer_size
INTEGER(7)::current_position
INTEGER(7)::selection
INTEGER*4 ::n_selected
INTEGER*4 ::vk_key
INTEGER*4 ::vk_shift
INTEGER*4 ::active
INTEGER*4 ::modified
INTEGER*4 ::closing
INTEGER*4 ::n_chars_to_colour
INTEGER(7)::text_to_colour
INTEGER(7)::text_colours
INTEGER(7)::background_colours
INTEGER*4 ::modification_count
INTEGER*4 ::modification_flag
INTEGER*2 ::reserved(8)
END TYPE
|
and my program runs fine. The other items of edit_info seem to have reasonable values, but currently I am not using any of them. |
|
Back to top |
|
 |
PaulLaidler Site Admin

Joined: 21 Feb 2005 Posts: 6088 Location: Salford, UK
|
Posted: Tue Mar 19, 2019 2:37 pm Post subject: |
|
|
I have not been able to reproduce your fault.
It is just possible that ClearWin+ has been changed so you could try using the new DLLs that you can download from here...
https://www.dropbox.com/s/eg8a7k9j4x9ysbt/newDLLs32.zip?dl=0
I don't get the crash but there does seem to be a fault in SDBG64 which sometimes gives a false error report for the array xyz_save. |
|
Back to top |
|
 |
Ralf
Joined: 30 Aug 2007 Posts: 38 Location: munich
|
Posted: Wed Mar 20, 2019 7:47 am Post subject: |
|
|
I replaced the DLLs with the new ones but have still the same program crash (Access Violation), no matter if I compile it with /debug or not, or using sdbg64 or not.
Funnily enough the contents of the 32byte that are written on info_eb%reserved is four times "BAADF00D", when displaying it in hexadecimal.
For completeness, here are my makefiles:
Code: | ftn95 /64 module_eb.f95
ftn95 /64 test_eb.f95
slink64 @lw |
with lw: Code: | lo module_eb
lo test_eb
windows
file Test_eb |
|
|
Back to top |
|
 |
Ralf
Joined: 30 Aug 2007 Posts: 38 Location: munich
|
Posted: Wed Mar 20, 2019 7:55 am Post subject: |
|
|
I don't know, if it makes any difference, but my OS is Windows 10 Enterprice, Version 1709.
Do you think that there may be any disadvantage, if I extend the type structure in the way I explained before? |
|
Back to top |
|
 |
PaulLaidler Site Admin

Joined: 21 Feb 2005 Posts: 6088 Location: Salford, UK
|
Posted: Wed Mar 20, 2019 8:18 am Post subject: |
|
|
There should be no problem when you increase the size of TYPE edit_info. It just has to be a block of memory large enough for the internal workings of ClearWin+.
If you want to access the information from your program then you will need to know the offset from the beginning of the structure to the information you need. Otherwise you could go back to using an integer array provided its size is increased to accommodate the new INTEGER*8 addresses.
There is no explicit reference to "reserved" in the ClearWin+ code so at the moment the fault remains unexplained. |
|
Back to top |
|
 |
|