diff dmd/doc.c @ 875:330f999ade44

Merged DMD 1.038
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Tue, 06 Jan 2009 16:33:51 +0100
parents cbd6c8073a32
children 27a379f288bf
line wrap: on
line diff
--- a/dmd/doc.c	Tue Jan 06 15:54:48 2009 +0100
+++ b/dmd/doc.c	Tue Jan 06 16:33:51 2009 +0100
@@ -47,9 +47,9 @@
 
 struct Escape
 {
-    char *strings[256];
+    const char *strings[256];
 
-    static char *escapeChar(unsigned c);
+    static const char *escapeChar(unsigned c);
 };
 
 struct Section
@@ -96,8 +96,8 @@
 };
 
 
-int cmp(char *stringz, void *s, size_t slen);
-int icmp(char *stringz, void *s, size_t slen);
+int cmp(const char *stringz, void *s, size_t slen);
+int icmp(const char *stringz, void *s, size_t slen);
 int isDitto(unsigned char *comment);
 unsigned char *skipwhitespace(unsigned char *p);
 unsigned skiptoident(OutBuffer *buf, unsigned i);
@@ -404,7 +404,7 @@
     OutBuffer *buf = sc->docbuf;
 
     if (members)
-    {	char *m = "$(DDOC_MEMBERS \n";
+    {	const char *m = "$(DDOC_MEMBERS \n";
 
 	if (isModule())
 	    m = "$(DDOC_MODULE_MEMBERS \n";
@@ -441,7 +441,7 @@
 
 void emitProtection(OutBuffer *buf, PROT prot)
 {
-    char *p;
+    const char *p;
 
     switch (prot)
     {
@@ -918,6 +918,7 @@
 DocComment *DocComment::parse(Scope *sc, Dsymbol *s, unsigned char *comment)
 {   unsigned idlen;
 
+    //printf("parse(%s): '%s'\n", s->toChars(), comment);
     if (sc->lastdc && isDitto(comment))
 	return NULL;
 
@@ -963,6 +964,7 @@
     unsigned char *name = NULL;
     unsigned namelen = 0;
 
+    //printf("parseSections('%s')\n", comment);
     p = comment;
     while (*p)
     {
@@ -1088,7 +1090,7 @@
 {
     if (namelen)
     {
-	static char *table[] =
+	static const char *table[] =
 	{	"AUTHORS", "BUGS", "COPYRIGHT", "DATE",
 		"DEPRECATED", "EXAMPLES", "HISTORY", "LICENSE",
 		"RETURNS", "SEE_ALSO", "STANDARDS", "THROWS",
@@ -1432,7 +1434,7 @@
  * Return < 0, ==0, > 0
  */
 
-int cmp(char *stringz, void *s, size_t slen)
+int cmp(const char *stringz, void *s, size_t slen)
 {
     size_t len1 = strlen(stringz);
 
@@ -1441,7 +1443,7 @@
     return memcmp(stringz, s, slen);
 }
 
-int icmp(char *stringz, void *s, size_t slen)
+int icmp(const char *stringz, void *s, size_t slen)
 {
     size_t len1 = strlen(stringz);
 
@@ -1578,7 +1580,7 @@
 
 int isKeyword(unsigned char *p, unsigned len)
 {
-    static char *table[] = { "true", "false", "null" };
+    static const char *table[] = { "true", "false", "null" };
 
     for (int i = 0; i < sizeof(table) / sizeof(table[0]); i++)
     {
@@ -1629,10 +1631,10 @@
 void highlightText(Scope *sc, Dsymbol *s, OutBuffer *buf, unsigned offset)
 {
     //printf("highlightText()\n");
-    char *sid = s->ident->toChars();
+    const char *sid = s->ident->toChars();
     FuncDeclaration *f = s->isFuncDeclaration();
     unsigned char *p;
-    char *se;
+    const char *se;
 
     int leadingBlank = 1;
     int inCode = 0;
@@ -1878,7 +1880,7 @@
     //printf("highlightCode(s = '%s', kind = %s)\n", sid, s->kind());
     for (unsigned i = offset; i < buf->offset; i++)
     {	unsigned char c = buf->data[i];
-	char *se;
+	const char *se;
 
 	se = Escape::escapeChar(c);
 	if (se)
@@ -1920,7 +1922,7 @@
 void highlightCode3(OutBuffer *buf, unsigned char *p, unsigned char *pend)
 {
     for (; p < pend; p++)
-    {	char *s = Escape::escapeChar(*p);
+    {	const char *s = Escape::escapeChar(*p);
 	if (s)
 	    buf->writestring(s);
 	else
@@ -1942,7 +1944,7 @@
     Token tok;
     OutBuffer res;
     unsigned char *lastp = buf->data;
-    char *highlight;
+    const char *highlight;
 
     //printf("highlightCode2('%.*s')\n", buf->offset - 1, buf->data);
     res.reserve(buf->offset);
@@ -2003,8 +2005,8 @@
  * Find character string to replace c with.
  */
 
-char *Escape::escapeChar(unsigned c)
-{   char *s;
+const char *Escape::escapeChar(unsigned c)
+{   const char *s;
 
     switch (c)
     {