aboutsummaryrefslogtreecommitdiff
path: root/src/Headers.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Headers.c')
-rw-r--r--src/Headers.c99
1 files changed, 65 insertions, 34 deletions
diff --git a/src/Headers.c b/src/Headers.c
index 25534d0..97b50e9 100644
--- a/src/Headers.c
+++ b/src/Headers.c
@@ -12,8 +12,6 @@
#include "util_String.h"
-#include <string.h>
-
#include "SString_Namespace.h"
#define EMPTYSTRING { '\0' }
@@ -113,11 +111,11 @@ static const char * cactus_doctype =
********************* External Routines **********************
********************************************************************/
-void SetHTML_HeadHeader( String *header)
+void HTTP_SetHeadInfo( String *header)
{
SetToCString( header, cactus_styles );
}
-void SetHTML_Doctype( String *header)
+void HTTP_SetDoctype( String *header)
{
SetToCString( header, cactus_doctype );
}
@@ -137,7 +135,7 @@ void SetHTML_Doctype( String *header)
@@*/
extern void CCTK_GetRunTitleString( String *s );
-int SetHTML_ContentHeader(const cGH *GH, int choice,
+int HTTP_SetContentHeaderString(const cGH *GH, int choice,
String *header, const String *menu)
{
String *title = String_New();
@@ -153,11 +151,10 @@ int SetHTML_ContentHeader(const cGH *GH, int choice,
if (choice == 0)
{
- ConcatCString( header,
- "<table cellpadding=\"10\" width=\"100%\" border=\"0\">\n"
- "<tr>\n"
- "<td class=\"menu\" valign=\"top\">\n"
- "<h2><a href=\"/\">Master Run Page</a></h2>\n");
+ ConcatCString( header, "<table cellpadding=\"10\" width=\"100%\">\n"
+ "<tr>\n"
+ "<td class=\"menu\" valign=\"top\">\n"
+ "<h2><a href=\"/\">Master Run Page</a></h2>\n");
}
if(ContentLinks)
@@ -184,34 +181,26 @@ int SetHTML_ContentHeader(const cGH *GH, int choice,
Util_CurrentTime(sizeof(currenttime),currenttime);
/* Build the header */
- ConcatCString( header,
- "\n"
- "<h3>Environment:</h3>\n"
- "Time: ");
+ ConcatCString( header, "\n"
+ "<h3>Environment:</h3>\n"
+ "Time: ");
ConcatCString( header, currenttime );
- ConcatCString( header,
- "<br />\n"
- "Date: " );
+ ConcatCString( header, "<br />\n"
+ "Date: " );
ConcatCString( header, currentdate );
- ConcatCString( header,
- "<br />\n" );
- ConcatCString( header,
- "<h3>Simulation:</h3>\n"
- "<span class=\"simulation_name\">");
+ ConcatCString( header, "<br />\n" );
+ ConcatCString( header, "<h3>Simulation:</h3>\n"
+ "<span class=\"simulation_name\">");
Concat( header, title );
- ConcatCString( header,
- "</span><br />\n"
- "<kbd>");
+ ConcatCString( header, "</span><br />\n"
+ "<kbd>");
ConcatCString( header, file );
- ConcatCString( header,
- "</kbd><br />\n"
- "Iteration: ");
+ ConcatCString( header, "</kbd><br />\n"
+ "Iteration: ");
ConcatDecimal( header, GH ? GH->cctk_iteration : 0 );
- ConcatCString( header,
- "<br />\nPhysical time: ");
- ConcatFormattedDouble( header, 4, 2, GH ? GH->cctk_time : 0 );
- ConcatCString( header,
- "<br />\n");
+ ConcatCString( header, "<br />\nPhysical time: ");
+ ConcatFormattedDouble( header, GH ? GH->cctk_time : 0, 4, 2, SFMT_DEFAULT );
+ ConcatCString( header, "<br />\n");
if (ContentLinks)
{
Concat( header, quicklinks);
@@ -246,7 +235,7 @@ int SetHTML_ContentHeader(const cGH *GH, int choice,
@endhistory
@@*/
-int SetHTML_ContentFooter(const cGH *GH, int choice, String *footer)
+int HTTP_SetContentFooterString(const cGH *GH, int choice, String *footer)
{
/* avoid compiler warnings about unused parameters */
GH = GH;
@@ -256,3 +245,45 @@ int SetHTML_ContentFooter(const cGH *GH, int choice, String *footer)
SetToCString(footer,cactus_footer);
return Length(footer);
}
+
+int HTTP_ContentHeader(const cGH *GH, int choice, int len,
+ char *header, const char *menu)
+{
+ String *menuString = NULL;
+ String *headerString = String_New();
+ int retval = 0;
+
+ if( menu )
+ menuString = String_Make( menu );
+
+ retval = HTTP_SetContentHeaderString( GH, choice, headerString, menuString );
+
+ /* SW: original didn't use len, although it was clearly meant
+ * to indicate the length of the buffer, and all calls I saw to it
+ * passed a buffer length */
+ if( len > 0 )
+ {
+ SetToBuffer( headerString, header, len );
+ }
+ String_Delete( menuString );
+ String_Delete( headerString );
+ return retval;
+}
+
+int HTTP_ContentFooter(const cGH *GH, int choice, int len, char *header)
+{
+ String *headerString = String_New();
+ int retval = 0;
+
+ retval = HTTP_SetContentFooterString( GH, choice, headerString );
+
+ /* note: original didn't use len, although it was clearly meant
+ * to indicate the length of the buffer, and all calls I saw to it
+ * passed a buffer length */
+ if( len > 0 )
+ {
+ SetToBuffer( headerString, header, len );
+ }
+ String_Delete( headerString );
+ return retval;
+}