Short: C code style checker for developers Author: amigazen project Uploader: toolkit amigazen com Type: dev/c Version: 47.3 Architecture: m68k-amigaos >= 3.1 Distribution: Aminet Kurz: C-Code-Analyse-Tool fur Entwickler Codex is a comprehensive C linter and style checker designed specifically for Amiga development. It provides static analysis of C source code without compilation, offering immediate feedback on potential issues, style violations, and compatibility problems. Features: - Syntax and Standards Compliance: Ensures your code follows C89 or C99 standards - Compiler Compatibility: Identifies code that won't compile with specific Amiga compilers (SAS/C, VBCC, DICE) - Amiga Coding Standards: Enforces Amiga-specific best practices and conventions - Memory Safety: Detects potentially unsafe functions and suggests alternatives - Code Style: Checks for common style violations like line length and magic numbers - Fast Analysis: Performs lexical analysis without compilation for immediate feedback - Multi-file Support: Analyze entire projects with wildcard support Requirements: - AmigaOS 3.1 or higher - Standard Amiga libraries (exec.library, dos.library, utility.library) Usage: Basic Command Line Format: Codex FILES/M AMIGA/S NDK/S C89/S C99/S SASC/S VBCC/S DICE/S MEMSAFE/S HELP/S File Specifications: Codex accepts one or more source files. You can use wildcards: Codex MyProject/Sources/#?.c Codex main.c utils.c helper.c Codex MyProject/Sources/*.c Validation Modes: C89/S (default): Enforces strict ANSI C89 compliance, flagging C99 features like: - C++ style comments (//) - inline keyword - Variable declarations after statements - Variable declarations in for loop initializers - C99 designated initializers and compound literals C99/S: Validates against the C99 standard, providing warnings for C99-specific features to ensure you're aware of their usage. AMIGA/S: Enforces Amiga-specific conventions: - Use Amiga types (LONG, STRPTR, APTR, etc.) instead of standard C types - PascalCase function naming (excludes stdlib and AmigaOS library functions) - Flags deprecated Amiga types (USHORT, COUNT, etc.) - Recommends proper Amiga library usage patterns Automatically enables C89 and NDK validation modes. NDK/S: Checks for non-universal NDK keywords and suggests universal replacements from in the latest Amiga NDK. SASC/S: Checks for SAS/C keyword compatibility issues. Automatically enables C89 mode and disables C99 mode (SAS/C is C89-only). VBCC/S: Checks for VBCC keyword compatibility issues. Automatically enables C99 mode and disables C89 mode (VBCC supports C99). DICE/S: Checks for DICE keyword compatibility issues. Automatically enables C89 and NDK validation modes. MEMSAFE/S: Identifies potentially memory-unsafe functions from the standard C library, such as strcpy, strcat, sprintf, gets, and suggests safer alternatives. NO-AMIGA-PASCALCASE/S: Disables Amiga function naming enforcement (PascalCase). NO-COMPILER-COMPAT/S: Disables compiler-specific keyword compatibility checking. HELP/S: Displays detailed help message with all options and examples. Examples: Check a single file for Amiga standards: Codex MyProject/main.c AMIGA This automatically enables C89 and NDK validation as well. Check for C99 and VBCC compatibility: Codex main.c C99 VBCC VBCC mode automatically enables C99 and disables C89. Check for memory safety issues: Codex MyProject/Sources/#?.c MEMSAFE Identifies unsafe functions like strcpy and suggests replacements. Check for SAS/C compatibility: Codex main.c SASC SAS/C mode automatically enables C89 and disables C99. Check multiple files with multiple modes: Codex MyProject/Sources/#?.c AMIGA MEMSAFE Comprehensive validation for Amiga standards and memory safety. What Codex Checks: General Style Checks (Always Active): - Line Length: Flags lines longer than 256 characters - Code Structure: Validates proper code organization C89 Standards Mode: - Declaration Placement: Flags variable declarations after statements - C99 Keywords: Flags inline, restrict, _Bool - C++ Comments: Flags single-line // comments - For-Loop Declarations: Flags variable declarations in for loops - C99 Features: Flags designated initializers, compound literals, variadic macros, flexible array members, and C99+ standard library functions C99 Standards Mode: - Validates C99 features are properly used - Provides warnings to ensure compiler support Amiga Standards Mode: - Amiga Types: Recommends LONG, STRPTR, APTR, CONST_STRPTR instead of standard C types - PascalCase: Checks user-defined function names (excludes stdlib and AmigaOS library functions) - Deprecated Types: Flags obsolete types like USHORT, COUNT, CPTR - Library Usage: Recommends proper Amiga library patterns Compiler Compatibility Modes: - Identifies compiler-specific keywords that should use universal syntax - Suggests replacements from Memory Safety Mode: - Flags unsafe functions: strcpy, strcat, sprintf, gets, scanf, etc. - Suggests safer alternatives: strncpy, strncat, snprintf, fgets, etc. - Provides guidance on proper usage patterns How It Works: Codex performs static analysis without compilation. It uses lexical analysis and pattern matching to identify potential issues. This makes it extremely fast and useful for: - Pre-commit validation: Check code before committing to version control - Continuous integration: Automated code quality checks in build pipelines - Learning and education: Understand common C programming pitfalls - Legacy code analysis: Evaluate existing codebases for issues Codex processes each file independently, analyzing line by line for: - Syntax violations - Style issues - Compatibility problems - Memory safety concerns The tool provides detailed error reports with: - File name and line number - Column position - Error type (SYNTAX, STYLE, WARNING, COMPILER, COMMENT) - Descriptive error message - Line excerpt showing the problematic code Limitations: Codex is a static analyzer, not a compiler. It has some limitations: - No preprocessor handling: It does not process macros or follow #includes - No cross-file analysis: Each file is processed independently - Pattern-based detection: Some complex cases may not be detected - No semantic analysis: It cannot understand program flow or logic These limitations are by design to ensure Codex remains fast and lightweight. For deeper analysis, a C compiler is required. For more information, and to report issues, visit: - GitHub: https://github.com/amigazen/Codex/ - Web: http://www.amigazen.com/toolkit/ This software is Free and Open Source Software distributed on BSD-2 license terms: Copyright (c) 2025 amigazen project All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. amigazen project philosophy is based on openness: Open to anyone and everyone - Open source and free for all - Open your mind and create!