Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Further fixes for g95 (and other c_int /= integer systems) compatibility

  • Loading branch information...
commit 227573ed4f6944d56a594ab549186fb876ae9c10 1 parent 3fca84e
@jtappin jtappin authored
View
3  CMakeLists.txt
@@ -40,6 +40,9 @@ set(CMAKE_INSTALL_LIBDIR lib)
set(CMAKE_Fortran_FLAGS_DEBUG
"-g -pthread -Wall -Wtabs -fcheck-array-temporaries -fbacktrace -fbounds-check -ffpe-trap=invalid,zero,overflow -Wno-unused-dummy-argument")
+# Not all of the above are understood by g95, the following is a minimal
+# setting.
+# "-g -pthread -fbounds-check")
set(CMAKE_Fortran_FLAGS_RELEASE
"-pthread -O3 -mtune=native -march=native")
View
3  examples/hl_list_n.f90
@@ -63,6 +63,7 @@ subroutine list_select(list, gdata) bind(c)
character(len=10) :: nodd
character :: code, ucode
integer(kind=c_int) :: icode, iucode
+
nsel = hl_gtk_listn_get_selections(C_NULL_PTR, selections, list)
if (nsel == 0) then
print *, "No selection"
@@ -249,7 +250,9 @@ program list_n
! realize the window
+ print *, "Created"
call gtk_widget_show_all(ihwin)
+ print *, "Realized"
! Event loop
View
8 examples/hl_textview.f90
@@ -48,17 +48,17 @@ subroutine tv_ins(widget,iter, text, nins, gdata) bind(c)
character(len=100), dimension(:), allocatable :: f_text
print *, "INSERT event", nins
- call c_f_pointer(text, cf_text, (/ nins /))
+ call c_f_pointer(text, cf_text, (/ int(nins) /))
call convert_c_string(cf_text, f_text)
print "(a)", f_text
- deallocate(f_text)
+!!$ deallocate(f_text)
call hl_gtk_text_view_get_info(C_NULL_PTR, buffer=widget, nlines=nl, &
& nchars=nc, ncline=ncl)
print *, nl, nc
print *, ncl
- deallocate(ncl)
+!!$ deallocate(ncl)
end subroutine tv_ins
@@ -75,7 +75,7 @@ subroutine tv_del(widget, s_iter, e_iter, gdata) bind(c)
& gtk_text_iter_get_offset(s_iter)
ctext = gtk_text_iter_get_text(s_iter, e_iter)
- call convert_c_string(ctext, dlen, ftext)
+ call convert_c_string(ctext, int(dlen), ftext)
print "(A)", ftext
deallocate(ftext)
View
6 examples/hl_tree.f90
@@ -210,11 +210,13 @@ program tree
call hl_gtk_box_pack(base, ihscrollcontain)
! Add a note about editable columns
- lbl = gtk_label_new("The ""Name"" and ""3N"" columns are editable"//c_null_char)
+ lbl = gtk_label_new("The ""Name"" and ""3N"" columns are editable"&
+ & //c_null_char)
call hl_gtk_box_pack(base, lbl)
! Delete selected row
- dbut = hl_gtk_button_new("Delete selected row"//c_null_char, clicked=c_funloc(del_row), &
+ dbut = hl_gtk_button_new("Delete selected row"//c_null_char, &
+ & clicked=c_funloc(del_row), &
& tooltip="Delete the selected row"//c_null_char, sensitive=FALSE)
call hl_gtk_box_pack(base, dbut)
View
14 examples/mandelbrot_pixbuf_zoom.f90
@@ -213,7 +213,8 @@ subroutine zoom_view(widget, event, gdata) bind(c)
mymax = mymin + 2._c_double * yr
end if
write(rangestr, &
- & "('Xmin: ',g11.4,' Xmax: ',g11.4,' Range: ',g11.4,' Ymin: ',g11.4,' Ymax: ', g11.4,' Range: ',g11.4)") &
+ & "('Xmin: ',g11.4,' Xmax: ',g11.4,' Range: ',g11.4,&
+ & ' Ymin: ',g11.4,' Ymax: ', g11.4,' Range: ',g11.4)") &
& mxmin, mxmax, mxmax-mxmin, mymin, mymax, mymax-mymin
call gtk_label_set_text(rangeid, trim(rangestr)//c_null_char)
@@ -364,7 +365,8 @@ program mandelbrot_zoom
call gtk_box_pack_start(jb, my_event_box, FALSE, FALSE, 0_c_int)
write(rangestr, &
- & "('Xmin: ',g11.4,' Xmax: ',g11.4,' Range: ',g11.4,' Ymin: ',g11.4,' Ymax: ', g11.4,' Range: ',g11.4)") &
+ & "('Xmin: ',g11.4,' Xmax: ',g11.4,' Range: ',g11.4,' &
+ & Ymin: ',g11.4,' Ymax: ', g11.4,' Range: ',g11.4)") &
& mxmin, mxmax, mxmax-mxmin, mymin, mymax, mymax-mymin
rangeid = gtk_label_new(trim(rangestr)//c_null_char)
call gtk_box_pack_start(jb, rangeid, FALSE, FALSE, 0_c_int)
@@ -372,7 +374,8 @@ program mandelbrot_zoom
status_bar = gtk_statusbar_new()
call gtk_box_pack_start(jb, status_bar, FALSE, FALSE, 0_c_int)
id = gtk_statusbar_push(status_bar, 0_c_int, &
- & "Left|Centre: mark region corner, Right: Reset, Wheel: Zoom in/out"//c_null_char)
+ & "Left|Centre: mark region corner, Right: Reset, Wheel: Zoom in/out" &
+ & //c_null_char)
call gtk_widget_show_all (my_window)
@@ -380,7 +383,8 @@ program mandelbrot_zoom
my_pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8_c_int, width, height)
nch = gdk_pixbuf_get_n_channels(my_pixbuf)
call c_f_pointer(gdk_pixbuf_get_pixels(my_pixbuf), pixel, &
- & (/nch, width, height/))
+ & int((/nch, width, height/)))
+ print *, shape(pixel)
rowstride = gdk_pixbuf_get_rowstride(my_pixbuf)
! We use char() because we need unsigned integers.
@@ -391,7 +395,7 @@ program mandelbrot_zoom
pixel(1,j,i)=char(0) ! Red
pixel(2,j,i)=char(0) ! Green
pixel(3,j,i)=char(0) ! Blue
- pixel(4,j,i)=char(255) ! Opacity (Alpha channel)
+ pixel(4,j,i)=char(255) ! Opacity (Alpha channel)
end do
end do
View
30 src/gdk-pixbuf-hl.f90
@@ -329,13 +329,14 @@ subroutine hl_gdk_pixbuf_get_pixels8(pixbuf, pixels)
type(c_ptr), target :: cpixels
integer(kind=c_int8_t), pointer, dimension(:) :: fpixels
integer :: i,j, iroff, ioff
- integer(kind=c_int) :: rowstr, nrows, ncols, nchans, lpix
+ integer(kind=c_int) :: rowstr, nrows, ncols, nchans
+ integer :: lpix
call hl_gdk_pixbuf_info(pixbuf, nchannels=nchans, height=nrows, &
& width=ncols, rowstride=rowstr)
allocate(pixels(nchans, ncols, nrows))
- lpix = rowstr*(nrows-1) + ncols
+ lpix = int(rowstr*(nrows-1) + ncols*nchans)
cpixels = gdk_pixbuf_get_pixels(pixbuf)
call c_f_pointer(cpixels, fpixels, [lpix])
@@ -368,13 +369,14 @@ subroutine hl_gdk_pixbuf_get_pixels16(pixbuf, pixels)
type(c_ptr), target :: cpixels
integer(kind=c_int8_t), pointer, dimension(:) :: fpixels
integer :: i,j, iroff, ioff
- integer(kind=c_int) :: rowstr, nrows, ncols, nchans, lpix
+ integer(kind=c_int) :: rowstr, nrows, ncols, nchans
+ integer :: lpix
call hl_gdk_pixbuf_info(pixbuf, nchannels=nchans, height=nrows, &
& width=ncols, rowstride=rowstr)
allocate(pixels(nchans, ncols, nrows))
- lpix = rowstr*(nrows-1) + ncols
+ lpix = int(rowstr*(nrows-1) + ncols*nchans)
cpixels = gdk_pixbuf_get_pixels(pixbuf)
call c_f_pointer(cpixels, fpixels, [lpix])
@@ -409,7 +411,8 @@ subroutine hl_gdk_pixbuf_set_pixels8(pixbuf, pixels, xoff, yoff)
!-
integer :: i,j, ioff, iroff, xstart, ystart, xtop, ytop, lput
- integer(kind=c_int) :: rowstr, nrows, ncols, nchans, lpix
+ integer(kind=c_int) :: rowstr, nrows, ncols, nchans
+ integer :: lpix
type(c_ptr), target :: cpixels
integer(kind=c_int8_t), pointer, dimension(:) :: fpixels
integer, dimension(3) :: sz
@@ -429,7 +432,7 @@ subroutine hl_gdk_pixbuf_set_pixels8(pixbuf, pixels, xoff, yoff)
call hl_gdk_pixbuf_info(pixbuf, nchannels=nchans, height=nrows, &
& width=ncols, rowstride=rowstr)
- lpix = rowstr*(nrows-1) + ncols
+ lpix = int(rowstr*(nrows-1) + ncols*nchans)
! Checks on sizes etc.
@@ -534,7 +537,8 @@ subroutine hl_gdk_pixbuf_set_pixels8g(pixbuf, pixels, xoff, yoff)
!-
integer :: i,j, ioff, iroff, xstart, ystart, xtop, ytop, lput
- integer(kind=c_int) :: rowstr, nrows, ncols, nchans, lpix
+ integer(kind=c_int) :: rowstr, nrows, ncols, nchans
+ integer :: lpix
type(c_ptr), target :: cpixels
integer(kind=c_int8_t), pointer, dimension(:) :: fpixels
integer, dimension(2) :: sz
@@ -553,7 +557,7 @@ subroutine hl_gdk_pixbuf_set_pixels8g(pixbuf, pixels, xoff, yoff)
call hl_gdk_pixbuf_info(pixbuf, nchannels=nchans, height=nrows, &
& width=ncols, rowstride=rowstr)
- lpix = rowstr*(nrows-1) + ncols
+ lpix = int(rowstr*(nrows-1) + ncols*nchans)
! Checks on sizes etc.
@@ -609,7 +613,8 @@ subroutine hl_gdk_pixbuf_set_pixels16(pixbuf, pixels, xoff, yoff)
!-
integer :: i,j, ioff, iroff, xstart, ystart, xtop, ytop, lput
- integer(kind=c_int) :: rowstr, nrows, ncols, nchans, lpix
+ integer(kind=c_int) :: rowstr, nrows, ncols, nchans
+ integer :: lpix
type(c_ptr), target :: cpixels
integer(kind=c_int8_t), pointer, dimension(:) :: fpixels
integer, dimension(3) :: sz
@@ -629,7 +634,7 @@ subroutine hl_gdk_pixbuf_set_pixels16(pixbuf, pixels, xoff, yoff)
call hl_gdk_pixbuf_info(pixbuf, nchannels=nchans, height=nrows, &
& width=ncols, rowstride=rowstr)
- lpix = rowstr*(nrows-1) + ncols
+ lpix = int(rowstr*(nrows-1) + ncols*nchans)
! Checks on sizes etc.
@@ -733,7 +738,8 @@ subroutine hl_gdk_pixbuf_set_pixels16g(pixbuf, pixels, xoff, yoff)
!-
integer :: i,j, ioff, iroff, xstart, ystart, xtop, ytop, lput
- integer(kind=c_int) :: rowstr, nrows, ncols, nchans, lpix
+ integer(kind=c_int) :: rowstr, nrows, ncols, nchans
+ integer :: lpix
type(c_ptr), target :: cpixels
integer(kind=c_int8_t), pointer, dimension(:) :: fpixels
integer, dimension(2) :: sz
@@ -752,7 +758,7 @@ subroutine hl_gdk_pixbuf_set_pixels16g(pixbuf, pixels, xoff, yoff)
call hl_gdk_pixbuf_info(pixbuf, nchannels=nchans, height=nrows, &
& width=ncols, rowstride=rowstr)
- lpix = rowstr*(nrows-1) + ncols
+ lpix = int(rowstr*(nrows-1) + ncols*nchans)
! Checks on sizes etc.
View
8 src/gtk-hl-entry-tmpl.f90
@@ -239,7 +239,7 @@ subroutine hl_gtk_entry_get_text(entry, text, status)
end if
ctext = gtk_entry_get_text(entry)
- call c_f_pointer(ctext, textptr, (/int(ntext,c_int)/))
+ call c_f_pointer(ctext, textptr, (/int(ntext)/))
call convert_c_string(textptr, text, istat)
if (present(status)) status=istat
@@ -592,7 +592,7 @@ subroutine hl_gtk_text_view_get_text(view, text, start_line, start_column, &
character(kind=c_char), dimension(:), pointer :: ftext0
type(gtktextiter), target :: s_iter, e_iter
integer(kind=c_int) :: ihid
- integer(kind=c_int) :: nchars_r
+ integer :: nchars_r
if (present(buffer)) then
tbuf = buffer
@@ -659,8 +659,8 @@ subroutine hl_gtk_text_view_get_text(view, text, start_line, start_column, &
ihid = TRUE
end if
ctext0 = gtk_text_buffer_get_text(tbuf, c_loc(s_iter), c_loc(e_iter), ihid)
- nchars_r = gtk_text_iter_get_offset(c_loc(e_iter)) - &
- & gtk_text_iter_get_offset(c_loc(s_iter)) + 1
+ nchars_r = int(gtk_text_iter_get_offset(c_loc(e_iter)) - &
+ & gtk_text_iter_get_offset(c_loc(s_iter))) + 1
call c_f_pointer(ctext0, ftext0, (/ nchars_r /))
call convert_c_string(ftext0, text)
View
12 src/gtk-hl-entry.f90
@@ -26,10 +26,10 @@
! --------------------------------------------------------
! gtk-hl-entry.f90
-! Generated: Fri Dec 7 05:01:37 2012 GMT
+! Generated: Mon Dec 24 00:30:42 2012 GMT
! Please do not edit this file directly,
! Edit gtk-hl-entry-tmpl.f90, and use ./mk_gtk_hl.pl to regenerate.
-! Generated for GTK+ version: 2.24.0.
+! Generated for GTK+ version: 3.4.0.
! Generated for GLIB version: 2.32.0.
! --------------------------------------------------------
@@ -238,7 +238,7 @@ subroutine hl_gtk_entry_get_text(entry, text, status)
end if
ctext = gtk_entry_get_text(entry)
- call c_f_pointer(ctext, textptr, (/int(ntext,c_int)/))
+ call c_f_pointer(ctext, textptr, (/int(ntext)/))
call convert_c_string(textptr, text, istat)
if (present(status)) status=istat
@@ -591,7 +591,7 @@ subroutine hl_gtk_text_view_get_text(view, text, start_line, start_column, &
character(kind=c_char), dimension(:), pointer :: ftext0
type(gtktextiter), target :: s_iter, e_iter
integer(kind=c_int) :: ihid
- integer(kind=c_int) :: nchars_r
+ integer :: nchars_r
if (present(buffer)) then
tbuf = buffer
@@ -658,8 +658,8 @@ subroutine hl_gtk_text_view_get_text(view, text, start_line, start_column, &
ihid = TRUE
end if
ctext0 = gtk_text_buffer_get_text(tbuf, c_loc(s_iter), c_loc(e_iter), ihid)
- nchars_r = gtk_text_iter_get_offset(c_loc(e_iter)) - &
- & gtk_text_iter_get_offset(c_loc(s_iter)) + 1
+ nchars_r = int(gtk_text_iter_get_offset(c_loc(e_iter)) - &
+ & gtk_text_iter_get_offset(c_loc(s_iter))) + 1
call c_f_pointer(ctext0, ftext0, (/ nchars_r /))
call convert_c_string(ftext0, text)
View
42 src/gtk-hl-tree-tmpl.f90
@@ -501,7 +501,6 @@ function hl_gtk_listn_get_selections(list, indices, selection) result(count)
!-
type(c_ptr) :: slist, vselection
- type(c_ptr), target :: model
integer(kind=c_int) :: i
type(c_ptr) :: cindex
integer(kind=c_int), pointer :: findex
@@ -513,7 +512,7 @@ function hl_gtk_listn_get_selections(list, indices, selection) result(count)
end if
slist = gtk_tree_selection_get_selected_rows(vselection, &
- & c_loc(model))
+ & c_null_ptr)
! If no selections, then set the count to 0 and return
if (.not. c_associated(slist)) then
@@ -1573,7 +1572,7 @@ function hl_gtk_tree_get_selections(tree, indices, depths, &
& intent(out), optional :: indices
integer(kind=c_int), dimension(:), allocatable, target, &
& intent(out), optional :: depths
- type(c_ptr), optional :: selection
+ type(c_ptr), intent(in), optional :: selection
! Get the indices of the selected rows
!
@@ -1594,7 +1593,6 @@ function hl_gtk_tree_get_selections(tree, indices, depths, &
!-
type(c_ptr) :: slist, vselection
- type(c_ptr), target :: model
integer(kind=c_int) :: i
integer(kind=c_int) :: maxdepth
integer(kind=c_int), dimension(:), pointer :: idxl
@@ -1608,7 +1606,7 @@ function hl_gtk_tree_get_selections(tree, indices, depths, &
end if
slist = gtk_tree_selection_get_selected_rows(vselection, &
- & c_loc(model))
+ & c_null_ptr)
! If no selections, then set the count to 0 and return
if (.not. c_associated(slist)) then
@@ -1626,18 +1624,17 @@ function hl_gtk_tree_get_selections(tree, indices, depths, &
maxdepth = 0
do i = 1, count
maxdepth = max(maxdepth, &
- & gtk_tree_path_get_depth(g_list_nth_data(slist, i-1_c_int))&
- & +1_c_int)
+ & gtk_tree_path_get_depth(g_list_nth_data(slist, i-1_c_int)))
end do
allocate(indices(maxdepth,count))
if (present(depths)) allocate(depths(count))
do i = 1, count
- idxlc = gtk_tree_path_get_indices_with_depth(g_list_nth_data(slist,&
- & i-1_c_int),&
+ idxlc = gtk_tree_path_get_indices_with_depth( &
+ & g_list_nth_data(slist, i-1_c_int), &
& c_loc(dep))
- call c_f_pointer(idxlc, idxl, (/ dep /) )
+ call c_f_pointer(idxlc, idxl, (/ int(dep) /) )
indices(:dep,i) = idxl
if (present(depths)) depths(i) = dep
end do
@@ -1952,13 +1949,12 @@ subroutine hl_gtk_listn_edit_cb(renderer, path, text, gdata) bind(c)
integer :: ios
type(c_ptr) :: pcol, list
- call convert_c_string(path, 200_c_int, fpath)
+ call convert_c_string(path, fpath)
read(fpath, *) irow
pcol = g_object_get_data(renderer, "column-number"//c_null_char)
call c_f_pointer(pcol, icol)
- call convert_c_string(text, 200_c_int, ftext)
+ call convert_c_string(text, ftext)
list = g_object_get_data(renderer, "view"//c_null_char)
-
call hl_gtk_listn_set_cell(list, irow, icol, &
& svalue=trim(ftext))
end subroutine hl_gtk_listn_edit_cb
@@ -1986,14 +1982,13 @@ subroutine hl_gtk_listn_toggle_cb(renderer, path, gdata) bind(c)
type(c_ptr) :: pcol, list
logical :: state
- call convert_c_string(path, 200_c_int, fpath)
+ call convert_c_string(path, fpath)
read(fpath, *) irow
pcol = g_object_get_data(renderer, "column-number"//c_null_char)
call c_f_pointer(pcol, icol)
list = g_object_get_data(renderer, "view"//c_null_char)
-
state = c_f_logical(gtk_cell_renderer_toggle_get_active(renderer))
call hl_gtk_listn_set_cell(list, irow, icol, &
& logvalue= .not. state)
@@ -2024,14 +2019,13 @@ subroutine hl_gtk_listn_rtoggle_cb(renderer, path, gdata) bind(c)
logical :: state
integer(kind=c_int) :: nrows
- call convert_c_string(path, 200_c_int, fpath)
+ call convert_c_string(path, fpath)
read(fpath, *) irow
pcol = g_object_get_data(renderer, "column-number"//c_null_char)
call c_f_pointer(pcol, icol)
list = g_object_get_data(renderer, "view"//c_null_char)
-
state = c_f_logical(gtk_cell_renderer_toggle_get_active(renderer))
if (state) return ! Don't act on an unset
@@ -2069,10 +2063,10 @@ subroutine hl_gtk_tree_edit_cb(renderer, path, text, gdata) bind(c)
integer :: ios, i, n
type(c_ptr) :: tree, pcol
- call convert_c_string(path, 200_c_int, fpath)
+ call convert_c_string(path, fpath)
pcol = g_object_get_data(renderer, "column-number"//c_null_char)
call c_f_pointer(pcol, icol)
- call convert_c_string(text, 200_c_int, ftext)
+ call convert_c_string(text, ftext)
n = 0
do i = 1, len_trim(fpath)
@@ -2114,7 +2108,7 @@ subroutine hl_gtk_tree_toggle_cb(renderer, path, gdata) bind(c)
type(c_ptr) :: pcol, tree
logical :: state
- call convert_c_string(path, 200_c_int, fpath)
+ call convert_c_string(path, fpath)
n = 0
do i = 1, len_trim(fpath)
if (fpath(i:i) == ":") then
@@ -2162,7 +2156,7 @@ subroutine hl_gtk_tree_rtoggle_cb(renderer, path, gdata) bind(c)
type(gtktreeiter), target :: iter, piter
integer(kind=c_int) :: valid, nchild
- call convert_c_string(path, 200_c_int, fpath)
+ call convert_c_string(path, fpath)
n = 0
do i = 1, len_trim(fpath)
if (fpath(i:i) == ":") then
@@ -2196,7 +2190,7 @@ subroutine hl_gtk_tree_rtoggle_cb(renderer, path, gdata) bind(c)
do
ipath = gtk_tree_model_get_string_from_iter (tree_model, c_loc(iter))
- call convert_c_string(ipath, 200_c_int, fpath)
+ call convert_c_string(ipath, fpath)
n = 0
do i = 1, len_trim(fpath)
if (fpath(i:i) == ":") then
@@ -2287,7 +2281,7 @@ subroutine hl_gtk_list_tree_add_column(icol, view, is_list, type, &
& data_edited_combo, changed_combo, data_changed_combo, toggled_radio, &
& data_toggled_radio)
integer(kind=c_int), intent(in) :: icol
- type(c_ptr), intent(in) :: view
+ type(c_ptr), intent(in), target :: view
logical, intent(in) :: is_list
integer(kind=type_kind), intent(in) :: type
integer(kind=c_int), dimension(:), optional, intent(in) :: editable, &
@@ -3138,7 +3132,7 @@ subroutine hl_gtk_list_tree_get_gvalue(val, ctype, &
case (G_TYPE_STRING)
if (present(svalue)) then
cstr = g_value_get_string(val)
- call convert_c_string(cstr, int(len(svalue), c_int), svalue)
+ call convert_c_string(cstr, svalue)
else
write(error_unit,*) "hl_gtk_list_tree_get_gvalue:: "//&
& "Cannot return 'string' type to any available output"
View
46 src/gtk-hl-tree.f90
@@ -26,10 +26,10 @@
! --------------------------------------------------------
! gtk-hl-tree.f90
-! Generated: Sat Dec 8 20:28:44 2012 GMT
+! Generated: Sun Dec 23 20:46:59 2012 GMT
! Please do not edit this file directly,
! Edit gtk-hl-tree-tmpl.f90, and use ./mk_gtk_hl.pl to regenerate.
-! Generated for GTK+ version: 2.24.0.
+! Generated for GTK+ version: 3.4.0.
! Generated for GLIB version: 2.32.0.
! --------------------------------------------------------
@@ -500,7 +500,6 @@ function hl_gtk_listn_get_selections(list, indices, selection) result(count)
!-
type(c_ptr) :: slist, vselection
- type(c_ptr), target :: model
integer(kind=c_int) :: i
type(c_ptr) :: cindex
integer(kind=c_int), pointer :: findex
@@ -512,7 +511,7 @@ function hl_gtk_listn_get_selections(list, indices, selection) result(count)
end if
slist = gtk_tree_selection_get_selected_rows(vselection, &
- & c_loc(model))
+ & c_null_ptr)
! If no selections, then set the count to 0 and return
if (.not. c_associated(slist)) then
@@ -1572,7 +1571,7 @@ function hl_gtk_tree_get_selections(tree, indices, depths, &
& intent(out), optional :: indices
integer(kind=c_int), dimension(:), allocatable, target, &
& intent(out), optional :: depths
- type(c_ptr), optional :: selection
+ type(c_ptr), intent(in), optional :: selection
! Get the indices of the selected rows
!
@@ -1593,7 +1592,6 @@ function hl_gtk_tree_get_selections(tree, indices, depths, &
!-
type(c_ptr) :: slist, vselection
- type(c_ptr), target :: model
integer(kind=c_int) :: i
integer(kind=c_int) :: maxdepth
integer(kind=c_int), dimension(:), pointer :: idxl
@@ -1607,7 +1605,7 @@ function hl_gtk_tree_get_selections(tree, indices, depths, &
end if
slist = gtk_tree_selection_get_selected_rows(vselection, &
- & c_loc(model))
+ & c_null_ptr)
! If no selections, then set the count to 0 and return
if (.not. c_associated(slist)) then
@@ -1625,18 +1623,17 @@ function hl_gtk_tree_get_selections(tree, indices, depths, &
maxdepth = 0
do i = 1, count
maxdepth = max(maxdepth, &
- & gtk_tree_path_get_depth(g_list_nth_data(slist, i-1_c_int))&
- & +1_c_int)
+ & gtk_tree_path_get_depth(g_list_nth_data(slist, i-1_c_int)))
end do
allocate(indices(maxdepth,count))
if (present(depths)) allocate(depths(count))
do i = 1, count
- idxlc = gtk_tree_path_get_indices_with_depth(g_list_nth_data(slist,&
- & i-1_c_int),&
+ idxlc = gtk_tree_path_get_indices_with_depth( &
+ & g_list_nth_data(slist, i-1_c_int), &
& c_loc(dep))
- call c_f_pointer(idxlc, idxl, (/ dep /) )
+ call c_f_pointer(idxlc, idxl, (/ int(dep) /) )
indices(:dep,i) = idxl
if (present(depths)) depths(i) = dep
end do
@@ -1951,13 +1948,12 @@ subroutine hl_gtk_listn_edit_cb(renderer, path, text, gdata) bind(c)
integer :: ios
type(c_ptr) :: pcol, list
- call convert_c_string(path, 200_c_int, fpath)
+ call convert_c_string(path, fpath)
read(fpath, *) irow
pcol = g_object_get_data(renderer, "column-number"//c_null_char)
call c_f_pointer(pcol, icol)
- call convert_c_string(text, 200_c_int, ftext)
+ call convert_c_string(text, ftext)
list = g_object_get_data(renderer, "view"//c_null_char)
-
call hl_gtk_listn_set_cell(list, irow, icol, &
& svalue=trim(ftext))
end subroutine hl_gtk_listn_edit_cb
@@ -1985,14 +1981,13 @@ subroutine hl_gtk_listn_toggle_cb(renderer, path, gdata) bind(c)
type(c_ptr) :: pcol, list
logical :: state
- call convert_c_string(path, 200_c_int, fpath)
+ call convert_c_string(path, fpath)
read(fpath, *) irow
pcol = g_object_get_data(renderer, "column-number"//c_null_char)
call c_f_pointer(pcol, icol)
list = g_object_get_data(renderer, "view"//c_null_char)
-
state = c_f_logical(gtk_cell_renderer_toggle_get_active(renderer))
call hl_gtk_listn_set_cell(list, irow, icol, &
& logvalue= .not. state)
@@ -2023,14 +2018,13 @@ subroutine hl_gtk_listn_rtoggle_cb(renderer, path, gdata) bind(c)
logical :: state
integer(kind=c_int) :: nrows
- call convert_c_string(path, 200_c_int, fpath)
+ call convert_c_string(path, fpath)
read(fpath, *) irow
pcol = g_object_get_data(renderer, "column-number"//c_null_char)
call c_f_pointer(pcol, icol)
list = g_object_get_data(renderer, "view"//c_null_char)
-
state = c_f_logical(gtk_cell_renderer_toggle_get_active(renderer))
if (state) return ! Don't act on an unset
@@ -2068,10 +2062,10 @@ subroutine hl_gtk_tree_edit_cb(renderer, path, text, gdata) bind(c)
integer :: ios, i, n
type(c_ptr) :: tree, pcol
- call convert_c_string(path, 200_c_int, fpath)
+ call convert_c_string(path, fpath)
pcol = g_object_get_data(renderer, "column-number"//c_null_char)
call c_f_pointer(pcol, icol)
- call convert_c_string(text, 200_c_int, ftext)
+ call convert_c_string(text, ftext)
n = 0
do i = 1, len_trim(fpath)
@@ -2113,7 +2107,7 @@ subroutine hl_gtk_tree_toggle_cb(renderer, path, gdata) bind(c)
type(c_ptr) :: pcol, tree
logical :: state
- call convert_c_string(path, 200_c_int, fpath)
+ call convert_c_string(path, fpath)
n = 0
do i = 1, len_trim(fpath)
if (fpath(i:i) == ":") then
@@ -2161,7 +2155,7 @@ subroutine hl_gtk_tree_rtoggle_cb(renderer, path, gdata) bind(c)
type(gtktreeiter), target :: iter, piter
integer(kind=c_int) :: valid, nchild
- call convert_c_string(path, 200_c_int, fpath)
+ call convert_c_string(path, fpath)
n = 0
do i = 1, len_trim(fpath)
if (fpath(i:i) == ":") then
@@ -2195,7 +2189,7 @@ subroutine hl_gtk_tree_rtoggle_cb(renderer, path, gdata) bind(c)
do
ipath = gtk_tree_model_get_string_from_iter (tree_model, c_loc(iter))
- call convert_c_string(ipath, 200_c_int, fpath)
+ call convert_c_string(ipath, fpath)
n = 0
do i = 1, len_trim(fpath)
if (fpath(i:i) == ":") then
@@ -2286,7 +2280,7 @@ subroutine hl_gtk_list_tree_add_column(icol, view, is_list, type, &
& data_edited_combo, changed_combo, data_changed_combo, toggled_radio, &
& data_toggled_radio)
integer(kind=c_int), intent(in) :: icol
- type(c_ptr), intent(in) :: view
+ type(c_ptr), intent(in), target :: view
logical, intent(in) :: is_list
integer(kind=type_kind), intent(in) :: type
integer(kind=c_int), dimension(:), optional, intent(in) :: editable, &
@@ -3137,7 +3131,7 @@ subroutine hl_gtk_list_tree_get_gvalue(val, ctype, &
case (G_TYPE_STRING)
if (present(svalue)) then
cstr = g_value_get_string(val)
- call convert_c_string(cstr, int(len(svalue), c_int), svalue)
+ call convert_c_string(cstr, svalue)
else
write(error_unit,*) "hl_gtk_list_tree_get_gvalue:: "//&
& "Cannot return 'string' type to any available output"
View
12 src/gtk-sup.f90
@@ -516,14 +516,14 @@ end subroutine convert_c_string_array
!+
subroutine convert_c_string_scalar_cptr(ctext, clen, f_string, status)
type(c_ptr), intent(in) :: ctext
- integer(kind=c_int), intent(in) :: clen
+ integer, intent(in) :: clen
character(len=*), intent(out) :: f_string
- integer(kind=c_int), intent(out), optional :: status
+ integer, intent(out), optional :: status
! Convert a null-terminated c-string to a fortran string
!
! CTEXT: c_ptr: required: A C poiner to string to be converted.
- ! CLEN: c_int: required: The length of the string (or of the Fortran
+ ! CLEN: int: required: The length of the string (or of the Fortran
! string if the C-string is of unknow length,=.
! F_STRING: f_string: required: A Scalar Fortran string.
! STATUS: integer: optional: Is set to -1 if the Fortran string
@@ -552,14 +552,14 @@ end subroutine convert_c_string_scalar_cptr
!+
subroutine convert_c_string_array_cptr(ctext, clen, f_string, status)
type(c_ptr), intent(in) :: ctext
- integer(kind=c_int), intent(in) :: clen
+ integer, intent(in) :: clen
character(len=*), intent(out), dimension(:), allocatable :: f_string
integer, intent(out), optional :: status
! Convert a null-terminated LF-separated c-string into a fortran
! string array
! CTEXT: c_ptr: required: A C poiner to string to be converted.
- ! CLEN: c_int: required: The length of the string (or of the Fortran
+ ! CLEN: int: required: The length of the string (or of the Fortran
! string if the C-string is of unknown length,=.
! F_STRING: f_string(): required: A Fortran string. array
! STATUS: integer: optional: Is set to -1 if the Fortran string
@@ -625,7 +625,7 @@ subroutine convert_c_string_scalar_cptr1(ctext, f_string, status)
integer :: i
character(kind=c_char), dimension(:), pointer :: textptr
- integer(kind=c_int) :: clen
+ integer :: clen
clen = len(f_string)
call c_f_pointer(ctext, textptr, (/ clen /))
Please sign in to comment.
Something went wrong with that request. Please try again.