Documentation Source Text

Check-in [4f034b4e83]
Login

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

Overview
Comment:Further improvements to the opcodes.html documentation generator.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4f034b4e838561f9659fa921efb082a784c5714d
User & Date: drh 2014-05-24 17:16:34.010
Context
2014-05-25
20:08
Enhancements to the optoverview.html document: Added discussion of partial sorting and fixed the conditions for query flattening. (check-in: fc0e9baa66 user: drh tags: trunk)
2014-05-24
17:16
Further improvements to the opcodes.html documentation generator. (check-in: 4f034b4e83 user: drh tags: trunk)
17:01
Enhance the "opcodes.html" document to include hyperlinks from to the opcodes. (check-in: 0d929c02e3 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to pages/opcode.in.
1
2
3
4
5
6





7
8
9
10
11
12
13
<title>SQLite Virtual Machine Opcodes</title>
<tcl>hd_keywords {virtual machine instructions}</tcl>

<h2>SQLite Virtual Machine Opcodes</h2>

<tcl>





set fd [open $::SRC/src/vdbe.c r]
set file [read $fd]
close $fd
set current_op {}
unset -nocomplain Opcode
unset -nocomplain OpcodeList
foreach line [split $file \n] {






>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<title>SQLite Virtual Machine Opcodes</title>
<tcl>hd_keywords {virtual machine instructions}</tcl>

<h2>SQLite Virtual Machine Opcodes</h2>

<tcl>
set uuid {}
catch {
  exec fossil sha1sum $::SRC/src/vdbe.c 
} uuid
set uuid [lindex $uuid 0]
set fd [open $::SRC/src/vdbe.c r]
set file [read $fd]
close $fd
set current_op {}
unset -nocomplain Opcode
unset -nocomplain OpcodeList
foreach line [split $file \n] {
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
unset file

# Scan $txt and replace every opcode name with a link to its documentation
#
proc LinkOpcodeNames {txt} {
  global Opcode
  set out {}
  while {[regexp {^(.*?)((OP_)?[A-Z][a-z][A-Za-z]+)(.*)$} $txt \
             all pre op opx tail]} {
    append out $pre
    regsub {^OP_} $op {} key
    if {[info exists Opcode($key:text)]} {
      append out "<a href=\"#$key\">$op</a>"
    } else {
      append out $op







|







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
unset file

# Scan $txt and replace every opcode name with a link to its documentation
#
proc LinkOpcodeNames {txt} {
  global Opcode
  set out {}
  while {[regexp {^(.*?\s)((OP_)?[A-Z][a-z][A-Za-z]+)(.*)$} $txt \
             all pre op opx tail]} {
    append out $pre
    regsub {^OP_} $op {} key
    if {[info exists Opcode($key:text)]} {
      append out "<a href=\"#$key\">$op</a>"
    } else {
      append out $op
233
234
235
236
237
238
239
240








241
242
243
244
245
246
247
248
249
250
251
252
253

<h3>The Opcodes</h3>

<p>There are currently <tcl>hd_puts [llength $OpcodeList]</tcl>
opcodes defined by the virtual machine.
All currently defined opcodes are described in the table below.
This table was generated automatically by scanning the source code
from the file <b>vdbe.c</b>.</p>









<p><table cellspacing="1" border="1" cellpadding="10">
<tr><th>Opcode&nbsp;Name</th><th>Description</th></tr>

<tcl>
  foreach op [lsort -dictionary $OpcodeList] {
    hd_puts {<tr><td valign="top" align="center">}
    hd_puts "\n<a name=\"$op\"></a><p>$op</p>\n"
    regsub -all {\[(P[0-9+]+)\]} $Opcode($op:text) {\&#91;\1\&#93} txt
    hd_resolve "<td>[string trim [LinkOpcodeNames $txt]]</td></tr>\n"
  }
</tcl>
</table></p>







|
>
>
>
>
>
>
>
>













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

<h3>The Opcodes</h3>

<p>There are currently <tcl>hd_puts [llength $OpcodeList]</tcl>
opcodes defined by the virtual machine.
All currently defined opcodes are described in the table below.
This table was generated automatically by scanning the source code
from the file
<tcl>
  if {$uuid==""} {
    hd_puts <b>vdbe.c</b>.
  } else {
    hd_puts "<a href=\"http://www.sqlite.org/src/artifact/$uuid\">vdbe.c</a>."
  }
</tcl></p>
 

<p><table cellspacing="1" border="1" cellpadding="10">
<tr><th>Opcode&nbsp;Name</th><th>Description</th></tr>

<tcl>
  foreach op [lsort -dictionary $OpcodeList] {
    hd_puts {<tr><td valign="top" align="center">}
    hd_puts "\n<a name=\"$op\"></a><p>$op</p>\n"
    regsub -all {\[(P[0-9+]+)\]} $Opcode($op:text) {\&#91;\1\&#93} txt
    hd_resolve "<td>[string trim [LinkOpcodeNames $txt]]</td></tr>\n"
  }
</tcl>
</table></p>