当前位置: 首页>>代码示例>>C++>>正文


C++ diagnostics函数代码示例

本文整理汇总了C++中diagnostics函数的典型用法代码示例。如果您正苦于以下问题:C++ diagnostics函数的具体用法?C++ diagnostics怎么用?C++ diagnostics使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了diagnostics函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getAngleParam

static char * 
getAngleParam(void)
/******************************************************************************
  purpose: return bracketed parameter
  			
  \item<1>  --->  "1"        \item<>   --->  ""        \item the  --->  NULL
       ^                           ^                         ^
  \item <1>  --->  "1"        \item <>  --->  ""        \item  the --->  NULL
       ^                           ^                         ^
 ******************************************************************************/
{
	char            c, *text;
	
	c = getNonBlank();

	if (c == '<') {
		text = getDelimitedText('<','>',TRUE);
		diagnostics(5, "getAngleParam [%s]", text);

	} else {
		ungetTexChar(c);
		text = NULL;
		diagnostics(5, "getAngleParam []");
	}
	
	return text;
}
开发者ID:ra3xdh,项目名称:latex2rtf-ex,代码行数:27,代码来源:xref.c

示例2: CmdFontSize

void 
CmdFontSize(int code)
/******************************************************************************
 purpose : handles LaTeX commands that change the font size
******************************************************************************/
{
	int             scaled_size;

	diagnostics(4,"CmdFontSize (before) depth=%d, family=%d, size=%d, shape=%d, series=%d",\
				   FontInfoDepth, RtfFontInfo[FontInfoDepth].family, \
	               RtfFontInfo[FontInfoDepth].size, RtfFontInfo[FontInfoDepth].shape,\
	               RtfFontInfo[FontInfoDepth].series);

	if (code == F_SMALLER) 
		scaled_size = (int) (CurrentFontSize() / 1.2 + 0.5);
	else if (code == F_LARGER) 
		scaled_size = (int) (CurrentFontSize() * 1.2 + 0.5);
	else
		scaled_size = (int) (code * DefaultFontSize() / 20.0 + 0.5);

	fprintRTF("\\fs%d ", scaled_size);

	diagnostics(4,"CmdFontSize (after) depth=%d, family=%d, size=%d, shape=%d, series=%d",\
				   FontInfoDepth, RtfFontInfo[FontInfoDepth].family, \
	               RtfFontInfo[FontInfoDepth].size, RtfFontInfo[FontInfoDepth].shape,\
	               RtfFontInfo[FontInfoDepth].series);
}
开发者ID:ra3xdh,项目名称:latex2rtf-ex,代码行数:27,代码来源:l2r_fonts.c

示例3: CmdIndex

void
CmdIndex(int code)
/******************************************************************************
purpose: convert \index{[email protected]\textit{article}!section}
              to {\xe\v "classe:{\i article}:section"}
******************************************************************************/
{
	char cThis, *text, *r, *s, *t;
	
	cThis = getNonBlank();
	text = getDelimitedText('{', '}', TRUE);
	diagnostics(4, "CmdIndex \\index{%s}", text);
	fprintRTF("{\\xe{\\v ");
	
	t = text;
	while (t) {
		s = t;
		t = strchr(s,'!');
		if (t) *t = '\0';
		r = strchr(s,'@');
		if (r) s=r+1;
		ConvertString(s);
/*		while (*s && *s != '@') putRtfChar(*s++);*/
		if (t) {
			fprintRTF("\\:");
			t++;
		}
	}
			
	fprintRTF("}}");
	diagnostics(4, "leaving CmdIndex");
	free(text);
}
开发者ID:ra3xdh,项目名称:latex2rtf-ex,代码行数:33,代码来源:xref.c

示例4: ConvertString

void 
ConvertString(char *string)
/******************************************************************************
     purpose : converts string in TeX-format to Rtf-format
 ******************************************************************************/
{
	char            temp[256];
	
	if (string==NULL) return;
	
	if (strlen(string)<250)
		strncpy(temp,string,250);
	else {
		strncpy(temp,string,125);
		strncpy(temp+125,"\n...\n", 5);
		strncpy(temp+130,string+strlen(string)-125,125);
		temp[255] = '\0';
	}
	
	if (PushSource(NULL, string) == 0) {
		diagnostics(4, "Entering Convert() from StringConvert()\n******\n%s\n*****",temp);
	
		while (StillSource())
			Convert();
			
		PopSource();
		diagnostics(4, "Exiting Convert() from StringConvert()");
	}
}
开发者ID:ra3xdh,项目名称:latex2rtf-ex,代码行数:29,代码来源:convert.c

示例5: PutGifFile

static void
PutGifFile(char *s, double scale, double baseline, int full_path)
/******************************************************************************
 purpose   : Insert GIF file (from g_home_dir) into RTF file as a PNG image
 ******************************************************************************/
{
	char *cmd, *gif, *png, *tmp_png;
	size_t cmd_len;
	
	diagnostics(1, "filename = <%s>", s);
	png = strdup_new_extension(s, ".gif", ".png");
	if (png == NULL) {
		png = strdup_new_extension(s, ".GIF", ".png");
		if (png == NULL) return;
	}
	
	tmp_png = strdup_tmp_path(png);
	gif = strdup_together(g_home_dir,s);
	
	cmd_len = strlen(gif)+strlen(tmp_png)+10;
	cmd = (char *) malloc(cmd_len);
	snprintf(cmd, cmd_len, "convert %s %s", gif, tmp_png);	
	diagnostics(2, "system graphics command = [%s]", cmd);
	system(cmd);
	
	PutPngFile(tmp_png, scale, baseline, TRUE);
	my_unlink(tmp_png);

	free(tmp_png);
	free(cmd);
	free(gif);
	free(png);
}
开发者ID:ra3xdh,项目名称:latex2rtf-ex,代码行数:33,代码来源:graphics.c

示例6: CmdMusic

void 
CmdMusic(int code)
/******************************************************************************
  purpose: Process \begin{music} ... \end{music} environment
 ******************************************************************************/
{
	char *contents;
	char endmusic[] = "\\end{music}";

	if (!(code & ON)) {
		diagnostics(4, "exiting CmdMusic");
		return;
	}

	diagnostics(4, "entering CmdMusic");
	contents = getTexUntil(endmusic, TRUE);
	CmdEndParagraph(0);
	CmdVspace(VSPACE_SMALL_SKIP);
	CmdIndent(INDENT_NONE);
	CmdStartParagraph(FIRST_PAR);
	WriteLatexAsBitmap("\\begin{music}",contents,endmusic);
	ConvertString(endmusic);	
	CmdEndParagraph(0);
	CmdVspace(VSPACE_SMALL_SKIP);
	CmdIndent(INDENT_INHIBIT);
	free(contents);		
}
开发者ID:ra3xdh,项目名称:latex2rtf-ex,代码行数:27,代码来源:graphics.c

示例7: pdf_to_png

static char *
pdf_to_png(char *pdf)
/******************************************************************************
     purpose : create a png file from an PDF file and return file name
 ******************************************************************************/
{
	char *cmd, *s1, *p, *png;
	size_t cmd_len;
	diagnostics(1, "filename = <%s>", pdf);

	s1 = strdup(pdf);
	if ((p=strstr(s1,".pdf")) == NULL && (p=strstr(s1,".PDF")) == NULL) {
		diagnostics(1, "<%s> is not a PDF file", pdf);
		free(s1);
		return NULL;
	}

	strcpy(p,".png");
	png = strdup_tmp_path(s1);
	cmd_len=strlen(pdf)+strlen(png)+40;
	cmd = (char *) malloc(cmd_len);
	snprintf(cmd, cmd_len, "convert -density %d %s %s", g_dots_per_inch, pdf, png);	
	diagnostics(2, "system graphics command = [%s]", cmd);
	system(cmd);	
	
	free(cmd);
	free(s1);
	return png;
}
开发者ID:ra3xdh,项目名称:latex2rtf-ex,代码行数:29,代码来源:graphics.c

示例8: exists_with_extension

char * exists_with_extension(char *s, char *ext)
/******************************************************************************
 purpose   : return s.ext or s.EXT if it exists otherwise return NULL
 ******************************************************************************/
{
	char *t,*x;
	FILE *fp;
	
	t=strdup_together(s,ext);
	fp=fopen(t,"r");
	diagnostics(4,"trying to open %s, result = %0x",t,fp);
	if (fp) {
		fclose(fp);
		return t;
	}
	free(t);
	
/* now try upper case version of ext */
	x=upper_case_string(ext);
	t=strdup_together(s,x);
	free(x);
	
	fp=fopen(t,"r");
	diagnostics(4,"trying to open %s, result = %0x",t,fp);
	if (fp) {
		fclose(fp);
		return t;
	}
	free(t);
	return NULL;
}
开发者ID:ra3xdh,项目名称:latex2rtf-ex,代码行数:31,代码来源:graphics.c

示例9: diagnostics

/******************************************************************************
  purpose: remove 'tag{contents}' from text and return contents
           note that tag should typically be "\\caption"
 ******************************************************************************/
char *ExtractAndRemoveTag(char *tag, char *text)
{
    char *s, *contents, *start=NULL;

    if (text==NULL || *text=='\0') return NULL;
    
    s = text;
    diagnostics(5, "target tag = <%s>", tag);
    diagnostics(5, "original text = <%s>", text);

    while (s) {                 /* find start of caption */
        start = strstr(s, tag);
        if (!start)
            return NULL;
        s = start + strlen(tag);
        if (*s == ' ' || *s == '{')
            break;
    }

    contents = getStringBraceParam(&s);
    if (contents == NULL) return NULL;
    
    /* erase "tag{contents}" */
    do
        *start++ = *s++;
    while (*s);               
    *start = '\0';

    diagnostics(5, "final contents = <%s>", contents);
    diagnostics(5, "final text = <%s>", text);

    return contents;
}
开发者ID:blipvert,项目名称:latex2rtf,代码行数:37,代码来源:utils.c

示例10: strdup

/******************************************************************************
 purpose:  returns a new string consisting of s+t
******************************************************************************/
char *strdup_together(const char *s, const char *t)
{
    char *both;
    size_t siz;
    
    if (s == NULL) {
        if (t == NULL)
            return NULL;
        return strdup(t);
    }
    if (t == NULL)
        return strdup(s);

    if (0) diagnostics(1, "'%s' + '%s'", s, t);
    siz = strlen(s) + strlen(t) + 1;
    both = (char *) malloc(siz);

    if (both == NULL)
        diagnostics(ERROR, "Could not allocate memory for both strings.");

    my_strlcpy(both, s, siz);
    my_strlcat(both, t, siz);

    return both;
}
开发者ID:blipvert,项目名称:latex2rtf,代码行数:28,代码来源:utils.c

示例11: CmdClosing

void 
CmdClosing( /* @[email protected] */ int code)
/******************************************************************************
 purpose: special command in the LaTex-letter-environment will be converted to a
	  similar Rtf-style
 globals: alignment
 ******************************************************************************/
{
	char           oldalignment;
	char           *s;
	
	oldalignment = alignment;

/* print closing on the right */
	alignment = RIGHT;
	fprintRTF("\n\\par\\pard\\q%c ", alignment);	
	diagnostics(5, "Entering ConvertString() from CmdClosing");
	s = getBraceParam();
	ConvertString(s);
	free(s);
	diagnostics(5, "Exiting ConvertString() from CmdClosing");

/* print signature a couple of lines down */
	fprintRTF("\n\\par\\par\\par ");

	diagnostics(5, "Entering ConvertString() from CmdSignature");
	ConvertString(g_letterSignature);
	diagnostics(5, "Exiting ConvertString() from CmdSignature");

	g_letterOpened = FALSE;
	alignment = oldalignment;
	fprintRTF("\n\\par\\pard\\q%c ", alignment);
}
开发者ID:ra3xdh,项目名称:latex2rtf-ex,代码行数:33,代码来源:letterformat.c

示例12: InsertBookmark

void
InsertBookmark(char *name, char *text)
{
	char *signet;
	if (!name) {
		fprintRTF("%s",text);
		return;
	}

	signet = strdup_nobadchars(name);

	if (ExistsBookmark(signet)) {
		diagnostics(3,"bookmark %s already exists",signet);

	} else {
		diagnostics(3,"bookmark %s being inserted around <%s>",signet,text);
		RecordBookmark(signet);
		if (g_fields_use_REF) 
			fprintRTF("{\\*\\bkmkstart BM%s}",signet);
		fprintRTF("%s",text);
		if (g_fields_use_REF) 
			fprintRTF("{\\*\\bkmkend BM%s}",signet);
	}
	
	free(signet);
}
开发者ID:ra3xdh,项目名称:latex2rtf-ex,代码行数:26,代码来源:xref.c

示例13: PutPictFile

static void 
PutPictFile(char * s, double scale, double baseline, int full_path)
/******************************************************************************
     purpose : Include .pict file in RTF
 ******************************************************************************/
{
FILE *fp;
char *pict;
short buffer[5];
short top, left, bottom, right;
int width, height;

	if (full_path)
		pict = strdup(s);
	else
		pict = strdup_together(g_home_dir, s);		
	diagnostics(1, "PutPictFile <%s>", pict);

	fp = fopen(pict, "rb");
	free(pict);
	if (fp == NULL) return;
	
	if (fseek(fp, 514L, SEEK_SET) || fread(buffer, 2, 4, fp) != 4) {
		diagnostics (WARNING, "Cannot read graphics file <%s>", s);
		fclose(fp);
		return;
	}
	
	top    = buffer[0];
	left   = buffer[1];
	bottom = buffer[2];
	right  = buffer[3];

	width  = right - left;
	height = bottom - top;
	
	if (g_little_endian) {
		top    = LETONS(top);
		bottom = LETONS(bottom);
		left   = LETONS(left);
		right  = LETONS(right);
	}

	diagnostics(4,"top = %d, bottom = %d", top, bottom);
	diagnostics(4,"left = %d, right = %d", left, right);
	diagnostics(4,"width = %d, height = %d", width, height);
	fprintRTF("\n{\\pict\\macpict\\picw%d\\pich%d\n", width, height);
	if (scale != 1.0) {
		int iscale = (int) (scale * 100);
		fprintRTF("\\picscalex%d\\picscaley%d", iscale, iscale);
	}

	fseek(fp, -10L, SEEK_CUR);
	PutHexFile(fp);
	fprintRTF("}\n");
	fclose(fp);
}
开发者ID:ra3xdh,项目名称:latex2rtf-ex,代码行数:57,代码来源:graphics.c

示例14: my_getopt

int my_getopt(int argc, char **argv, char *optstring)
{
    char *q;
    static char *rem = NULL;
    int c;
    int needarg = 0;

    optarg = NULL;

    diagnostics(4, "Processing option `%s'", argv[optind]);

    /* 
     * printf("optind = %d\n", optind);  if (rem) printf("rem=`%s'\n",
     * rem);
     */

    if (!rem) {
        if (optind < argc && argv[optind][0] == '-') {
            rem = argv[optind] + 1;
            if (*rem == 0)
                return EOF;     /* Treat lone "-" as a non-option arg */
            if (*rem == '-') {
                optind++;
                return EOF;
            }                   /* skip "--" and terminate */
        } else
            return EOF;
    }
    c = *rem;
    q = strchr(optstring, c);
    if (q && c != ':') {        /* matched */
        needarg = (q[1] == ':');
        if (needarg) {
            if (rem[1] != 0)
                optarg = rem + 1;
            else {
                optind++;
                if (optind < argc)
                    optarg = argv[optind];
                else {
                    diagnostics(ERROR, "Missing argument after -%c\n", c);
                }
            }
        } else
            rem++;
    } else {
        diagnostics(WARNING, "%s: illegal option -- %c\n", argv[0], c);
        c = '?';
        rem++;
    }
    if (needarg || *rem == 0) {
        rem = NULL;
        optind++;
    }
    return c;
}
开发者ID:blipvert,项目名称:latex2rtf,代码行数:56,代码来源:mygetopt.c

示例15: ScanAux

static char * 
ScanAux(char *token, char * reference, int code)
/*************************************************************************
purpose: obtains a reference from .aux file

code=0 means \token{reference}{number}       -> "number"
code=1 means \token{reference}{{sect}{line}} -> "sect"
 ************************************************************************/
{
	static FILE    *fAux = NULL;
	char            AuxLine[2048];
	char            target[512];
	char           *s,*t;
	int				braces;

	if (g_aux_file_missing || strlen(token) == 0) {
		return NULL;
	}

	diagnostics(4,"seeking in .aux for <%s>",reference);
	
	snprintf(target, 512, "\\%s{%s}", token, reference);
	
	if (fAux == NULL && (fAux = my_fopen(g_aux_name, "r")) == NULL) {
		diagnostics(WARNING, "No .aux file.  Run LaTeX to create %s\n", g_aux_name);
		g_aux_file_missing = TRUE;
		return NULL;
	}
	
	rewind(fAux);
	
	while (fgets(AuxLine, 2047, fAux) != NULL) {

		s = strstr(AuxLine, target);
		if (s) {
		
			s += strlen(target);		/* move to \token{reference}{ */			
			if (code==1) s++;			/* move to \token{reference}{{ */

			t = s;					
			braces = 1;
			while ( braces >= 1) {		/* skip matched braces */
				t++;
				if (*t == '{') braces++;
				if (*t == '}') braces--;
				if (*t == '\0') return NULL;
			}
			
			*t = '\0';
			diagnostics(4,"found <%s>",s+1);
			return strdup(s+1);
		}
	}
	return NULL;
}
开发者ID:ra3xdh,项目名称:latex2rtf-ex,代码行数:55,代码来源:xref.c


注:本文中的diagnostics函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。