System.Data.SQLite
Check-in [5a46d020f4]
Not logged in

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

Overview
Comment:Further enhance backward compatibility of the 'vtab.tcl' doc tool.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5a46d020f42c82834270b65f3a855d3b9034f80c
User & Date: mistachkin 2016-09-12 21:35:16
Context
2016-09-13
21:54
Minor simplification of the 'vtab.tcl' doc tool. check-in: f318af97f7 user: mistachkin tags: trunk
2016-09-12
21:35
Further enhance backward compatibility of the 'vtab.tcl' doc tool. check-in: 5a46d020f4 user: mistachkin tags: trunk
21:28
Pickup the SQLite core library 3.14.2 docs from upstream. check-in: 0d2c14e945 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to Doc/vtab.tcl.

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
..
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
...
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
...
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
...
201
202
203
204
205
206
207







208
209
210
211
212
213
214
...
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
      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
................................................................................
  }

  set indent "        /// "

  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 -- {<div class="codeblock"><pre>} $result \
      <para><code>\n$indent result

  regsub -all -- {</pre></div>} $result </code></para> 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} {
................................................................................
        }

        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 {
              # non-first line, leading line separator.
              append data \n $prefix <para>
            } else {
................................................................................
            # 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 levels(p)
        }
      } 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.
................................................................................

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

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







|







 







>
>
|
|
>













>
|







 







|







 







|








|







 







>
>
>
>
>
>
>







 







|
|







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
..
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
...
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
...
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
...
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
...
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
      lappend result $element
    }
  }

  return $result
}
 
proc processLine { line prefix ltAndGt } {
  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
................................................................................
  }

  set indent "        /// "

  regsub -all -- {&ne;} $result {\&#8800;} result
  regsub -all -- {&#91(?:;)?} $result {[} result
  regsub -all -- {&#93(?:;)?} $result {]} result

  if {$ltAndGt} then {
    regsub -all -- {<( |\"|\d|=)} $result {\&lt;\1} result
    regsub -all -- {( |\"|\d|=)>} $result {\1\&gt;} result
  }

  regsub -all -- {<div class="codeblock"><pre>} $result \
      <para><code>\n$indent result

  regsub -all -- {</pre></div>} $result </code></para> 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 ltAndGt } {
  upvar 1 $indexVarName index
  upvar 1 $methodsVarName methods

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

  while {$index < $length} {
................................................................................
        }

        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 $ltAndGt]

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

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

          incr levels(p)
        }
      } else {
        set newLine [processLine $line $prefix $ltAndGt]

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

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]

if {[string first &lt\; $inputData] != -1 || \
    [string first &gt\; $inputData] != -1} then {
  set ltAndGt false
} else {
  set ltAndGt true
}

set lines [split [string map [list \r\n \n] $inputData] \n]

set patterns(start) [string trim {
  ^(?:</p>\n)?<h1>(?:<span>)?2\. (?:</span>)?Virtual Table Methods</h1>$
}]

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

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