",Attr);
free ((void *) Attr);
}
else
HTM_DIV_BeginWithoutAttr ();
}
else
HTM_DIV_BeginWithoutAttr ();
HTM_DIV_NestingLevel++;
}
static void HTM_DIV_BeginWithoutAttr (void)
{
fprintf (Gbl.F.Out,"
");
}
void HTM_DIV_End (void)
{
if (HTM_DIV_NestingLevel == 0) // No DIV open
Ale_ShowAlert (Ale_ERROR,"Trying to close unopened DIV.");
fprintf (Gbl.F.Out,"
");
HTM_DIV_NestingLevel--;
}
/*****************************************************************************/
/******************************** Main zone **********************************/
/*****************************************************************************/
void HTM_MAIN_Begin (const char *Class)
{
fprintf (Gbl.F.Out,"
",Class);
}
void HTM_MAIN_End (void)
{
fprintf (Gbl.F.Out,"");
}
/*****************************************************************************/
/********************************* Articles **********************************/
/*****************************************************************************/
void HTM_ARTICLE_Begin (const char *ArticleId)
{
fprintf (Gbl.F.Out,"
",ArticleId);
}
void HTM_ARTICLE_End (void)
{
fprintf (Gbl.F.Out,"");
}
/*****************************************************************************/
/********************************* Sections **********************************/
/*****************************************************************************/
void HTM_SECTION_Begin (const char *SectionId)
{
fprintf (Gbl.F.Out,"
",SectionId);
}
void HTM_SECTION_End (void)
{
fprintf (Gbl.F.Out,"");
}
/*****************************************************************************/
/****************************** Unordered lists ******************************/
/*****************************************************************************/
void HTM_UL_Begin (const char *fmt,...)
{
va_list ap;
int NumBytesPrinted;
char *Attr;
if (fmt)
{
if (fmt[0])
{
va_start (ap,fmt);
NumBytesPrinted = vasprintf (&Attr,fmt,ap);
va_end (ap);
if (NumBytesPrinted < 0) // If memory allocation wasn't possible,
// or some other error occurs,
// vasprintf will return -1
Lay_NotEnoughMemoryExit ();
/***** Print HTML *****/
fprintf (Gbl.F.Out,"
",Attr);
free ((void *) Attr);
}
else
HTM_UL_BeginWithoutAttr ();
}
else
HTM_UL_BeginWithoutAttr ();
HTM_UL_NestingLevel++;
}
static void HTM_UL_BeginWithoutAttr (void)
{
fprintf (Gbl.F.Out,"");
}
void HTM_UL_End (void)
{
if (HTM_UL_NestingLevel == 0) // No UL open
Ale_ShowAlert (Ale_ERROR,"Trying to close unopened UL.");
fprintf (Gbl.F.Out,"
");
HTM_UL_NestingLevel--;
}
/*****************************************************************************/
/******************************** List items *********************************/
/*****************************************************************************/
void HTM_LI_Begin (const char *fmt,...)
{
va_list ap;
int NumBytesPrinted;
char *Attr;
if (fmt)
{
if (fmt[0])
{
va_start (ap,fmt);
NumBytesPrinted = vasprintf (&Attr,fmt,ap);
va_end (ap);
if (NumBytesPrinted < 0) // If memory allocation wasn't possible,
// or some other error occurs,
// vasprintf will return -1
Lay_NotEnoughMemoryExit ();
/***** Print HTML *****/
fprintf (Gbl.F.Out,"- ",Attr);
free ((void *) Attr);
}
else
HTM_LI_BeginWithoutAttr ();
}
else
HTM_LI_BeginWithoutAttr ();
HTM_LI_NestingLevel++;
}
static void HTM_LI_BeginWithoutAttr (void)
{
fprintf (Gbl.F.Out,"
- ");
}
void HTM_LI_End (void)
{
if (HTM_LI_NestingLevel == 0) // No LI open
Ale_ShowAlert (Ale_ERROR,"Trying to close unopened LI.");
fprintf (Gbl.F.Out,"
");
HTM_LI_NestingLevel--;
}
/*****************************************************************************/
/********************************** Anchors **********************************/
/*****************************************************************************/
void HTM_A_Begin (const char *fmt,...)
{
va_list ap;
int NumBytesPrinted;
char *Attr;
if (fmt)
{
if (fmt[0])
{
va_start (ap,fmt);
NumBytesPrinted = vasprintf (&Attr,fmt,ap);
va_end (ap);
if (NumBytesPrinted < 0) // If memory allocation wasn't possible,
// or some other error occurs,
// vasprintf will return -1
Lay_NotEnoughMemoryExit ();
/***** Print HTML *****/
fprintf (Gbl.F.Out,"",Attr);
free ((void *) Attr);
}
else
HTM_A_BeginWithoutAttr ();
}
else
HTM_A_BeginWithoutAttr ();
HTM_A_NestingLevel++;
}
static void HTM_A_BeginWithoutAttr (void)
{
fprintf (Gbl.F.Out,"");
}
void HTM_A_End (void)
{
if (HTM_A_NestingLevel == 0) // No A open
Ale_ShowAlert (Ale_ERROR,"Trying to close unopened A.");
fprintf (Gbl.F.Out,"");
HTM_A_NestingLevel--;
}
/*****************************************************************************/
/********************************* Text areas ********************************/
/*****************************************************************************/
void HTM_TEXTAREA_Begin (const char *fmt,...)
{
va_list ap;
int NumBytesPrinted;
char *Attr;
if (fmt)
{
if (fmt[0])
{
va_start (ap,fmt);
NumBytesPrinted = vasprintf (&Attr,fmt,ap);
va_end (ap);
if (NumBytesPrinted < 0) // If memory allocation wasn't possible,
// or some other error occurs,
// vasprintf will return -1
Lay_NotEnoughMemoryExit ();
/***** Print HTML *****/
fprintf (Gbl.F.Out,"