4 Commits
Author SHA1 Message Date
tomasz.sowa 7c6a95dd9e add a .clang-format file 2026-08-18 00:17:34 +02:00
tomasz.sowa f6e6c4b1c6 allow to force installing a clangd and qtcreator files
Add a forceclangd target to Makefile to force installing a .clangd file.
Add a forceqtcreator target to force installing qtcreator files.
Existing files will be overwritten.

while here:
- update the c++ standard to c++23
2026-08-17 23:54:24 +02:00
tomasz.sowa a3e94d0785 allow to use multiple directories in the PatternParser 2026-06-21 01:50:51 +02:00
tomasz.sowa b7952104c0 bump version to 0.9.6 2026-06-21 01:49:58 +02:00
11 changed files with 444 additions and 69 deletions
+252
View File
@@ -0,0 +1,252 @@
---
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignArrayOfStructures: Left
AlignConsecutiveAssignments:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignEscapedNewlines: DontAlign
AlignOperands: DontAlign
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: true
BeforeWhile: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: AfterComma
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: AfterColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 150
CommentPragmas: '^ IWYU pragma:'
QualifierAlignment: Left
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DeriveLineEnding: false
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Leave
EmptyLineBeforeAccessModifier: Leave
ExperimentalAutoDetectBinPacking: false
PackConstructorInitializers: CurrentLine
BasedOnStyle: ''
ConstructorInitializerAllOnOneLineOrOnePerLine: false
AllowAllConstructorInitializersOnNextLine: true
FixNamespaceComments: true
ForEachMacros:
- forever
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<Q.*'
Priority: 200
SortPriority: 200
CaseSensitive: true
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: Indent
IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertBraces: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 3
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 150
PenaltyBreakBeforeFirstCallParameter: 300
PenaltyBreakComment: 500
PenaltyBreakFirstLessLess: 400
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 600
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 50
PenaltyReturnTypeOnItsOwnLine: 300
PenaltyIndentedWhitespace: 0
PointerAlignment: Middle
PPIndentWidth: 1
ReferenceAlignment: Middle
ReflowComments: false
RemoveBracesLLVM: false
RequiresClausePosition: OwnLine
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
AfterControlStatements: false
AfterForeachMacros: false
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: false
AfterOverloadedOperator: false
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: false
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Custom
SpacesInParensOptions:
ExceptDoubleParentheses: false
InConditionalStatements: true
InCStyleCasts: false
InEmptyParentheses: false
Other: false
SpacesInParentheses: true
SpacesInSquareBrackets: false
Standard: c++20
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
- Q_CLASSINFO
- Q_ENUM
- Q_ENUM_NS
- Q_FLAG
- Q_FLAG_NS
- Q_GADGET
- Q_GADGET_EXPORT
- Q_INTERFACES
- Q_MOC_INCLUDE
- Q_NAMESPACE
- Q_NAMESPACE_EXPORT
- Q_OBJECT
- Q_PROPERTY
- Q_REVISION
- Q_DISABLE_COPY
- Q_SET_OBJECT_NAME
- QT_BEGIN_NAMESPACE
- QT_END_NAMESPACE
- QML_ADDED_IN_MINOR_VERSION
- QML_ANONYMOUS
- QML_ATTACHED
- QML_DECLARE_TYPE
- QML_DECLARE_TYPEINFO
- QML_ELEMENT
- QML_EXTENDED
- QML_EXTENDED_NAMESPACE
- QML_EXTRA_VERSION
- QML_FOREIGN
- QML_FOREIGN_NAMESPACE
- QML_IMPLEMENTS_INTERFACES
- QML_INTERFACE
- QML_NAMED_ELEMENT
- QML_REMOVED_IN_MINOR_VERSION
- QML_SINGLETON
- QML_UNAVAILABLE
- QML_UNCREATABLE
- QML_VALUE_TYPE
TabWidth: 4
UseCRLF: false
UseTab: Always
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...
+1 -1
View File
@@ -1,2 +1,2 @@
CompileFlags:
Add: [-pthread, -std=c++20, -I%%%CURRENT_DIR%%%/src, -I%%%GLOBAL_WORKING_DIR%%%/pikotools/src, -I%%%GLOBAL_WORKING_DIR%%%/morm/src, -I/usr/include, -I/usr/local/include, -DEZC_HAS_MORM_LIBRARY]
Add: [-pthread, -std=c++23, -I%%%CURRENT_DIR%%%/src, -I%%%GLOBAL_WORKING_DIR%%%/pikotools/src, -I%%%GLOBAL_WORKING_DIR%%%/morm/src, -I/usr/include, -I/usr/local/include, -DEZC_HAS_MORM_LIBRARY]
+1 -1
View File
@@ -1 +1 @@
-std=c20
-std=c23
+1 -1
View File
@@ -1 +1 @@
-std=c++20
-std=c++23
+9 -1
View File
@@ -5,6 +5,14 @@ GLOBAL_WORKING_DIR=$(realpath ${CURRENT_DIR}/..)
# ----------
has_force_arg=0
if [ $# -eq 1 ] ; then
if [ $1 == 'force' ] ; then
has_force_arg=1
fi
fi
# make sure the current directory is correct
if [ ! -d ${CURRENT_DIR}/.templates ] ; then
echo "this script should be called by make: make clangd (one level up)"
@@ -17,7 +25,7 @@ GLOBAL_WORKING_DIR_FOR_SED=$(echo ${GLOBAL_WORKING_DIR} | sed 's/\//\\\//g')
if [ -f "${CURRENT_DIR}/.templates/.clangd" ] ; then
if [ ! -f "${CURRENT_DIR}/.clangd" ] ; then
if [ $has_force_arg -eq 1 -o ! -f "${CURRENT_DIR}/.clangd" ] ; then
cat "${CURRENT_DIR}/.templates/.clangd" | \
sed -e "s/%%%CURRENT_DIR%%%/${CURRENT_DIR_FOR_SED}/g" \
-e "s/%%%GLOBAL_WORKING_DIR%%%/${GLOBAL_WORKING_DIR_FOR_SED}/g" > \
+13 -2
View File
@@ -6,6 +6,14 @@ QTCREATOR_DIR=${CURRENT_DIR}/.qtcreator
# ----------
has_force_arg=0
if [ $# -eq 1 ] ; then
if [ $1 == 'force' ] ; then
has_force_arg=1
fi
fi
# make sure the current directory is correct
if [ ! -d ${CURRENT_DIR}/.templates ] ; then
echo "this script should be called by make: make qtcreator (one level up)"
@@ -48,6 +56,10 @@ GLOBAL_WORKING_DIR_FOR_SED=$(echo ${GLOBAL_WORKING_DIR} | sed 's/\//\\\//g')
was_qtcreator_dir=0
if [ $has_force_arg -eq 1 ] ; then
rm -rf "${QTCREATOR_DIR}"
fi
if [ -d "${QTCREATOR_DIR}" ] ; then
was_qtcreator_dir=1
else
@@ -76,7 +88,7 @@ if [ -d "${QTCREATOR_DIR}" ] ; then
if [ $was_qtcreator_dir -eq 0 ] ; then
echo "QTCreator files generated to ${QTCREATOR_DIR} directory"
echo "select an 'open project...' option and find a ${QTCREATOR_DIR}/*.creator file"
echo "In QTCreator select an 'open project...' option and find a ${QTCREATOR_DIR}/*.creator file"
fi
fi
@@ -96,4 +108,3 @@ if [ -d "${QTCREATOR_DIR}" ] ; then
fi
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (c) 2007-2022, Tomasz Sowa
Copyright (c) 2007-2026, Tomasz Sowa
All rights reserved.
Redistribution and use in source and binary forms, with or without
+8
View File
@@ -24,9 +24,17 @@ clangd: FORCE
@.templates/install_clangd.sh
forceclangd: FORCE
@.templates/install_clangd.sh force
qtcreator: clangd
@.templates/install_qtcreator.sh
forceqtcreator: forceclangd
@.templates/install_qtcreator.sh force
FORCE:
+132 -44
View File
@@ -4,8 +4,8 @@
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2007-2021, Tomasz Sowa
/*
* Copyright (c) 2007-2026, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -54,66 +54,148 @@ PatternParser::PatternParser()
}
void PatternParser::Directory(const char * dir, const char * dir2)
void PatternParser::AddDirectory(const char * dir)
{
directory.clear();
directory2.clear();
if( dir )
pt::utf8_to_wide(dir, directory);
if( dir2 )
pt::utf8_to_wide(dir2, directory2);
pt::utf8_to_wide(dir, file_name);
directories.push_back(file_name);
file_name.clear();
}
void PatternParser::Directory(const std::string & dir)
void PatternParser::AddDirectory(const wchar_t * dir)
{
pt::utf8_to_wide(dir, directory);
directory2.clear();
directories.push_back(dir);
}
void PatternParser::Directory(const std::string & dir, const std::string & dir2)
void PatternParser::AddDirectory(const std::string & dir)
{
pt::utf8_to_wide(dir, directory);
pt::utf8_to_wide(dir2, directory2);
pt::utf8_to_wide(dir, file_name);
directories.push_back(file_name);
file_name.clear();
}
void PatternParser::Directory(const wchar_t * dir, const wchar_t * dir2)
void PatternParser::AddDirectory(const std::wstring & dir)
{
directory.clear();
directory2.clear();
if( dir )
directory = dir;
if( dir2 )
directory2 = dir2;
directories.push_back(dir);
}
void PatternParser::Directory(const std::wstring & dir)
void PatternParser::AddDirectories(const std::vector<std::string> & dirs)
{
directory = dir;
directory2.clear();
for(const std::string & dir : dirs)
{
pt::utf8_to_wide(dir, file_name);
directories.push_back(file_name);
}
file_name.clear();
}
void PatternParser::Directory(const std::wstring & dir, const std::wstring & dir2)
void PatternParser::AddDirectories(const std::list<std::string> & dirs)
{
directory = dir;
directory2 = dir2;
for(const std::string & dir : dirs)
{
pt::utf8_to_wide(dir, file_name);
directories.push_back(file_name);
}
file_name.clear();
}
void PatternParser::AddDirectories(const std::vector<std::wstring> & dirs)
{
for(const std::wstring & dir : dirs)
{
directories.push_back(dir);
}
}
void PatternParser::AddDirectories(const std::list<std::wstring> & dirs)
{
for(const std::wstring & dir : dirs)
{
directories.push_back(dir);
}
}
void PatternParser::SetDirectory(const char * dir)
{
directories.clear();
AddDirectory(dir);
}
void PatternParser::SetDirectory(const wchar_t * dir)
{
directories.clear();
AddDirectory(dir);
}
void PatternParser::SetDirectory(const std::string & dir)
{
directories.clear();
AddDirectory(dir);
}
void PatternParser::SetDirectory(const std::wstring & dir)
{
directories.clear();
AddDirectory(dir);
}
void PatternParser::SetDirectories(const std::vector<std::string> & dirs)
{
directories.clear();
for(const std::string & dir : dirs)
{
AddDirectory(dir);
}
}
void PatternParser::SetDirectories(const std::list<std::string> & dirs)
{
directories.clear();
for(const std::string & dir : dirs)
{
AddDirectory(dir);
}
}
void PatternParser::SetDirectories(const std::vector<std::wstring> & dirs)
{
directories = dirs;
}
void PatternParser::SetDirectories(const std::list<std::wstring> & dirs)
{
directories.clear();
for(const std::wstring & dir : dirs)
{
directories.push_back(dir);
}
}
void PatternParser::ClearDirectories()
{
directories.clear();
}
void PatternParser::SetBlocks(Blocks & blocks)
{
@@ -341,16 +423,22 @@ void PatternParser::ReadFile(const wchar_t * name, std::wstring & result)
{
result.clear();
if( !ReadFileFromDir(directory, name, result) )
bool file_read_successfully = false;
std::vector<std::wstring>::reverse_iterator dir = directories.rbegin();
for( ; dir != directories.rend() ; ++dir)
{
if( !ReadFileFromDir(directory2, name, result) )
if( ReadFileFromDir(*dir, name, result) )
{
if( log )
{
(*log) << pt::Log::log2 << "Ezc: can't open file: " << name << pt::Log::logend;
}
file_read_successfully = true;
break;
}
}
if( !file_read_successfully && log )
{
(*log) << pt::Log::log2 << "Ezc: can't open file: " << name << pt::Log::logend;
}
}
}
+23 -15
View File
@@ -4,8 +4,8 @@
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2007-2021, Tomasz Sowa
/*
* Copyright (c) 2007-2026, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -52,16 +52,25 @@ public:
PatternParser();
// first we're trying to read a file from directory dir
// if there is no such a file there then we try read from dir2
// (the second dir2 can be empty - it will not be used)
void Directory(const char * dir, const char * dir2 = 0);
void Directory(const std::string & dir);
void Directory(const std::string & dir, const std::string & dir2);
void AddDirectory(const char * dir);
void AddDirectory(const wchar_t * dir);
void AddDirectory(const std::string & dir);
void AddDirectory(const std::wstring & dir);
void AddDirectories(const std::vector<std::string> & dirs);
void AddDirectories(const std::list<std::string> & dirs);
void AddDirectories(const std::vector<std::wstring> & dirs);
void AddDirectories(const std::list<std::wstring> & dirs);
void Directory(const wchar_t * dir, const wchar_t * dir2 = 0);
void Directory(const std::wstring & dir);
void Directory(const std::wstring & dir, const std::wstring & dir2);
void SetDirectory(const char * dir);
void SetDirectory(const wchar_t * dir);
void SetDirectory(const std::string & dir);
void SetDirectory(const std::wstring & dir);
void SetDirectories(const std::vector<std::string> & dirs);
void SetDirectories(const std::list<std::string> & dirs);
void SetDirectories(const std::vector<std::wstring> & dirs);
void SetDirectories(const std::list<std::wstring> & dirs);
void ClearDirectories();
void ParseFile(const char * file_name, Pattern & pattern);
void ParseFile(const std::string & file_name, Pattern & pattern);
@@ -115,10 +124,9 @@ private:
// default: false
bool delete_white_text_items;
// first we're trying to read a file from 'directory'
// if there is no such a file there then we try read from 'directory2'
// we read from these directories only if they are not empty
std::wstring directory, directory2;
// directories for templates
// we start looking for files from the last directory
std::vector<std::wstring> directories;
int include_level, include_level_max;
+3 -3
View File
@@ -4,8 +4,8 @@
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2022, Tomasz Sowa
/*
* Copyright (c) 2022-2026, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,7 @@
#define EZC_VERSION_MAJOR 0
#define EZC_VERSION_MINOR 9
#define EZC_VERSION_PATCH 5
#define EZC_VERSION_PATCH 6
#endif