comparison dmd/doc.c @ 130:a7dfa0ed966c trunk

[svn r134] Merged the DMD 1.024 frontend. Added std.base64.
author lindquist
date Fri, 28 Dec 2007 23:52:40 +0100
parents c53b6e3fe49a
children 5acec6b2eef8
comparison
equal deleted inserted replaced
129:8096ba7082db 130:a7dfa0ed966c
267 dc->copyright->nooutput = 1; 267 dc->copyright->nooutput = 1;
268 Macro::define(&macrotable, (unsigned char *)"COPYRIGHT", 9, dc->copyright->body, dc->copyright->bodylen); 268 Macro::define(&macrotable, (unsigned char *)"COPYRIGHT", 9, dc->copyright->body, dc->copyright->bodylen);
269 } 269 }
270 270
271 buf.printf("$(DDOC_COMMENT Generated by Ddoc from %s)\n", srcfile->toChars()); 271 buf.printf("$(DDOC_COMMENT Generated by Ddoc from %s)\n", srcfile->toChars());
272
273 if (isDocFile) 272 if (isDocFile)
274 { 273 {
275 size_t commentlen = strlen((char *)comment); 274 size_t commentlen = strlen((char *)comment);
276 if (dc->macros) 275 if (dc->macros)
277 { 276 {
281 sc->docbuf->write(comment, commentlen); 280 sc->docbuf->write(comment, commentlen);
282 highlightText(NULL, this, sc->docbuf, 0); 281 highlightText(NULL, this, sc->docbuf, 0);
283 } 282 }
284 else 283 else
285 { 284 {
286
287 dc->writeSections(sc, this, sc->docbuf); 285 dc->writeSections(sc, this, sc->docbuf);
288 emitMemberComments(sc); 286 emitMemberComments(sc);
289 } 287 }
290 288
291 //printf("BODY= '%.*s'\n", buf.offset, buf.data); 289 //printf("BODY= '%.*s'\n", buf.offset, buf.data);
652 buf->writestring("abstract "); 650 buf->writestring("abstract ");
653 if (d->isStatic()) 651 if (d->isStatic())
654 buf->writestring("static "); 652 buf->writestring("static ");
655 if (d->isConst()) 653 if (d->isConst())
656 buf->writestring("const "); 654 buf->writestring("const ");
655 #if V2
656 if (d->isInvariant())
657 buf->writestring("invariant ");
658 #endif
657 if (d->isFinal()) 659 if (d->isFinal())
658 buf->writestring("final "); 660 buf->writestring("final ");
659 if (d->isSynchronized()) 661 if (d->isSynchronized())
660 buf->writestring("synchronized "); 662 buf->writestring("synchronized ");
661 } 663 }
662 } 664 }
663 665
664 void Declaration::toDocBuffer(OutBuffer *buf) 666 void Declaration::toDocBuffer(OutBuffer *buf)
665 { 667 {
666 //printf("Declaration::toDocbuffer() %s\n", toChars()); 668 //printf("Declaration::toDocbuffer() %s, originalType = %p\n", toChars(), originalType);
667 if (ident) 669 if (ident)
668 { 670 {
669 prefix(buf, this); 671 prefix(buf, this);
670 672
671 if (type) 673 if (type)
672 { HdrGenState hgs; 674 { HdrGenState hgs;
673 hgs.ddoc = 1; 675 hgs.ddoc = 1;
674 type->toCBuffer(buf, ident, &hgs); 676 if (originalType)
677 { //originalType->print();
678 originalType->toCBuffer(buf, ident, &hgs);
679 }
680 else
681 type->toCBuffer(buf, ident, &hgs);
675 } 682 }
676 else 683 else
677 buf->writestring(ident->toChars()); 684 buf->writestring(ident->toChars());
678 buf->writestring(";\n"); 685 buf->writestring(";\n");
679 } 686 }
721 if (parent && 728 if (parent &&
722 (td = parent->isTemplateDeclaration()) != NULL && 729 (td = parent->isTemplateDeclaration()) != NULL &&
723 td->onemember == this) 730 td->onemember == this)
724 { HdrGenState hgs; 731 { HdrGenState hgs;
725 unsigned o = buf->offset; 732 unsigned o = buf->offset;
733 TypeFunction *tf = (TypeFunction *)type;
726 734
727 hgs.ddoc = 1; 735 hgs.ddoc = 1;
728 prefix(buf, td); 736 prefix(buf, td);
729 type->next->toCBuffer(buf, NULL, &hgs); 737 tf->next->toCBuffer(buf, NULL, &hgs);
730 buf->writeByte(' '); 738 buf->writeByte(' ');
731 buf->writestring(ident->toChars()); 739 buf->writestring(ident->toChars());
732 buf->writeByte('('); 740 buf->writeByte('(');
733 for (int i = 0; i < td->parameters->dim; i++) 741 for (int i = 0; i < td->parameters->dim; i++)
734 { 742 {
736 if (i) 744 if (i)
737 buf->writeByte(','); 745 buf->writeByte(',');
738 tp->toCBuffer(buf, &hgs); 746 tp->toCBuffer(buf, &hgs);
739 } 747 }
740 buf->writeByte(')'); 748 buf->writeByte(')');
741 TypeFunction *tf = (TypeFunction *)type;
742 Argument::argsToCBuffer(buf, &hgs, tf->parameters, tf->varargs); 749 Argument::argsToCBuffer(buf, &hgs, tf->parameters, tf->varargs);
743 buf->writestring(";\n"); 750 buf->writestring(";\n");
744 751
745 highlightCode(NULL, this, buf, o); 752 highlightCode(NULL, this, buf, o);
746 } 753 }