⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 doc2tex.ll

📁 Doc++,可以根据你的C/C++和java的源码文件中的注释行自动生成Html说明文件的工具
💻 LL
📖 第 1 页 / 共 3 页
字号:
			}<HTML>"&times;" 	{			fprintf(out, "$\\times$");			}<HTML>"&empty;" 	{			fprintf(out, "$\\emptyset$");			}<HTML>"&sub;"	 	{			fprintf(out, "$\\subset$");			}<HTML>"&sup;"	 	{			fprintf(out, "$\\superset$");			}<HTML>"&sube;"	 	{			fprintf(out, "$\\subseteq$");			}<HTML>"&supe;"	 	{			fprintf(out, "$\\superseteq$");			}<HTML>"<"[ \t]*[bB][rR][ \t]*">"	{			fprintf(out, "\\\\");			}<HTML>\\		{			fprintf(out, "$\\backslash$");			}<HTML>.			{			fprintf(out, "%s", yytext);			}<HTML>\n		{			fprintf(out, "%s", yytext);			} <HTMLverbatim>(.|\n)	{			fprintf(out, "%s", yytext);			}<HTMLverbatim>"</"[ \t]*([pP][rR][eE]|[cC][oO][dD][eE])[ \t]*">"	{			fprintf(out, "\\end{verbatim}\n");			BEGIN(lastContext);			}<*>\x06[^\x06]*\x06	{			yyLineNr = 1;			int i;		   	for(i = 0; yytext[i + 1] != 6; i++)		   	    yyFileName[i] = yytext[i + 1];		   	yyFileName[i] = 0;			fprintf(out, "\\strut\\\\\n");			skip = 1;		   	}<Listing>^[ \t]*\n	{			if(!skip)			    fprintf(out, "\\cxxCodeLine{%d} %c\n\\\\\n", yyLineNr, 3);			yyLineNr++;			}<Listing>\t		{			if(!verbMode)			    setupVerbMode();			do			    {			    putc(' ', out);			    }			while(++tab % 8);			}<Listing>\"[^\n"]*\"	{			if(!verbMode)			    setupVerbMode();			fprintf(out, "%s", &(yytext[0]));			tab += yyleng;			}<Listing>.		{			if(!verbMode)			    setupVerbMode();			putc(yytext[0], out);			++tab;			}<Listing>\n		{			if(!skip)			    {			    if(!verbMode)				setupVerbMode();			    closeVerbMode();			    fprintf(out, "\\\\\n");			    }			yyLineNr++;			}<Listing>"//@"[^\n]*\n	{			yyLineNr++;			}<Listing>"/*@"[^\n]*"*/"<Listing>[ \t\n]*"/*@"	{			BEGIN(RealComment);			}<RealComment>.<RealComment>\n		{			yyLineNr++;			}<RealComment>"*/"	{			BEGIN(Listing);			}<Listing>"//"		{ 			if(!verbMode)			    setupVerbMode();			closeVerbMode();			fprintf(out, "\\hbox{//");			commentMode = CC_COMMENT;			BEGIN(Comment);			}<Listing>"/*"		{ 			if(verbMode)			    closeVerbMode();			fprintf(out, "\\hbox{/*");			commentMode = SHORT_C_COMMENT;			BEGIN(Comment);			}<Listing>[ \t]*\n[\n\t ]*"/*"	{			if(verbMode)			    closeVerbMode();			commentMode = C_COMMENT;			while(yyleng--)			    yyLineNr += (yytext[yyleng] == '\n');			BEGIN(Comment);			fprintf(out, "\\strut\\\\");			fprintf(out, "\\strut\\\\");			}<Comment>"*/"		{			switch(commentMode)			    {			    case SHORT_C_COMMENT:				fprintf(out, "%s", &(yytext[0]));				fprintf(out, "}\\\\\n");				BEGIN(Listing);				break;			    case C_COMMENT:				skip = 1;				BEGIN(Listing);				break;			    default:				fprintf(out, "%s", &(yytext[0]));				break;			    }			}<Comment>\n		{			switch(commentMode)			    {			    case SHORT_C_COMMENT:				commentMode = C_COMMENT;				fprintf(out, "}\n");			    case C_COMMENT:				putc(yytext[0], out);				break;			    default:				fprintf(out, "}\\strut\\\\\n");				BEGIN(Listing);				break;			    }			yyLineNr++;			}<Comment>"#\\#"		{			fprintf(out, "$\\backslash$");			}<Comment>"\\#"		{			fprintf(out, "%s", yytext);			}<Comment>"#"		{			fprintf(out, "{\\tt\\strut ");			BEGIN(LVerb);			}<Comment>.		{			putc(yytext[0], out);			}<Graph>"SP"		{			fprintf(out, "\\cxxNone");			}<Graph>"||"		{			fprintf(out, "\\cxxLong");			}<Graph>"L."		{			fprintf(out, upArrows ? "\\cxxLinkPriLeft" \			    : "\\cxxPriLeft");			}<Graph>"L-"		{			fprintf(out, upArrows ? "\\cxxLinkProLeft" \			    : "\\cxxProLeft");			}<Graph>"L_"		{			fprintf(out, upArrows ? "\\cxxLinkPubLeft" \			    : "\\cxxPubLeft");			}<Graph>"l."		{			fprintf(out, upArrows ? "\\cxxLinkPrileft" \			    : "\\cxxPrileft");			}<Graph>"l-"		{			fprintf(out, upArrows ? "\\cxxLinkProleft" \			    : "\\cxxProleft");			}<Graph>"l_"		{			fprintf(out, upArrows ? "\\cxxLinkPubleft" \			    : "\\cxxPubleft");			}<Graph>"D."		{			fprintf(out, upArrows ? "\\cxxLinkPriLeft" \			    : "\\cxxLastPriLeft");			}<Graph>"D-"		{			fprintf(out, upArrows ? "\\cxxLinkProLeft" \			    : "\\cxxLastProLeft");			}<Graph>"D_"		{			fprintf(out, upArrows ? "\\cxxLinkPubLeft" \			    : "\\cxxLastPubLeft");			}<Graph>"d."		{			fprintf(out, upArrows ? "\\cxxLinkPrileft" \			    : "\\cxxLastPrileft");			}<Graph>"d-"		{			fprintf(out, upArrows ? "\\cxxLinkProleft" \			    : "\\cxxLastProleft");			}<Graph>"d_"		{			fprintf(out, upArrows ? "\\cxxLinkPubleft" \			    : "\\cxxLastPubleft");			}<Graph>"R."		{			fprintf(out, upArrows ? "\\cxxPriRight" \			    : "\\cxxLinkPriRight");			}<Graph>"R-"		{			fprintf(out, upArrows ? "\\cxxProRight" \			    : "\\cxxLinkProRight");			}<Graph>"R_"		{			fprintf(out, upArrows ? "\\cxxPubRight" \			    : "\\cxxLinkPubRight");			}<Graph>"r."		{			fprintf(out, upArrows ? "\\cxxPriright" \			    : "\\cxxLinkPriright");			}<Graph>"r-"		{			fprintf(out, upArrows ? "\\cxxProright" \			    : "\\cxxLinkProright");			}<Graph>"r_"		{			fprintf(out, upArrows ? "\\cxxPubright" \			    : "\\cxxLinkPubright");			}<Graph>"^."		{			fprintf(out, upArrows ? "\\cxxFirstPriright" \			    : "\\cxxLinkPriright");			}<Graph>"^-"		{			fprintf(out, upArrows ? "\\cxxFirstProright" \			    : "\\cxxLinkProright");			}<Graph>"^_"		{			fprintf(out, upArrows ? "\\cxxFirstPubright" \			    : "\\cxxLinkPubright");			}<Graph>"|."		{			fprintf(out, upArrows ? "\\cxxFirstPriRight" \			    : "\\cxxLinkPriRight");			}<Graph>"|-"		{			fprintf(out, upArrows ? "\\cxxFirstProRight" \			    : "\\cxxLinkProRight");			}<Graph>"|_"		{			fprintf(out, upArrows ? "\\cxxFirstPubRight" \			    : "\\cxxLinkPubRight");			}%%static void initLatex(){    char ch;    int	 i;    if(texFile.length() > 0)	{	ifstream env(texFile.c_str());	if(env)	    {	    while(env)		{		env.get(ch);		// "env >> ch;" never returns whitespaces and special chars!!!		putc(ch, out);		}	    if(!noLatex)		{		if(generateIndex)		    fprintf(out, "\\makeindex\n");		for(i = 0; i < texPackages.size(); i++)		    fprintf(out, "\\usepackage{%s}\n", texPackages[i]->c_str());		fprintf(out, "\\usepackage{docxx}\n");		fprintf(out, "\\begin{document}\n");		fprintf(out, "\\pagebreak\n");		fprintf(out, "\\sloppy\n");		}	    }	else	    cerr << "could not open " << texFile.c_str() << endl;	}    else	if(!noLatex)	    {	    fprintf(out, "\\documentclass");	    if(texOption.length() > 0)		fprintf(out, "[%s]", texOption.c_str());	    fprintf(out, "{article}\n");	    if(generateIndex)		fprintf(out, "\\makeindex\n");	    for(i = 0; i < texPackages.size(); i++)		fprintf(out, "\\usepackage{%s}\n", texPackages[i]->c_str());	    fprintf(out, "\\usepackage{docxx}\n");	    fprintf(out, "\\begin{document}\n");	    fprintf(out, "\\pagebreak\n");	    fprintf(out, "\\sloppy\n");	    }    if(texTitle.length() > 0 && !noLatex)	{	ifstream title(texTitle.c_str());	if(title)	    while(title)		{		title.get(ch);		putc(ch, out);		}	else	    cerr << "could not open " << texTitle.c_str() << endl;	}}static void finitLatex(){    char indName[50];    char *p;    FILE *file;    if(!noLatex)	{ 	if(!onlyClassGraph && generateIndex && texOutputName.length() > 0) 	    { 	    strcpy((char *)&indName, texOutputName.c_str());  	    p = strrchr((char *)&indName, '.'); 	    if(p)  		*p = '\0'; 	    strcat((char *)&indName, ".ind"); 	    fprintf(out, "\\label{Index}\n"); 	    fprintf(out, "\\input %s\n", (char *)&indName); 	    file = fopen((char *)&indName, "r"); 	    if(!file) 		file = fopen((char *)&indName, "w"); 	    if(file) 		fclose(file); 	    }	fprintf(out, "\\end{document}\n");	}}void listing(char *str){    inPos = 0;    inStr = str;    skip = 1;    initLatex();    doc2texYYrestart(0);    BEGIN(Listing);    doc2texYYlex();    finitLatex();}static void printCode(Entry *cur, const char *str){    inPos = 0;    inStr = str;    current = cur;    if(cur && cur->section == MANUAL_SEC)	{	printYYDOC(cur, str);	return;	}    doc2texYYrestart(0);    BEGIN(Code);    doc2texYYlex();}static void printCode(Entry *cur, const McString& str){    printCode(cur, str.c_str());}void printYYDOC(Entry *cur, const char *str, int escapePrcnt){    if(strlen(str) > 0)	{	inPos = 0;	inStr = str;	current = cur;	escapePercent = escapePrcnt;	doc2texYYrestart(0);	BEGIN(HTMLsyntax ? HTML : 0);	doc2texYYlex();	}    escapePercent = 0;}void printYYDOC(Entry *cur, const McString& str, int escapePrcnt){    printYYDOC(cur, str.c_str(), escapePrcnt);}char *getEntryName(Entry *entry){    McString *name;    if(entry->fromUnknownPackage && entry->parent)	{	name = new McString(getEntryName (entry->parent));	if(name->length() > 0)	    *name += ".";	*name += entry->name;	return *name;	}    else	return entry->name;}static void dumpCxxItem(Entry *tmp){    fprintf(out, "{");    printCode(tmp, tmp->type);    fprintf(out, "}\n        {");    printCode(tmp, getEntryName(tmp));    fprintf(out, "}\n        {");    printCode(tmp, tmp->args);    fprintf(out, "}\n        {");    printYYDOC(tmp, tmp->memo.c_str());    fprintf(out, "}\n        {");    if(MAKE_DOC(tmp))	{	tmp->dumpNumber(out);	fprintf(out, "}\n");	}    else	{	fprintf(out, "}\n");	fprintf(out, "\\label{cxx.");	tmp->dumpNumber(out);	fprintf(out, "}\n");	}}static int baseDepth(Entry *entry, int n = 1){    if(!HAS_BASES(entry))	return n;    int i, j, nn;    nn = n + 1;    for(i = 0 ; i < entry->pubBaseclasses.size(); ++i)	{	j = baseDepth(entry->pubBaseclasses[i], n + 1);	if(j > nn)	    nn = j;	}    for(i = 0 ; i < entry->proBaseclasses.size(); ++i)	{	j = baseDepth(entry->proBaseclasses[i], n + 1);	if(j > nn)	    nn = j;	}    return nn;}void printYYGraph(const McString& str){    inPos = 0;    inStr = str.c_str();    doc2texYYrestart(0);    BEGIN(Graph);    doc2texYYlex();}static void dumpInheritanceEntry(ClassGraph *cls){    int i;    fprintf(out, "\\cxxInheritanceEntry{");	for(i = 0 ; i < cls->indent; ++i)	    fprintf(out, "\\cxxNone");    printYYGraph(cls->before);    fprintf(out, "}{");    if(cls->entry)	if(!cls->entry->fromUnknownPackage && !onlyClassGraph)	    cls->entry->dumpNumber(out);    fprintf(out, "}{");    if(cls->entry)	printCode(cls->entry, getEntryName (cls->entry));    else	printCode(0, cls->name.c_str());        fprintf(out, "}{");    printYYGraph(cls->after);    fprintf(out, "}\n");}static void dumpHierarchy(Entry *entry)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -