Alien-TinyCC

 view release on metacpan or  search on metacpan

src/Changelog  view on Meta::CPAN

  484: Handle parentheses within __attribute__((...)) (Rob Landley)
  480: Remove a goto in decl_initializer_alloc (Rob Landley)
  475: Fix dereferences in inline assembly output (Joshua Phillips)
  474: Cast ptrs to ints of different sizes correctly (Joshua Phillips)
  473: Fix size of structs with empty array member (Joshua Phillips)
  470: No warning for && and || with mixed pointers/integers (Rob Landley)
  469: Fix symbol visibility problems in the linker (Vincent Pit)
  468: Allow && and || involving pointer arguments (Rob Landley)
  455: Optimize case labels with no code in between (Zdenek Pavlas)
  450: Implement alloca for x86 (grischka)
  415: Parse unicode escape sequences (Axel Liljencrantz)
  407: Add a simple va_copy() in stdarg.h (Hasso Tepper)
  400: Allow typedef names as symbols (Dave Dodge)

- Import some changesets from Rob Landley's fork (part 1):
  462: Use LGPL with bcheck.c and il-gen.c
  458: Fix global compound literals (in unary: case '&':) (Andrew Johnson)
  456: Use return code from tcc_output_file in main() (Michael Somos)
  442: Fix indirections with function pointers (***fn)() (grischka)
  441: Fix LL left shift in libtcc1.c:__shldi3 (grischka)
  440: Pass structures and function ptrs through ?: (grischka)

src/tccpp.c  view on Meta::CPAN

{
    if (is_space(t)) {
        if (*spc) 
            return 1;
        *spc = 1;
    } else 
        *spc = 0;
    return 0;
}

/* parse a string without interpreting escapes */
static uint8_t *parse_pp_string(uint8_t *p,
                                int sep, CString *str)
{
    int c;
    p++;
    for(;;) {
        c = *p;
        if (c == sep) {
            break;
        } else if (c == '\\') {
            file->buf_ptr = p;
            c = handle_eob();
            p = file->buf_ptr;
            if (c == CH_EOF) {
            unterminated_string:
                /* XXX: indicate line number of start of string */
                tcc_error("missing terminating %c character", sep);
            } else if (c == '\\') {
                /* escape : just skip \[\r]\n */
                PEEKC_EOB(c, p);
                if (c == '\n') {
                    file->line_num++;
                    p++;
                } else if (c == '\r') {
                    PEEKC_EOB(c, p);
                    if (c != '\n')
                        expect("'\n' after '\r'");
                    file->line_num++;
                    p++;

src/tccpp.c  view on Meta::CPAN

        }
        break;
    }
    /* ignore other preprocess commands or #! for C scripts */
    while (tok != TOK_LINEFEED)
        next_nomacro();
 the_end:
    parse_flags = saved_parse_flags;
}

/* evaluate escape codes in a string. */
static void parse_escape_string(CString *outstr, const uint8_t *buf, int is_long)
{
    int c, n;
    const uint8_t *p;

    p = buf;
    for(;;) {
        c = *p;
        if (c == '\0')
            break;
        if (c == '\\') {
            p++;
            /* escape */
            c = *p;
            switch(c) {
            case '0': case '1': case '2': case '3':
            case '4': case '5': case '6': case '7':
                /* at most three octal digits */
                n = c - '0';
                p++;
                c = *p;
                if (isoct(c)) {
                    n = n * 8 + c - '0';

src/tccpp.c  view on Meta::CPAN

                c = '\r';
                break;
            case 't':
                c = '\t';
                break;
            case 'v':
                c = '\v';
                break;
            case 'e':
                if (!gnu_ext)
                    goto invalid_escape;
                c = 27;
                break;
            case '\'':
            case '\"':
            case '\\': 
            case '?':
                break;
            default:
            invalid_escape:
                if (c >= '!' && c <= '~')
                    tcc_warning("unknown escape sequence: \'\\%c\'", c);
                else
                    tcc_warning("unknown escape sequence: \'\\x%x\'", c);
                break;
            }
        }
        p++;
    add_char_nonext:
        if (!is_long)
            cstr_ccat(outstr, c);
        else
            cstr_wccat(outstr, c);
    }

src/tccpp.c  view on Meta::CPAN

            CString str;
            int sep;

            sep = c;

            /* parse the string */
            cstr_new(&str);
            p = parse_pp_string(p, sep, &str);
            cstr_ccat(&str, '\0');
            
            /* eval the escape (should be done as TOK_PPNUM) */
            cstr_reset(&tokcstr);
            parse_escape_string(&tokcstr, str.data, is_long);
            cstr_free(&str);

            if (sep == '\'') {
                int char_size;
                /* XXX: make it portable */
                if (!is_long)
                    char_size = 1;
                else
                    char_size = sizeof(nwchar_t);
                if (tokcstr.size <= char_size)

src/texi2pod.pl  view on Meta::CPAN

    s/\@dots\{\}/.../g;
    s/\@enddots\{\}/..../g;
    s/\@([.!? ])/$1/g;
    s/\@[:-]//g;
    s/\@bullet(?:\{\})?/*/g;
    s/\@TeX\{\}/TeX/g;
    s/\@pounds\{\}/\#/g;
    s/\@minus(?:\{\})?/-/g;
    s/\\,/,/g;

    # Now the ones that have to be replaced by special escapes
    # (which will be turned back into text by unmunge())
    s/&/&amp;/g;
    s/\@\{/&lbrace;/g;
    s/\@\}/&rbrace;/g;
    s/\@\@/&at;/g;

    # Inside a verbatim block, handle @var specially.
    if ($shift ne "") {
	s/\@var\{([^\}]*)\}/<$1>/g;
    }

src/texi2pod.pl  view on Meta::CPAN


    /^\@((?:small)?example|display)/ and do {
	push @endwstack, $endw;
	$endw = $1;
	$shift = "\t";
	$_ = "";	# need a paragraph break
    };

    /^\@itemx?\s*(.+)?$/ and do {
	if (defined $1) {
	    # Entity escapes prevent munging by the <> processing below.
	    $_ = "\n=item $ic\&LT;$1\&GT;\n";
	} else {
	    $_ = "\n=item $ic\n";
	    $ic =~ y/A-Ya-y/B-Zb-z/;
	    $ic =~ s/(\d+)/$1 + 1/eg;
	}
    };

    $section .= $shift.$_."\n";
}

src/texi2pod.pl  view on Meta::CPAN

	if (! exists $defs{$2}) {
	    print STDERR "Option $2 not defined\n";
	    s/\Q$1\E//;
	} else {
	    $value = $defs{$2};
	    s/\Q$1\E/$value/;
	}
    }

    # Formatting commands.
    # Temporary escape for @r.
    s/\@r\{([^\}]*)\}/R<$1>/g;
    s/\@(?:dfn|var|emph|cite|i)\{([^\}]*)\}/I<$1>/g;
    s/\@(?:code|kbd)\{([^\}]*)\}/C<$1>/g;
    s/\@(?:gccoptlist|samp|strong|key|option|env|command|b)\{([^\}]*)\}/B<$1>/g;
    s/\@sc\{([^\}]*)\}/\U$1/g;
    s/\@file\{([^\}]*)\}/F<$1>/g;
    s/\@w\{([^\}]*)\}/S<$1>/g;
    s/\@(?:dmn|math)\{([^\}]*)\}/$1/g;

    # Cross references are thrown away, as are @noindent and @refill.

src/texi2pod.pl  view on Meta::CPAN

	s/\@footnote\{([^\}]+)\}/[$fnno]/;
	add_footnote($1, $fnno);
	$fnno++;
    }

    return $_;
}

sub unmunge
{
    # Replace escaped symbols with their equivalents.
    local $_ = $_[0];

    s/&lt;/E<lt>/g;
    s/&gt;/E<gt>/g;
    s/&lbrace;/\{/g;
    s/&rbrace;/\}/g;
    s/&at;/\@/g;
    s/&amp;/&/g;
    return $_;
}



( run in 0.316 second using v1.01-cache-2.11-cpan-c21f80fb71c )