Commit graph

54 commits

Author SHA1 Message Date
Théo Lebrun
0e846ccd6e script.sh: parse-defs: C: index defs that have a CONFIG_ in their line
Take the pm_ptr() macro as example:

⟩ ctags -x --kinds-c=+p+x --extras='-{anonymous}' include/linux/pm.h | grep pm_ptr
pm_ptr           macro       475 include/linux/pm.h #define pm_ptr(_ptr) PTR_IF(IS_ENABLED(CONFIG_PM), (_ptr))

The previous grep would remove the pm_ptr() line because it contains
CONFIG_. We only want to remove a line if it starts with CONFIG_.

Testing this commit:

⟩ export LXR_REPO_DIR=...
⟩ hash=97b0e23363c8283f53c361d8129ef90d7a2b9350
⟩ ./script.sh parse-defs $hash pm.h C | sort > /tmp/defs-pm-before.txt
⟩ # TODO: apply commit
⟩ ./script.sh parse-defs $hash pm.h C | sort > /tmp/defs-pm-after.txt
⟩ comm -13 /tmp/defs-pm-before.txt /tmp/defs-pm-after.txt
pm_ptr macro 475
pm_sleep_ptr macro 476

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2025-02-25 09:28:52 +01:00
Théo Lebrun
c6bc09ed10 script/query: don't restrict ./script.sh get-latest to a single tag
`./script.sh get-latest <offset>` gets the full list of tags, filters
it, sorts it then returns a single result. On the Python side, it gets
the first one. If that works, it uses it, else it tries the second one,
etc.

That is a weird implementation: modify get-latest to return all tags so
that Python code only has to spawn a single subprocess.

Also, rename it from `get-latest` to `get-latest-tags`. This makes
things more explicit (what latest?) and also explicits that more than
one tag is required.

Also, argument 1 is supposed to be an offset.
No custom implementation of get_latest() did implement that.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2025-01-03 11:44:22 +01:00
Costa Shulyupin
47a6001385 parse linux system calls definitions
fixes #222
2023-05-15 14:58:57 +02:00
Maxime Chretien
781c5d6e2c lib.py/script.sh: Handle ctags __anon correctly
Disable __anon output from ctags instead of blacklisting them in lib.py

See : https://github.com/universal-ctags/ctags/issues/2572

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-06-11 14:55:02 +02:00
Maxime Chretien
e2adc03d1e find_compatibles_dts: Convert to a python class to increase performances
Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-06-10 10:16:19 +02:00
Maxime Chretien
81fa361c54 database: Add support for dts compatible strings
They can be found in C, DTS and documentation files

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-06-08 15:37:59 +02:00
Christopher White
359f89af53 Detect function definitions in .S files
Issue 150
2020-06-04 08:22:54 -04:00
Maxime Chretien
8fd2bc4700 script.sh: Index struct, enum and union members in C files
Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-06-02 10:18:55 +02:00
Michael Opdenacker
4c23138b32
Merge pull request #138 from MaximeChretien/ctags-upstream
script.sh: Adapt to universal-ctags Kconfig parser
2020-05-27 09:39:20 +02:00
Maxime Chretien
155733bdd9 Enable ctags extern variable support
This is needed to fix https://github.com/bootlin/elixir/issues/61

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-05-26 12:16:39 +02:00
Maxime Chretien
0f1f7139bd script.sh: Adapt to universal-ctags Kconfig parser
The parser has been modified before being merged so we adapt to the
changes.

See : https://github.com/universal-ctags/ctags/pull/2553

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-05-26 11:52:34 +02:00
Chris White
5e7cab18ca Added/updated copyright notices; whitespace fixes
No functional changes
2020-05-23 15:14:21 -04:00
Maxime Chretien
72571fbfd9 database: Add support for Kconfig et Devicetree files
This brings the idea of file families, each ident is identified by his
family and can be referenced in compatible families.

For exemple :
- A Kconfig ident can be referenced in a C file but not in a Devicetree file.
- A Devicetree ident is only referenced in Devicetree files.
- A C ident is only referenced in C files.

Kconfig idents are defined without the CONFIG_ at the beginning.
We add it while indexing for an easier processing of other files.

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-05-22 10:29:24 +02:00
Maxime Chretien
ded9a1112e query.py: get latest indexed version instead of latest git version
This prevent bad queries when the git repo is more up to date than the
database.

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-05-19 17:41:32 +02:00
Maxime Chretien
9f29697105 symlinks: Handle symlinks in the tree view
git ls-tree return file permissions and symlinks always have permission
120000
So we can use that to identify them

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-05-18 10:52:05 +02:00
Maxime Chretien
8988f34721 script.sh: Specify current dir when including specific project scripts
This fix the FIXME tag name in the web menus

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-04-23 14:03:22 +02:00
Chris White
a171485c4f doc-comments: support uncommented first function
If the first function in a file does not have a doc comment, do not
run off the beginning of the file.  Fixes #102.

Also:
- Add t/tree/issue102.c that exhibits this bug.
- in find-file-doc-comments.pl and script.sh, exit with a nonzero code
  if this should recur.
2020-04-04 12:21:45 -04:00
Christopher White
8a6031c8a1 Add doc-comment extraction
- find-file-doc-comments.pl: new file
- data.py: Add database to store doc-comment locations
- script.sh: Add parse-docs subcommand
- update.py:
  - Add code to process doc comments
  - Update some variable names in hopes of reducing confusion
- query.py:
  - Add code to report doc comments
  - Update some variable names in hopes of reducing confusion

Also:
- t/TestEnvironment.pm: Add find_doc attribute
- t/interact.pl: Don't die if update.py fails
- t/TestHelpers.pm: Permit checking specific sections of query.py output
- t/300: update regexes per the preceding
- gitignore tags (ctags output) and .cache (api_test.py output)
2020-04-02 13:03:03 -04:00
Chris White
f112ab0826 Regularize whitespace; add editorconfig
- Change the few files that use leading tabs into leading spaces.
  This way they match the other files in the repo.
- Add an EditorConfig file so that supported editors will automatically
  use spaces instead of tabs.
- (Extra) Add some common editor backup-file extensions to .gitignore.
2020-03-21 08:58:43 -04:00
CheezeCake
dbec4df54c Fix C string literals 2019-09-30 21:44:30 +02:00
Michael Opdenacker
89b777fb4f Add some comments
Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-09-23 14:34:20 +02:00
Chengguang Xu
1b72698a06 fix list_tags_h problem when major version is bigger than v9
./scripts.sh list-tags -h cannot handle correctly when
the major version number is bigger than v9, so need to
add '*' in the regular expression of major number.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
2018-04-19 16:37:45 +08:00
Michael Opdenacker
2ad97fb303 Switch to a usable default for list-tags -h
- This way, it's not always necessary to create
  custom definitions for new projects.

- Update the definitions for projects that can
  use such a default.

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
2018-04-04 10:17:35 +02:00
Michael Opdenacker
e732c6a295 Version 0.3: support projects through rudimentary "plugins"
- Allows to add a project by just adding custom
  definitions to projects/<project>.sh

- Except for cases that haven't been anticipated yet,
  modifying common code should no longer be needed

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
2018-04-03 15:29:08 +02:00
Michael Opdenacker
cc3650587b Add Barebox support
- See https://barebox.org/

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
2018-03-28 07:16:14 +02:00
Michael Opdenacker
2525377e1a Add musl C library support
- Project hosted at https://www.musl-libc.org/

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
2018-03-27 15:39:35 +02:00
Henrik Brix Andersen
c76178d626 Add support for the Zephyr project. 2018-02-25 20:15:43 +01:00
Mikaël Bouillot
537e6b3a7b Change business name 2018-02-15 21:27:00 +00:00
Mikaël Bouillot
661f32fa12 Fix parsing of C strings
Fixes #29
2017-07-20 13:22:49 +02:00
stdk
4845e25186 Filenames that contain spaces are now processed correctly (#24)
Fixes #23
2017-07-02 17:03:54 +00:00
Mikaël Bouillot
bb762d0645 Ignore C++ operator identification from Ctags
Fixes #19
2017-06-30 12:57:02 +02:00
Mikaël Bouillot
1b4c0fc7d4 Update notices to match the new license 2017-06-27 14:13:28 +02:00
Silvio Fricke
9aea0051bd make useable for submodules
git ls-tree returnes `commit` entries for submodules. We remove them
from the output. Without this the script crashes with this trace:

    Traceback (most recent call last):
      File "./update.py", line 138, in <module>
        newBlobs = updateBlobIDs (tag)
      File "./update.py", line 46, in updateBlobIDs
        hash, filename = blob.split (b' ')
    ValueError: too many values to unpack (expected 2)

Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
2017-06-14 10:33:56 +02:00
Mikaël Bouillot
362264b2a5 Fix escaped quotes and includes in tokenizer 2017-05-02 09:34:16 +02:00
Mikaël Bouillot
9c2cf2cf86 Use Perl non-greedy regex in tokenizer
We can now exclude C++ style comments and #includes,
in addition to C-style comments and strings.
2017-05-01 22:30:18 +02:00
Mikaël Bouillot
7db38c24fd Add support for virtual 'latest' version
Fixes #8
2017-05-01 19:14:08 +02:00
Mikaël Bouillot
3ae5fac4bf Implement tag translation
Busybox uses tags with underscores instead of dots.
This commit translates between the two forms in the
shell script.
2017-04-10 22:01:02 +02:00
Mikaël Bouillot
471134bf85 Move version hierarchy logic to script.sh 2017-04-06 21:04:26 +02:00
Mikaël Bouillot
a9e176e01a Remove indexing of struct members 2017-04-05 19:44:27 +02:00
Mikaël Bouillot
84bd5a0a16 Normalize paths 2017-04-04 15:12:59 +02:00
Mikaël Bouillot
2c3e362833 Expose raw git tags 2017-04-03 19:56:15 +02:00
Mikaël Bouillot
3ef4641fc4 Style string literals 2017-03-23 17:33:32 +01:00
Mikaël Bouillot
24a25481b2 Do not tokenize strings 2017-03-16 21:39:59 +01:00
Mikaël Bouillot
80e113ab99 Don't deduce type from trailing slash
Instead of using a trailing slash in the path to tell trees from blobs,
we actually ask git the type of the object. Also, if the object is a
tree but lacks a trailing slash, we redirect to the correct URL.

Fixes #6
2017-03-09 18:37:40 +01:00
Mikaël Bouillot
832f7c8b6d Add license 2017-03-09 17:25:42 +01:00
Mikaël Bouillot
6cae0dd8c3 Silence Git and treat empty responses as errors 2017-02-14 15:26:22 +01:00
Mikaël Bouillot
bab7dce487 Display only indexed versions 2017-02-14 13:23:37 +01:00
Mikaël Bouillot
4421c30e58 Add indexing of function prototypes 2017-02-07 15:56:31 +01:00
Mikaël Bouillot
e871501c11 List all tags in reverse order 2017-02-07 10:58:07 +01:00
Mikaël Bouillot
0bf34d7751 Database update script, new data format 2017-02-06 15:15:51 +01:00