From: Jarkko Hietaniemi Date: Thu, 17 Aug 2006 19:16:09 +0000 (+0300) Subject: Re: A large-ish C++ TODO (Re: [PATCH] g++ stage 1 reached) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a0c21aa16d2e2969e7469365a39ad48179751e84;p=p5sagit%2Fp5-mst-13.2.git Re: A large-ish C++ TODO (Re: [PATCH] g++ stage 1 reached) Message-ID: <44E49649.9090307@iki.fi> p4raw-id: //depot/perl@28734 --- diff --git a/XSUB.h b/XSUB.h index 580d639..51112a9 100644 --- a/XSUB.h +++ b/XSUB.h @@ -107,7 +107,11 @@ is a lexical $_ in scope. # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus) # define XS(name) void name(pTHX_ CV* cv __attribute__unused__) # else -# define XS(name) void name(pTHX_ CV* cv) +# ifdef __cplusplus +# define XS(name) extern "C" void name(pTHX_ CV* cv) +# else +# define XS(name) void name(pTHX_ CV* cv) +# endif # endif #endif diff --git a/mathoms.c b/mathoms.c index 72639dc..d15aec9 100644 --- a/mathoms.c +++ b/mathoms.c @@ -29,41 +29,42 @@ #define PERL_IN_MATHOMS_C #include "perl.h" -OP * Perl_ref(pTHX_ OP *o, I32 type); -void Perl_sv_unref(pTHX_ SV *sv); -void Perl_sv_taint(pTHX_ SV *sv); -IV Perl_sv_2iv(pTHX_ register SV *sv); -UV Perl_sv_2uv(pTHX_ register SV *sv); -char * Perl_sv_2pv(pTHX_ register SV *sv, STRLEN *lp); -char * Perl_sv_2pv_nolen(pTHX_ register SV *sv); -char * Perl_sv_2pvbyte_nolen(pTHX_ register SV *sv); -char * Perl_sv_2pvutf8_nolen(pTHX_ register SV *sv); -void Perl_sv_force_normal(pTHX_ register SV *sv); -void Perl_sv_setsv(pTHX_ SV *dstr, register SV *sstr); -void Perl_sv_catpvn(pTHX_ SV *dsv, const char* sstr, STRLEN slen); -void Perl_sv_catpvn_mg(pTHX_ register SV *sv, register const char *ptr, register STRLEN len); -void Perl_sv_catsv(pTHX_ SV *dstr, register SV *sstr); -void Perl_sv_catsv_mg(pTHX_ SV *dsv, register SV *ssv); -char * Perl_sv_pv(pTHX_ SV *sv); -char * Perl_sv_pvn_force(pTHX_ SV *sv, STRLEN *lp); -char * Perl_sv_pvbyte(pTHX_ SV *sv); -char * Perl_sv_pvutf8(pTHX_ SV *sv); -STRLEN Perl_sv_utf8_upgrade(pTHX_ register SV *sv); -NV Perl_huge(void); -void Perl_gv_fullname3(pTHX_ SV *sv, const GV *gv, const char *prefix); -void Perl_gv_efullname3(pTHX_ SV *sv, const GV *gv, const char *prefix); -GV * Perl_gv_fetchmethod(pTHX_ HV *stash, const char *name); -HE * Perl_hv_iternext(pTHX_ HV *hv); -void Perl_hv_magic(pTHX_ HV *hv, GV *gv, int how); -bool Perl_do_open(pTHX_ GV *gv, register const char *name, I32 len, int as_raw, - int rawmode, int rawperm, PerlIO *supplied_fp); -bool Perl_do_aexec(pTHX_ SV *really, register SV **mark, register SV **sp); -bool Perl_do_exec(pTHX_ const char *cmd); -U8 * Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv); -bool Perl_is_utf8_string_loc(pTHX_ const U8 *s, STRLEN len, const U8 **ep); -void Perl_sv_nolocking(pTHX_ SV *sv); -void Perl_sv_usepvn_mg(pTHX_ SV *sv, char *ptr, STRLEN len); -void Perl_sv_usepvn(pTHX_ SV *sv, char *ptr, STRLEN len); +PERL_CALLCONV OP * Perl_ref(pTHX_ OP *o, I32 type); +PERL_CALLCONV void Perl_sv_unref(pTHX_ SV *sv); +PERL_CALLCONV void Perl_sv_taint(pTHX_ SV *sv); +PERL_CALLCONV IV Perl_sv_2iv(pTHX_ register SV *sv); +PERL_CALLCONV UV Perl_sv_2uv(pTHX_ register SV *sv); +PERL_CALLCONV char * Perl_sv_2pv(pTHX_ register SV *sv, STRLEN *lp); +PERL_CALLCONV char * Perl_sv_2pv_nolen(pTHX_ register SV *sv); +PERL_CALLCONV char * Perl_sv_2pvbyte_nolen(pTHX_ register SV *sv); +PERL_CALLCONV char * Perl_sv_2pvutf8_nolen(pTHX_ register SV *sv); +PERL_CALLCONV void Perl_sv_force_normal(pTHX_ register SV *sv); +PERL_CALLCONV void Perl_sv_setsv(pTHX_ SV *dstr, register SV *sstr); +PERL_CALLCONV void Perl_sv_catpvn(pTHX_ SV *dsv, const char* sstr, STRLEN slen); +PERL_CALLCONV void Perl_sv_catpvn_mg(pTHX_ register SV *sv, register const char *ptr, register STRLEN len); +PERL_CALLCONV void Perl_sv_catsv(pTHX_ SV *dstr, register SV *sstr); +PERL_CALLCONV void Perl_sv_catsv_mg(pTHX_ SV *dsv, register SV *ssv); +PERL_CALLCONV char * Perl_sv_pv(pTHX_ SV *sv); +PERL_CALLCONV char * Perl_sv_pvn_force(pTHX_ SV *sv, STRLEN *lp); +PERL_CALLCONV char * Perl_sv_pvbyte(pTHX_ SV *sv); +PERL_CALLCONV char * Perl_sv_pvutf8(pTHX_ SV *sv); +PERL_CALLCONV STRLEN Perl_sv_utf8_upgrade(pTHX_ register SV *sv); +PERL_CALLCONV NV Perl_huge(void); +PERL_CALLCONV void Perl_gv_fullname3(pTHX_ SV *sv, const GV *gv, const char *prefix); +PERL_CALLCONV void Perl_gv_efullname3(pTHX_ SV *sv, const GV *gv, const char *prefix); +PERL_CALLCONV GV * Perl_gv_fetchmethod(pTHX_ HV *stash, const char *name); +PERL_CALLCONV HE * Perl_hv_iternext(pTHX_ HV *hv); +PERL_CALLCONV void Perl_hv_magic(pTHX_ HV *hv, GV *gv, int how); +PERL_CALLCONV bool Perl_do_open(pTHX_ GV *gv, register const char *name, I32 len, int as_raw, int rawmode, int rawperm, PerlIO *supplied_fp); +PERL_CALLCONV bool Perl_do_aexec(pTHX_ SV *really, register SV **mark, register SV **sp); +PERL_CALLCONV bool Perl_do_exec(pTHX_ const char *cmd); +PERL_CALLCONV U8 * Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv); +PERL_CALLCONV bool Perl_is_utf8_string_loc(pTHX_ const U8 *s, STRLEN len, const U8 **ep); +PERL_CALLCONV void Perl_sv_nolocking(pTHX_ SV *sv); +PERL_CALLCONV void Perl_sv_usepvn_mg(pTHX_ SV *sv, char *ptr, STRLEN len); +PERL_CALLCONV void Perl_sv_usepvn(pTHX_ SV *sv, char *ptr, STRLEN len); +PERL_CALLCONV int Perl_fprintf_nocontext(PerlIO *stream, const char *format, ...); +PERL_CALLCONV int Perl_printf_nocontext(const char *format, ...); /* ref() is now a macro using Perl_doref; diff --git a/op.h b/op.h index 8c1bffb..c299c5d 100644 --- a/op.h +++ b/op.h @@ -542,8 +542,9 @@ struct loop { #define PERL_LOADMOD_NOIMPORT 0x2 #define PERL_LOADMOD_IMPORT_OPS 0x4 -/* used in perly.y */ +#if defined(PERL_IN_PERLY_C) || defined(PERL_IN_OP_C) #define ref(o, type) doref(o, type, TRUE) +#endif /* no longer used anywhere in core */ #ifndef PERL_CORE diff --git a/perl.h b/perl.h index a5b0f06..b2b9a9c 100644 --- a/perl.h +++ b/perl.h @@ -337,10 +337,18 @@ * PERL_CALLCONV to be something special. See also the * definition of XS() in XSUB.h. */ #ifndef PERL_EXPORT_C -# define PERL_EXPORT_C extern +# ifdef __cplusplus +# define PERL_EXPORT_C extern "C" +# else +# define PERL_EXPORT_C extern +# endif #endif #ifndef PERL_XS_EXPORT_C -# define PERL_XS_EXPORT_C +# ifdef __cplusplus +# define PERL_XS_EXPORT_C extern "C" +# else +# define PERL_XS_EXPORT_C +# endif #endif #ifdef OP_IN_REGISTER @@ -4401,7 +4409,11 @@ struct tempsym; /* defined in pp_pack.c */ #include "pp.h" #ifndef PERL_CALLCONV -# define PERL_CALLCONV +# ifdef __cplusplus +# define PERL_CALLCONV extern "C" +# else +# define PERL_CALLCONV +# endif #endif #undef PERL_CKDEF #undef PERL_PPDEF diff --git a/perlio.c b/perlio.c index 7d8c5e0..dcd6138 100644 --- a/perlio.c +++ b/perlio.c @@ -120,6 +120,9 @@ extern off_t ftello(FILE *); #endif #ifndef USE_SFIO + +EXTERN_C int perlsio_binmode(FILE *fp, int iotype, int mode); + int perlsio_binmode(FILE *fp, int iotype, int mode) { diff --git a/utf8.c b/utf8.c index 21be126..f3e3633 100644 --- a/utf8.c +++ b/utf8.c @@ -25,6 +25,13 @@ #define PERL_IN_UTF8_C #include "perl.h" +#ifndef EBCDIC +/* Separate prototypes needed because in ASCII systems these + * usually macros but they still are compiled as code, too. */ +PERL_CALLCONV UV Perl_utf8n_to_uvchr(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags); +PERL_CALLCONV U8* Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv); +#endif + static const char unees[] = "Malformed UTF-8 character (unexpected end of string)";