diff options
author | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-07-18 10:28:13 +0000 |
---|---|---|
committer | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-07-18 10:28:13 +0000 |
commit | c641478ad08daf6924db06d4a41eea76b743410f (patch) | |
tree | 009d02af27c15b838a15dfd2b64875da15ee7181 /src/main/Banner.c | |
parent | e9033ed6f914dd008f50c15f85fc56e8a458a210 (diff) |
Registration routine to add a banner during cactus start up. At the
moment this registers a "C" style string, although maybe it should
just register a routine.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@721 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/Banner.c')
-rw-r--r-- | src/main/Banner.c | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/main/Banner.c b/src/main/Banner.c new file mode 100644 index 00000000..aef67f1f --- /dev/null +++ b/src/main/Banner.c @@ -0,0 +1,83 @@ + /*@@ + @file Banner.c + @date July 16 00:11:26 1999 + @author Gabrielle Allen + @desc + Routines to deal with the Cactus banners. + @enddesc + @@*/ + +#include <stdlib.h> +#include <stdio.h> + +#include "config.h" +#include "cctk_parameters.h" + +static int number_banners = 0; +static const char **strings; + + /*@@ + @routine CCTK_RegisterBanner + @date July 16 00:11:26 1999 + @author Gabrielle Allen + @desc + Registers a string as a banner + @enddesc + @var string + @vdesc The banner as a C string + @vtype const char * + @vio + @vcomment + @endvar +@@*/ + +void CCTK_RegisterBanner(const char *string) +{ + + number_banners++; + + if (number_banners == 1) + strings = (const char **)malloc( number_banners*sizeof(const char *)); + else + realloc( strings, number_banners*sizeof(const char *)); + + strings[number_banners-1] = string; +} + + + /*@@ + @routine CCTKi_PrintBanners + @date July 16 00:11:26 1999 + @author Gabrielle Allen + @desc + Print all registered banners + @enddesc + @var string + @vdesc The banner as a C string + @vtype const char * + @vio + @vcomment + @endvar +@@*/ + +void CCTKi_PrintBanners(void) +{ + + DECLARE_CCTK_PARAMETERS + + int i; + + if (cctk_show_banners) + { + for (i=0;i<number_banners;i++) + { + printf("-------------------------------------------------------------------------------------\n"); + printf("%s\n",strings[i]); + printf("-------------------------------------------------------------------------------------\n"); + } + } +} + + + + |