#!./ginsbasic001ok
include "wxbasicscript/basefunctions.inc"

gtkdocdir = "/mnt/sda7/gtk/gtk/share/gtk-doc/html/"


workingfiles = {
"gtk/GtkWindow.html",
"gtk/gtk-General.html",
"gtk/gtk-Keyboard-Accelerators.html",
"--gtk/gtk-Drag-and-Drop.html",
"gtk/GtkIconTheme.html",
"gtk/gtk-Clipboards.html",
"gtk/gtk-Resource-Files.html",
"--gtk/GtkStyle.html",
"gtk/gtk-Feature-Test-Macros.html",
"gtk/GtkLabel.html", 
"gtk/GtkButton.html",
"gtk/GtkFileChooser.html",
"gtk/GtkFileChooserButton.html",
"gtk/GtkFileSelection.html",
"gtk/GtkColorButton.html",
"gtk/GtkTextBuffer.html",
"gtk/gtk-GtkTextIter.html",
"gtk/GtkTextView.html",
"gtk/GtkEntry.html",
"gtk/GtkBox.html",
"gtk/GtkWidget.html",
"gtk/GtkDialog.html",
"gtk/GtkCheckButton.html",
"gtk/gtk-gtkfilefilter.html"
}


'workingfiles = {
'"gtk/GtkWindow.html",
'"gtk/GtkLabel.html--"
'"gtk/GtkRadioButton.html",
'"glib/glib-Singly-Linked-Lists.html"
'}


allowedargs = {
"void " ,
"gint " ,
"gboolean " ,
"gdouble " ,
"const gchar " ,
"const gchar* ",
"gchar ",
"gchar* " ,
"gfloat ",
"GtkBox",
"GtkLabel",
"GtkTextBuffer",
"GtkTextView",
"GtkButton",
"GtkWindow",
"GtkEntry",
"GtkWidget",
"GtkContainer",
"GtkDialog",
"GtkCheckButton",
"GtkFileFilter"
}


droppedfunctions = {}
droppedfunctionscounter = 0
usedfunctions = {}
usedfunctionscounter = 0


functionlist = {}
fc = 0
for each thefile in workingfiles

thefile = gtkdocdir & thefile
print "----------------------------------" & thefile

html = {}
html = readfiletolist(thefile)

print count(html)
c=0
done = 0
//for each theline in html

for l=0 to count(html)-1
theline = html[l]


  if instr(theline , "<pre") then
    start = 1
  end if

  if done = 0 then
  if start = 1 then
  if left(theline , 1) != " " then

//if instr(theline , "gtk_text_view_get_buffer") then print "    ---" & theline

  for n = 1 to 20
    nextline = html[c+n]
    if left(nextline , 1) = " " or left(nextline , 4)="href" or left(nextline , 1) = ">" then
      nextline = trim(nextline)
      theline &= nextline
    else
      'n=21
      break
    end if
  next
newline = removehtml( theline )
//if instr(newline , "gtk_text_view_get_buffer") then print "    -----" & newline
newline = replace (newline , " * " , "* ")
'print newline
for each check in allowedargs
  if left(newline , len(check)) = check then

//if instr(newline , "gtk_text_view_get_buffer") then print "    -------" & newline

    while instr(newline , "  ")
      newline = replace(newline , "  " , " ")
    wend

    // remove functions that are pointers
    acheck = cutleft(newline , check)
    if left(acheck , 1) != "(" then
      print newline
      functionlist[fc] = newline
      fc += 1
    end if
  end if
next
  end if
  end if
  end if

  if instr(theline , "</pre>") then
    start = 0
    done = 1
  end if
  c+=1
next

next

writelisttofile("gtkfunctions.txt" , functionlist)

for each used in usedfunctions
  print used
next

for each dropped in droppedfunctions
  print dropped
next



