System.Data.SQLite

Check-in [d8c22e8ff7]
Login

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

Overview
Comment:More doc tooling updates.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d8c22e8ff72729a137782c9e20546176f23ed661
User & Date: mistachkin 2016-09-12 21:01:27.702
Context
2016-09-12
21:07
Enhance backward compatibility of the 'vtab.tcl' doc tool. check-in: 59cb4c92a5 user: mistachkin tags: trunk
21:01
More doc tooling updates. check-in: d8c22e8ff7 user: mistachkin tags: trunk
19:44
Add tooling to sync up the SQLite core library docs from upstream. check-in: 23a3ba47a0 user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Doc/sync.eagle.
203
204
205
206
207
208
209
210
211
212
        "Downloading \"" $uri "\" to \"" $fileName "\"... "]
  }

  file delete $fileName
  uri download $uri $fileName

  if {$verbose} then {
    puts stdout OK
  }
}







|


203
204
205
206
207
208
209
210
211
212
        "Downloading \"" $uri "\" to \"" $fileName "\"... "]
  }

  file delete $fileName
  uri download $uri $fileName

  if {$verbose} then {
    puts stdout <Ok>
  }
}
Changes to Doc/vtab.tcl.
25
26
27
28
29
30
31
32
33


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

52
53
54
55
56
57
58

proc escapeSubSpec { data } {
  regsub -all -- {&} $data {\\\&} data
  regsub -all -- {\\(\d+)} $data {\\\\\1} data
  return $data
}

proc removeSectionId { value } {
  regsub -- { id="section(?:_\d+)+"} $value "" value


  return $value
}

proc englishToList { value } {
  set result [list]

  foreach element [split $value "\t\n ,"] {
    if {[string tolower $element] ni [list "" and or]} then {
      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

  foreach remove [list \
      {<a name=".*?">} {<a href=".*?">} {</a>} {<p>} {</p>}] {







|
|
>
>

















|
>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

proc escapeSubSpec { data } {
  regsub -all -- {&} $data {\\\&} data
  regsub -all -- {\\(\d+)} $data {\\\\\1} data
  return $data
}

proc preProcessLine { value } {
  regsub -- { id="[a-z_]+"} $value "" value
  regsub -- {</p><h(\d)>} $value </p>\n<h\\1> value
  regsub -- {</p><blockquote><pre>} $value <blockquote><pre> value
  return $value
}

proc englishToList { value } {
  set result [list]

  foreach element [split $value "\t\n ,"] {
    if {[string tolower $element] ni [list "" and or]} then {
      lappend result $element
    }
  }

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

  set result $line

  foreach remove [list \
      {<a name=".*?">} {<a href=".*?">} {</a>} {<p>} {</p>}] {
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112

113
114
115
116
117
118
119
      {<ul>} {</ul>}] {
    regsub -all -- ($escape) $result {<![CDATA[\1]]>} 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

  array set levels {p 0}
  set length [llength $lines]

  while {$index < $length} {
    set line [removeSectionId [lindex $lines $index]]

    if {[regexp -- $pattern $line]} then {
      break; # stop on this line for outer loop.
    } else {
      set trimLine [string trim $line]; set data ""

      if {$levels(p) > 0 && [string length $trimLine] == 0} then {
        # blank line, close paragraph.
        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>
        }

        incr levels(p) -1
      } elseif {[string range $trimLine 0 2] eq "<p>"} then {

        # open tag ... 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 tag, wrap.
            if {[info exists methods($name)]} then {







|
|
















|

















|
>







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
      {<ul>} {</ul>}] {
    regsub -all -- ($escape) $result {<![CDATA[\1]]>} 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

  array set levels {p 0}
  set length [llength $lines]

  while {$index < $length} {
    set line [preProcessLine [lindex $lines $index]]

    if {[regexp -- $pattern $line]} then {
      break; # stop on this line for outer loop.
    } else {
      set trimLine [string trim $line]; set data ""

      if {$levels(p) > 0 && [string length $trimLine] == 0} then {
        # blank line, close paragraph.
        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>
        }

        incr levels(p) -1
      } elseif {[string range $trimLine 0 2] eq "<p>" || \
          [string range $trimLine 0 6] eq "</p><p>"} then {
        # open tag ... 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 tag, wrap.
            if {[info exists methods($name)]} then {
192
193
194
195
196
197
198

199
200



201
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

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) {^<h2>2\.\d+\. The (.*) Method(?:s)?</h2>$}



set prefix "        /// "
unset -nocomplain methods; set start false

for {set index 0} {$index < [llength $lines]} {} {
  set line [removeSectionId [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
      }

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

set outputData [string map [list \r\n \n] [readFile $outputFileName]]







>

|
>
>
>




|














|







196
197
198
199
200
201
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

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(start) {^</p>\n<h1><span>2\. </span>Virtual Table Methods</h1>$}

set patterns(method) [string trim {
  ^(?:</p>\n)?<h2><span>2\.\d+\. </span>The (.*) Method(?:s)?</h2>$
}]

set prefix "        /// "
unset -nocomplain methods; set start false

for {set index 0} {$index < [llength $lines]} {} {
  set line [preProcessLine [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
      }

      set index $methodIndex
    } else {
      incr index
    }
  } elseif {[regexp -- $patterns(start) $line]} then {
    set start true; incr index
  } else {
    incr index
  }
}

set outputData [string map [list \r\n \n] [readFile $outputFileName]]
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
    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







|










264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
    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; incr start [expr {[string length $methods($name)] + 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