autosar-calltree 0.3.1__tar.gz → 0.3.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {autosar_calltree-0.3.1/src/autosar_calltree.egg-info → autosar_calltree-0.3.3}/PKG-INFO +2 -2
  2. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/README.md +1 -1
  3. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/pyproject.toml +1 -1
  4. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree/database/function_database.py +11 -1
  5. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree/parsers/c_parser.py +33 -0
  6. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree/version.py +1 -1
  7. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3/src/autosar_calltree.egg-info}/PKG-INFO +2 -2
  8. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/LICENSE +0 -0
  9. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/MANIFEST.in +0 -0
  10. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/setup.cfg +0 -0
  11. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/setup.py +0 -0
  12. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree/__init__.py +0 -0
  13. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree/analyzers/__init__.py +0 -0
  14. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree/analyzers/call_tree_builder.py +0 -0
  15. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree/cli/__init__.py +0 -0
  16. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree/cli/main.py +0 -0
  17. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree/config/__init__.py +0 -0
  18. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree/config/module_config.py +0 -0
  19. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree/database/__init__.py +0 -0
  20. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree/database/models.py +0 -0
  21. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree/generators/__init__.py +0 -0
  22. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree/generators/mermaid_generator.py +0 -0
  23. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree/parsers/__init__.py +0 -0
  24. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree/parsers/autosar_parser.py +0 -0
  25. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree.egg-info/SOURCES.txt +0 -0
  26. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree.egg-info/dependency_links.txt +0 -0
  27. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree.egg-info/entry_points.txt +0 -0
  28. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree.egg-info/requires.txt +0 -0
  29. {autosar_calltree-0.3.1 → autosar_calltree-0.3.3}/src/autosar_calltree.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: autosar-calltree
3
- Version: 0.3.1
3
+ Version: 0.3.3
4
4
  Summary: A Python tool to analyze C/AUTOSAR codebases and generate function call trees with Mermaid and XMI output
5
5
  Author-email: melodypapa <melodypapa@outlook.com>
6
6
  Maintainer-email: melodypapa <melodypapa@outlook.com>
@@ -255,7 +255,7 @@ default_module: "Other"
255
255
 
256
256
  **Usage**:
257
257
  ```bash
258
- calltree --start-function Demo_Init --module-config module_mapping.yaml --use-module-names --max-depth 3
258
+ calltree --start-function Demo_Init --module-config demo/module_mapping.yaml --use-module-names --max-depth 3 --output demo/demo_sequence.md
259
259
  ```
260
260
 
261
261
  This generates diagrams with:
@@ -209,7 +209,7 @@ default_module: "Other"
209
209
 
210
210
  **Usage**:
211
211
  ```bash
212
- calltree --start-function Demo_Init --module-config module_mapping.yaml --use-module-names --max-depth 3
212
+ calltree --start-function Demo_Init --module-config demo/module_mapping.yaml --use-module-names --max-depth 3 --output demo/demo_sequence.md
213
213
  ```
214
214
 
215
215
  This generates diagrams with:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "autosar-calltree"
7
- version = "0.3.1"
7
+ version = "0.3.3"
8
8
  description = "A Python tool to analyze C/AUTOSAR codebases and generate function call trees with Mermaid and XMI output"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -25,6 +25,16 @@ from ..parsers.c_parser import CParser
25
25
  from .models import FunctionInfo
26
26
 
27
27
 
28
+ def _format_file_size(size_bytes: int) -> str:
29
+ """Format file size in human-readable format."""
30
+ if size_bytes >= 1024 * 1024:
31
+ return f"{size_bytes / (1024 * 1024):.2f}M"
32
+ elif size_bytes >= 1024:
33
+ return f"{size_bytes / 1024:.2f}K"
34
+ else:
35
+ return str(size_bytes)
36
+
37
+
28
38
  @dataclass
29
39
  class CacheMetadata:
30
40
  """Metadata for cache validation."""
@@ -132,7 +142,7 @@ class FunctionDatabase:
132
142
 
133
143
  # Parse each file
134
144
  for idx, file_path in enumerate(c_files, 1):
135
- print(f"Processing: [{idx}/{len(c_files)}] {file_path.name}")
145
+ print(f"Processing: [{idx}/{len(c_files)}] {file_path.name} (Size: {_format_file_size(file_path.stat().st_size)})")
136
146
 
137
147
  try:
138
148
  self._parse_file(file_path)
@@ -58,6 +58,29 @@ class CParser:
58
58
  "_Generic",
59
59
  }
60
60
 
61
+ # AUTOSAR and standard C macros to exclude from function detection
62
+ # These macros look like function calls but should not be parsed as functions
63
+ AUTOSAR_MACROS = {
64
+ # Standard C integer literal macros (stdint.h)
65
+ "INT8_C",
66
+ "INT16_C",
67
+ "INT32_C",
68
+ "INT64_C",
69
+ "UINT8_C",
70
+ "UINT16_C",
71
+ "UINT32_C",
72
+ "UINT64_C",
73
+ "INTMAX_C",
74
+ "UINTMAX_C",
75
+ # AUTOSAR tool-specific macros
76
+ "TS_MAKEREF2CFG",
77
+ "TS_MAKENULLREF2CFG",
78
+ "TS_MAKEREFLIST2CFG",
79
+ # Common AUTOSAR configuration macros
80
+ "STD_ON",
81
+ "STD_OFF",
82
+ }
83
+
61
84
  # Common AUTOSAR types
62
85
  AUTOSAR_TYPES = {
63
86
  "uint8",
@@ -244,6 +267,16 @@ class CParser:
244
267
  if return_type in self.C_KEYWORDS or function_name in self.C_KEYWORDS:
245
268
  return None
246
269
 
270
+ # Skip AUTOSAR and standard C macros that look like function calls
271
+ # This prevents false positives on macros like UINT32_C(value), TS_MAKEREF2CFG(...)
272
+ if function_name in self.AUTOSAR_MACROS:
273
+ return None
274
+
275
+ # Skip standard C integer literal macros (those ending with _C)
276
+ # These are defined in stdint.h and look like: INT32_C(42), UINT64_C(100)
277
+ if function_name.endswith("_C"):
278
+ return None
279
+
247
280
  # Skip common control structures
248
281
  if function_name in ["if", "for", "while", "switch", "case", "else"]:
249
282
  return None
@@ -1,5 +1,5 @@
1
1
  """Version information for autosar-calltree package."""
2
2
 
3
- __version__ = "0.3.1"
3
+ __version__ = "0.3.3"
4
4
  __author__ = "melodypapa"
5
5
  __email__ = "melodypapa@outlook.com"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: autosar-calltree
3
- Version: 0.3.1
3
+ Version: 0.3.3
4
4
  Summary: A Python tool to analyze C/AUTOSAR codebases and generate function call trees with Mermaid and XMI output
5
5
  Author-email: melodypapa <melodypapa@outlook.com>
6
6
  Maintainer-email: melodypapa <melodypapa@outlook.com>
@@ -255,7 +255,7 @@ default_module: "Other"
255
255
 
256
256
  **Usage**:
257
257
  ```bash
258
- calltree --start-function Demo_Init --module-config module_mapping.yaml --use-module-names --max-depth 3
258
+ calltree --start-function Demo_Init --module-config demo/module_mapping.yaml --use-module-names --max-depth 3 --output demo/demo_sequence.md
259
259
  ```
260
260
 
261
261
  This generates diagrams with: