コード例 #1
0
ファイル: xmlproc.c プロジェクト: Remmy/afterstep
void 
start_varlistentry_tag( xml_elem_t *doc, xml_elem_t *parm, ASXMLInterpreterState *state )
{
	if( state->doc_type == DocType_HTML	|| state->doc_type == DocType_PHP	 )
		add_anchor( parm, state );
 /*	else if( state->doc_type == DocType_NROFF )
		fprintf( state->dest_fp, "\n.IP "); */

}
コード例 #2
0
ファイル: xmlproc.c プロジェクト: Remmy/afterstep
void 
start_refsect1_tag( xml_elem_t *doc, xml_elem_t *parm, ASXMLInterpreterState *state )
{
	++(state->header_depth);	
	set_flags( state->flags, ASXMLI_RefSection );
	if( state->doc_type == DocType_HTML	|| state->doc_type == DocType_PHP	 )
	{
		add_anchor( parm, state );
		fwrite( "<LI>", 1, 4, state->dest_fp );
	}else if( state->doc_type == DocType_NROFF )
		fprintf( state->dest_fp, "\n.SH ");
}
コード例 #3
0
ファイル: xmlproc.c プロジェクト: Remmy/afterstep
void
start_code_tag( xml_elem_t *doc, xml_elem_t *parm, ASXMLInterpreterState *state )
{
	if( state->doc_type == DocType_HTML	|| state->doc_type == DocType_PHP	 )
	{
		add_anchor( parm, state );
		close_link(state);
		fprintf( state->dest_fp, "<P class=\"dense\">" );	   			  
		fprintf( state->dest_fp, "<div class=\"container\">");
	}else if( state->doc_type == DocType_NROFF )
		fprintf( state->dest_fp, "\n.in +4n\n");

}
コード例 #4
0
ファイル: xmlproc.c プロジェクト: Remmy/afterstep
void
start_example_tag( xml_elem_t *doc, xml_elem_t *parm, ASXMLInterpreterState *state )
{
	set_flags( state->flags, ASXMLI_InsideExample );
	if( state->doc_type == DocType_HTML	|| state->doc_type == DocType_PHP	 )
	{
		add_anchor( parm, state );
		close_link(state);
		fprintf( state->dest_fp, "<P class=\"dense\"> <B>Example : </B> " );	   			  
		fprintf( state->dest_fp, "<div class=\"container\">");
	}else if( state->doc_type == DocType_NROFF )
		fprintf( state->dest_fp, "\nExample : ");

}
コード例 #5
0
ファイル: xmlproc.c プロジェクト: Remmy/afterstep
void 
start_cmdsynopsis_tag( xml_elem_t *doc, xml_elem_t *parm, ASXMLInterpreterState *state )
{
	++(state->header_depth);	
	if( state->doc_type == DocType_HTML	|| state->doc_type == DocType_PHP	 )
	{
		add_anchor( parm, state );
		if( state->doc_type == DocType_PHP ) 
			fprintf( state->dest_fp, "<LI><b>SYNOPSIS</b><p>" );	   			  
		else
			fprintf( state->dest_fp, "<LI><h%d>SYNOPSIS</h%d>", state->header_depth, state->header_depth );	   			  
		close_link(state);
	}else if( state->doc_type == DocType_NROFF )
		fprintf( state->dest_fp, ".SH SYNOPSIS\n");
}
コード例 #6
0
ファイル: xmlproc.c プロジェクト: Remmy/afterstep
void 
start_section_tag( xml_elem_t *doc, xml_elem_t *parm, ASXMLInterpreterState *state )
{
	++(state->header_depth);	
	if( state->doc_type == DocType_HTML	|| state->doc_type == DocType_PHP	 )
	{
		/*if( state->doc_type == DocType_HTML ) 
			fwrite( "<HR>\n", 1, 5, state->dest_fp );
		 */
		add_anchor( parm, state );
		if( get_flags( state->flags, ASXMLI_OrderSections ) )
			fwrite( "<OL>", 1, 4, state->dest_fp );
		else
			fwrite( "<UL>", 1, 4, state->dest_fp );
	}
	else if (state->doc_type == DocType_NROFF && !strcmp(state->doc_name, ASFAQ_NAME))
	{
		fprintf( state->dest_fp, state->header_depth == 2 ? "\n.SH " : "\n.SS " );
	}		
}
コード例 #7
0
/*
 *   Read a stream from an object file 
 */
void CTcDataStream::load_object_file(CVmFile *fp,
                                     const textchar_t *fname)
{
    ulong stream_len;
    ulong rem;
    char buf[1024];
    ulong start_ofs;
    ulong anchor_cnt;

    /* read the length of the stream */
    stream_len = fp->read_uint4();

    /* remember my starting offset */
    start_ofs = get_ofs();

    /* read the stream bytes */
    for (rem = stream_len ; rem != 0 ; )
    {
        size_t cur;

        /* read up to a buffer-full, or however much is left */
        cur = sizeof(buf);
        if (cur > rem)
            cur = rem;

        /* read this chunk */
        fp->read_bytes(buf, cur);

        /* add this chunk to the stream */
        write(buf, cur);

        /* deduct the amount we've read from the amount remaining */
        rem -= cur;
    }

    /*
     *   Read the anchors.  For each anchor, we must fix up the anchor by
     *   adding the base address of the stream we just read - the original
     *   anchor offsets in the object file reflect a base stream offset of
     *   zero, but we could be loading the stream after a bunch of other
     *   data have already been loaded into the stream.
     *   
     *   First, read the number of anchors, then loop through the anchors
     *   and read each one.  
     */
    for (anchor_cnt = fp->read_uint4() ; anchor_cnt != 0 ;
         --anchor_cnt)
    {
        ulong anchor_ofs;
        size_t sym_len;
        CTcStreamAnchor *anchor;
        
        /* read this anchor */
        fp->read_bytes(buf, 6);

        /* get the offset, and adjust for the new stream base offset */
        anchor_ofs = t3rp4u(buf) + start_ofs;

        /* get the length of the owning symbol's name, if any */
        sym_len = osrp2(buf+4);

        /* if there's a symbol name, read it */
        if (sym_len != 0)
        {
            CTcSymbol *owner_sym;
            
            /* read the symbol name */
            fp->read_bytes(buf, sym_len);

            /* look it up in the global symbol table */
            owner_sym = G_prs->get_global_symtab()->find(buf, sym_len);
            if (owner_sym == 0)
            {
                /* 
                 *   the owner symbol doesn't exist - this is an internal
                 *   inconsistency in the object file, because the anchor
                 *   symbol must always be defined in the same file and
                 *   hence should have been loaded already; complain and
                 *   go on 
                 */
                G_tcmain->log_error(0, 0, TC_SEV_ERROR,
                                    TCERR_OBJFILE_INT_SYM_MISSING,
                                    (int)sym_len, buf, fname);

                /* we can't create the anchor */
                anchor = 0;
            }
            else
            {
                /* create the anchor based on the symbol */
                anchor = add_anchor(owner_sym,
                                    owner_sym->get_fixup_list_anchor(),
                                    anchor_ofs);

                /* set the anchor in the symbol */
                owner_sym->set_anchor(anchor);
            }
        }
        else
        {
            /* create the anchor with no external references */
            anchor = add_anchor(0, 0, anchor_ofs);
        }

        /* load the fixup list */
        CTcAbsFixup::
            load_fixup_list_from_object_file(fp, fname,
                                             anchor->fixup_list_head_);
    }
}
コード例 #8
0
ファイル: xmlproc.c プロジェクト: Remmy/afterstep
void 
start_formalpara_tag( xml_elem_t *doc, xml_elem_t *parm, ASXMLInterpreterState *state )
{
	add_anchor( parm, state );
	set_flags( state->flags, ASXMLI_FormalPara );
}
コード例 #9
0
ファイル: xmlproc.c プロジェクト: Remmy/afterstep
void 
start_anchor_tag( xml_elem_t *doc, xml_elem_t *parm, ASXMLInterpreterState *state )
{
	if( state->doc_type == DocType_HTML	|| state->doc_type == DocType_PHP	 )
		add_anchor( parm, state );	
}
コード例 #10
0
ファイル: finelink.c プロジェクト: LeoNelson/hypermail
static char *url_replying_to(struct emailinfo *email, char *line1,	/* first line of quoted text, with html */
			     const char *line2,	/* first line of quoted text, w/o html */
			     const struct body *bp, int quote_num, int *quoting_msgnum, int count_quoted_lines, int maybe_reply)
{
    String_Match match_info;
    char *p;
    int subjmatch = 0;
    char *anchor;
    struct emailinfo *ep;
	int statusnum = hashreplynumlookup(*quoting_msgnum, email->inreplyto, email->subject,
			   &subjmatch);
    hashnumlookup(*quoting_msgnum, &ep);
    trio_asprintf(&anchor, "%.4dqlink%d", *quoting_msgnum, quote_num);
    if (statusnum != -1) {
	struct emailinfo *ep2;
	hashnumlookup(statusnum, &ep2);
		if (add_anchor(statusnum, *quoting_msgnum, quote_num, anchor, line1, 0, count_quoted_lines, NULL)) {
	    char *path = get_path(ep, ep2);
	    char *buf;
			trio_asprintf(&buf, "%s%.4d.%s#%s", path, statusnum, set_htmlsuffix, anchor);
	    if (maybe_reply)
		set_new_reply_to(statusnum, strlen(line2));
	    if (*path)
	        free(path);
	    free(anchor);
	    return buf;
	}
	if (strlen(line2) > 6 && (p = strstr(line2, "..."))) {
	    char *parsed;
	    char *tptr = (char *)emalloc(p - line2 + 1 + strlen(p + 3));	/* AUDIT biege: IOF unlikely */
	    strncpy(tptr, line2, p - line2);
	    strcpy(tptr + (p - line2), p + 3);
	    parsed = ConvURLsString(tptr, email->msgid, email->subject, email->charset);
	    free(tptr);
	    tptr = stripwhitespace(parsed ? parsed : "");
	    if (parsed)
		free(parsed);
			if (add_anchor(statusnum, *quoting_msgnum, quote_num, anchor, tptr, 1, count_quoted_lines, NULL)) {
	        char *path = get_path(ep, ep2);
		char *buf;
				trio_asprintf(&buf, "%s%.4d.%s#%s", path, statusnum, set_htmlsuffix, anchor);
		free(tptr);
		if (maybe_reply)
		    set_new_reply_to(statusnum, strlen(buf));
		if (*path)
	            free(path);
		free(anchor);
		return buf;
	    }
	    free(tptr);
	}
    }
    {
	int i;
	struct Push full_line;
	struct Push exact_line;
	INIT_PUSH(full_line);
	INIT_PUSH(exact_line);
	PushString(&full_line, p = stripwhitespace(line2));
	free(p);
	PushString(&exact_line, line2);
	for (i = 1; i < count_quoted_lines && (bp = bp->next); ++i) {
	    char *stripped = unquote_and_strip(bp->line);
	    PushByte(&full_line, '\n');
	    PushString(&full_line, p = stripwhitespace(stripped));
	    free(p);
	    free(stripped);
	    PushString(&exact_line, unquote(bp->line));
	}
		search_for_quote(PUSH_STRING(full_line), PUSH_STRING(exact_line), *quoting_msgnum, &match_info);
	free(PUSH_STRING(full_line));
	free(PUSH_STRING(exact_line));
    }
    if (match_info.msgnum >= 0) {
		char *parsed = ConvURLsString(match_info.last_matched_string, email->msgid,
			   email->subject, email->charset);
	if (parsed) {
	    char *parsed2 = stripwhitespace(parsed);
	    free(parsed);
	    if (add_anchor(match_info.msgnum, *quoting_msgnum, quote_num, anchor, parsed2, 1, count_quoted_lines, &match_info)) {
	        struct emailinfo *ep2;
                char *path;
                char *buf;
                hashnumlookup(match_info.msgnum, &ep2);
                path = get_path(ep, ep2);

		trio_asprintf(&buf, "%s%.4d.%s#%s", path, match_info.msgnum, set_htmlsuffix, anchor);
		set_new_reply_to(match_info.msgnum, match_info.match_len_bytes);
		free(parsed2);
		if (*path)
		    free(path);
		free(anchor);
		return buf;
	    }
	    free(parsed2);
	}
	if (match_info.last_matched_string)
	    free(match_info.last_matched_string);
    }
    if (count_quoted_lines < 3 && strcmp(get_quote_prefix(), ">")
	&& strcmp(get_quote_prefix(), " >"))	/* was quote_prefix guess shaky? */
	*quoting_msgnum = -1;	/* msg probably doesn't have any quotes */
    free(anchor);
    return NULL;
}