System.Data.SQLite
Check-in [38521bfdf8]
Not logged in

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

Overview
Comment:Enhance virtual table documentation importer script tool so that it can handle 'DRAFT' documentation.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 38521bfdf8ade8396afd2210bace8cdbeb9e00f2
User & Date: mistachkin 2015-12-04 21:35:13
Context
2015-12-05
00:56
Tweak version history docs. check-in: a723103a3b user: mistachkin tags: trunk
2015-12-04
21:35
Enhance virtual table documentation importer script tool so that it can handle 'DRAFT' documentation. check-in: 38521bfdf8 user: mistachkin tags: trunk
21:08
Slightly simplify using statements when compiled for the .NET Compact Framework. check-in: 3c7977f4b3 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Doc/vtab.tcl.

179
180
181
182
183
184
185







186
187
188
189
190
191
192
193
...
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
...
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245

246
247
248
249
250
251
252
253
254
255
256
257
258
259
set outputFileName [file join $interfacePath ISQLiteNativeModule.cs]

if {![file exists $outputFileName]} then {
  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]

................................................................................
  } 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

#
# NOTE: These method names must be processed in the EXACT order that they
#       appear in the output file.
#
foreach name [list \
................................................................................
    xFilter xNext xEof xColumn xRowid xUpdate xBegin xSync xCommit \
    xRollback xFindFunction xRename xSavepoint xRelease xRollbackTo] {
  #
  # HACK: This assumes that a line of 71 forward slashes will be present
  #       before each method, except for the first one.
  #
  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 -nocase -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]
}

exit 0







>
>
>
>
>
>
>
|







 







|







 







|











|



>
|
|








|



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
...
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
...
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
set outputFileName [file join $interfacePath ISQLiteNativeModule.cs]

if {![file exists $outputFileName]} then {
  puts "output file \"$outputFileName\" does not exist"
  exit 1
}

set inputData [readFile $inputFileName]

set inputData [string map [list \
    {<font size="6" color="red">*** DRAFT ***</font>} ""] $inputData]

set inputData [string map [list {<p align="center"></p>} ""] $inputData]

set lines [split [string map [list \r\n \n] $inputData] \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]

................................................................................
  } elseif {[regexp -- {^<h2>2\.0 Virtual Table Methods</h2>$} $line]} then {
    set start true; incr index
  } else {
    incr index
  }
}

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

#
# NOTE: These method names must be processed in the EXACT order that they
#       appear in the output file.
#
foreach name [list \
................................................................................
    xFilter xNext xEof xColumn xRowid xUpdate xBegin xSync xCommit \
    xRollback xFindFunction xRename xSavepoint xRelease xRollbackTo] {
  #
  # HACK: This assumes that a line of 71 forward slashes will be present
  #       before each method, except for the first one.
  #
  if {$count > 0} then {
    set start [string first [string repeat / 71] $outputData $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 -nocase -start \
      $start -line -indices -- $pattern $outputData dummy indexes]} then {
    set summaryStart [lindex $indexes 0]
    set summaryEnd [lindex $indexes 1]

    set outputData [string range \
        $outputData 0 $summaryStart]$methods($name)[string \
        range $outputData [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] $outputData]
}

exit 0