Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
doxverilog
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
doxverilog
Commits
158ffb7f
Commit
158ffb7f
authored
Jan 09, 2014
by
Dimitri van Heesch
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:doxygen/doxygen
parents
b4b40f4c
16a5d979
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
169 additions
and
9 deletions
+169
-9
search.py
addon/doxypysql/search.py
+159
-0
sqlite3gen.cpp
src/sqlite3gen.cpp
+10
-9
No files found.
addon/doxypysql/search.py
0 → 100755
View file @
158ffb7f
#!/usr/bin/python
# python script to search through doxygen_sqlite3.db
#
# Permission to use, copy, modify, and distribute this software and its
# documentation under the terms of the GNU General Public License is hereby
# granted. No representations are made about the suitability of this software
# for any purpose. It is provided "as is" without express or implied warranty.
# See the GNU General Public License for more details.
#
import
sqlite3
import
sys
import
os
import
re
import
getopt
class
MemberType
:
Define
=
"0"
Function
=
"1"
Variable
=
"2"
Typedef
=
"3"
Enumeration
=
"4"
EnumValue
=
"5"
Signal
=
"6"
Slot
=
"7"
Friend
=
"8"
DCOP
=
"9"
Property
=
"10"
Event
=
"11"
###############################################################################
def
escapeLike
(
val
):
return
'LIKE "
%
'
+
val
.
replace
(
"
\\
"
,
"
\\\\
"
)
.
replace
(
"_"
,
"
\\
_"
)
\
.
replace
(
"
%
"
,
"
\\
%
"
)
+
'
%
" ESCAPE "
\\
"'
def
getLine
(
id_file
,
line
,
column
):
rv
=
""
for
r
in
g_conn
.
execute
(
'SELECT * FROM files WHERE id=
%
d;'
%
id_file
)
.
fetchall
():
rv
+=
"found in file
%
s:
%
d:
%
d"
%
(
r
[
'name'
],
line
,
column
)
return
rv
###############################################################################
def
processCallers
(
caller
,
path
=
None
,
fid
=
None
):
cur
=
g_conn
.
cursor
()
if
fid
is
None
:
cur
.
execute
(
"SELECT refid FROM memberdef WHERE name='
%
s'"
%
caller
)
refids
=
cur
.
fetchall
()
if
len
(
refids
)
==
0
:
print
'No results found'
return
refid
=
refids
[
0
][
'refid'
]
print
"
%
s"
%
refid
cur
=
g_conn
.
cursor
()
for
info
in
cur
.
execute
(
"SELECT * FROM xrefs WHERE dst LIKE '
%
"
+
refid
+
"
%
'"
):
cur
=
g_conn
.
cursor
()
for
i2
in
cur
.
execute
(
"SELECT * FROM memberdef WHERE refid='
%
s'"
%
info
[
'src'
]):
print
"caller:
%
s"
%
i2
[
'name'
]
for
i2
in
cur
.
execute
(
"SELECT * FROM files WHERE id='
%
s'"
%
info
[
'id_file'
]):
print
"file :
%
s:
%
d"
%
(
i2
[
'name'
],
info
[
'line'
])
def
processFunction
(
name
):
for
r
in
g_conn
.
execute
(
'SELECT * FROM memberdef WHERE name LIKE "
%
'
+
name
+
'
%
" AND kind='
+
MemberType
.
Function
+
';'
)
.
fetchall
():
print
'==>
%
s
%
s
%
s'
%
(
r
[
'type'
],
r
[
'name'
],
r
[
'argsstring'
])
print
getLine
(
r
[
'id_file'
],
r
[
'line'
],
r
[
'column'
])
def
processMacro
(
name
):
for
r
in
g_conn
.
execute
(
'SELECT * FROM memberdef WHERE name LIKE "
%
'
+
name
+
'
%
" AND kind='
+
MemberType
.
Define
+
';'
)
.
fetchall
():
mname
=
r
[
'name'
]
if
r
[
'argsstring'
]:
mname
+=
r
[
'argsstring'
]
print
'
%
s'
%
(
mname
)
print
getLine
(
r
[
'id_file'
],
r
[
'line'
],
r
[
'column'
])
def
processType
(
name
,
path
=
None
):
for
r
in
g_conn
.
execute
(
'SELECT * FROM memberdef WHERE name LIKE "
%
'
+
name
+
'
%
" AND kind='
+
MemberType
.
Typedef
+
';'
)
.
fetchall
():
print
'
%
s'
%
(
r
[
'name'
])
print
getLine
(
r
[
'id_file'
],
r
[
'line'
],
r
[
'column'
])
def
processVariable
(
name
):
for
r
in
g_conn
.
execute
(
'SELECT * FROM memberdef WHERE name LIKE "
%
'
+
name
+
'
%
" AND kind='
+
MemberType
.
Variable
+
';'
)
.
fetchall
():
print
'>
%
s'
%
(
r
[
'name'
])
print
getLine
(
r
[
'id_file'
],
r
[
'line'
],
r
[
'column'
])
###############################################################################
def
usage
():
print
"""Usage: search.py [options]
Options:
-h, --help
-d <D> Use database <D> for queries
-c <F> Search for callers of <F>
-f <F> Search for function <F>
-m <M> Search for macro <M>
-t <T> Search for type <T>
-v <V> Search for variable <V>
"""
def
openDb
(
dbname
):
global
g_conn
if
dbname
==
None
:
dbname
=
"doxygen_sqlite3.db"
if
not
os
.
path
.
isfile
(
dbname
):
raise
BaseException
(
"No such file
%
s"
%
dbname
)
g_conn
=
sqlite3
.
connect
(
dbname
)
g_conn
.
execute
(
'PRAGMA temp_store = MEMORY;'
)
g_conn
.
row_factory
=
sqlite3
.
Row
###############################################################################
def
main
(
argv
):
try
:
opts
,
args
=
getopt
.
getopt
(
argv
,
"hc:d:f:m:t:v:"
,[
"help"
])
except
getopt
.
GetoptError
:
usage
()
sys
.
exit
(
1
)
dbname
=
None
for
a
,
o
in
opts
:
if
a
in
(
'-h'
,
'--help'
):
usage
()
sys
.
exit
(
0
)
elif
a
in
(
'-d'
):
dbname
=
o
elif
a
in
(
'-c'
):
openDb
(
dbname
)
processCallers
(
o
)
elif
a
in
(
'-f'
):
openDb
(
dbname
)
processFunction
(
o
)
elif
a
in
(
'-m'
):
openDb
(
dbname
)
processMacro
(
o
)
elif
a
in
(
'-t'
):
openDb
(
dbname
)
processType
(
o
)
elif
a
in
(
'-v'
):
openDb
(
dbname
)
processVariable
(
o
)
if
__name__
==
'__main__'
:
main
(
sys
.
argv
[
1
:])
src/sqlite3gen.cpp
View file @
158ffb7f
...
@@ -310,7 +310,8 @@ static void insertMemberReference(sqlite3 *db, MemberDef *src, MemberDef *dst, c
...
@@ -310,7 +310,8 @@ static void insertMemberReference(sqlite3 *db, MemberDef *src, MemberDef *dst, c
{
{
sscanf
(
floc
,
"%[^:]:%d:%d"
,
file
,
&
line
,
&
column
);
sscanf
(
floc
,
"%[^:]:%d:%d"
,
file
,
&
line
,
&
column
);
}
}
insertMemberReference
(
db
,
src
->
anchor
().
data
(),
dst
->
anchor
().
data
(),
file
,
line
,
column
);
#warning Disabled until the xref key can be stored as file:line:column
//insertMemberReference(db,src->anchor().data(),dst->anchor().data(),file,line,column);
}
}
}
}
...
@@ -476,7 +477,6 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def)
...
@@ -476,7 +477,6 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def)
// + template arguments
// + template arguments
// (templateArguments(), definitionTemplateParameterLists())
// (templateArguments(), definitionTemplateParameterLists())
// - call graph
// - call graph
msg
(
"=====%s
\n
"
,
md
->
name
().
data
());
// enum values are written as part of the enum
// enum values are written as part of the enum
if
(
md
->
memberType
()
==
MemberType_EnumValue
)
return
;
if
(
md
->
memberType
()
==
MemberType_EnumValue
)
return
;
...
@@ -611,11 +611,12 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def)
...
@@ -611,11 +611,12 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def)
StringList
l
;
StringList
l
;
linkifyText
(
TextGeneratorSqlite3Impl
(
l
),
def
,
md
->
getBodyDef
(),
md
,
a
->
type
);
linkifyText
(
TextGeneratorSqlite3Impl
(
l
),
def
,
md
->
getBodyDef
(),
md
,
a
->
type
);
QCString
*
s
=
l
.
first
();
StringListIterator
li
(
l
);
while
(
s
)
QCString
*
s
;
while
((
s
=
li
.
current
()))
{
{
insertMemberReference
(
db
,
md
->
anchor
().
data
(),
s
->
data
(),
def
->
getDefFileName
().
data
(),
md
->
getDefLine
(),
1
);
insertMemberReference
(
db
,
md
->
anchor
().
data
(),
s
->
data
(),
def
->
getDefFileName
().
data
(),
md
->
getDefLine
(),
1
);
s
=
l
.
next
()
;
++
li
;
}
}
}
}
if
(
!
a
->
name
.
isEmpty
())
if
(
!
a
->
name
.
isEmpty
())
...
@@ -669,8 +670,9 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def)
...
@@ -669,8 +670,9 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def)
StringList
l
;
StringList
l
;
linkifyText
(
TextGeneratorSqlite3Impl
(
l
),
def
,
md
->
getBodyDef
(),
md
,
md
->
initializer
());
linkifyText
(
TextGeneratorSqlite3Impl
(
l
),
def
,
md
->
getBodyDef
(),
md
,
md
->
initializer
());
QCString
*
s
=
l
.
first
();
StringListIterator
li
(
l
);
while
(
s
)
QCString
*
s
;
while
((
s
=
li
.
current
()))
{
{
if
(
md
->
getBodyDef
())
if
(
md
->
getBodyDef
())
{
{
...
@@ -681,7 +683,7 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def)
...
@@ -681,7 +683,7 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def)
md
->
getStartBodyLine
()));
md
->
getStartBodyLine
()));
insertMemberReference
(
db
,
md
->
anchor
().
data
(),
s
->
data
(),
md
->
getBodyDef
()
->
getDefFileName
().
data
(),
md
->
getStartBodyLine
(),
1
);
insertMemberReference
(
db
,
md
->
anchor
().
data
(),
s
->
data
(),
md
->
getBodyDef
()
->
getDefFileName
().
data
(),
md
->
getStartBodyLine
(),
1
);
}
}
s
=
l
.
next
()
;
++
li
;
}
}
}
}
...
@@ -762,7 +764,6 @@ static void generateSqlite3Section(sqlite3*db,
...
@@ -762,7 +764,6 @@ static void generateSqlite3Section(sqlite3*db,
int
count
=
0
;
int
count
=
0
;
for
(
mli
.
toFirst
();(
md
=
mli
.
current
());
++
mli
)
for
(
mli
.
toFirst
();(
md
=
mli
.
current
());
++
mli
)
{
{
msg
(
"I:%s
\n
"
,
md
->
name
().
data
());
// namespace members are also inserted in the file scope, but
// namespace members are also inserted in the file scope, but
// to prevent this duplication in the XML output, we filter those here.
// to prevent this duplication in the XML output, we filter those here.
if
(
d
->
definitionType
()
!=
Definition
::
TypeFile
||
md
->
getNamespaceDef
()
==
0
)
if
(
d
->
definitionType
()
!=
Definition
::
TypeFile
||
md
->
getNamespaceDef
()
==
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment