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 Side-by-Side Diffs Ignore Whitespace Patch

Changes to Doc/vtab.tcl.

   179    179   set outputFileName [file join $interfacePath ISQLiteNativeModule.cs]
   180    180   
   181    181   if {![file exists $outputFileName]} then {
   182    182     puts "output file \"$outputFileName\" does not exist"
   183    183     exit 1
   184    184   }
   185    185   
   186         -set lines [split [string map [list \r\n \n] [readFile $inputFileName]] \n]
          186  +set inputData [readFile $inputFileName]
          187  +
          188  +set inputData [string map [list \
          189  +    {<font size="6" color="red">*** DRAFT ***</font>} ""] $inputData]
          190  +
          191  +set inputData [string map [list {<p align="center"></p>} ""] $inputData]
          192  +
          193  +set lines [split [string map [list \r\n \n] $inputData] \n]
   187    194   set patterns(method) {^<h3>2\.\d+ The (.*) Method(?:s)?</h3>$}
   188    195   set prefix "        /// "
   189    196   unset -nocomplain methods; set start false
   190    197   
   191    198   for {set index 0} {$index < [llength $lines]} {} {
   192    199     set line [lindex $lines $index]
   193    200   
................................................................................
   207    214     } elseif {[regexp -- {^<h2>2\.0 Virtual Table Methods</h2>$} $line]} then {
   208    215       set start true; incr index
   209    216     } else {
   210    217       incr index
   211    218     }
   212    219   }
   213    220   
   214         -set data [string map [list \r\n \n] [readFile $outputFileName]]
          221  +set outputData [string map [list \r\n \n] [readFile $outputFileName]]
   215    222   set count 0; set start 0
   216    223   
   217    224   #
   218    225   # NOTE: These method names must be processed in the EXACT order that they
   219    226   #       appear in the output file.
   220    227   #
   221    228   foreach name [list \
................................................................................
   223    230       xFilter xNext xEof xColumn xRowid xUpdate xBegin xSync xCommit \
   224    231       xRollback xFindFunction xRename xSavepoint xRelease xRollbackTo] {
   225    232     #
   226    233     # HACK: This assumes that a line of 71 forward slashes will be present
   227    234     #       before each method, except for the first one.
   228    235     #
   229    236     if {$count > 0} then {
   230         -    set start [string first [string repeat / 71] $data $start]
          237  +    set start [string first [string repeat / 71] $outputData $start]
   231    238     }
   232    239   
   233    240     set pattern ""
   234    241   
   235    242     append pattern ^ {\s{8}} "/// <summary>"
   236    243     append pattern {((?:.|\n)*?)}
   237    244     append pattern {\n\s{8}} "/// </summary>"
   238    245     append pattern {(?:(?:.|\n)*?)}
   239    246     append pattern {\n\s{8}[\w]+?\s+?} $name {\($}
   240    247   
   241    248     if {[regexp -nocase -start \
   242         -      $start -line -indices -- $pattern $data dummy indexes]} then {
          249  +      $start -line -indices -- $pattern $outputData dummy indexes]} then {
   243    250       set summaryStart [lindex $indexes 0]
   244    251       set summaryEnd [lindex $indexes 1]
   245    252   
   246         -    set data [string range $data 0 $summaryStart]$methods($name)[string \
   247         -        range $data [expr {$summaryEnd + 1}] end]
          253  +    set outputData [string range \
          254  +        $outputData 0 $summaryStart]$methods($name)[string \
          255  +        range $outputData [expr {$summaryEnd + 1}] end]
   248    256   
   249    257       incr count; set start [expr {$summaryEnd + 1}]
   250    258     } else {
   251    259       error "cannot find virtual table method \"$name\" in \"$outputFileName\""
   252    260     }
   253    261   }
   254    262   
   255    263   if {$count > 0} then {
   256         -  writeFile $outputFileName [string map [list \n \r\n] $data]
          264  +  writeFile $outputFileName [string map [list \n \r\n] $outputData]
   257    265   }
   258    266   
   259    267   exit 0