Chris Croughton wrote on 17/04/05 :[color=blue]
> On Sun, 17 Apr 2005 12:36:08 +0200, Emmanuel Delahaye
> <emdel@YOURBRAnoos.fr> wrote:
>[color=green]
>> I personally use the folowing pattern:
>>
>> H_<initials/company>_<file name>_<date><time>
>>
>> date in YYYYMMDD format and time in HHMMSS format
>>
>> It provides a better protection against doublons.
>>
>> For example :
>>
>> H_ED_RANDOM_20080416123300
>>
>> that is used :
>>
>> #ifndef H_ED_RANDOM_20080416123300
>> #define H_ED_RANDOM_20080416123300
>>
>> /* ... */
>>
>> #endif /* guard */
>>
>> Of course, this is automated. (UltraEdit can do that, and I have
>> written a separated utility too.)[/color]
>
> Is that utility publically available in source form? I could of course
> write my own, but if there's an existing one it may be more efficient to
> reuse it...
>
> (I use a Vim macro and template files in general, but I have old files
> which could do with being guarded properly...)
>
> Chris C[/color]
The project files
c.c \clib\c\src
c_guard.c \clib\c\src
c_tools.c \clib\c\src
ascii.c \clib\ed\src
str.c \clib\ed\src
sys.c \clib\ed\src
fic.c \clib\ed\src
main.c
The main file is here
http://mapage.noos.fr/emdel/clib/tools/guard/src/main.c
The 'C' files are here
http://mapage.noos.fr/emdel/clib/c/inc/c.h http://mapage.noos.fr/emdel/clib/c/inc/ci.h http://mapage.noos.fr/emdel/clib/c/src/c.c http://mapage.noos.fr/emdel/clib/c/src/c_tools.c http://mapage.noos.fr/emdel/clib/c/src/c_guard.c
the missing files (ED) are accessible by
http://mapage.noos.fr/emdel/clib.htm
The 'initial/company' field is ED by default and can be redefined by
the GUARD environment variable.
Usage:
-> Returned when the program is invoked without parameter:
USAGE guard <header file .h or .hpp>
-> Returned when the file is unknown:
USAGE guard <header file .h or .hpp>
test.h: No such file or directory
-> Returned when the file is known:
Nothing !
The test file was:
<begin>
/* test.h */
<end>
It has been modified to
<begin>
#ifndef H_ED_TEST_20050417191614
#define H_ED_TEST_20050417191614
#ifdef __cplusplus
extern "C"
{
#endif
/* test.h */
#ifdef __cplusplus
}
#endif
#endif /* guard */
/* Guards added by GUARD (c) ED 2000-2005 Apr 17 2005 Ver. 1.7 */
<end>
The original file has been renamed in test.gua
Let me know if you are in trouble.
The use and enhancement of this utility and of the clib files is free
(in both means) as long as the copyright indications "(c) ED
<year>[-<year>]" are mentioned. In case of enhancement, you can add you
own (c).
--
Emmanuel
The C-FAQ:
http://www.eskimo.com/~scs/C-faq/faq.html
The C-library:
http://www.dinkumware.com/refxc.html
"Clearly your code does not meet the original spec."
"You are sentenced to 30 lashes with a wet noodle."
-- Jerry Coffin in a.l.c.c++