Co-existing Multiple Application within single C implementation 
Author Message
 Co-existing Multiple Application within single C implementation

Hello:

Problem Background:
I am dealing with a problem of having to write some C code on top of
existing software. The current software is several 100 thousand lines.
We are adding some code specific to our needs to the current code. The
issue is that the current code pertains to a product line and hence has
its own releases and changes. The new additions that we are putting are
for another product line. Our changes are minor modifications and
additions. The constraint is to maintain one stream and have both the
applications code co-exists. We are reusing a lot/most of the existing C

code and adding some more to customize to the other application needs.
The challenge is every time the base software changes or has a new
release, we may have to rebase - Typical SW maintanence problem.

Specific Questions:
What will be a good design to minimize rebase nightmares for the
following:
1. Modification of existing data structure.
  - there are a few data structures currently defined. we want to add
some stuff specific to the new product while not screwing up whats
supported for the existing products. one way to do this is to put the
new members with ifdefs so that only we make a compile time de-coupling.

But this will be a nightmare when we rebase.
Is there are good design where we can keep our changes our own
datastructure and inherit their (the current base data structures)?
Something that may be inline with whats being done in the OO/C++
paradigm.

2. Modification to current functions.
  - we want to add a few lines here and there on several existing
functions. Can someone suggest a good way of doing this such that we
have minimal rebase effort when the base code changes. We want to keep
most of the changes in one place (not scattered all over the functions)
so that rebase is easy. Whats the best way to clone and own existing
functions such that it is easy to rebase when the code that is being
cloned is changed frequently

Any pointers to address these issues through design insights or code
examples will be very helpful. I am sure this is something that is
common in the industry which is why I'd rather not re-invent the wheel.

Thank you in advance for all the input.



Mon, 04 Nov 2002 03:00:00 GMT  
 Co-existing Multiple Application within single C implementation
It seems like what you really want is to write your code as
an independent source of "patches" to the original.
To get your compilable source, you'd always apply your "patch",
then compile.

When rehosting occurs, simply apply your patch to the new source.

Now the problem is one of "how to reliably patch".
To do this, you want to trigger your patches not according to position
(that'd wire you to the "current" source), but rather to the
*content* of code,under the assumption that the content
in a rehosted source isn't much different.

So you want your patches to specify patterns in the source,
to be replaced by blocks of new code.   For instance,
if the typedef FOO was a structure, and you needed to
add another slot for your application, you'd like to say:

     "typedef FOO { \members }; "
          patch to
     "typedef FOO {\members; my_app_member int;}"
and have this patch applied consistently whereever FOO was
found in the base sources, regardless of how FOO is layed
out textually.

So you can't used SED or PERL (at least not without
implementing your own C lexer in Perl; I assure
you, you don't want to do that.


(http://www.semdesigns.com/Products/DMS/DMSToolkit.html)
will accept "patches"
in almost exactly the form specified above, and can
carry out the patching automatically.     Since it operates
by first parsing the source (and parsing the patches, which
means if they are accepted, they are syntactically well-formed),
and does matching by comparing the "abstract syntax trees",
it isn't fooled by layout or any other properties.   After
patching, it can reformat the the result back into "C" text
suitable to be fed to your compiler.    DMS will also
handle very large sources; a few hundred K SLOC
is way below its capacity.

I can send slides showing roughly how the tool can do this
if you are interested.

--

Semantic Designs, Inc., www.semdesigns.com FAX 512-250-1191
12636 Research Blvd #C214, Austin, Texas 78759



Quote:
> Hello:

> Problem Background:
> I am dealing with a problem of having to write some C code on top of
> existing software. The current software is several 100 thousand lines.
> We are adding some code specific to our needs to the current code. The
> issue is that the current code pertains to a product line and hence has
> its own releases and changes. The new additions that we are putting are
> for another product line. Our changes are minor modifications and
> additions. The constraint is to maintain one stream and have both the
> applications code co-exists. We are reusing a lot/most of the existing C

> code and adding some more to customize to the other application needs.
> The challenge is every time the base software changes or has a new
> release, we may have to rebase - Typical SW maintanence problem.

> Specific Questions:
> What will be a good design to minimize rebase nightmares for the
> following:
> 1. Modification of existing data structure.
>   - there are a few data structures currently defined. we want to add
> some stuff specific to the new product while not screwing up whats
> supported for the existing products. one way to do this is to put the
> new members with ifdefs so that only we make a compile time de-coupling.

> But this will be a nightmare when we rebase.
> Is there are good design where we can keep our changes our own
> datastructure and inherit their (the current base data structures)?
> Something that may be inline with whats being done in the OO/C++
> paradigm.

> 2. Modification to current functions.
>   - we want to add a few lines here and there on several existing
> functions. Can someone suggest a good way of doing this such that we
> have minimal rebase effort when the base code changes. We want to keep
> most of the changes in one place (not scattered all over the functions)
> so that rebase is easy. Whats the best way to clone and own existing
> functions such that it is easy to rebase when the code that is being
> cloned is changed frequently

> Any pointers to address these issues through design insights or code
> examples will be very helpful. I am sure this is something that is
> common in the industry which is why I'd rather not re-invent the wheel.

> Thank you in advance for all the input.



Mon, 04 Nov 2002 03:00:00 GMT  
 Co-existing Multiple Application within single C implementation
On Thu, 18 May 2000 16:09:50 -0500, Subramaniam, Gokul [RICH2:2Q23:EXCH]

Quote:

>additions. The constraint is to maintain one stream and have both the
>applications code co-exists. We are reusing a lot/most of the existing C

>code and adding some more to customize to the other application needs.
>The challenge is every time the base software changes or has a new
>release, we may have to rebase - Typical SW maintanence problem.

The comp.lang.c newsgroup does not not deal with software maintenance or
configuration.  The newsgroup is about programming in the C language.

Quote:
>so that rebase is easy. Whats the best way to clone and own existing
>functions such that it is easy to rebase when the code that is being
>cloned is changed frequently

One easy way is to maintain your own branch of the code with a reasonable
version control tool and periodically merge with changes done to
the main stream.

Discussing version control tools is outside of the comp.lang.c scope.

--
#exclude <windows.h>



Mon, 04 Nov 2002 03:00:00 GMT  
 Co-existing Multiple Application within single C implementation

Quote:

> On Thu, 18 May 2000 16:09:50 -0500, Subramaniam, Gokul [RICH2:2Q23:EXCH]

> >additions. The constraint is to maintain one stream and have both the
> >applications code co-exists. We are reusing a lot/most of the existing C

> >code and adding some more to customize to the other application needs.
> >The challenge is every time the base software changes or has a new
> >release, we may have to rebase - Typical SW maintanence problem.

> The comp.lang.c newsgroup does not not deal with software maintenance or
> configuration.  The newsgroup is about programming in the C language.

The question was specific to C programming. Read complete posting:
1. Modification of existing data structure.
  - there are a few data structures currently defined. we want to add
some stuff specific to the new product while not screwing up whats
supported for the existing products. one way to do this is to put the
new members with ifdefs so that only we make a compile time de-coupling.

But this will be a nightmare when we rebase.
Is there are good design where we can keep our changes our own
datastructure and inherit their (the current base data structures)?
Something that may be inline with whats being done in the OO/C++
paradigm.

How can C structs clone and owned or inherited similar to the C++ concept
such that the old struct and the new modified struct can be reused?

2. Modification to current functions.
  - we want to add a few lines here and there on several existing
functions. Can someone suggest a good way of doing this such that we
have minimal rebase effort when the base code changes. We want to keep
most of the changes in one place (not scattered all over the functions)
so that rebase is easy. Whats the best way to clone and own existing
functions such that it is easy to rebase when the code that is being
cloned is changed frequently?

This question is specific to C function implementation.

You seem to have read the background. I only provided that for contextual
reasons.
I was hoping to get C programming language specific nuances to handle the
above mentioned issues.

Quote:

> >so that rebase is easy. Whats the best way to clone and own existing
> >functions such that it is easy to rebase when the code that is being
> >cloned is changed frequently

> One easy way is to maintain your own branch of the code with a reasonable
> version control tool and periodically merge with changes done to
> the main stream.

> Discussing version control tools is outside of the comp.lang.c scope.

> --
> #exclude <windows.h>

Thanks for your response.


Tue, 05 Nov 2002 03:00:00 GMT  
 Co-existing Multiple Application within single C implementation

Quote:


> > On Thu, 18 May 2000 16:09:50 -0500, Subramaniam, Gokul [RICH2:2Q23:EXCH]

> > >additions. The constraint is to maintain one stream and have both the
> > >applications code co-exists. We are reusing a lot/most of the existing C

> > >code and adding some more to customize to the other application needs.
> > >The challenge is every time the base software changes or has a new
> > >release, we may have to rebase - Typical SW maintanence problem.

> > The comp.lang.c newsgroup does not not deal with software maintenance or
> > configuration.  The newsgroup is about programming in the C language.

> The question was specific to C programming. Read complete posting:
> 1. Modification of existing data structure.
>   - there are a few data structures currently defined. we want to add
> some stuff specific to the new product while not screwing up whats
> supported for the existing products. one way to do this is to put the
> new members with ifdefs so that only we make a compile time de-coupling.

> But this will be a nightmare when we rebase.
> Is there are good design where we can keep our changes our own
> datastructure and inherit their (the current base data structures)?
> Something that may be inline with whats being done in the OO/C++
> paradigm.

> How can C structs clone and owned or inherited similar to the C++ concept
> such that the old struct and the new modified struct can be reused?

"Owned?" Explain. It's not C terminology, that's for sure.
You can, somewhat, simulate inheritance by including one struct as a
member of another struct, if that's what you mean. It's far from ideal,
though.

Quote:
> 2. Modification to current functions.
>   - we want to add a few lines here and there on several existing
> functions. Can someone suggest a good way of doing this such that we
> have minimal rebase effort when the base code changes. We want to keep
> most of the changes in one place (not scattered all over the functions)
> so that rebase is easy. Whats the best way to clone and own existing
> functions such that it is easy to rebase when the code that is being
> cloned is changed frequently?

> This question is specific to C function implementation.

No. It's specific to code handling. You could have the same problem with
Pascal, VB, probably even Lisp. Anyway, perhaps something like CVS could
help you? Note that it's not ISO-C specific either, and should therefore
really be discussed in another newsgroup.

Richard



Tue, 05 Nov 2002 03:00:00 GMT  
 Co-existing Multiple Application within single C implementation



Quote:

> The question was specific to C programming. Read complete posting:
> 1. Modification of existing data structure.
>   - there are a few data structures currently defined. we want to add
> some stuff specific to the new product while not screwing up whats
> supported for the existing products. one way to do this is to put the
> new members with ifdefs so that only we make a compile time de-coupling.

> But this will be a nightmare when we rebase.
> Is there are good design where we can keep our changes our own
> datastructure and inherit their (the current base data structures)?
> Something that may be inline with whats being done in the OO/C++
> paradigm.

> How can C structs clone and owned or inherited similar to the C++ concept
> such that the old struct and the new modified struct can be reused?

The first step is to SEGREGATE existing functionality.  Then extend your
ENUMERATIONS over the sub-set and add additional EVALUATIONS.  If you can't
extricate all of your macros you'll need to create INDEPENDENT objects.

Quote:
> 2. Modification to current functions.
>   - we want to add a few lines here and there on several existing
> functions. Can someone suggest a good way of doing this such that we
> have minimal rebase effort when the base code changes. We want to keep
> most of the changes in one place (not scattered all over the functions)
> so that rebase is easy. Whats the best way to clone and own existing
> functions such that it is easy to rebase when the code that is being
> cloned is changed frequently?

This sounds like a C program GENERATOR problem.  What do you mean by rebase?
Karl M


Tue, 05 Nov 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Co-existing Multiple Application within single C implementation

2. Dialog box co-exist with a SDI application??

3. Multiple components update within a single Transaction

4. Multiple active dialogs in a single application

5. Multiple Console Windows in a Single Application???

6. Multiple windows in a single application in WIN32 API

7. Single document, multiple view application?

8. Question: Multiple Document/Single View application, how?

9. Single Document with Multiple Views in an SDI Application

10. Question: Multiple Document/Single View application, how?

11. Multiple levels of implementation and implementation inheritance

12. johng@rogge.co.uk;malio@rogge.co.uk;richardg@rogge.co.uk

 

 
Powered by phpBB® Forum Software