Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include <elektra/kdb.h> #817

Open
markus2330 opened this issue Jun 30, 2016 · 10 comments
Open

include <elektra/kdb.h> #817

markus2330 opened this issue Jun 30, 2016 · 10 comments
Projects
Milestone

Comments

@markus2330
Copy link
Contributor

markus2330 commented Jun 30, 2016

We could install all header files also to /usr/include/elektra, which allows us to include <elektra/kdb.h> without any include path.

@markus2330
Copy link
Contributor Author

@domhof Is this a 1.0 issue?

@sanssecours
Copy link
Member

If the alternative “Macro magic to support both inclusion options“ means that we do not need to install each header file twice, then I am for that option.

How about creating a link /usr/include/elektra/legacy that points to /usr/include/elektra. Would that also work?

@markus2330
Copy link
Contributor Author

markus2330 commented Feb 9, 2017

means that we do not need to install each header file twice, then I am for that option.

What is so bad about installing the files twice? They are not really large... (388K)

How about creating a link /usr/include/elektra/legacy that points to /usr/include/elektra. Would that also work?

You are right, actually we do not need to install them twice. (even the symlink does not seem to be necessary.) We simply internally always use <elektra/file.h> and if the user sets the include path to /usr/include/elektra the internal elektra/kdb.h should still work?

Within the source repo, however, we would need to create a folder called elektra, so the include files would be in `src/include/elektra.

@sanssecours
Copy link
Member

What is so bad about installing the files twice? They are not really large... (388K)

It’s not that bad, but I am usually a fan of keeping things small and tidy.

Within the source repo, however, we would need to create a folder called elektra, so the include files would be in src/include/elektra.

Provided that this solution works, creating an additional subfolder does not sound that bad. I certainly could live with it.

@markus2330 markus2330 added this to to discuss in lcdproc Mar 6, 2017
@markus2330 markus2330 moved this from to discuss to to implement in lcdproc Mar 16, 2017
@markus2330
Copy link
Contributor Author

lets do it

@markus2330 markus2330 self-assigned this Aug 2, 2017
@markus2330 markus2330 added this to the 0.8.22 milestone Dec 17, 2017
@markus2330 markus2330 modified the milestones: 0.8.22, 0.8.23 Feb 12, 2018
@markus2330 markus2330 modified the milestones: 0.8.23, 0.8.24 Apr 15, 2018
@markus2330 markus2330 removed their assignment Jun 3, 2018
@markus2330 markus2330 modified the milestones: 0.8.24, 0.8.25, 0.9.0 Aug 18, 2018
bauhaus93 added a commit to bauhaus93/libelektra that referenced this issue Oct 18, 2019
Includes for <kdb.h> and "kdb.h" were replaced by <elektra/kdb.h> and "elektra/kdb.h".
Targeted files: *.h/*.hpp/*.c/*.cpp/*.chs/*.i (including matching files with suffix .in) in folders src, tests, examples, benchmarks.
Resolving ElektraInitiative#817

Script used for replacement:

replace()
{
	    if [[ $(sed -i "s/$2/$3/gw /dev/stdout" $1) ]]
		then
		echo "$1"
	    fi
}

for file in $(find libelektra/src libelektra/tests libelektra/examples libelektra/benchmarks -regex ".*\.\(h\|\(hpp\)\|c\|\(cpp\)\|\(chs\)\|i\)\(\.in\)?"); do
	replace "$file" '#include <kdb\.h>' '#include <elektra\/kdb\.h>'
	replace "$file" '#include "kdb\.h"' '#include "elektra\/kdb\.h"'
	replace "$file" '%include "kdb\.h"' '%include "elektra\/kdb\.h"'
done
bauhaus93 added a commit to bauhaus93/libelektra that referenced this issue Oct 18, 2019
kdb.h.in moved into subfolder elektra, so that kdb.h can be included by <elektra/kdb.h> and "elektra/kdb.h".
The configure_file and install commands in the CMakeLists.txt were moved/updated.
For custom target elektra_config_headers the path of kdb.h was updated.
Resolving ElektraInitiative#817
@bauhaus93 bauhaus93 mentioned this issue Oct 18, 2019
16 tasks
bauhaus93 added a commit to bauhaus93/libelektra that referenced this issue Nov 24, 2019
Includes for <kdb.h> and "kdb.h" were replaced by <elektra/kdb.h> and "elektra/kdb.h".
Targeted files: *.h/*.hpp/*.c/*.cpp/*.chs/*.i (including matching files with suffix .in) in folders src, tests, examples, benchmarks.
Resolving ElektraInitiative#817

Script used for replacement:

replace()
{
	    if [[ $(sed -i "s/$2/$3/gw /dev/stdout" $1) ]]
		then
		echo "$1"
	    fi
}

for file in $(find libelektra/src libelektra/tests libelektra/examples libelektra/benchmarks -regex ".*\.\(h\|\(hpp\)\|c\|\(cpp\)\|\(chs\)\|i\)\(\.in\)?"); do
	replace "$file" '#include <kdb\.h>' '#include <elektra\/kdb\.h>'
	replace "$file" '#include "kdb\.h"' '#include "elektra\/kdb\.h"'
	replace "$file" '%include "kdb\.h"' '%include "elektra\/kdb\.h"'
done
bauhaus93 added a commit to bauhaus93/libelektra that referenced this issue Nov 24, 2019
kdb.h.in moved into subfolder elektra, so that kdb.h can be included by <elektra/kdb.h> and "elektra/kdb.h".
The configure_file and install commands in the CMakeLists.txt were moved/updated.
For custom target elektra_config_headers the path of kdb.h was updated.
Resolving ElektraInitiative#817
bauhaus93 added a commit to bauhaus93/libelektra that referenced this issue Nov 24, 2019
Includes for <kdb.h> and "kdb.h" were replaced by <elektra/kdb.h> and "elektra/kdb.h".
Targeted files: *.h/*.hpp/*.c/*.cpp/*.chs/*.i (including matching files with suffix .in) in folders src, tests, examples, benchmarks.
Resolving ElektraInitiative#817

Script used for replacement:

replace()
{
	    if [[ $(sed -i "s/$2/$3/gw /dev/stdout" $1) ]]
		then
		echo "$1"
	    fi
}

for file in $(find libelektra/src libelektra/tests libelektra/examples libelektra/benchmarks -regex ".*\.\(h\|\(hpp\)\|c\|\(cpp\)\|\(chs\)\|i\)\(\.in\)?"); do
	replace "$file" '#include <kdb\.h>' '#include <elektra\/kdb\.h>'
	replace "$file" '#include "kdb\.h"' '#include "elektra\/kdb\.h"'
	replace "$file" '%include "kdb\.h"' '%include "elektra\/kdb\.h"'
done
bauhaus93 added a commit to bauhaus93/libelektra that referenced this issue Nov 24, 2019
kdb.h.in moved into subfolder elektra, so that kdb.h can be included by <elektra/kdb.h> and "elektra/kdb.h".
The configure_file and install commands in the CMakeLists.txt were moved/updated.
For custom target elektra_config_headers the path of kdb.h was updated.
Resolving ElektraInitiative#817
bauhaus93 added a commit to bauhaus93/libelektra that referenced this issue Jan 18, 2020
Includes for <kdb.h> and "kdb.h" were replaced by <elektra/kdb.h> and "elektra/kdb.h".
Targeted files: *.h/*.hpp/*.c/*.cpp/*.chs/*.i (including matching files with suffix .in) in folders src, tests, examples, benchmarks.
Resolving ElektraInitiative#817

Script used for replacement:

replace()
{
	    if [[ $(sed -i "s/$2/$3/gw /dev/stdout" $1) ]]
		then
		echo "$1"
	    fi
}

for file in $(find libelektra/src libelektra/tests libelektra/examples libelektra/benchmarks -regex ".*\.\(h\|\(hpp\)\|c\|\(cpp\)\|\(chs\)\|i\)\(\.in\)?"); do
	replace "$file" '#include <kdb\.h>' '#include <elektra\/kdb\.h>'
	replace "$file" '#include "kdb\.h"' '#include "elektra\/kdb\.h"'
	replace "$file" '%include "kdb\.h"' '%include "elektra\/kdb\.h"'
done
bauhaus93 added a commit to bauhaus93/libelektra that referenced this issue Jan 18, 2020
kdb.h.in moved into subfolder elektra, so that kdb.h can be included by <elektra/kdb.h> and "elektra/kdb.h".
The configure_file and install commands in the CMakeLists.txt were moved/updated.
For custom target elektra_config_headers the path of kdb.h was updated.
Resolving ElektraInitiative#817
@markus2330 markus2330 changed the title proposal: include <elektra/kdb.h> include <elektra/kdb.h> Apr 14, 2020
@kodebach
Copy link
Member

kodebach commented Mar 3, 2021

I think a big issue here is also that we often use e.g. #include <kdbmacros.h> with <>. AFAIK the C standard doesn't have an opinion on this, but most compilers will start only look in include paths with <>. But with #include "kdbmacros.h" they first look in the directory the current file is in, so that way it should work no matter where we put our headers, as long as the have the same relative layout as in the source tree.

@kodebach kodebach added the cm2022s for university course label Mar 3, 2021
@markus2330 markus2330 removed the cm2022s for university course label Mar 3, 2021
mpranj pushed a commit to mpranj/libelektra that referenced this issue Apr 27, 2021
Includes for <kdb.h> and "kdb.h" were replaced by <elektra/kdb.h> and "elektra/kdb.h".
Targeted files: *.h/*.hpp/*.c/*.cpp/*.chs/*.i (including matching files with suffix .in) in folders src, tests, examples, benchmarks.
Resolving ElektraInitiative#817

Script used for replacement:

replace()
{
	    if [[ $(sed -i "s/$2/$3/gw /dev/stdout" $1) ]]
		then
		echo "$1"
	    fi
}

for file in $(find libelektra/src libelektra/tests libelektra/examples libelektra/benchmarks -regex ".*\.\(h\|\(hpp\)\|c\|\(cpp\)\|\(chs\)\|i\)\(\.in\)?"); do
	replace "$file" '#include <kdb\.h>' '#include <elektra\/kdb\.h>'
	replace "$file" '#include "kdb\.h"' '#include "elektra\/kdb\.h"'
	replace "$file" '%include "kdb\.h"' '%include "elektra\/kdb\.h"'
done
mpranj pushed a commit to mpranj/libelektra that referenced this issue Apr 27, 2021
kdb.h.in moved into subfolder elektra, so that kdb.h can be included by <elektra/kdb.h> and "elektra/kdb.h".
The configure_file and install commands in the CMakeLists.txt were moved/updated.
For custom target elektra_config_headers the path of kdb.h was updated.
Resolving ElektraInitiative#817
@mpranj mpranj mentioned this issue Apr 27, 2021
20 tasks
@markus2330
Copy link
Contributor Author

As discussed in #3813 we do not need any legacy header files. The only supported way to include files should be <elektra/NAME.h>, where NAME usually does not start with "kdb", so e.g. it would be <elektra/macros.h>.

@Janldeboer
Copy link
Contributor

To proceed with this, we have to move all the header files into the src/include/elektra folder, is that correct?

@kodebach
Copy link
Member

kodebach commented Dec 1, 2022

This issue is a bit outdated. We now have a few decisions that describe what the everything should look like:

There are also some decisions that are tangentially related:

For this issue I'd say the main part is header_file_structure.md. Fully implementing that, also requires updating includes and CMake config. So doing everything at once might a bit much. Maybe start with moving things to src/include/elektra and src/include/internal and updating the CMake config.

@Janldeboer
Copy link
Contributor

Thank you for the feedback, I will continue with that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
lcdproc
to implement
Development

Successfully merging a pull request may close this issue.

5 participants