summaryrefslogtreecommitdiff
path: root/perl.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove DECCRTL_SOCKETS from PL_bincompat_options.Craig A. Berry2011-03-091-3/+0
| | | | | | | | | | The socket libraries provided by the C run-time have been the only viable option for building sockets in Perl for many years, so we don't need to take up a valuable slot in the options list to record that we're using them. Also, the new bincompat.t test requires options to be in alpha- betical order, and this wasn't.
* fix many s/// tainting bugsDavid Mitchell2011-02-161-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a re-implementation of the tainting code in pp_subst and pp_substcont. Although this fixes many bugs, because its a de-novo rewrite of the tainting parts of the code in those two functions, it's quite possible that it breaks some existing tainting behaviour. It doesn't break any existing tests, although it turns out that this area was severely under-tested anyway. The main bugs that this commit fixes are as follows, where: T = a tainted value L = pattern tainted by locale (e.g. use locale; s/\w//) Happens both with and without 'use re taint' unless specified. Happens with all modifiers (/g, /r etc) unless explicitly mentioned. $1 unexpectedly untainted: s/T// T =~ s/// under use re 'taint' original string unexpectedly untainted: s/L//, s/L//g return value unexpectedly untainted: T =~ s///g under no re 'taint' s/L//g, s/L//r return value unexpectedly tainted: s/T// s//T/r under no re 'taint' T =~ s/// under use re 'taint' s//T/ under use re 'taint' Also, with /ge, the original string becomes tainted as soon as possible (usually in the second entry to the /e code block) rather than only at the end, in code like $orig =~ s/T/...code.../ge The rationale behind the taintedness of the return value of s/// (in the non /r case), is that a boolean value shouldn't be tainted. This corresponds to the general perl tainting policy that boolean ops don't return tainted values. On the other hand, when it returns an integer (number of matches), that should be tainted. A couple of note about the old tainting code this replaces: firstly, several occurrences of the following were NOOPs, since rxtainted was U8 and the bit being ored was > 256: rxtainted |= RX_MATCH_TAINTED(rx) secondly, removing a whole bunch of the following didn't make any existing tests fail: TAINT_IF(rxtainted & 1);
* Remove vestigial ORANGE referencesDavid Mitchell2011-01-301-1/+0
| | | | | This was a temporary type used while regexes were in the process of being promoted to first-class SVs
* Break out the generated function Perl_keywords() into keywords.c, a new file.Nicholas Clark2011-01-241-0/+8
| | | | | | | | As it and Perl_yylex() both need FEATURE_IS_ENABLED, feature_is_enabled() is no longer static, and the two macro definitions move from toke.c to perl.h Previously, one had to cut and paste the output of perl_keywords.pl into the middle of toke.c, and it was not clear that it was generated code.
* Remove obsolete macrosLeon Timmermans2011-01-171-30/+0
|
* Fix typos (spelling errors) in Perl sources.Peter J. Acklam) (via RT2011-01-071-6/+6
| | | | | | | | | # New Ticket Created by (Peter J. Acklam) # Please include the string: [perl #81904] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81904 > Signed-off-by: Abigail <abigail@abigail.be>
* Change regexes to debug dump non-ASCII as hex.Karl Williamson2010-12-191-1/+1
| | | | | | instead of the less familiar octal for larger values. Perhaps they should actually print the actual character, but this is far easier than the previous to understand.
* pv_escape: Add option to dump all non-ascii as hexKarl Williamson2010-12-191-0/+1
| | | | | | | This patch adds an option to pv_escape() to dump all characters above ASCII in hex. Before, you could get all chars as hex or the Latin1 non-ASCII as octal, whereas the typical values for these that people think in are given in hex.
* Add a verbose option to -DP, and replace C<#if 0> blocks in sv_gets() with it.Nicholas Clark2010-11-291-0/+5
|
* Fix C++ build problems introduced in 9a5a5549Tony Cook2010-11-291-0/+1
| | | | | | | | | | | | Fixes the following compilation errors: regexec.c: In function 'char* S_find_byclass(regexp*, const regnode*, char*, const char*, regmatch_info*)': regexec.c:1525: error: invalid conversion from 'I32 (*)(const char*, const char*, I32)' to 'I32 (*)()' regexec.c:1525: error: too many arguments to function regexec.c:1527: error: invalid conversion from 'I32 (*)(const char*, const char*, I32)' to 'I32 (*)()' regexec.c:1527: error: too many arguments to function
* Make PerlIO marginally reentrantDavid Mitchell2010-11-261-1/+0
| | | | | | | | | | | | | | | | | | | | | | Currently if an operation on a file handle is interrupted, and if the signal handler accesses that same file handle (e.g. closes it), then perl will crash. See [perl #75556]. This commit provides some basic infrastructure to avoid segfaults. Basically it adds a lock count field to each handle (by re-purposing the unused flags field in the PL_perlio array), then each time a signal handler is called, the count is incremented. Then various parts of PerlIO use a positive count to change behaviour. Most importantly, when layers are popped, the PerlIOl structure is cleared, but not freed, and is left in the chain of layers. This means that callers still holding pointers to the various layers won't access freed structures. It does however mean that PerlIOl structs may be leaked, and possibly slots in PL_perlio. But this is better than crashing. Not much has been done to give sensible behaviour on re-entrancy; for example, a buffer that has already been written once might get written again. Fixing this sort of thing would require a large-scale audit of perlio.c.
* add 'head' field to PerlIOl structDavid Mitchell2010-11-261-0/+1
| | | | | | | | | | | | | This allows any layer to find the top of the layer stack, or more specifically, the entry in PL_perlio that points to the top. Needed for the next commit, which will implement a reference counting scheme. There's currently a bug in MakeMaker which causes several extensions to miss the dependency on perliol.h having changed, so this commit includes a gratuitous whitespace change to perl.h to hopefully force recompilation.
* perl.h: Add latin1 fold tableKarl Williamson2010-11-221-0/+44
| | | | | | The adds a folding table that works on the full Latin1 character set, except for three problematic characters that need special handling. It is accessed by PL_fold_latin1.
* PL_fold wrong for EBCDIC platforms.Karl Williamson2010-11-221-36/+5
| | | | | | | | | | | | | | | | | | | | | The PL_fold table map on EBCDIC only works on the ASCII-subrange characters, not the full native Latin1. To fix this, I moved the table to utfebcdic.h for EBCDIC platforms, and actually changed it to three tables, one for each of the code pages known to Perl. There is no EBCDIC platform available to test on. What I did was hack together a program from existing code that does EBCDIC transforms. I ran it in ASCII mode, and verified that the generated table was identical to the Latin1 table I had previously constructed by hand and extensively tested. I then ran it on each of the three EBCDIC transforms, and verified that each matched the places in the original table that I knew were correct, all the ASCII alphabetics, the controls, and a few other code points. So these tables are at least as correct as the existing one, as they are identical to it for [A-Z], [a-z].
* perl.h: Expand commentKarl Williamson2010-11-221-1/+3
|
* Improve custom OP support.Ben Morrow2010-11-141-0/+2
| | | | | | | | | | | | | | | | | Change the custom op registrations from two separate hashes to one hash holding structure pointers, and add API functions to register ops and look them up. This will make it easier to add new properties of custom ops in the future. Copy entries across from the old hashes where necessary, to preserve compatibility. Add two new properties, in addition to the already-existing 'name' and 'description': 'class' and 'peep'. 'class' is one of the OA_*OP constants, and allows B and other introspection mechanisms to work with custom ops that aren't BASEOPs. 'peep' is a pointer to a function that will be called for ops of this type from Perl_rpeep. Adjust B.xs to take account of the new properties, and also to give custom ops their registered name rather than simply 'custom'.
* Eliminate PL_dirtyFlorian Ragwitz2010-11-141-0/+7
| | | | | It now only exists as a compatibility macro for extensions that want to introspect it.
* Add ${^GLOBAL_PHASE}Florian Ragwitz2010-11-141-0/+26
| | | | This exposes the current top-level interpreter phase to perl space.
* Remove THREADSV_NAMES, part of 5005 threads that the chainsaw missed.Nicholas Clark2010-10-271-3/+0
| | | | | Also remove the documentation of OPf_SPECIAL for OP_ENTERITER, as that was only for 5.005 threads. Stop B::Deparse misinterpreting OPf_SPECIAL on OP_ENTERITER.
* Fix calling conventions in malloc_ctl.hJan Dubois2010-10-211-4/+4
| | | | | | | The Perl_malloc() etc. functions are *also* declared in proto.h, so the declarations need to match. The inclusion of malloc_ctl.h into perl.h had to be moved down until after the point where PERL_CALLCONV was completely defined.
* [perl #78072] use re '/xism';Father Chrysostomos2010-10-211-0/+2
|
* plugin mechanism to rewrite calls to a subroutineZefram2010-10-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | New magic type PERL_MAGIC_checkcall attaches a function to a CV, which will be called as the second half of the op checker for an entersub op calling that CV. Default state, in the absence of this magic, is to process the CV's prototype if it has one, or apply list context to all the arguments if not. New API functions cv_get_call_checker() and cv_set_call_checker() provide a clean interface to this facility, hiding the internal use of magic. Expose in the API the new functions rv2cv_op_cv(), ck_entersub_args_list(), ck_entersub_args_proto(), and ck_entersub_args_proto_or_list(), which are meaningful segments of standard entersub op checking and are likely to be useful in plugged-in call checker functions. Expose new API function op_contextualize(), which is a public interface to the internal scalar()/list()/scalarvoid() functions. This API is likely to be required in most plugged-in call checker functions. Incidentally add new function mg_free_type(), in the API, which will remove magic of one type from an SV. (mg_free() removes all magic, and there isn't anything else more selective.)
* Add VMS symbol shortening to PL_bincompat_options.Craig A. Berry2010-10-091-0/+3
|
* Remove MEMBER_TO_FPTR.Ben Morrow2010-10-061-58/+55
| | | | This is left over from PERL_OBJECT (see beeff2, 16c915, and so on).
* fix indentation of MY_CXT #definesDavid Mitchell2010-09-011-35/+35
| | | | Only whitespace changes
* merge two similar MY_CXT code branchesDavid Mitchell2010-09-011-37/+7
| | | | No functional changes
* MY_CXT macros: make the two sets of defs similarDavid Mitchell2010-09-011-8/+12
| | | | | | | Three years ago there was a cut and paste of all the MY_CXT macros into a second #ifdef PERL_GLOBAL_STRUCT_PRIVATE branch with minor modifications (Bad programmer! No cookie!). Make the two branches more similar in preparation for a partial merge. No functional changes.
* Remove CALL_FPTR and CPERLscope.Ben Morrow2010-08-201-40/+47
| | | | | | | | | | | | | | | | These are left from PERL_OBJECT, which was an implementation of multiplicity using C++ objects. PERL_OBJECT was removed in 5.8, but the macros seem to have been cargo-culted all over the core (including in places where they would have been inappropriate originally). Since they now do exactly nothing, it's cleaner to remove them. I have left the definitions in perl.h, under #ifndef PERL_CORE, since some CPAN XS code uses them (also often incorrectly). I have also left STATIC alone, since it seems potentially more useful and is much more ingrained. The only appearance of these macros this patch doesn't touch is in Devel-PPPort, because that's a CPAN module.
* Revert "Make the peep recurse via PL_peepp"Florian Ragwitz2010-08-161-7/+1
| | | | | | | | | | | | | This reverts commit 65bfe90c4b4ea5706a50067179e60d4e8de6807a. While it made a few of the things I wanted possible, a couple of other things one might need to do and I thought this change would enable don't actually work. Thanks Zefram for pointing out my mistake. Conflicts: ext/XS-APItest/APItest.xs op.c
* make string-append on win32 100 times fasterWolfram Humann2010-08-131-0/+8
| | | | | | | | | | | | | | | | When a string grows (e.g. gets appended to), perl calls sv_grow. When sv_grow decides that the memory currently allocated to the string is insufficient, it calls saferealloc. Depending on whether or not perl was compiled with 'usemymalloc' this calls realloc in either perls internal version or on the operating system. Perl requests from realloc just the amount of memory required for the current operation. With 'usemymalloc' this is not a problem because it rounds up memory allocation to a certain geometric progression anyway. When the operating system's realloc is called, this may or may not lead to desaster, depending on how it's implemented. On win32 it does lead to desaster: when I loop 1000 times and each time append 1000 chars to an initial string size of 10 million, the memory grows from 10.000e6 to 10.001e6 to 10.002e6 and so on 1000 times till it ends at 11.000e6.
* Check API compatibility when loading xs modulesFlorian Ragwitz2010-07-261-0/+4
| | | | | | | | | | | | | This adds PL_apiversion, allowing the API version of a running interpreter to be introspected. It is used in the new XS_APIVERSION_BOOTCHECK macro, which is added to the _boot function of every XS module, to compare it against the API version the module has been compiled against. If the versions do not match, an exception is thrown. This doesn't fully prevent binary incompatible extensions to be loaded. It merely compares PERL_API_* between compile- and runtime, and does not attempt to solve the problem of identifying binary incompatible perls with the same API version (i.e. the same perl version configured with and without DEBUGGING).
* Make the peep recurse via PL_peeppFlorian Ragwitz2010-07-251-1/+7
| | | | | | | | | | | Also allows extensions, when delegating to Perl_peep, to specify what function it should use when recursing into a part of the op tree. The usecase for this are extensions like namespace::alias, which need to hook into the peep to do their thing. With this change they can stop copying the whole peep only to add tiny bits of new behaviour to it, allowing them to work easier on a large variety of perls, without having to maintain one peep which works on all of them (which is HARD!).
* Add a Configure probe for static inline.Andy Dougherty2010-07-221-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | This patch enables Configure to probe for C99-style 'static inline'. (That is, functions may be inlined, but will not be externally visible.) The initial idea is that some common code in messy macros inside headers might be simplified using inline functions. If the compiler does not support 'static inline', then a plain 'static' is used instead, along with the consequent implications of a function call (though the compiler may optimize away the function call and inline the function anyway). In either case, you simply use PERL_STATIC_INLINE. This patch does not *use* this facility at all yet. It is merely a Configure patch to make the facility availble for others to experiment with. VMS and Windows files will still need to be manually updated. Finally, before actually converting anything to inline functions, please try to carefully evaluate the performance implications of any proposed changes. Compilers vary in what they will and will not convert to inline functions, so it's worth proceeding slowly and carefully. This patch results from a single new metaconfig unit, d_static_inline.U, which I will separately upload to the metaconfig repository.
* Macroify the block_hooks structure.Ben Morrow2010-07-121-0/+2
| | | | | Add a flags member, so it can be extended later if necessary. Add a bhk_eval member, called from doeval to catch requires and string evals.
* add my_[l]stat_flags(); make my_[l]stat() mathomsDavid Mitchell2010-07-031-0/+4
| | | | | | | my_stat() and my_lstat() call get magic on the stack arg, so create _flags() variants that allow us to control this. (I can't just change the signature or the mg_get() behaviour since my_[l]stat() are listed as being in the public API, even though they're undocumented.)
* Stop using WITH_THR and WITH_THX, as they were never necessary here.Nicholas Clark2010-06-161-2/+2
|
* add handy note on vtable fieldsDavid Mitchell2010-06-051-0/+13
|
* add PL_signalhook to hook into signal dispatchDavid Mitchell2010-06-041-1/+2
| | | | | This is initially intended for threads::shared and shouldn't (yet) be considered part of the public API.
* On the save stack, store the save type as the bottom 6 bits of a UV.Nicholas Clark2010-05-011-0/+1
| | | | This makes the other 26 (or 58) bits available for save data.
* remove Perl_pmflagRobin Barker2010-04-261-8/+0
|
* Don't allocate pointer table entries from arenas.Nicholas Clark2010-04-251-3/+3
| | | | | Instead, allocate a private arena chain per pointer table, and free that chain when its pointer table is freed. Patch from RT #72598.
* improve -Dl debugging outputDavid Mitchell2010-03-301-2/+4
| | | | | In particular, distinguish between scope and context stack push/pops, show depth of JUMPENV stack, and show STACKINFO push/pops
* Introduce C<use feature "unicode_strings">Rafael Garcia-Suarez2009-12-201-1/+1
| | | | | | | | | | | | | This turns on the unicode semantics for uc/lc/ucfirst/lcfirst operations on strings without the UTF8 bit set but with ASCII characters higher than 127. This replaces the "legacy" pragma experiment. Note that currently this feature sets both a bit in $^H and a (unused) key in %^H. The bit in $^H could be replaced by a flag on the uc/lc/etc op. It's probably not feasible to test a key in %^H in pp_uc in friends each time we want to know which semantics to apply.
* Handle $@ being assigned a read-only value (without error or busting the stack).Nicholas Clark2009-11-291-2/+18
| | | | Discovered whilst investigating RT #70862.
* Fix RT #70862 by converting ERRSV to GvSVn() to ensure a non-NULL GvSV().Nicholas Clark2009-11-291-1/+1
|
* Make unicode semantics the defaultKarl Williamson2009-11-231-1/+1
|
* Inline PL_no_symref_sv into its users. Deprecate the visible global variable.Nicholas Clark2009-11-151-2/+4
| | | | | | | | | As the core no longer needs this fixed string outside of pp.c, it seems daft to make it public just in case any module wants to use it. Modules that do should provide their own inline copy in future. Also restore the visible global PL_no_symref_sv back to the original format specificiation (of 5.10.0 and earlier).
* Inline PL_no_symref into pp_entersub. Deprecate the visible global variable.Nicholas Clark2009-11-151-2/+2
| | | | | | | | | | | As the core no longer needs this fixed string in more than one place, it seems daft to go to the overhead (and cost) of making it public in case any module wants to use it. Modules that do want to use it should provide their own inline copy in future. Also restore the visible global PL_no_symref back to the original format specification (of 5.10.0 and earlier), as an extra %s has the potential to cause SEGVs or worse if not spotted at compile time.
* add code for Unicode semantics for non-utf8 latin1 charsKarl Williamson2009-11-141-21/+97
|
* Merge branch 'legacy-pragma' into bleadRafael Garcia-Suarez2009-11-061-0/+1
|\ | | | | | | | | Conflicts: MANIFEST