System.Data.SQLite
Check-in [17daddabf3]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:More fixes to input file processing. Initial work on output file processing.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | vtabDocComments
Files: files | file ages | folders
SHA1: 17daddabf30b084f9a32d2cec140f79cc462e8c5
User & Date: mistachkin 2015-10-18 04:31:27
Context
2015-10-18
05:10
More output file fixes. The tool is now working. check-in: 1129095ae9 user: mistachkin tags: vtabDocComments
04:31
More fixes to input file processing. Initial work on output file processing. check-in: 17daddabf3 user: mistachkin tags: vtabDocComments
01:56
Consistently handle the special case of the first line, even when it seems impossible. check-in: 2e0349b541 user: mistachkin tags: vtabDocComments
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Doc/vtab.tcl.

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
..
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
..
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
...
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134





135
136
137
138
139
140
141
142
143
144
145
146
147
...
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
...
207
208
209
210
211
212
213
214



































215
      lappend result $element
    }
  }

  return $result
}
 
proc processLine { line } {
  if {[string length [string trim $line]] == 0 || \
      [regexp -- {<h\d(?: |>)} [string range $line 0 3]]} then {
    return ""
  }

  set result $line

................................................................................
    regsub -all -- $remove $result "" result

    if {[string length [string trim $result]] == 0} then {
      return ""
    }
  }

  regsub -all -- {<br>} $result \n result
  regsub -all -- {&ne;} $result {\&#8800;} result
  regsub -all -- {&#91(?:;)?} $result {[} result
  regsub -all -- {&#93(?:;)?} $result {]} result
  regsub -all -- {<( |\"|\d|=)} $result {\&lt;\1} result
  regsub -all -- {( |\"|\d|=)>} $result {\1\&gt;} result
  regsub -all -- {<blockquote><pre>} $result <code> result
  regsub -all -- {</pre></blockquote>} $result </code> result
  regsub -all -- {<blockquote>} $result <code> result
  regsub -all -- {</blockquote>} $result </code> result

  return $result
}
 
proc extractMethod { name lines pattern prefix indexVarName methodsVarName } {
  upvar 1 $indexVarName index
  upvar 1 $methodsVarName methods
................................................................................
          append data $prefix </para>
        }

        incr paragraph -1
      } elseif {[string range $trimLine 0 2] eq "<p>"} then {
        # open paragraph ... maybe one line?
        if {[string range $trimLine end-3 end] eq "</p>"} then {
          set newLine [processLine $line]

          if {[string length $newLine] > 0} then {
            # one line paragraph, wrap.
            if {[info exists methods($name)]} then {
              # non-first line, leading line separator.
              append data \n $prefix <para>
            } else {
................................................................................
              append data $prefix <para>
            }

            append data \n $prefix $newLine
            append data \n $prefix </para>
          }
        } else {
          append data \n $prefix <para>

          set newLine [processLine $line]

          if {[string length $newLine] > 0} then {
            # open paragraph, add line to it.
            if {[info exists methods($name)]} then {
              # non-first line, leading line separator.
              append data \n $prefix $newLine
            } else {
              # first line, no leading line separator.
              append data $prefix $newLine
            }





          }

          incr paragraph
        }
      } else {
        set newLine [processLine $line]

        if {[string length $newLine] > 0} then {
          if {[info exists methods($name)]} then {
            # non-first line, leading line separator.
            append data \n $prefix $newLine
          } else {
            # first line, no leading line separator.
................................................................................
  puts "output file \"$outputFileName\" does not exist"
  exit 1
}

set lines [split [string map [list \r\n \n] [readFile $inputFileName]] \n]
set patterns(method) {^<h3>2\.\d+ The (.*) Method(?:s)?</h3>$}
set prefix "        /// "
set start false; array set methods {}

for {set index 0} {$index < [llength $lines]} {} {
  set line [lindex $lines $index]

  if {$start} then {
    if {[regexp -- {^<a name=".*"></a>$} $line]} then {
      incr index; continue
    }

    if {[regexp -- $patterns(method) $line dummy capture]} then {
      foreach method [englishToList $capture] {
        set methodIndex [expr {$index + 1}]

        extractMethod \
            $method $lines $patterns(method) $prefix methodIndex methods
      }
................................................................................
    }
  } elseif {[regexp -- {^<h2>2\.0 Virtual Table Methods</h2>$} $line]} then {
    set start true; incr index
  } else {
    incr index
  }
}




































# exit 0







|







 







|





|
|
|
|







 







|







 







<
<
<
<
<
<
|
|
|
|
|
|
|
>
>
>
>
>





|







 







|





<
<
<
<







 








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
..
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
..
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
...
115
116
117
118
119
120
121






122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
...
178
179
180
181
182
183
184
185
186
187
188
189
190




191
192
193
194
195
196
197
...
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
      lappend result $element
    }
  }

  return $result
}
 
proc processLine { line prefix } {
  if {[string length [string trim $line]] == 0 || \
      [regexp -- {<h\d(?: |>)} [string range $line 0 3]]} then {
    return ""
  }

  set result $line

................................................................................
    regsub -all -- $remove $result "" result

    if {[string length [string trim $result]] == 0} then {
      return ""
    }
  }

  regsub -all -- {<br>} $result \n[escapeSubSpec $prefix] result
  regsub -all -- {&ne;} $result {\&#8800;} result
  regsub -all -- {&#91(?:;)?} $result {[} result
  regsub -all -- {&#93(?:;)?} $result {]} result
  regsub -all -- {<( |\"|\d|=)} $result {\&lt;\1} result
  regsub -all -- {( |\"|\d|=)>} $result {\1\&gt;} result
  regsub -all -- {<blockquote><pre>} $result <para><code> result
  regsub -all -- {</pre></blockquote>} $result </code></para> result
  regsub -all -- {<blockquote>} $result <para><code> result
  regsub -all -- {</blockquote>} $result </code></para> result

  return $result
}
 
proc extractMethod { name lines pattern prefix indexVarName methodsVarName } {
  upvar 1 $indexVarName index
  upvar 1 $methodsVarName methods
................................................................................
          append data $prefix </para>
        }

        incr paragraph -1
      } elseif {[string range $trimLine 0 2] eq "<p>"} then {
        # open paragraph ... maybe one line?
        if {[string range $trimLine end-3 end] eq "</p>"} then {
          set newLine [processLine $line $prefix]

          if {[string length $newLine] > 0} then {
            # one line paragraph, wrap.
            if {[info exists methods($name)]} then {
              # non-first line, leading line separator.
              append data \n $prefix <para>
            } else {
................................................................................
              append data $prefix <para>
            }

            append data \n $prefix $newLine
            append data \n $prefix </para>
          }
        } else {






          if {[info exists methods($name)]} then {
            # non-first line, leading line separator.
            append data \n $prefix <para>
          } else {
            # first line, no leading line separator.
            append data $prefix <para>
          }

          set newLine [processLine $line $prefix]

          if {[string length $newLine] > 0} then {
            append data \n $prefix $newLine
          }

          incr paragraph
        }
      } else {
        set newLine [processLine $line $prefix]

        if {[string length $newLine] > 0} then {
          if {[info exists methods($name)]} then {
            # non-first line, leading line separator.
            append data \n $prefix $newLine
          } else {
            # first line, no leading line separator.
................................................................................
  puts "output file \"$outputFileName\" does not exist"
  exit 1
}

set lines [split [string map [list \r\n \n] [readFile $inputFileName]] \n]
set patterns(method) {^<h3>2\.\d+ The (.*) Method(?:s)?</h3>$}
set prefix "        /// "
unset -nocomplain methods; set start false

for {set index 0} {$index < [llength $lines]} {} {
  set line [lindex $lines $index]

  if {$start} then {




    if {[regexp -- $patterns(method) $line dummy capture]} then {
      foreach method [englishToList $capture] {
        set methodIndex [expr {$index + 1}]

        extractMethod \
            $method $lines $patterns(method) $prefix methodIndex methods
      }
................................................................................
    }
  } elseif {[regexp -- {^<h2>2\.0 Virtual Table Methods</h2>$} $line]} then {
    set start true; incr index
  } else {
    incr index
  }
}

set data [string map [list \r\n \n] [readFile $outputFileName]]
set count 0; set start 0

foreach name [array names methods] {
  if {$count > 0} then {
    set start [string first [string repeat / 71] $data $start]
  }

  set pattern ""

  append pattern ^ {\s{8}} "/// <summary>"
  append pattern {((?:.|\n)*?)}
  append pattern {\n\s{8}} "/// </summary>"
  append pattern {(?:(?:.|\n)*?)}
  append pattern {\n\s{8}[\w]+?\s+?} $name {\($}

  if {[regexp -start \
      $start -line -indices -- $pattern $data dummy indexes]} then {
    set summaryStart [lindex $indexes 0]
    set summaryEnd [lindex $indexes 1]

    set data [string range $data 0 $summaryStart]$methods($name)[string \
        range $data [expr {$summaryEnd + 1}] end]

    incr count; set start [expr {$summaryEnd + 1}]
  } else {
    error "cannot find virtual table method \"$name\" in \"$outputFileName\""
  }
}

if {$count > 0} then {
  # writeFile $outputFileName [string map [list \n \r\n] $data]
  writeFile $outputFileName.new [string map [list \n \r\n] $data]
}

# exit 0