Swish Programming Style Guide
=============================


History:
========

 2001-04-26  rasc     first draft




Content:
========

This files contains some information about
data and module layout for the upcoming swish version.

This is necessary, because on the old "quick&dirty"
layout of swish 1.x it is hard to include all new
ideas and performance hacks, because the current module
design lacks a clear functional design (modules are
interacting heavily on data structur level, functions
are scattered over several modules, multiple similar library
functions, etc.).

There were some code cleanups in version 2.x.



Goal:
=====

- Better modular design, to support contribution of new
  encapsulated modules for some new functions - without 
  compromising the current code. 

-  Restrict new code mainly to the new module.
   Enable support for new interfaces to swish.
    e.g.:
     - shell cmdline interface
     - swish perllib
     - server module (new)
     - apache plugin (new)

- Rewriting some modules
    e.g.:
     - db interface
        - swish
        - sql  (oracle, mysql, etc.) (??)
     - new parser
        - new functions

- Redesign of Swish code layout
     - changing module concept
     - rearrange code 
     - change cmdline handling
     - change config file handling
     



Code draft:
===========


Some modules routine ideas:


// init basic module data
void initModule_#modulename# (SWISH  *sw)
// free all module data
void freeModule_#modulename# (SWISH *sw)
// config file handling for this module
int configModule_#modulename# (SWISH *sw, StringList *sl)


// command line handling
int cmdlineModule_#modulename# (SWISH *sw, .....)

   here are some ideas needed...



How to store module data:

   SWISH *sw;
   sw->modulename->data







Some routine ideas:

    
    InitSwish():
    FreeSwish():
        Basic init of swish()


    InitSwishDB ():
    FreeSwishDB ():
        Basic init for using a index database.

    OpenSwishDB():
    CloseSwishDB():


    

    OpenSwish():
    CloseSwish():
         Open/Close a swish session (e.g. via interface)

         There might be different ones





ToDo:
=====
   - new datatypes
   - parser
   - db interface
   - server module
   - apache 2.0 module
   - new functions





