Line 1 was replaced by line 1 |
- !New Initialization Scheme for SICS |
+ !!New Initialization Scheme for SICS |
Lines 4-20 were replaced by lines 4-8 |
- one list when adding a new feature. Let us look at the |
- difference when adding a command or driver. Before using this |
- scheme, there were many different places in psi/psi.c where |
- modifications had to be added: |
- |
- * when adding a new command |
- ** prototype declaration of the command function or include |
- statement |
- ** inserting the command to the AddPsiCommands function |
- ** if it is a startup command, inserting the command to |
- the RemovePsiCommands function |
- * when adding a new driver |
- ** prototype declaration of the driver creation function or |
- include statement |
- ** adding a "else if" clause to the CreatePsiXXX function |
- ** in the case of an envitonment driver, also add an "else if" |
- clause to the ConfigureController function. |
+ one list when adding a new feature. The aim is not |
+ to make the source code shorter. In fact, the initialization |
+ code is just moved from a central place to the modules. |
+ The main goal is to have a better structure of the code, |
+ which should be easier to maintain, and less error-prone. |
At line 21 added 20 lines. |
+ Let us look at the difference when adding a command or driver. |
+ Before using this scheme, there were many different places in |
+ psi/psi.c where modifications had to be added: |
+ |
+ when adding a new command: |
+ |
+ * prototype declaration of the command function or include |
+ statement |
+ * inserting the command to the ''AddPsiCommands'' function |
+ * if it is a startup command, inserting the command to |
+ the ''RemovePsiCommands'' function |
+ |
+ when adding a new driver: |
+ |
+ * prototype declaration of the driver creation function or |
+ include statement |
+ * adding an "else if" clause to the ''CreatePsi''XXX function |
+ * in the case of an environment driver, also add an "else if" |
+ clause to the ''ConfigureController'' function. |
+ |
Lines 24-29 were replaced by lines 32-57 |
- In this function, for standalone commands, either AddIniCmd[1] or |
- AddCmd[1] is called to insert a startup or normal command. To create |
- a new driver, use either the MakeDriver function, if you want |
- to use the MakeObject[2] command to create the driver, or the functions |
- MakeInitializer/GetInitializer[2], if you want to do use an other |
- factory command. |
+ In this function, you call ''AddCmd'', ''AddIniCmd'' or ''AddCommand''(SCinter.h) to |
+ insert a standalone command, startup command or an object command. To |
+ create a new driver, use either the ''MakeDriver'' function, if you want |
+ to use the ''MakeObject'' command to create the driver, or the functions |
+ ''MakeInitializer/GetInitializer'', if you want to do use an other |
+ factory command (see initializer.h). |
+ The init function has to be added to the system by inserting one line |
+ to the ''SiteInit'' (psi.c) or ''InitGeneral'' (ofac.c) function. |
+ |
+ ''Suggestion by [Markus Zolliker]'' |
+ |
+ At present, only the new stuff I inserted uses this scheme. I propose |
+ to move to the new scheme during next shutdown. |
+ |
+ ofac.c: |
+ |
+ * remove ''InitIniCommands'' (moving first few lines ''InitObjectCommands'') |
+ and ''RemoveIniCommands'' |
+ * move ''InitGeneral'' to a new file named ''inigen.c'' |
+ * Create init functions for all modules defining commands, and add |
+ calls to the ''InitGeneral'' function |
+ |
+ psi.c: |
+ |
+ * all stuff (except ''SiteInit'') is moved to the corresponding modules, |
+ using ''MakeInitializer/GetInitializer'' |
Lines 31-32 were replaced by line 59 |
- [#1] SCinter.h |
- [#2] initializer.h |
+ These modifications will not change the behaviour of SICS. |