Today I worked on cleaning codes and data structures.
I removed/modified some unnecessary header files. I thought that the name "interface_type.hpp" is inadequate for just a header file that declares basic types, so I just changed it to "types.hpp."
Also I thought that there need some common header file that contains essential header files, so I created "essentials.hpp" that includes types.hpp and other configuration files.
/* file essentials.hpp */
#ifndef _KERNEL_ESSENTIALS_HPP_
#define _KERNEL_ESSENTIALS_HPP_
#include <kernel/types.hpp>
#include <kernel/configurations.hpp>
#endif
I always wanted to make a centralized header file that contains every configuration variables that the kernel needs (Just like Linux!)
I also want to make a file format dedicated for storing all the configuration information comprehensively. I do not just want to make an endless lists of macros all scattered and jumbled up with each other, so I thought of very simple syntax for configuration file. What I thought of is this :
For grouping the variables I just thought of grouping with simple brackets and at the end add the warning message. And for declaring a variable I thought of simple equality statement that directly translates into #define statement in C++.
+ I will abandon the idea of separating the configurations by files, as it will become unnecessarily complicated. All the configuration variables will be stored in just one file.
# use this character for comment, cuz I'm lazy
[feature name]=enabled {
value0=enable
value1=disable
value2=10
value3=20
} WARNING "You didn't enable the feature [feature name]!"
This above code would translate into the following C++ code :
#define WARNING(str) debug::out::printf(DEBUG_WARNING , str)
/******************* CONFIG_USE_[feature_name] *******************/
#define CONFIG_USE_[feature_name]
#define CONFIG_value0 /* enabled */
// #define CONFIG_value1 /* disabled */
#define CONFIG_value1 10
#define CONFIG_value2 20
#define CONFIG_WARNING_NO_[feature_name] WARNING("You didn't enable the feature [feature name]!")
As you can see the brackets in the configuration file acts as just a visual aids for easy representation of system structure.
Making the interpreter for the configuration file would be easy, as it will just consists of analyzing the lines one by one and, filter out comments and interpret into C++ macro.
Guess I will have to do it later..