1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>perlapi - perldoc.perl.org</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en-gb">
<link rel="search" type="application/opensearchdescription+xml" title="Search perldoc.perl.org" href="/static/search.xml"/>
<link href="static/css-20100830.css" rel="stylesheet" rev="stylesheet" type="text/css" media="screen">
<link href="static/exploreperl.css" rel="stylesheet" rev="stylesheet" type="text/css">
</head>
<body onLoad="perldoc.startup();" onPageShow="if (event.persisted) perldoc.startup();">
<div id="page">
<div id="header">
<div id="homepage_link">
<a href="index.html"></a>
</div>
<div id="strapline">
Perl Programming Documentation
</div>
<div id="download_link" class="download">
<a href="http://www.perl.org/get.html">Download Perl</a>
</div>
<div id="explore_link" class="download">
<a id="explore_anchor" href="#">Explore</a>
</div>
</div>
<div id="body">
<div id="left_column">
<div class="side_group">
<div class="side_panel doc_panel">
<p>Manual</p>
<ul>
<li><a href="index-overview.html">Overview</a>
<li><a href="index-tutorials.html">Tutorials</a>
<li><a href="index-faq.html">FAQs</a>
<li><a href="index-history.html">History / Changes</a>
<li><a href="index-licence.html">License</a>
</ul>
</div>
<div class="side_panel doc_panel">
<p>Reference</p>
<ul>
<li><a href="index-language.html">Language</a>
<li><a href="index-functions.html">Functions</a>
<li><a href="perlop.html">Operators</a>
<li><a href="perlvar.html">Special Variables</a>
<li><a href="index-pragmas.html">Pragmas</a>
<li><a href="index-utilities.html">Utilities</a>
<li><a href="index-internals.html">Internals</a>
<li><a href="index-platforms.html">Platform Specific</a>
</ul>
</div>
<div class="side_panel doc_panel">
<p>Modules</p>
<ul>
<li>
<a href="index-modules-A.html">A</a>
•
<a href="index-modules-B.html">B</a>
•
<a href="index-modules-C.html">C</a>
•
<a href="index-modules-D.html">D</a>
•
<a href="index-modules-E.html">E</a>
<li>
<a href="index-modules-F.html">F</a>
•
<a href="index-modules-G.html">G</a>
•
<a href="index-modules-H.html">H</a>
•
<a href="index-modules-I.html">I</a>
•
<a href="index-modules-L.html">L</a>
<li>
<a href="index-modules-M.html">M</a>
•
<a href="index-modules-N.html">N</a>
•
<a href="index-modules-O.html">O</a>
•
<a href="index-modules-P.html">P</a>
•
<a href="index-modules-S.html">S</a>
<li>
<a href="index-modules-T.html">T</a>
•
<a href="index-modules-U.html">U</a>
•
<a href="index-modules-X.html">X</a>
</ul>
</div>
<div class="side_panel doc_panel">
<p>Tools</p>
<ul>
<li><a href="preferences.html">Preferences</a>
</ul>
</div>
</div>
</div>
<div id="centre_column">
<div id="content_header">
<div id="title_bar">
<div id="page_name">
<h1>perlapi</h1>
</div>
<div id="perl_version">
Perl 5 version 22.0 documentation
</div>
<div class="page_links" id="page_links_top">
<a href="#" onClick="toolbar.goToTop();return false;">Go to top</a>
</div>
<div class="page_links" id="page_links_bottom">
<a href="#" id="page_index_toggle">Show page index</a> •
<a href="#" id="recent_pages_toggle">Show recent pages</a>
</div>
<div id="search_form">
<form action="search.html" method="GET" id="search">
<input type="text" name="q" id="search_box" alt="Search">
</form>
</div>
</div>
<div id="breadcrumbs">
<a href="index.html">Home</a> >
<a href="index-internals.html">Internals and C language interface</a> >
perlapi
</div>
</div>
<div id="content_body">
<!--[if lt IE 7]>
<div class="noscript">
<p>
<strong>It looks like you're using Internet Explorer 6. This is a very old
browser which does not offer full support for modern websites.</strong>
</p>
<p>
Unfortunately this means that this website will not work on
your computer.
</p>
<p>
Don't miss out though! To view the site (and get a better experience from
many other websites), simply upgrade to
<a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx">Internet
Explorer 8</a>
or download an alternative browser such as
<a href="http://www.mozilla.com/en-US/firefox/firefox.html">Firefox</a>,
<a href="http://www.apple.com/safari/download/">Safari</a>, or
<a href="http://www.google.co.uk/chrome">Google Chrome</a>.
</p>
<p>
All of these browsers are free. If you're using a PC at work, you may
need to contact your IT administrator.
</p>
</div>
<![endif]-->
<noscript>
<div class="noscript">
<p>
<strong>Please note: Many features of this site require JavaScript. You appear to have JavaScript disabled,
or are running a non-JavaScript capable web browser.</strong>
</p>
<p>
To get the best experience, please enable JavaScript or download a modern web browser such as <a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx">Internet Explorer 8</a>, <a href="http://www.mozilla.com/en-US/firefox/firefox.html">Firefox</a>, <a href="http://www.apple.com/safari/download/">Safari</a>, or <a href="http://www.google.co.uk/chrome">Google Chrome</a>.
</p>
</div>
</noscript>
<div id="recent_pages" class="hud_container">
<div id="recent_pages_header" class="hud_header">
<div id="recent_pages_close" class="hud_close"><a href="#" onClick="recentPages.hide();return false;"></a></div>
<div id="recent_pages_title" class="hud_title"><span class="hud_span_top">Recently read</span></div>
<div id="recent_pages_topright" class="hud_topright"></div>
</div>
<div id="recent_pages_content" class="hud_content">
</div>
<div id="recent_pages_footer" class="hud_footer">
<div id="recent_pages_bottomleft" class="hud_bottomleft"></div>
<div id="recent_pages_bottom" class="hud_bottom"><span class="hud_span_bottom"></span></div>
<div id="recent_pages_resize" class="hud_resize"></div>
</div>
</div>
<div id="from_search"></div>
<h1>perlapi</h1>
<!-- -->
<ul><li><a href="#NAME">NAME</a><li><a href="#DESCRIPTION">DESCRIPTION
</a><li><a href="#%22Gimme%22-Values">"Gimme" Values</a><li><a href="#Array-Manipulation-Functions">Array Manipulation Functions</a><li><a href="#xsubpp-variables-and-internal-functions">xsubpp variables and internal functions</a><li><a href="#Callback-Functions">Callback Functions</a><li><a href="#Character-case-changing">Character case changing</a><li><a href="#Character-classification">Character classification</a><li><a href="#Cloning-an-interpreter">Cloning an interpreter</a><li><a href="#Compile-time-scope-hooks">Compile-time scope hooks</a><li><a href="#COP-Hint-Hashes">COP Hint Hashes</a><li><a href="#COP-Hint-Reading">COP Hint Reading</a><li><a href="#Custom-Operators">Custom Operators</a><li><a href="#CV-Manipulation-Functions">CV Manipulation Functions</a><li><a href="#Debugging-Utilities">Debugging Utilities</a><li><a href="#Display-and-Dump-functions">Display and Dump functions</a><li><a href="#Embedding-Functions">Embedding Functions</a><li><a href="#Exception-Handling-(simple)-Macros">Exception Handling (simple) Macros</a><li><a href="#Global-Variables">Global Variables</a><li><a href="#GV-Functions">GV Functions</a><li><a href="#Handy-Values">Handy Values</a><li><a href="#Hash-Manipulation-Functions">Hash Manipulation Functions</a><li><a href="#Hook-manipulation">Hook manipulation</a><li><a href="#Lexer-interface">Lexer interface</a><li><a href="#Locale-related-functions-and-macros">Locale-related functions and macros</a><li><a href="#Magical-Functions">Magical Functions</a><li><a href="#Memory-Management">Memory Management</a><li><a href="#Miscellaneous-Functions">Miscellaneous Functions</a><li><a href="#MRO-Functions">MRO Functions</a><li><a href="#Multicall-Functions">Multicall Functions</a><li><a href="#Numeric-functions">Numeric functions</a><li><a href="#Obsolete-backwards-compatibility-functions">Obsolete backwards compatibility functions</a><li><a href="#Optree-construction">Optree construction</a><li><a href="#Optree-Manipulation-Functions">Optree Manipulation Functions</a><li><a href="#Pack-and-Unpack">Pack and Unpack</a><li><a href="#Pad-Data-Structures">Pad Data Structures</a><li><a href="#Per-Interpreter-Variables">Per-Interpreter Variables</a><li><a href="#REGEXP-Functions">REGEXP Functions</a><li><a href="#Stack-Manipulation-Macros">Stack Manipulation Macros</a><li><a href="#SV-Flags">SV Flags</a><li><a href="#SV-Manipulation-Functions">SV Manipulation Functions</a><li><a href="#SV-Body-Allocation">SV-Body Allocation</a><li><a href="#Unicode-Support">Unicode Support</a><li><a href="#Variables-created-by-xsubpp-and-xsubpp-internal-functions">Variables created by xsubpp and xsubpp internal functions</a><li><a href="#Versioning">Versioning</a><li><a href="#Warning-and-Dieing">Warning and Dieing</a><li><a href="#Undocumented-functions">Undocumented functions</a><li><a href="#AUTHORS">AUTHORS</a><li><a href="#SEE-ALSO">SEE ALSO</a></ul><a name="NAME"></a><h1>NAME</h1>
<p>perlapi - autogenerated documentation for the perl public API</p>
<a name="DESCRIPTION"></a><h1>DESCRIPTION
</h1>
<p>This file contains the documentation of the perl public API generated by
<i>embed.pl</i>, specifically a listing of functions, macros, flags, and variables
that may be used by extension writers. <a href="#Undocumented-functions">At the end</a>
is a list of functions which have yet to be documented. The interfaces of
those are subject to change without notice. Anything not listed here is
not part of the public API, and should not be used by extension writers at
all. For these reasons, blindly using functions listed in proto.h is to be
avoided when writing extensions.</p>
<p>Note that all Perl API global variables must be referenced with the <code class="inline"><span class="w">PL_</span></code>
prefix. Again, those not listed here are not to be used by extension writers,
and can be changed or removed without notice; same with macros.
Some macros are provided for compatibility with the older,
unadorned names, but this support may be disabled in a future release.</p>
<p>Perl was originally written to handle US-ASCII only (that is characters
whose ordinal numbers are in the range 0 - 127).
And documentation and comments may still use the term ASCII, when
sometimes in fact the entire range from 0 - 255 is meant.</p>
<p>Note that Perl can be compiled and run under either ASCII or EBCDIC (See
<a href="perlebcdic.html">perlebcdic</a>). Most of the documentation (and even comments in the code)
ignore the EBCDIC possibility.
For almost all purposes the differences are transparent.
As an example, under EBCDIC,
instead of UTF-8, UTF-EBCDIC is used to encode Unicode strings, and so
whenever this documentation refers to <code class="inline"><span class="w">utf8</span></code>
(and variants of that name, including in function names),
it also (essentially transparently) means <code class="inline"><span class="w">UTF</span>-<span class="w">EBCDIC</span></code>
.
But the ordinals of characters differ between ASCII, EBCDIC, and
the UTF- encodings, and a string encoded in UTF-EBCDIC may occupy more bytes
than in UTF-8.</p>
<p>The listing below is alphabetical, case insensitive.</p>
<a name="%22Gimme%22-Values"></a><h1>"Gimme" Values</h1>
<ul>
<li><a name="GIMME"></a><b>GIMME
</b>
<p>A backward-compatible version of <code class="inline"><span class="w">GIMME_V</span></code>
which can only return
<code class="inline"><span class="w">G_SCALAR</span></code>
or <code class="inline"><span class="w">G_ARRAY</span></code>
; in a void context, it returns <code class="inline"><span class="w">G_SCALAR</span></code>
.
Deprecated. Use <code class="inline"><span class="w">GIMME_V</span></code>
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="w">GIMME</span></li></ol></pre></li>
<li><a name="GIMME_V"></a><b>GIMME_V
</b>
<p>The XSUB-writer's equivalent to Perl's <code class="inline"><a class="l_k" href="functions/wantarray.html">wantarray</a></code>. Returns <code class="inline"><span class="w">G_VOID</span></code>
,
<code class="inline"><span class="w">G_SCALAR</span></code>
or <code class="inline"><span class="w">G_ARRAY</span></code>
for void, scalar or list context,
respectively. See <a href="perlcall.html">perlcall</a> for a usage example.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="w">GIMME_V</span></li></ol></pre></li>
<li><a name="G_ARRAY"></a><b>G_ARRAY
</b>
<p>Used to indicate list context. See <code class="inline"><span class="w">GIMME_V</span></code>
, <code class="inline"><span class="w">GIMME</span></code>
and
<a href="perlcall.html">perlcall</a>.</p>
</li>
<li><a name="G_DISCARD"></a><b>G_DISCARD
</b>
<p>Indicates that arguments returned from a callback should be discarded. See
<a href="perlcall.html">perlcall</a>.</p>
</li>
<li><a name="G_EVAL"></a><b>G_EVAL
</b>
<p>Used to force a Perl <code class="inline"><a class="l_k" href="functions/eval.html">eval</a></code> wrapper around a callback. See
<a href="perlcall.html">perlcall</a>.</p>
</li>
<li><a name="G_NOARGS"></a><b>G_NOARGS
</b>
<p>Indicates that no arguments are being sent to a callback. See
<a href="perlcall.html">perlcall</a>.</p>
</li>
<li><a name="G_SCALAR"></a><b>G_SCALAR
</b>
<p>Used to indicate scalar context. See <code class="inline"><span class="w">GIMME_V</span></code>
, <code class="inline"><span class="w">GIMME</span></code>
, and
<a href="perlcall.html">perlcall</a>.</p>
</li>
<li><a name="G_VOID"></a><b>G_VOID
</b>
<p>Used to indicate void context. See <code class="inline"><span class="w">GIMME_V</span></code>
and <a href="perlcall.html">perlcall</a>.</p>
</li>
</ul>
<a name="Array-Manipulation-Functions"></a><h1>Array Manipulation Functions</h1>
<ul>
<li><a name="AvFILL"></a><b>AvFILL
</b>
<p>Same as <code class="inline"><span class="i">av_top_index</span><span class="s">(</span><span class="s">)</span></code>
. Deprecated, use <code class="inline"><span class="i">av_top_index</span><span class="s">(</span><span class="s">)</span></code>
instead.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">AvFILL</span><span class="s">(</span><span class="w">AV</span>* <span class="w">av</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_clear"></a><b>av_clear
</b>
<p>Clears an array, making it empty. Does not free the memory the av uses to
store its list of scalars. If any destructors are triggered as a result,
the av itself may be freed when this function returns.</p>
<p>Perl equivalent: <code class="inline"><span class="i">@myarray</span> = <span class="s">(</span><span class="s">)</span><span class="sc">;</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">av_clear</span><span class="s">(</span><span class="w">AV</span> *<span class="w">av</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_create_and_push"></a><b>av_create_and_push
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Push an SV onto the end of the array, creating the array if necessary.
A small internal helper function to remove a commonly duplicated idiom.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">av_create_and_push</span><span class="s">(</span><span class="w">AV</span> **<span class="w">const</span> <span class="w">avp</span><span class="cm">,</span></li><li> <span class="w">SV</span> *<span class="w">const</span> <span class="w">val</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_create_and_unshift_one"></a><b>av_create_and_unshift_one
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Unshifts an SV onto the beginning of the array, creating the array if
necessary.
A small internal helper function to remove a commonly duplicated idiom.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>** <span class="i">av_create_and_unshift_one</span><span class="s">(</span><span class="w">AV</span> **<span class="w">const</span> <span class="w">avp</span><span class="cm">,</span></li><li> <span class="w">SV</span> *<span class="w">const</span> <span class="w">val</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_delete"></a><b>av_delete
</b>
<p>Deletes the element indexed by <code class="inline"><span class="w">key</span></code>
from the array, makes the element mortal,
and returns it. If <code class="inline"><span class="w">flags</span></code>
equals <code class="inline"><span class="w">G_DISCARD</span></code>
, the element is freed and null
is returned. Perl equivalent: <code class="inline"><a class="l_k" href="functions/my.html">my</a> <span class="i">$elem</span> = <a class="l_k" href="functions/delete.html">delete</a><span class="s">(</span><span class="i">$myarray</span>[<span class="i">$idx</span>]<span class="s">)</span><span class="sc">;</span></code>
for the
non-<code class="inline"><span class="w">G_DISCARD</span></code>
version and a void-context <code class="inline"><a class="l_k" href="functions/delete.html">delete($myarray[$idx]);</a></code> for the
<code class="inline"><span class="w">G_DISCARD</span></code>
version.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">av_delete</span><span class="s">(</span><span class="w">AV</span> *<span class="w">av</span><span class="cm">,</span> <span class="w">SSize_t</span> <span class="w">key</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_exists"></a><b>av_exists
</b>
<p>Returns true if the element indexed by <code class="inline"><span class="w">key</span></code>
has been initialized.</p>
<p>This relies on the fact that uninitialized array elements are set to
NULL.</p>
<p>Perl equivalent: <code class="inline"><a class="l_k" href="functions/exists.html">exists($myarray[$key])</a></code>.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">av_exists</span><span class="s">(</span><span class="w">AV</span> *<span class="w">av</span><span class="cm">,</span> <span class="w">SSize_t</span> <span class="w">key</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_extend"></a><b>av_extend
</b>
<p>Pre-extend an array. The <code class="inline"><span class="w">key</span></code>
is the index to which the array should be
extended.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">av_extend</span><span class="s">(</span><span class="w">AV</span> *<span class="w">av</span><span class="cm">,</span> <span class="w">SSize_t</span> <span class="w">key</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_fetch"></a><b>av_fetch
</b>
<p>Returns the SV at the specified index in the array. The <code class="inline"><span class="w">key</span></code>
is the
index. If lval is true, you are guaranteed to get a real SV back (in case
it wasn't real before), which you can then modify. Check that the return
value is non-null before dereferencing it to a <code class="inline"><span class="w">SV</span>*</code>
.</p>
<p>See <a href="perlguts.html#Understanding-the-Magic-of-Tied-Hashes-and-Arrays">Understanding the Magic of Tied Hashes and Arrays in perlguts</a> for
more information on how to use this function on tied arrays.</p>
<p>The rough perl equivalent is <code class="inline"><span class="i">$myarray</span>[<span class="i">$idx</span>]</code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>** <span class="i">av_fetch</span><span class="s">(</span><span class="w">AV</span> *<span class="w">av</span><span class="cm">,</span> <span class="w">SSize_t</span> <span class="w">key</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">lval</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_fill"></a><b>av_fill
</b>
<p>Set the highest index in the array to the given number, equivalent to
Perl's <code class="inline"><span class="i">$#array</span> = <span class="i">$fill</span><span class="sc">;</span></code>
.</p>
<p>The number of elements in the array will be <code class="inline"><span class="w">fill</span> + <span class="n">1</span></code>
after
av_fill() returns. If the array was previously shorter, then the
additional elements appended are set to NULL. If the array
was longer, then the excess elements are freed. <code class="inline"><span class="i">av_fill</span><span class="s">(</span><span class="w">av</span><span class="cm">,</span> <span class="n">-1</span><span class="s">)</span></code>
is
the same as <code class="inline"><span class="i">av_clear</span><span class="s">(</span><span class="w">av</span><span class="s">)</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">av_fill</span><span class="s">(</span><span class="w">AV</span> *<span class="w">av</span><span class="cm">,</span> <span class="w">SSize_t</span> <span class="w">fill</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_len"></a><b>av_len
</b>
<p>Same as <a href="#av_top_index">av_top_index</a>. Note that, unlike what the name implies, it returns
the highest index in the array, so to get the size of the array you need to use
<code class="inline"><span class="i">av_len</span><span class="s">(</span><span class="w">av</span><span class="s">)</span> + <span class="n">1</span></code>
. This is unlike <a href="#sv_len">sv_len</a>, which returns what you would
expect.</p>
<pre class="verbatim"><ol><li> <span class="w">SSize_t</span> <span class="i">av_len</span><span class="s">(</span><span class="w">AV</span> *<span class="w">av</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_make"></a><b>av_make
</b>
<p>Creates a new AV and populates it with a list of SVs. The SVs are copied
into the array, so they may be freed after the call to av_make. The new AV
will have a reference count of 1.</p>
<p>Perl equivalent: <code class="inline"><a class="l_k" href="functions/my.html">my</a> <span class="i">@new_array</span> = <span class="s">(</span><span class="i">$scalar1</span><span class="cm">,</span> <span class="i">$scalar2</span><span class="cm">,</span> <span class="i">$scalar3</span>...<span class="s">)</span><span class="sc">;</span></code>
</p>
<pre class="verbatim"><ol><li> <span class="w">AV</span>* <span class="i">av_make</span><span class="s">(</span><span class="w">SSize_t</span> <span class="w">size</span><span class="cm">,</span> <span class="w">SV</span> **<span class="w">strp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_pop"></a><b>av_pop
</b>
<p>Removes one SV from the end of the array, reducing its size by one and
returning the SV (transferring control of one reference count) to the
caller. Returns <code class="inline"><span class="i">&PL_sv_undef</span></code>
if the array is empty.</p>
<p>Perl equivalent: <code class="inline"><a class="l_k" href="functions/pop.html">pop(@myarray);</a></code></p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">av_pop</span><span class="s">(</span><span class="w">AV</span> *<span class="w">av</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_push"></a><b>av_push
</b>
<p>Pushes an SV onto the end of the array. The array will grow automatically
to accommodate the addition. This takes ownership of one reference count.</p>
<p>Perl equivalent: <code class="inline"><a class="l_k" href="functions/push.html">push</a> <span class="i">@myarray</span><span class="cm">,</span> <span class="i">$elem</span><span class="sc">;</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">av_push</span><span class="s">(</span><span class="w">AV</span> *<span class="w">av</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">val</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_shift"></a><b>av_shift
</b>
<p>Removes one SV from the start of the array, reducing its size by one and
returning the SV (transferring control of one reference count) to the
caller. Returns <code class="inline"><span class="i">&PL_sv_undef</span></code>
if the array is empty.</p>
<p>Perl equivalent: <code class="inline"><a class="l_k" href="functions/shift.html">shift(@myarray);</a></code></p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">av_shift</span><span class="s">(</span><span class="w">AV</span> *<span class="w">av</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_store"></a><b>av_store
</b>
<p>Stores an SV in an array. The array index is specified as <code class="inline"><span class="w">key</span></code>
. The
return value will be NULL if the operation failed or if the value did not
need to be actually stored within the array (as in the case of tied
arrays). Otherwise, it can be dereferenced
to get the <code class="inline"><span class="w">SV</span>*</code>
that was stored
there (= <code class="inline"><span class="w">val</span></code>
)).</p>
<p>Note that the caller is responsible for suitably incrementing the reference
count of <code class="inline"><span class="w">val</span></code>
before the call, and decrementing it if the function
returned NULL.</p>
<p>Approximate Perl equivalent: <code class="inline"><span class="i">$myarray</span>[<span class="i">$key</span>] = <span class="i">$val</span><span class="sc">;</span></code>
.</p>
<p>See <a href="perlguts.html#Understanding-the-Magic-of-Tied-Hashes-and-Arrays">Understanding the Magic of Tied Hashes and Arrays in perlguts</a> for
more information on how to use this function on tied arrays.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>** <span class="i">av_store</span><span class="s">(</span><span class="w">AV</span> *<span class="w">av</span><span class="cm">,</span> <span class="w">SSize_t</span> <span class="w">key</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">val</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_tindex"></a><b>av_tindex
</b>
<p>Same as <code class="inline"><span class="i">av_top_index</span><span class="s">(</span><span class="s">)</span></code>
.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">av_tindex</span><span class="s">(</span><span class="w">AV</span>* <span class="w">av</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_top_index"></a><b>av_top_index
</b>
<p>Returns the highest index in the array. The number of elements in the
array is <code class="inline"><span class="i">av_top_index</span><span class="s">(</span><span class="w">av</span><span class="s">)</span> + <span class="n">1</span></code>
. Returns -1 if the array is empty.</p>
<p>The Perl equivalent for this is <code class="inline"><span class="i">$#myarray</span></code>
.</p>
<p>(A slightly shorter form is <code class="inline"><span class="w">av_tindex</span></code>
.)</p>
<pre class="verbatim"><ol><li> <span class="w">SSize_t</span> <span class="i">av_top_index</span><span class="s">(</span><span class="w">AV</span> *<span class="w">av</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_undef"></a><b>av_undef
</b>
<p>Undefines the array. Frees the memory used by the av to store its list of
scalars. If any destructors are triggered as a result, the av itself may
be freed.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">av_undef</span><span class="s">(</span><span class="w">AV</span> *<span class="w">av</span><span class="s">)</span></li></ol></pre></li>
<li><a name="av_unshift"></a><b>av_unshift
</b>
<p>Unshift the given number of <code class="inline"><a class="l_k" href="functions/undef.html">undef</a></code> values onto the beginning of the
array. The array will grow automatically to accommodate the addition. You
must then use <code class="inline"><span class="w">av_store</span></code>
to assign values to these new elements.</p>
<p>Perl equivalent: <code class="inline"><a class="l_k" href="functions/unshift.html">unshift</a> <span class="i">@myarray</span><span class="cm">,</span> <span class="s">(</span> <span class="s">(</span><a class="l_k" href="functions/undef.html">undef</a><span class="s">)</span> x <span class="i">$n</span> <span class="s">)</span><span class="sc">;</span></code>
</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">av_unshift</span><span class="s">(</span><span class="w">AV</span> *<span class="w">av</span><span class="cm">,</span> <span class="w">SSize_t</span> <span class="w">num</span><span class="s">)</span></li></ol></pre></li>
<li><a name="get_av"></a><b>get_av
</b>
<p>Returns the AV of the specified Perl global or package array with the given
name (so it won't work on lexical variables). <code class="inline"><span class="w">flags</span></code>
are passed
to <code class="inline"><span class="w">gv_fetchpv</span></code>
. If <code class="inline"><span class="w">GV_ADD</span></code>
is set and the
Perl variable does not exist then it will be created. If <code class="inline"><span class="w">flags</span></code>
is zero
and the variable does not exist then NULL is returned.</p>
<p>Perl equivalent: <code class="inline"><span class="i">@</span>{<span class="q">"$name"</span>}</code>
.</p>
<p>NOTE: the perl_ form of this function is deprecated.</p>
<pre class="verbatim"><ol><li> <span class="w">AV</span>* <span class="i">get_av</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">name</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newAV"></a><b>newAV
</b>
<p>Creates a new AV. The reference count is set to 1.</p>
<p>Perl equivalent: <code class="inline"><a class="l_k" href="functions/my.html">my</a> <span class="i">@array</span><span class="sc">;</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">AV</span>* <span class="i">newAV</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sortsv"></a><b>sortsv
</b>
<p>Sort an array. Here is an example:</p>
<pre class="verbatim"><ol><li> <span class="i">sortsv</span><span class="s">(</span><span class="i">AvARRAY</span><span class="s">(</span><span class="w">av</span><span class="s">)</span><span class="cm">,</span> <span class="i">av_top_index</span><span class="s">(</span><span class="w">av</span><span class="s">)</span>+<span class="n">1</span><span class="cm">,</span> <span class="w">Perl_sv_cmp_locale</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>Currently this always uses mergesort. See sortsv_flags for a more
flexible routine.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sortsv</span><span class="s">(</span><span class="w">SV</span>** <span class="w">array</span><span class="cm">,</span> <span class="w">size_t</span> <span class="w">num_elts</span><span class="cm">,</span></li><li> <span class="w">SVCOMPARE_t</span> <a class="l_k" href="functions/cmp.html">cmp</a><span class="s">)</span></li></ol></pre></li>
<li><a name="sortsv_flags"></a><b>sortsv_flags
</b>
<p>Sort an array, with various options.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sortsv_flags</span><span class="s">(</span><span class="w">SV</span>** <span class="w">array</span><span class="cm">,</span> <span class="w">size_t</span> <span class="w">num_elts</span><span class="cm">,</span></li><li> <span class="w">SVCOMPARE_t</span> <a class="l_k" href="functions/cmp.html">cmp</a><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="xsubpp-variables-and-internal-functions"></a><h1><code class="inline"><span class="w">xsubpp</span></code>
variables and internal functions</h1>
<ul>
<li><a name="ax"></a><b>ax
</b>
<p>Variable which is setup by <code class="inline"><span class="w">xsubpp</span></code>
to indicate the stack base offset,
used by the <code class="inline"><span class="w">ST</span></code>
, <code class="inline"><span class="w">XSprePUSH</span></code>
and <code class="inline"><span class="w">XSRETURN</span></code>
macros. The <code class="inline"><span class="w">dMARK</span></code>
macro
must be called prior to setup the <code class="inline"><span class="w">MARK</span></code>
variable.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="w">ax</span></li></ol></pre></li>
<li><a name="CLASS"></a><b>CLASS
</b>
<p>Variable which is setup by <code class="inline"><span class="w">xsubpp</span></code>
to indicate the
class name for a C++ XS constructor. This is always a <code class="inline"><span class="w">char</span>*</code>
. See <code class="inline"><span class="w">THIS</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="w">CLASS</span></li></ol></pre></li>
<li><a name="dAX"></a><b>dAX
</b>
<p>Sets up the <code class="inline"><span class="w">ax</span></code>
variable.
This is usually handled automatically by <code class="inline"><span class="w">xsubpp</span></code>
by calling <code class="inline"><span class="w">dXSARGS</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">dAX</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="dAXMARK"></a><b>dAXMARK
</b>
<p>Sets up the <code class="inline"><span class="w">ax</span></code>
variable and stack marker variable <code class="inline"><span class="w">mark</span></code>
.
This is usually handled automatically by <code class="inline"><span class="w">xsubpp</span></code>
by calling <code class="inline"><span class="w">dXSARGS</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">dAXMARK</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="dITEMS"></a><b>dITEMS
</b>
<p>Sets up the <code class="inline"><span class="w">items</span></code>
variable.
This is usually handled automatically by <code class="inline"><span class="w">xsubpp</span></code>
by calling <code class="inline"><span class="w">dXSARGS</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">dITEMS</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="dUNDERBAR"></a><b>dUNDERBAR
</b>
<p>Sets up any variable needed by the <code class="inline"><span class="w">UNDERBAR</span></code>
macro. It used to define
<code class="inline"><span class="w">padoff_du</span></code>
, but it is currently a noop. However, it is strongly advised
to still use it for ensuring past and future compatibility.</p>
<pre class="verbatim"><ol><li> <span class="w">dUNDERBAR</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="dXSARGS"></a><b>dXSARGS
</b>
<p>Sets up stack and mark pointers for an XSUB, calling dSP and dMARK.
Sets up the <code class="inline"><span class="w">ax</span></code>
and <code class="inline"><span class="w">items</span></code>
variables by calling <code class="inline"><span class="w">dAX</span></code>
and <code class="inline"><span class="w">dITEMS</span></code>
.
This is usually handled automatically by <code class="inline"><span class="w">xsubpp</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">dXSARGS</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="dXSI32"></a><b>dXSI32
</b>
<p>Sets up the <code class="inline"><span class="w">ix</span></code>
variable for an XSUB which has aliases. This is usually
handled automatically by <code class="inline"><span class="w">xsubpp</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">dXSI32</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="items"></a><b>items
</b>
<p>Variable which is setup by <code class="inline"><span class="w">xsubpp</span></code>
to indicate the number of
items on the stack. See <a href="perlxs.html#Variable-length-Parameter-Lists">Variable-length Parameter Lists in perlxs</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="w">items</span></li></ol></pre></li>
<li><a name="ix"></a><b>ix
</b>
<p>Variable which is setup by <code class="inline"><span class="w">xsubpp</span></code>
to indicate which of an
XSUB's aliases was used to invoke it. See <a href="perlxs.html#The-ALIAS%3a-Keyword">The ALIAS: Keyword in perlxs</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="w">ix</span></li></ol></pre></li>
<li><a name="RETVAL"></a><b>RETVAL
</b>
<p>Variable which is setup by <code class="inline"><span class="w">xsubpp</span></code>
to hold the return value for an
XSUB. This is always the proper type for the XSUB. See
<a href="perlxs.html#The-RETVAL-Variable">The RETVAL Variable in perlxs</a>.</p>
<pre class="verbatim"><ol><li> (whatever) RETVAL</li></ol></pre></li>
<li><a name="ST"></a><b>ST
</b>
<p>Used to access elements on the XSUB's stack.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">ST</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> <span class="w">ix</span><span class="s">)</span></li></ol></pre></li>
<li><a name="THIS"></a><b>THIS
</b>
<p>Variable which is setup by <code class="inline"><span class="w">xsubpp</span></code>
to designate the object in a C++
XSUB. This is always the proper type for the C++ object. See <code class="inline"><span class="w">CLASS</span></code>
and
<a href="perlxs.html#Using-XS-With-C%2b%2b">Using XS With C++ in perlxs</a>.</p>
<pre class="verbatim"><ol><li> (whatever) THIS</li></ol></pre></li>
<li><a name="UNDERBAR"></a><b>UNDERBAR
</b>
<p>The SV* corresponding to the $_ variable. Works even if there
is a lexical $_ in scope.</p>
</li>
<li><a name="XS"></a><b>XS
</b>
<p>Macro to declare an XSUB and its C parameter list. This is handled by
<code class="inline"><span class="w">xsubpp</span></code>
. It is the same as using the more explicit XS_EXTERNAL macro.</p>
</li>
<li><a name="XS_EXTERNAL"></a><b>XS_EXTERNAL
</b>
<p>Macro to declare an XSUB and its C parameter list explicitly exporting the symbols.</p>
</li>
<li><a name="XS_INTERNAL"></a><b>XS_INTERNAL
</b>
<p>Macro to declare an XSUB and its C parameter list without exporting the symbols.
This is handled by <code class="inline"><span class="w">xsubpp</span></code>
and generally preferable over exporting the XSUB
symbols unnecessarily.</p>
</li>
</ul>
<a name="Callback-Functions"></a><h1>Callback Functions</h1>
<ul>
<li><a name="call_argv"></a><b>call_argv
</b>
<p>Performs a callback to the specified named and package-scoped Perl subroutine
with <code class="inline"><span class="w">argv</span></code>
(a NULL-terminated array of strings) as arguments. See
<a href="perlcall.html">perlcall</a>.</p>
<p>Approximate Perl equivalent: <code class="inline"><span class="i">&</span>{<span class="q">"$sub_name"</span>}<span class="s">(</span><span class="i">@$argv</span><span class="s">)</span></code>
.</p>
<p>NOTE: the perl_ form of this function is deprecated.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">call_argv</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">sub_name</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span></li><li> <span class="w">char</span>** <span class="w">argv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="call_method"></a><b>call_method
</b>
<p>Performs a callback to the specified Perl method. The blessed object must
be on the stack. See <a href="perlcall.html">perlcall</a>.</p>
<p>NOTE: the perl_ form of this function is deprecated.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">call_method</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">methname</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="call_pv"></a><b>call_pv
</b>
<p>Performs a callback to the specified Perl sub. See <a href="perlcall.html">perlcall</a>.</p>
<p>NOTE: the perl_ form of this function is deprecated.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">call_pv</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">sub_name</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="call_sv"></a><b>call_sv
</b>
<p>Performs a callback to the Perl sub whose name is in the SV. See
<a href="perlcall.html">perlcall</a>.</p>
<p>NOTE: the perl_ form of this function is deprecated.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">call_sv</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">VOL</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="ENTER"></a><b>ENTER
</b>
<p>Opening bracket on a callback. See <code class="inline"><span class="w">LEAVE</span></code>
and <a href="perlcall.html">perlcall</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">ENTER</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="eval_pv"></a><b>eval_pv
</b>
<p>Tells Perl to <code class="inline"><a class="l_k" href="functions/eval.html">eval</a></code> the given string in scalar context and return an SV* result.</p>
<p>NOTE: the perl_ form of this function is deprecated.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">eval_pv</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">p</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">croak_on_error</span><span class="s">)</span></li></ol></pre></li>
<li><a name="eval_sv"></a><b>eval_sv
</b>
<p>Tells Perl to <code class="inline"><a class="l_k" href="functions/eval.html">eval</a></code> the string in the SV. It supports the same flags
as <code class="inline"><span class="w">call_sv</span></code>
, with the obvious exception of G_EVAL. See <a href="perlcall.html">perlcall</a>.</p>
<p>NOTE: the perl_ form of this function is deprecated.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">eval_sv</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="FREETMPS"></a><b>FREETMPS
</b>
<p>Closing bracket for temporaries on a callback. See <code class="inline"><span class="w">SAVETMPS</span></code>
and
<a href="perlcall.html">perlcall</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">FREETMPS</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="LEAVE"></a><b>LEAVE
</b>
<p>Closing bracket on a callback. See <code class="inline"><span class="w">ENTER</span></code>
and <a href="perlcall.html">perlcall</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">LEAVE</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="SAVETMPS"></a><b>SAVETMPS
</b>
<p>Opening bracket for temporaries on a callback. See <code class="inline"><span class="w">FREETMPS</span></code>
and
<a href="perlcall.html">perlcall</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">SAVETMPS</span><span class="sc">;</span></li></ol></pre></li>
</ul>
<a name="Character-case-changing"></a><h1>Character case changing</h1>
<ul>
<li><a name="toFOLD"></a><b>toFOLD
</b>
<p>Converts the specified character to foldcase. If the input is anything but an
ASCII uppercase character, that input character itself is returned. Variant
<code class="inline"><span class="w">toFOLD_A</span></code>
is equivalent. (There is no equivalent <code class="inline"><span class="w">to_FOLD_L1</span></code>
for the full
Latin1 range, as the full generality of <a href="#toFOLD_uni">toFOLD_uni</a> is needed there.)</p>
<pre class="verbatim"><ol><li> <span class="w">U8</span> <span class="i">toFOLD</span><span class="s">(</span><span class="w">U8</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="toFOLD_uni"></a><b>toFOLD_uni
</b>
<p>Converts the Unicode code point <code class="inline"><span class="w">cp</span></code>
to its foldcase version, and
stores that in UTF-8 in <code class="inline"><a class="l_k" href="functions/s.html">s</a></code>, and its length in bytes in <code class="inline"><span class="w">lenp</span></code>
. Note
that the buffer pointed to by <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> needs to be at least <code class="inline"><span class="w">UTF8_MAXBYTES_CASE</span>+<span class="n">1</span></code>
bytes since the foldcase version may be longer than the original character.</p>
<p>The first code point of the foldcased version is returned
(but note, as explained just above, that there may be more.)</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">toFOLD_uni</span><span class="s">(</span><span class="w">UV</span> <span class="w">cp</span><span class="cm">,</span> <span class="w">U8</span>* <span class="q">s, STRLEN* lenp)</span></li></ol></pre></li>
<li><a name="toFOLD_utf8"></a><b>toFOLD_utf8
</b>
<p>Converts the UTF-8 encoded character at <code class="inline"><span class="w">p</span></code>
to its foldcase version, and
stores that in UTF-8 in <code class="inline"><a class="l_k" href="functions/s.html">s</a></code>, and its length in bytes in <code class="inline"><span class="w">lenp</span></code>
. Note
that the buffer pointed to by <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> needs to be at least <code class="inline"><span class="w">UTF8_MAXBYTES_CASE</span>+<span class="n">1</span></code>
bytes since the foldcase version may be longer than the original character.</p>
<p>The first code point of the foldcased version is returned
(but note, as explained just above, that there may be more.)</p>
<p>The input character at <code class="inline"><span class="w">p</span></code>
is assumed to be well-formed.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">toFOLD_utf8</span><span class="s">(</span><span class="w">U8</span>* <span class="w">p</span><span class="cm">,</span> <span class="w">U8</span>* <span class="q">s, STRLEN* lenp)</span></li></ol></pre></li>
<li><a name="toLOWER"></a><b>toLOWER
</b>
<p>Converts the specified character to lowercase. If the input is anything but an
ASCII uppercase character, that input character itself is returned. Variant
<code class="inline"><span class="w">toLOWER_A</span></code>
is equivalent.</p>
<pre class="verbatim"><ol><li> <span class="w">U8</span> <span class="i">toLOWER</span><span class="s">(</span><span class="w">U8</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="toLOWER_L1"></a><b>toLOWER_L1
</b>
<p>Converts the specified Latin1 character to lowercase. The results are undefined if
the input doesn't fit in a byte.</p>
<pre class="verbatim"><ol><li> <span class="w">U8</span> <span class="i">toLOWER_L1</span><span class="s">(</span><span class="w">U8</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="toLOWER_LC"></a><b>toLOWER_LC
</b>
<p>Converts the specified character to lowercase using the current locale's rules,
if possible; otherwise returns the input character itself.</p>
<pre class="verbatim"><ol><li> <span class="w">U8</span> <span class="i">toLOWER_LC</span><span class="s">(</span><span class="w">U8</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="toLOWER_uni"></a><b>toLOWER_uni
</b>
<p>Converts the Unicode code point <code class="inline"><span class="w">cp</span></code>
to its lowercase version, and
stores that in UTF-8 in <code class="inline"><a class="l_k" href="functions/s.html">s</a></code>, and its length in bytes in <code class="inline"><span class="w">lenp</span></code>
. Note
that the buffer pointed to by <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> needs to be at least <code class="inline"><span class="w">UTF8_MAXBYTES_CASE</span>+<span class="n">1</span></code>
bytes since the lowercase version may be longer than the original character.</p>
<p>The first code point of the lowercased version is returned
(but note, as explained just above, that there may be more.)</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">toLOWER_uni</span><span class="s">(</span><span class="w">UV</span> <span class="w">cp</span><span class="cm">,</span> <span class="w">U8</span>* <span class="q">s, STRLEN* lenp)</span></li></ol></pre></li>
<li><a name="toLOWER_utf8"></a><b>toLOWER_utf8
</b>
<p>Converts the UTF-8 encoded character at <code class="inline"><span class="w">p</span></code>
to its lowercase version, and
stores that in UTF-8 in <code class="inline"><a class="l_k" href="functions/s.html">s</a></code>, and its length in bytes in <code class="inline"><span class="w">lenp</span></code>
. Note
that the buffer pointed to by <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> needs to be at least <code class="inline"><span class="w">UTF8_MAXBYTES_CASE</span>+<span class="n">1</span></code>
bytes since the lowercase version may be longer than the original character.</p>
<p>The first code point of the lowercased version is returned
(but note, as explained just above, that there may be more.)</p>
<p>The input character at <code class="inline"><span class="w">p</span></code>
is assumed to be well-formed.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">toLOWER_utf8</span><span class="s">(</span><span class="w">U8</span>* <span class="w">p</span><span class="cm">,</span> <span class="w">U8</span>* <span class="q">s, STRLEN* lenp)</span></li></ol></pre></li>
<li><a name="toTITLE"></a><b>toTITLE
</b>
<p>Converts the specified character to titlecase. If the input is anything but an
ASCII lowercase character, that input character itself is returned. Variant
<code class="inline"><span class="w">toTITLE_A</span></code>
is equivalent. (There is no <code class="inline"><span class="w">toTITLE_L1</span></code>
for the full Latin1 range,
as the full generality of <a href="#toTITLE_uni">toTITLE_uni</a> is needed there. Titlecase is not a
concept used in locale handling, so there is no functionality for that.)</p>
<pre class="verbatim"><ol><li> <span class="w">U8</span> <span class="i">toTITLE</span><span class="s">(</span><span class="w">U8</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="toTITLE_uni"></a><b>toTITLE_uni
</b>
<p>Converts the Unicode code point <code class="inline"><span class="w">cp</span></code>
to its titlecase version, and
stores that in UTF-8 in <code class="inline"><a class="l_k" href="functions/s.html">s</a></code>, and its length in bytes in <code class="inline"><span class="w">lenp</span></code>
. Note
that the buffer pointed to by <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> needs to be at least <code class="inline"><span class="w">UTF8_MAXBYTES_CASE</span>+<span class="n">1</span></code>
bytes since the titlecase version may be longer than the original character.</p>
<p>The first code point of the titlecased version is returned
(but note, as explained just above, that there may be more.)</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">toTITLE_uni</span><span class="s">(</span><span class="w">UV</span> <span class="w">cp</span><span class="cm">,</span> <span class="w">U8</span>* <span class="q">s, STRLEN* lenp)</span></li></ol></pre></li>
<li><a name="toTITLE_utf8"></a><b>toTITLE_utf8
</b>
<p>Converts the UTF-8 encoded character at <code class="inline"><span class="w">p</span></code>
to its titlecase version, and
stores that in UTF-8 in <code class="inline"><a class="l_k" href="functions/s.html">s</a></code>, and its length in bytes in <code class="inline"><span class="w">lenp</span></code>
. Note
that the buffer pointed to by <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> needs to be at least <code class="inline"><span class="w">UTF8_MAXBYTES_CASE</span>+<span class="n">1</span></code>
bytes since the titlecase version may be longer than the original character.</p>
<p>The first code point of the titlecased version is returned
(but note, as explained just above, that there may be more.)</p>
<p>The input character at <code class="inline"><span class="w">p</span></code>
is assumed to be well-formed.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">toTITLE_utf8</span><span class="s">(</span><span class="w">U8</span>* <span class="w">p</span><span class="cm">,</span> <span class="w">U8</span>* <span class="q">s, STRLEN* lenp)</span></li></ol></pre></li>
<li><a name="toUPPER"></a><b>toUPPER
</b>
<p>Converts the specified character to uppercase. If the input is anything but an
ASCII lowercase character, that input character itself is returned. Variant
<code class="inline"><span class="w">toUPPER_A</span></code>
is equivalent.</p>
<pre class="verbatim"><ol><li> <span class="w">U8</span> <span class="i">toUPPER</span><span class="s">(</span><span class="w">U8</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="toUPPER_uni"></a><b>toUPPER_uni
</b>
<p>Converts the Unicode code point <code class="inline"><span class="w">cp</span></code>
to its uppercase version, and
stores that in UTF-8 in <code class="inline"><a class="l_k" href="functions/s.html">s</a></code>, and its length in bytes in <code class="inline"><span class="w">lenp</span></code>
. Note
that the buffer pointed to by <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> needs to be at least <code class="inline"><span class="w">UTF8_MAXBYTES_CASE</span>+<span class="n">1</span></code>
bytes since the uppercase version may be longer than the original character.</p>
<p>The first code point of the uppercased version is returned
(but note, as explained just above, that there may be more.)</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">toUPPER_uni</span><span class="s">(</span><span class="w">UV</span> <span class="w">cp</span><span class="cm">,</span> <span class="w">U8</span>* <span class="q">s, STRLEN* lenp)</span></li></ol></pre></li>
<li><a name="toUPPER_utf8"></a><b>toUPPER_utf8
</b>
<p>Converts the UTF-8 encoded character at <code class="inline"><span class="w">p</span></code>
to its uppercase version, and
stores that in UTF-8 in <code class="inline"><a class="l_k" href="functions/s.html">s</a></code>, and its length in bytes in <code class="inline"><span class="w">lenp</span></code>
. Note
that the buffer pointed to by <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> needs to be at least <code class="inline"><span class="w">UTF8_MAXBYTES_CASE</span>+<span class="n">1</span></code>
bytes since the uppercase version may be longer than the original character.</p>
<p>The first code point of the uppercased version is returned
(but note, as explained just above, that there may be more.)</p>
<p>The input character at <code class="inline"><span class="w">p</span></code>
is assumed to be well-formed.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">toUPPER_utf8</span><span class="s">(</span><span class="w">U8</span>* <span class="w">p</span><span class="cm">,</span> <span class="w">U8</span>* <span class="q">s, STRLEN* lenp)</span></li></ol></pre></li>
</ul>
<a name="Character-classification"></a><h1>Character classification</h1>
<p>This section is about functions (really macros) that classify characters
into types, such as punctuation versus alphabetic, etc. Most of these are
analogous to regular expression character classes. (See
<a href="perlrecharclass.html#POSIX-Character-Classes">POSIX Character Classes in perlrecharclass</a>.) There are several variants for
each class. (Not all macros have all variants; each item below lists the
ones valid for it.) None are affected by <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">bytes</span></code>
, and only the ones
with <code class="inline"><span class="w">LC</span></code>
in the name are affected by the current locale.</p>
<p>The base function, e.g., <code class="inline"><span class="i">isALPHA</span><span class="s">(</span><span class="s">)</span></code>
, takes an octet (either a <code class="inline"><span class="w">char</span></code>
or a
<code class="inline"><span class="w">U8</span></code>
) as input and returns a boolean as to whether or not the character
represented by that octet is (or on non-ASCII platforms, corresponds to) an
ASCII character in the named class based on platform, Unicode, and Perl rules.
If the input is a number that doesn't fit in an octet, FALSE is returned.</p>
<p>Variant <code class="inline"><span class="w">isFOO_A</span></code>
(e.g., <code class="inline"><span class="i">isALPHA_A</span><span class="s">(</span><span class="s">)</span></code>
) is identical to the base function
with no suffix <code class="inline"><span class="q">"_A"</span></code>
.</p>
<p>Variant <code class="inline"><span class="w">isFOO_L1</span></code>
imposes the Latin-1 (or EBCDIC equivlalent) character set
onto the platform. That is, the code points that are ASCII are unaffected,
since ASCII is a subset of Latin-1. But the non-ASCII code points are treated
as if they are Latin-1 characters. For example, <code class="inline"><span class="i">isWORDCHAR_L1</span><span class="s">(</span><span class="s">)</span></code>
will return
true when called with the code point 0xDF, which is a word character in both
ASCII and EBCDIC (though it represents different characters in each).</p>
<p>Variant <code class="inline"><span class="w">isFOO_uni</span></code>
is like the <code class="inline"><span class="w">isFOO_L1</span></code>
variant, but accepts any UV code
point as input. If the code point is larger than 255, Unicode rules are used
to determine if it is in the character class. For example,
<code class="inline"><span class="i">isWORDCHAR_uni</span><span class="s">(</span><span class="n">0x100</span><span class="s">)</span></code>
returns TRUE, since 0x100 is LATIN CAPITAL LETTER A
WITH MACRON in Unicode, and is a word character.</p>
<p>Variant <code class="inline"><span class="w">isFOO_utf8</span></code>
is like <code class="inline"><span class="w">isFOO_uni</span></code>
, but the input is a pointer to a
(known to be well-formed) UTF-8 encoded string (<code class="inline"><span class="w">U8</span>*</code>
or <code class="inline"><span class="w">char</span>*</code>
). The
classification of just the first (possibly multi-byte) character in the string
is tested.</p>
<p>Variant <code class="inline"><span class="w">isFOO_LC</span></code>
is like the <code class="inline"><span class="w">isFOO_A</span></code>
and <code class="inline"><span class="w">isFOO_L1</span></code>
variants, but the
result is based on the current locale, which is what <code class="inline"><span class="w">LC</span></code>
in the name stands
for. If Perl can determine that the current locale is a UTF-8 locale, it uses
the published Unicode rules; otherwise, it uses the C library function that
gives the named classification. For example, <code class="inline"><span class="i">isDIGIT_LC</span><span class="s">(</span><span class="s">)</span></code>
when not in a
UTF-8 locale returns the result of calling <code class="inline"><span class="i">isdigit</span><span class="s">(</span><span class="s">)</span></code>
. FALSE is always
returned if the input won't fit into an octet. On some platforms where the C
library function is known to be defective, Perl changes its result to follow
the POSIX standard's rules.</p>
<p>Variant <code class="inline"><span class="w">isFOO_LC_uvchr</span></code>
is like <code class="inline"><span class="w">isFOO_LC</span></code>
, but is defined on any UV. It
returns the same as <code class="inline"><span class="w">isFOO_LC</span></code>
for input code points less than 256, and
returns the hard-coded, not-affected-by-locale, Unicode results for larger ones.</p>
<p>Variant <code class="inline"><span class="w">isFOO_LC_utf8</span></code>
is like <code class="inline"><span class="w">isFOO_LC_uvchr</span></code>
, but the input is a pointer to a
(known to be well-formed) UTF-8 encoded string (<code class="inline"><span class="w">U8</span>*</code>
or <code class="inline"><span class="w">char</span>*</code>
). The
classification of just the first (possibly multi-byte) character in the string
is tested.</p>
<ul>
<li><a name="isALPHA"></a><b>isALPHA
</b>
<p>Returns a boolean indicating whether the specified character is an
alphabetic character, analogous to <code class="inline"><a class="l_k" href="functions/m.html">m/[[:alpha:]]/</a></code>.
See the <a href="#Character-classification">top of this section</a> for an explanation of
variants
<code class="inline"><span class="w">isALPHA_A</span></code>
, <code class="inline"><span class="w">isALPHA_L1</span></code>
, <code class="inline"><span class="w">isALPHA_uni</span></code>
, <code class="inline"><span class="w">isALPHA_utf8</span></code>
, <code class="inline"><span class="w">isALPHA_LC</span></code>
,
<code class="inline"><span class="w">isALPHA_LC_uvchr</span></code>
, and <code class="inline"><span class="w">isALPHA_LC_utf8</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isALPHA</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isALPHANUMERIC"></a><b>isALPHANUMERIC
</b>
<p>Returns a boolean indicating whether the specified character is a either an
alphabetic character or decimal digit, analogous to <code class="inline"><a class="l_k" href="functions/m.html">m/[[:alnum:]]/</a></code>.
See the <a href="#Character-classification">top of this section</a> for an explanation of
variants
<code class="inline"><span class="w">isALPHANUMERIC_A</span></code>
, <code class="inline"><span class="w">isALPHANUMERIC_L1</span></code>
, <code class="inline"><span class="w">isALPHANUMERIC_uni</span></code>
,
<code class="inline"><span class="w">isALPHANUMERIC_utf8</span></code>
, <code class="inline"><span class="w">isALPHANUMERIC_LC</span></code>
, <code class="inline"><span class="w">isALPHANUMERIC_LC_uvchr</span></code>
, and
<code class="inline"><span class="w">isALPHANUMERIC_LC_utf8</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isALPHANUMERIC</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isASCII"></a><b>isASCII
</b>
<p>Returns a boolean indicating whether the specified character is one of the 128
characters in the ASCII character set, analogous to <code class="inline"><a class="l_k" href="functions/m.html">m/[[:ascii:]]/</a></code>.
On non-ASCII platforms, it returns TRUE iff this
character corresponds to an ASCII character. Variants <code class="inline"><span class="i">isASCII_A</span><span class="s">(</span><span class="s">)</span></code>
and
<code class="inline"><span class="i">isASCII_L1</span><span class="s">(</span><span class="s">)</span></code>
are identical to <code class="inline"><span class="i">isASCII</span><span class="s">(</span><span class="s">)</span></code>
.
See the <a href="#Character-classification">top of this section</a> for an explanation of
variants
<code class="inline"><span class="w">isASCII_uni</span></code>
, <code class="inline"><span class="w">isASCII_utf8</span></code>
, <code class="inline"><span class="w">isASCII_LC</span></code>
, <code class="inline"><span class="w">isASCII_LC_uvchr</span></code>
, and
<code class="inline"><span class="w">isASCII_LC_utf8</span></code>
. Note, however, that some platforms do not have the C
library routine <code class="inline"><span class="i">isascii</span><span class="s">(</span><span class="s">)</span></code>
. In these cases, the variants whose names contain
<code class="inline"><span class="w">LC</span></code>
are the same as the corresponding ones without.</p>
<p>Also note, that because all ASCII characters are UTF-8 invariant (meaning they
have the exact same representation (always a single byte) whether encoded in
UTF-8 or not), <code class="inline"><span class="w">isASCII</span></code>
will give the correct results when called with any
byte in any string encoded or not in UTF-8. And similarly <code class="inline"><span class="w">isASCII_utf8</span></code>
will
work properly on any string encoded or not in UTF-8.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isASCII</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isBLANK"></a><b>isBLANK
</b>
<p>Returns a boolean indicating whether the specified character is a
character considered to be a blank, analogous to <code class="inline"><a class="l_k" href="functions/m.html">m/[[:blank:]]/</a></code>.
See the <a href="#Character-classification">top of this section</a> for an explanation of
variants
<code class="inline"><span class="w">isBLANK_A</span></code>
, <code class="inline"><span class="w">isBLANK_L1</span></code>
, <code class="inline"><span class="w">isBLANK_uni</span></code>
, <code class="inline"><span class="w">isBLANK_utf8</span></code>
, <code class="inline"><span class="w">isBLANK_LC</span></code>
,
<code class="inline"><span class="w">isBLANK_LC_uvchr</span></code>
, and <code class="inline"><span class="w">isBLANK_LC_utf8</span></code>
. Note, however, that some
platforms do not have the C library routine <code class="inline"><span class="i">isblank</span><span class="s">(</span><span class="s">)</span></code>
. In these cases, the
variants whose names contain <code class="inline"><span class="w">LC</span></code>
are the same as the corresponding ones
without.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isBLANK</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isCNTRL"></a><b>isCNTRL
</b>
<p>Returns a boolean indicating whether the specified character is a
control character, analogous to <code class="inline"><a class="l_k" href="functions/m.html">m/[[:cntrl:]]/</a></code>.
See the <a href="#Character-classification">top of this section</a> for an explanation of
variants
<code class="inline"><span class="w">isCNTRL_A</span></code>
, <code class="inline"><span class="w">isCNTRL_L1</span></code>
, <code class="inline"><span class="w">isCNTRL_uni</span></code>
, <code class="inline"><span class="w">isCNTRL_utf8</span></code>
, <code class="inline"><span class="w">isCNTRL_LC</span></code>
,
<code class="inline"><span class="w">isCNTRL_LC_uvchr</span></code>
, and <code class="inline"><span class="w">isCNTRL_LC_utf8</span></code>
On EBCDIC platforms, you almost always want to use the <code class="inline"><span class="w">isCNTRL_L1</span></code>
variant.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isCNTRL</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isDIGIT"></a><b>isDIGIT
</b>
<p>Returns a boolean indicating whether the specified character is a
digit, analogous to <code class="inline"><a class="l_k" href="functions/m.html">m/[[:digit:]]/</a></code>.
Variants <code class="inline"><span class="w">isDIGIT_A</span></code>
and <code class="inline"><span class="w">isDIGIT_L1</span></code>
are identical to <code class="inline"><span class="w">isDIGIT</span></code>
.
See the <a href="#Character-classification">top of this section</a> for an explanation of
variants
<code class="inline"><span class="w">isDIGIT_uni</span></code>
, <code class="inline"><span class="w">isDIGIT_utf8</span></code>
, <code class="inline"><span class="w">isDIGIT_LC</span></code>
, <code class="inline"><span class="w">isDIGIT_LC_uvchr</span></code>
, and
<code class="inline"><span class="w">isDIGIT_LC_utf8</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isDIGIT</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isGRAPH"></a><b>isGRAPH
</b>
<p>Returns a boolean indicating whether the specified character is a
graphic character, analogous to <code class="inline"><a class="l_k" href="functions/m.html">m/[[:graph:]]/</a></code>.
See the <a href="#Character-classification">top of this section</a> for an explanation of
variants
<code class="inline"><span class="w">isGRAPH_A</span></code>
, <code class="inline"><span class="w">isGRAPH_L1</span></code>
, <code class="inline"><span class="w">isGRAPH_uni</span></code>
, <code class="inline"><span class="w">isGRAPH_utf8</span></code>
, <code class="inline"><span class="w">isGRAPH_LC</span></code>
,
<code class="inline"><span class="w">isGRAPH_LC_uvchr</span></code>
, and <code class="inline"><span class="w">isGRAPH_LC_utf8</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isGRAPH</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isIDCONT"></a><b>isIDCONT
</b>
<p>Returns a boolean indicating whether the specified character can be the
second or succeeding character of an identifier. This is very close to, but
not quite the same as the official Unicode property <code class="inline"><span class="w">XID_Continue</span></code>
. The
difference is that this returns true only if the input character also matches
<a href="#isWORDCHAR">isWORDCHAR</a>. See the <a href="#Character-classification">top of this section</a> for
an
explanation of variants <code class="inline"><span class="w">isIDCONT_A</span></code>
, <code class="inline"><span class="w">isIDCONT_L1</span></code>
, <code class="inline"><span class="w">isIDCONT_uni</span></code>
,
<code class="inline"><span class="w">isIDCONT_utf8</span></code>
, <code class="inline"><span class="w">isIDCONT_LC</span></code>
, <code class="inline"><span class="w">isIDCONT_LC_uvchr</span></code>
, and
<code class="inline"><span class="w">isIDCONT_LC_utf8</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isIDCONT</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isIDFIRST"></a><b>isIDFIRST
</b>
<p>Returns a boolean indicating whether the specified character can be the first
character of an identifier. This is very close to, but not quite the same as
the official Unicode property <code class="inline"><span class="w">XID_Start</span></code>
. The difference is that this
returns true only if the input character also matches <a href="#isWORDCHAR">isWORDCHAR</a>.
See the <a href="#Character-classification">top of this section</a> for an explanation of
variants
<code class="inline"><span class="w">isIDFIRST_A</span></code>
, <code class="inline"><span class="w">isIDFIRST_L1</span></code>
, <code class="inline"><span class="w">isIDFIRST_uni</span></code>
, <code class="inline"><span class="w">isIDFIRST_utf8</span></code>
,
<code class="inline"><span class="w">isIDFIRST_LC</span></code>
, <code class="inline"><span class="w">isIDFIRST_LC_uvchr</span></code>
, and <code class="inline"><span class="w">isIDFIRST_LC_utf8</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isIDFIRST</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isLOWER"></a><b>isLOWER
</b>
<p>Returns a boolean indicating whether the specified character is a
lowercase character, analogous to <code class="inline"><a class="l_k" href="functions/m.html">m/[[:lower:]]/</a></code>.
See the <a href="#Character-classification">top of this section</a> for an explanation of
variants
<code class="inline"><span class="w">isLOWER_A</span></code>
, <code class="inline"><span class="w">isLOWER_L1</span></code>
, <code class="inline"><span class="w">isLOWER_uni</span></code>
, <code class="inline"><span class="w">isLOWER_utf8</span></code>
, <code class="inline"><span class="w">isLOWER_LC</span></code>
,
<code class="inline"><span class="w">isLOWER_LC_uvchr</span></code>
, and <code class="inline"><span class="w">isLOWER_LC_utf8</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isLOWER</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isOCTAL"></a><b>isOCTAL
</b>
<p>Returns a boolean indicating whether the specified character is an
octal digit, [0-7].
The only two variants are <code class="inline"><span class="w">isOCTAL_A</span></code>
and <code class="inline"><span class="w">isOCTAL_L1</span></code>
; each is identical to
<code class="inline"><span class="w">isOCTAL</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isOCTAL</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isPRINT"></a><b>isPRINT
</b>
<p>Returns a boolean indicating whether the specified character is a
printable character, analogous to <code class="inline"><a class="l_k" href="functions/m.html">m/[[:print:]]/</a></code>.
See the <a href="#Character-classification">top of this section</a> for an explanation of
variants
<code class="inline"><span class="w">isPRINT_A</span></code>
, <code class="inline"><span class="w">isPRINT_L1</span></code>
, <code class="inline"><span class="w">isPRINT_uni</span></code>
, <code class="inline"><span class="w">isPRINT_utf8</span></code>
, <code class="inline"><span class="w">isPRINT_LC</span></code>
,
<code class="inline"><span class="w">isPRINT_LC_uvchr</span></code>
, and <code class="inline"><span class="w">isPRINT_LC_utf8</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isPRINT</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isPSXSPC"></a><b>isPSXSPC
</b>
<p>(short for Posix Space)
Starting in 5.18, this is identical in all its forms to the
corresponding <code class="inline"><span class="i">isSPACE</span><span class="s">(</span><span class="s">)</span></code>
macros.
The locale forms of this macro are identical to their corresponding
<code class="inline"><span class="i">isSPACE</span><span class="s">(</span><span class="s">)</span></code>
forms in all Perl releases. In releases prior to 5.18, the
non-locale forms differ from their <code class="inline"><span class="i">isSPACE</span><span class="s">(</span><span class="s">)</span></code>
forms only in that the
<code class="inline"><span class="i">isSPACE</span><span class="s">(</span><span class="s">)</span></code>
forms don't match a Vertical Tab, and the <code class="inline"><span class="i">isPSXSPC</span><span class="s">(</span><span class="s">)</span></code>
forms do.
Otherwise they are identical. Thus this macro is analogous to what
<code class="inline"><a class="l_k" href="functions/m.html">m/[[:space:]]/</a></code> matches in a regular expression.
See the <a href="#Character-classification">top of this section</a> for an explanation of
variants
<code class="inline"><span class="w">isPSXSPC_A</span></code>
, <code class="inline"><span class="w">isPSXSPC_L1</span></code>
, <code class="inline"><span class="w">isPSXSPC_uni</span></code>
, <code class="inline"><span class="w">isPSXSPC_utf8</span></code>
, <code class="inline"><span class="w">isPSXSPC_LC</span></code>
,
<code class="inline"><span class="w">isPSXSPC_LC_uvchr</span></code>
, and <code class="inline"><span class="w">isPSXSPC_LC_utf8</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isPSXSPC</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isPUNCT"></a><b>isPUNCT
</b>
<p>Returns a boolean indicating whether the specified character is a
punctuation character, analogous to <code class="inline"><a class="l_k" href="functions/m.html">m/[[:punct:]]/</a></code>.
Note that the definition of what is punctuation isn't as
straightforward as one might desire. See <a href="perlrecharclass.html#POSIX-Character-Classes">POSIX Character Classes in perlrecharclass</a> for details.
See the <a href="#Character-classification">top of this section</a> for an explanation of
variants
<code class="inline"><span class="w">isPUNCT_A</span></code>
, <code class="inline"><span class="w">isPUNCT_L1</span></code>
, <code class="inline"><span class="w">isPUNCT_uni</span></code>
, <code class="inline"><span class="w">isPUNCT_utf8</span></code>
, <code class="inline"><span class="w">isPUNCT_LC</span></code>
,
<code class="inline"><span class="w">isPUNCT_LC_uvchr</span></code>
, and <code class="inline"><span class="w">isPUNCT_LC_utf8</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isPUNCT</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isSPACE"></a><b>isSPACE
</b>
<p>Returns a boolean indicating whether the specified character is a
whitespace character. This is analogous
to what <code class="inline"><a class="l_k" href="functions/m.html">m/\s/</a></code> matches in a regular expression. Starting in Perl 5.18
this also matches what <code class="inline"><a class="l_k" href="functions/m.html">m/[[:space:]]/</a></code> does. Prior to 5.18, only the
locale forms of this macro (the ones with <code class="inline"><span class="w">LC</span></code>
in their names) matched
precisely what <code class="inline"><a class="l_k" href="functions/m.html">m/[[:space:]]/</a></code> does. In those releases, the only difference,
in the non-locale variants, was that <code class="inline"><span class="i">isSPACE</span><span class="s">(</span><span class="s">)</span></code>
did not match a vertical tab.
(See <a href="#isPSXSPC">isPSXSPC</a> for a macro that matches a vertical tab in all releases.)
See the <a href="#Character-classification">top of this section</a> for an explanation of
variants
<code class="inline"><span class="w">isSPACE_A</span></code>
, <code class="inline"><span class="w">isSPACE_L1</span></code>
, <code class="inline"><span class="w">isSPACE_uni</span></code>
, <code class="inline"><span class="w">isSPACE_utf8</span></code>
, <code class="inline"><span class="w">isSPACE_LC</span></code>
,
<code class="inline"><span class="w">isSPACE_LC_uvchr</span></code>
, and <code class="inline"><span class="w">isSPACE_LC_utf8</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isSPACE</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isUPPER"></a><b>isUPPER
</b>
<p>Returns a boolean indicating whether the specified character is an
uppercase character, analogous to <code class="inline"><a class="l_k" href="functions/m.html">m/[[:upper:]]/</a></code>.
See the <a href="#Character-classification">top of this section</a> for an explanation of
variants
<code class="inline"><span class="w">isUPPER_A</span></code>
, <code class="inline"><span class="w">isUPPER_L1</span></code>
, <code class="inline"><span class="w">isUPPER_uni</span></code>
, <code class="inline"><span class="w">isUPPER_utf8</span></code>
, <code class="inline"><span class="w">isUPPER_LC</span></code>
,
<code class="inline"><span class="w">isUPPER_LC_uvchr</span></code>
, and <code class="inline"><span class="w">isUPPER_LC_utf8</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isUPPER</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isWORDCHAR"></a><b>isWORDCHAR
</b>
<p>Returns a boolean indicating whether the specified character is a character
that is a word character, analogous to what <code class="inline"><a class="l_k" href="functions/m.html">m/\w/</a></code> and <code class="inline"><a class="l_k" href="functions/m.html">m/[[:word:]]/</a></code> match
in a regular expression. A word character is an alphabetic character, a
decimal digit, a connecting punctuation character (such as an underscore), or
a "mark" character that attaches to one of those (like some sort of accent).
<code class="inline"><span class="i">isALNUM</span><span class="s">(</span><span class="s">)</span></code>
is a synonym provided for backward compatibility, even though a
word character includes more than the standard C language meaning of
alphanumeric.
See the <a href="#Character-classification">top of this section</a> for an explanation of
variants
<code class="inline"><span class="w">isWORDCHAR_A</span></code>
, <code class="inline"><span class="w">isWORDCHAR_L1</span></code>
, <code class="inline"><span class="w">isWORDCHAR_uni</span></code>
, and <code class="inline"><span class="w">isWORDCHAR_utf8</span></code>
.
<code class="inline"><span class="w">isWORDCHAR_LC</span></code>
, <code class="inline"><span class="w">isWORDCHAR_LC_uvchr</span></code>
, and <code class="inline"><span class="w">isWORDCHAR_LC_utf8</span></code>
are also as
described there, but additionally include the platform's native underscore.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isWORDCHAR</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isXDIGIT"></a><b>isXDIGIT
</b>
<p>Returns a boolean indicating whether the specified character is a hexadecimal
digit. In the ASCII range these are <code class="inline"><span class="s">[</span><span class="n">0</span>-<span class="n">9</span><span class="w">A</span>-<span class="w">Fa</span>-f<span class="s">]</span></code>
. Variants <code class="inline"><span class="i">isXDIGIT_A</span><span class="s">(</span><span class="s">)</span></code>
and <code class="inline"><span class="i">isXDIGIT_L1</span><span class="s">(</span><span class="s">)</span></code>
are identical to <code class="inline"><span class="i">isXDIGIT</span><span class="s">(</span><span class="s">)</span></code>
.
See the <a href="#Character-classification">top of this section</a> for an explanation of
variants
<code class="inline"><span class="w">isXDIGIT_uni</span></code>
, <code class="inline"><span class="w">isXDIGIT_utf8</span></code>
, <code class="inline"><span class="w">isXDIGIT_LC</span></code>
, <code class="inline"><span class="w">isXDIGIT_LC_uvchr</span></code>
, and
<code class="inline"><span class="w">isXDIGIT_LC_utf8</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isXDIGIT</span><span class="s">(</span><span class="w">char</span> <span class="w">ch</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Cloning-an-interpreter"></a><h1>Cloning an interpreter</h1>
<ul>
<li><a name="perl_clone"></a><b>perl_clone
</b>
<p>Create and return a new interpreter by cloning the current one.</p>
<p>perl_clone takes these flags as parameters:</p>
<p>CLONEf_COPY_STACKS - is used to, well, copy the stacks also,
without it we only clone the data and zero the stacks,
with it we copy the stacks and the new perl interpreter is
ready to run at the exact same point as the previous one.
The pseudo-fork code uses COPY_STACKS while the
threads->create doesn't.</p>
<p>CLONEf_KEEP_PTR_TABLE -
perl_clone keeps a ptr_table with the pointer of the old
variable as a key and the new variable as a value,
this allows it to check if something has been cloned and not
clone it again but rather just use the value and increase the
refcount. If KEEP_PTR_TABLE is not set then perl_clone will kill
the ptr_table using the function
<code class="inline"><span class="i">ptr_table_free</span><span class="s">(</span><span class="w">PL_ptr_table</span><span class="s">)</span><span class="sc">;</span> <span class="w">PL_ptr_table</span> = <span class="w">NULL</span><span class="sc">;</span></code>
,
reason to keep it around is if you want to dup some of your own
variable who are outside the graph perl scans, example of this
code is in threads.xs create.</p>
<p>CLONEf_CLONE_HOST -
This is a win32 thing, it is ignored on unix, it tells perls
win32host code (which is c++) to clone itself, this is needed on
win32 if you want to run two threads at the same time,
if you just want to do some stuff in a separate perl interpreter
and then throw it away and return to the original one,
you don't need to do anything.</p>
<pre class="verbatim"><ol><li> <span class="w">PerlInterpreter</span>* <span class="i">perl_clone</span><span class="s">(</span></li><li> <span class="w">PerlInterpreter</span> *<span class="w">proto_perl</span><span class="cm">,</span></li><li> <span class="w">UV</span> <span class="w">flags</span></li><li> <span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Compile-time-scope-hooks"></a><h1>Compile-time scope hooks</h1>
<ul>
<li><a name="BhkDISABLE"></a><b>BhkDISABLE
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Temporarily disable an entry in this BHK structure, by clearing the
appropriate flag. <i>which</i> is a preprocessor token indicating which
entry to disable.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">BhkDISABLE</span><span class="s">(</span><span class="w">BHK</span> *<span class="w">hk</span><span class="cm">,</span> <span class="w">which</span><span class="s">)</span></li></ol></pre></li>
<li><a name="BhkENABLE"></a><b>BhkENABLE
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Re-enable an entry in this BHK structure, by setting the appropriate
flag. <i>which</i> is a preprocessor token indicating which entry to enable.
This will assert (under -DDEBUGGING) if the entry doesn't contain a valid
pointer.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">BhkENABLE</span><span class="s">(</span><span class="w">BHK</span> *<span class="w">hk</span><span class="cm">,</span> <span class="w">which</span><span class="s">)</span></li></ol></pre></li>
<li><a name="BhkENTRY_set"></a><b>BhkENTRY_set
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Set an entry in the BHK structure, and set the flags to indicate it is
valid. <i>which</i> is a preprocessing token indicating which entry to set.
The type of <i>ptr</i> depends on the entry.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">BhkENTRY_set</span><span class="s">(</span><span class="w">BHK</span> *<span class="w">hk</span><span class="cm">,</span> <span class="w">which</span><span class="cm">,</span> <span class="w">void</span> *<span class="w">ptr</span><span class="s">)</span></li></ol></pre></li>
<li><a name="blockhook_register"></a><b>blockhook_register
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Register a set of hooks to be called when the Perl lexical scope changes
at compile time. See <a href="perlguts.html#Compile-time-scope-hooks">Compile-time scope hooks in perlguts</a>.</p>
<p>NOTE: this function must be explicitly called as Perl_blockhook_register with an aTHX_ parameter.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">Perl_blockhook_register</span><span class="s">(</span><span class="w">pTHX_</span> <span class="w">BHK</span> *<span class="w">hk</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="COP-Hint-Hashes"></a><h1>COP Hint Hashes</h1>
<ul>
<li><a name="cophh_2hv"></a><b>cophh_2hv
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Generates and returns a standard Perl hash representing the full set of
key/value pairs in the cop hints hash <i>cophh</i>. <i>flags</i> is currently
unused and must be zero.</p>
<pre class="verbatim"><ol><li> <span class="w">HV</span> * <span class="i">cophh_2hv</span><span class="s">(</span><span class="w">const</span> <span class="w">COPHH</span> *<span class="w">cophh</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cophh_copy"></a><b>cophh_copy
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Make and return a complete copy of the cop hints hash <i>cophh</i>.</p>
<pre class="verbatim"><ol><li> <span class="w">COPHH</span> * <span class="i">cophh_copy</span><span class="s">(</span><span class="w">COPHH</span> *<span class="w">cophh</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cophh_delete_pv"></a><b>cophh_delete_pv
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Like <a href="#cophh_delete_pvn">cophh_delete_pvn</a>, but takes a nul-terminated string instead of
a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">COPHH</span> * <span class="i">cophh_delete_pv</span><span class="s">(</span><span class="w">const</span> <span class="w">COPHH</span> *<span class="w">cophh</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">key</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">hash</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cophh_delete_pvn"></a><b>cophh_delete_pvn
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Delete a key and its associated value from the cop hints hash <i>cophh</i>,
and returns the modified hash. The returned hash pointer is in general
not the same as the hash pointer that was passed in. The input hash is
consumed by the function, and the pointer to it must not be subsequently
used. Use <a href="#cophh_copy">cophh_copy</a> if you need both hashes.</p>
<p>The key is specified by <i>keypv</i> and <i>keylen</i>. If <i>flags</i> has the
<code class="inline"><span class="w">COPHH_KEY_UTF8</span></code>
bit set, the key octets are interpreted as UTF-8,
otherwise they are interpreted as Latin-1. <i>hash</i> is a precomputed
hash of the key string, or zero if it has not been precomputed.</p>
<pre class="verbatim"><ol><li> <span class="w">COPHH</span> * <span class="i">cophh_delete_pvn</span><span class="s">(</span><span class="w">COPHH</span> *<span class="w">cophh</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">keypv</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">keylen</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">hash</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cophh_delete_pvs"></a><b>cophh_delete_pvs
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Like <a href="#cophh_delete_pvn">cophh_delete_pvn</a>, but takes a literal string instead of a
string/length pair, and no precomputed hash.</p>
<pre class="verbatim"><ol><li> <span class="w">COPHH</span> * <span class="i">cophh_delete_pvs</span><span class="s">(</span><span class="w">const</span> <span class="w">COPHH</span> *<span class="w">cophh</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">key</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cophh_delete_sv"></a><b>cophh_delete_sv
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Like <a href="#cophh_delete_pvn">cophh_delete_pvn</a>, but takes a Perl scalar instead of a
string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">COPHH</span> * <span class="i">cophh_delete_sv</span><span class="s">(</span><span class="w">const</span> <span class="w">COPHH</span> *<span class="w">cophh</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">key</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">hash</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cophh_fetch_pv"></a><b>cophh_fetch_pv
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Like <a href="#cophh_fetch_pvn">cophh_fetch_pvn</a>, but takes a nul-terminated string instead of
a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">cophh_fetch_pv</span><span class="s">(</span><span class="w">const</span> <span class="w">COPHH</span> *<span class="w">cophh</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">key</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">hash</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cophh_fetch_pvn"></a><b>cophh_fetch_pvn
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Look up the entry in the cop hints hash <i>cophh</i> with the key specified by
<i>keypv</i> and <i>keylen</i>. If <i>flags</i> has the <code class="inline"><span class="w">COPHH_KEY_UTF8</span></code>
bit set,
the key octets are interpreted as UTF-8, otherwise they are interpreted
as Latin-1. <i>hash</i> is a precomputed hash of the key string, or zero if
it has not been precomputed. Returns a mortal scalar copy of the value
associated with the key, or <code class="inline"><span class="i">&PL_sv_placeholder</span></code>
if there is no value
associated with the key.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">cophh_fetch_pvn</span><span class="s">(</span><span class="w">const</span> <span class="w">COPHH</span> *<span class="w">cophh</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">keypv</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">keylen</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">hash</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cophh_fetch_pvs"></a><b>cophh_fetch_pvs
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Like <a href="#cophh_fetch_pvn">cophh_fetch_pvn</a>, but takes a literal string instead of a
string/length pair, and no precomputed hash.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">cophh_fetch_pvs</span><span class="s">(</span><span class="w">const</span> <span class="w">COPHH</span> *<span class="w">cophh</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">key</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cophh_fetch_sv"></a><b>cophh_fetch_sv
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Like <a href="#cophh_fetch_pvn">cophh_fetch_pvn</a>, but takes a Perl scalar instead of a
string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">cophh_fetch_sv</span><span class="s">(</span><span class="w">const</span> <span class="w">COPHH</span> *<span class="w">cophh</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">key</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">hash</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cophh_free"></a><b>cophh_free
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Discard the cop hints hash <i>cophh</i>, freeing all resources associated
with it.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">cophh_free</span><span class="s">(</span><span class="w">COPHH</span> *<span class="w">cophh</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cophh_new_empty"></a><b>cophh_new_empty
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Generate and return a fresh cop hints hash containing no entries.</p>
<pre class="verbatim"><ol><li> <span class="w">COPHH</span> * <span class="i">cophh_new_empty</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cophh_store_pv"></a><b>cophh_store_pv
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Like <a href="#cophh_store_pvn">cophh_store_pvn</a>, but takes a nul-terminated string instead of
a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">COPHH</span> * <span class="i">cophh_store_pv</span><span class="s">(</span><span class="w">const</span> <span class="w">COPHH</span> *<span class="w">cophh</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">key</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">hash</span><span class="cm">,</span></li><li> <span class="w">SV</span> *<span class="w">value</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cophh_store_pvn"></a><b>cophh_store_pvn
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Stores a value, associated with a key, in the cop hints hash <i>cophh</i>,
and returns the modified hash. The returned hash pointer is in general
not the same as the hash pointer that was passed in. The input hash is
consumed by the function, and the pointer to it must not be subsequently
used. Use <a href="#cophh_copy">cophh_copy</a> if you need both hashes.</p>
<p>The key is specified by <i>keypv</i> and <i>keylen</i>. If <i>flags</i> has the
<code class="inline"><span class="w">COPHH_KEY_UTF8</span></code>
bit set, the key octets are interpreted as UTF-8,
otherwise they are interpreted as Latin-1. <i>hash</i> is a precomputed
hash of the key string, or zero if it has not been precomputed.</p>
<p><i>value</i> is the scalar value to store for this key. <i>value</i> is copied
by this function, which thus does not take ownership of any reference
to it, and later changes to the scalar will not be reflected in the
value visible in the cop hints hash. Complex types of scalar will not
be stored with referential integrity, but will be coerced to strings.</p>
<pre class="verbatim"><ol><li> <span class="w">COPHH</span> * <span class="i">cophh_store_pvn</span><span class="s">(</span><span class="w">COPHH</span> *<span class="w">cophh</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">keypv</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">keylen</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">hash</span><span class="cm">,</span></li><li> <span class="w">SV</span> *<span class="w">value</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cophh_store_pvs"></a><b>cophh_store_pvs
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Like <a href="#cophh_store_pvn">cophh_store_pvn</a>, but takes a literal string instead of a
string/length pair, and no precomputed hash.</p>
<pre class="verbatim"><ol><li> <span class="w">COPHH</span> * <span class="i">cophh_store_pvs</span><span class="s">(</span><span class="w">const</span> <span class="w">COPHH</span> *<span class="w">cophh</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">key</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">value</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cophh_store_sv"></a><b>cophh_store_sv
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Like <a href="#cophh_store_pvn">cophh_store_pvn</a>, but takes a Perl scalar instead of a
string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">COPHH</span> * <span class="i">cophh_store_sv</span><span class="s">(</span><span class="w">const</span> <span class="w">COPHH</span> *<span class="w">cophh</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">key</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">hash</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">value</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="COP-Hint-Reading"></a><h1>COP Hint Reading</h1>
<ul>
<li><a name="cop_hints_2hv"></a><b>cop_hints_2hv
</b>
<p>Generates and returns a standard Perl hash representing the full set of
hint entries in the cop <i>cop</i>. <i>flags</i> is currently unused and must
be zero.</p>
<pre class="verbatim"><ol><li> <span class="w">HV</span> * <span class="i">cop_hints_2hv</span><span class="s">(</span><span class="w">const</span> <span class="w">COP</span> *<span class="w">cop</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cop_hints_fetch_pv"></a><b>cop_hints_fetch_pv
</b>
<p>Like <a href="#cop_hints_fetch_pvn">cop_hints_fetch_pvn</a>, but takes a nul-terminated string instead
of a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">cop_hints_fetch_pv</span><span class="s">(</span><span class="w">const</span> <span class="w">COP</span> *<span class="w">cop</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">key</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">hash</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cop_hints_fetch_pvn"></a><b>cop_hints_fetch_pvn
</b>
<p>Look up the hint entry in the cop <i>cop</i> with the key specified by
<i>keypv</i> and <i>keylen</i>. If <i>flags</i> has the <code class="inline"><span class="w">COPHH_KEY_UTF8</span></code>
bit set,
the key octets are interpreted as UTF-8, otherwise they are interpreted
as Latin-1. <i>hash</i> is a precomputed hash of the key string, or zero if
it has not been precomputed. Returns a mortal scalar copy of the value
associated with the key, or <code class="inline"><span class="i">&PL_sv_placeholder</span></code>
if there is no value
associated with the key.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">cop_hints_fetch_pvn</span><span class="s">(</span><span class="w">const</span> <span class="w">COP</span> *<span class="w">cop</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">keypv</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">keylen</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">hash</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cop_hints_fetch_pvs"></a><b>cop_hints_fetch_pvs
</b>
<p>Like <a href="#cop_hints_fetch_pvn">cop_hints_fetch_pvn</a>, but takes a literal string instead of a
string/length pair, and no precomputed hash.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">cop_hints_fetch_pvs</span><span class="s">(</span><span class="w">const</span> <span class="w">COP</span> *<span class="w">cop</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">key</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cop_hints_fetch_sv"></a><b>cop_hints_fetch_sv
</b>
<p>Like <a href="#cop_hints_fetch_pvn">cop_hints_fetch_pvn</a>, but takes a Perl scalar instead of a
string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">cop_hints_fetch_sv</span><span class="s">(</span><span class="w">const</span> <span class="w">COP</span> *<span class="w">cop</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">key</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">hash</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Custom-Operators"></a><h1>Custom Operators</h1>
<ul>
<li><a name="custom_op_register"></a><b>custom_op_register
</b>
<p>Register a custom op. See <a href="perlguts.html#Custom-Operators">Custom Operators in perlguts</a>.</p>
<p>NOTE: this function must be explicitly called as Perl_custom_op_register with an aTHX_ parameter.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">Perl_custom_op_register</span><span class="s">(</span><span class="w">pTHX_</span> </li><li> <span class="w">Perl_ppaddr_t</span> <span class="w">ppaddr</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">XOP</span> *<span class="w">xop</span><span class="s">)</span></li></ol></pre></li>
<li><a name="custom_op_xop"></a><b>custom_op_xop
</b>
<p>Return the XOP structure for a given custom op. This macro should be
considered internal to OP_NAME and the other access macros: use them instead.
This macro does call a function. Prior
to 5.19.6, this was implemented as a
function.</p>
<p>NOTE: this function must be explicitly called as Perl_custom_op_xop with an aTHX_ parameter.</p>
<pre class="verbatim"><ol><li> <span class="w">const</span> <span class="w">XOP</span> * <span class="i">Perl_custom_op_xop</span><span class="s">(</span><span class="w">pTHX_</span> <span class="w">const</span> <span class="w">OP</span> *<span class="w">o</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XopDISABLE"></a><b>XopDISABLE
</b>
<p>Temporarily disable a member of the XOP, by clearing the appropriate flag.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XopDISABLE</span><span class="s">(</span><span class="w">XOP</span> *<span class="w">xop</span><span class="cm">,</span> <span class="w">which</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XopENABLE"></a><b>XopENABLE
</b>
<p>Reenable a member of the XOP which has been disabled.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XopENABLE</span><span class="s">(</span><span class="w">XOP</span> *<span class="w">xop</span><span class="cm">,</span> <span class="w">which</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XopENTRY"></a><b>XopENTRY
</b>
<p>Return a member of the XOP structure. <i>which</i> is a cpp token
indicating which entry to return. If the member is not set
this will return a default value. The return type depends
on <i>which</i>. This macro evaluates its arguments more than
once. If you are using <code class="inline"><span class="w">Perl_custom_op_xop</span></code>
to retreive a
<code class="inline"><span class="w">XOP</span> *</code>
from a <code class="inline"><span class="w">OP</span> *</code>
, use the more efficient <a href="#XopENTRYCUSTOM">XopENTRYCUSTOM</a> instead.</p>
<pre class="verbatim"><ol><li> <span class="i">XopENTRY</span><span class="s">(</span><span class="w">XOP</span> *<span class="w">xop</span><span class="cm">,</span> <span class="w">which</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XopENTRYCUSTOM"></a><b>XopENTRYCUSTOM
</b>
<p>Exactly like <code class="inline"><span class="i">XopENTRY</span><span class="s">(</span><span class="i">XopENTRY</span><span class="s">(</span><span class="i">Perl_custom_op_xop</span><span class="s">(</span><span class="w">aTHX_</span> <span class="w">o</span><span class="s">)</span><span class="cm">,</span> <span class="w">which</span><span class="s">)</span></code>
but more
efficient. The <i>which</i> parameter is identical to <a href="#XopENTRY">XopENTRY</a>.</p>
<pre class="verbatim"><ol><li> <span class="i">XopENTRYCUSTOM</span><span class="s">(</span><span class="w">const</span> <span class="w">OP</span> *<span class="w">o</span><span class="cm">,</span> <span class="w">which</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XopENTRY_set"></a><b>XopENTRY_set
</b>
<p>Set a member of the XOP structure. <i>which</i> is a cpp token
indicating which entry to set. See <a href="perlguts.html#Custom-Operators">Custom Operators in perlguts</a>
for details about the available members and how
they are used. This macro evaluates its argument
more than once.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XopENTRY_set</span><span class="s">(</span><span class="w">XOP</span> *<span class="w">xop</span><span class="cm">,</span> <span class="w">which</span><span class="cm">,</span> <span class="w">value</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XopFLAGS"></a><b>XopFLAGS
</b>
<p>Return the XOP's flags.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">XopFLAGS</span><span class="s">(</span><span class="w">XOP</span> *<span class="w">xop</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="CV-Manipulation-Functions"></a><h1>CV Manipulation Functions</h1>
<p>This section documents functions to manipulate CVs which are code-values,
or subroutines. For more information, see <a href="perlguts.html">perlguts</a>.</p>
<ul>
<li><a name="caller_cx"></a><b>caller_cx
</b>
<p>The XSUB-writer's equivalent of <a href="functions/caller.html">caller</a>. The
returned <code class="inline"><span class="w">PERL_CONTEXT</span></code>
structure can be interrogated to find all the
information returned to Perl by <code class="inline"><a class="l_k" href="functions/caller.html">caller</a></code>. Note that XSUBs don't get a
stack frame, so <code class="inline"><span class="i">caller_cx</span><span class="s">(</span><span class="n">0</span><span class="cm">,</span> <span class="w">NULL</span><span class="s">)</span></code>
will return information for the
immediately-surrounding Perl code.</p>
<p>This function skips over the automatic calls to <code class="inline"><span class="i">&DB::sub</span></code>
made on the
behalf of the debugger. If the stack frame requested was a sub called by
<code class="inline"><span class="w">DB::sub</span></code>
, the return value will be the frame for the call to
<code class="inline"><span class="w">DB::sub</span></code>
, since that has the correct line number/etc. for the call
site. If <i>dbcxp</i> is non-<code class="inline"><span class="w">NULL</span></code>
, it will be set to a pointer to the
frame for the sub call itself.</p>
<pre class="verbatim"><ol><li> <span class="w">const</span> <span class="w">PERL_CONTEXT</span> * <span class="i">caller_cx</span><span class="s">(</span></li><li> <span class="w">I32</span> <span class="w">level</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">PERL_CONTEXT</span> **<span class="w">dbcxp</span></li><li> <span class="s">)</span></li></ol></pre></li>
<li><a name="CvSTASH"></a><b>CvSTASH
</b>
<p>Returns the stash of the CV. A stash is the symbol table hash, containing
the package-scoped variables in the package where the subroutine was defined.
For more information, see <a href="perlguts.html">perlguts</a>.</p>
<p>This also has a special use with XS AUTOLOAD subs.
See <a href="perlguts.html#Autoloading-with-XSUBs">Autoloading with XSUBs in perlguts</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">HV</span>* <span class="i">CvSTASH</span><span class="s">(</span><span class="w">CV</span>* <span class="w">cv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="find_runcv"></a><b>find_runcv
</b>
<p>Locate the CV corresponding to the currently executing sub or eval.
If db_seqp is non_null, skip CVs that are in the DB package and populate
*db_seqp with the cop sequence number at the point that the DB:: code was
entered. (This allows debuggers to eval in the scope of the breakpoint
rather than in the scope of the debugger itself.)</p>
<pre class="verbatim"><ol><li> <span class="w">CV</span>* <span class="i">find_runcv</span><span class="s">(</span><span class="w">U32</span> *<span class="w">db_seqp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="get_cv"></a><b>get_cv
</b>
<p>Uses <code class="inline"><span class="w">strlen</span></code>
to get the length of <code class="inline"><span class="w">name</span></code>
, then calls <code class="inline"><span class="w">get_cvn_flags</span></code>
.</p>
<p>NOTE: the perl_ form of this function is deprecated.</p>
<pre class="verbatim"><ol><li> <span class="w">CV</span>* <span class="i">get_cv</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="get_cvn_flags"></a><b>get_cvn_flags
</b>
<p>Returns the CV of the specified Perl subroutine. <code class="inline"><span class="w">flags</span></code>
are passed to
<code class="inline"><span class="w">gv_fetchpvn_flags</span></code>
. If <code class="inline"><span class="w">GV_ADD</span></code>
is set and the Perl subroutine does not
exist then it will be declared (which has the same effect as saying
<code class="inline">sub <span class="m">name</span><span class="sc">;</span></code>
). If <code class="inline"><span class="w">GV_ADD</span></code>
is not set and the subroutine does not exist
then NULL is returned.</p>
<p>NOTE: the perl_ form of this function is deprecated.</p>
<pre class="verbatim"><ol><li> <span class="w">CV</span>* <span class="i">get_cvn_flags</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span></li><li> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Debugging-Utilities"></a><h1>Debugging Utilities</h1>
<ul>
<li><a name="dump_all"></a><b>dump_all
</b>
<p>Dumps the entire optree of the current program starting at <code class="inline"><span class="w">PL_main_root</span></code>
to
<code class="inline"><span class="w">STDERR</span></code>
. Also dumps the optrees for all visible subroutines in
<code class="inline"><span class="w">PL_defstash</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">dump_all</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="dump_packsubs"></a><b>dump_packsubs
</b>
<p>Dumps the optrees for all visible subroutines in <code class="inline"><span class="w">stash</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">dump_packsubs</span><span class="s">(</span><span class="w">const</span> <span class="w">HV</span>* <span class="w">stash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="op_dump"></a><b>op_dump
</b>
<p>Dumps the optree starting at OP <code class="inline"><span class="w">o</span></code>
to <code class="inline"><span class="w">STDERR</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">op_dump</span><span class="s">(</span><span class="w">const</span> <span class="w">OP</span> *<span class="w">o</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_dump"></a><b>sv_dump
</b>
<p>Dumps the contents of an SV to the <code class="inline"><span class="w">STDERR</span></code>
filehandle.</p>
<p>For an example of its output, see <a href="Devel/Peek.html">Devel::Peek</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_dump</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Display-and-Dump-functions"></a><h1>Display and Dump functions</h1>
<ul>
<li><a name="pv_display"></a><b>pv_display
</b>
<p>Similar to</p>
<pre class="verbatim"><ol><li> <span class="i">pv_escape</span><span class="s">(</span><span class="w">dsv</span><span class="cm">,</span><span class="w">pv</span><span class="cm">,</span><span class="w">cur</span><span class="cm">,</span><span class="w">pvlim</span><span class="cm">,</span><span class="w">PERL_PV_ESCAPE_QUOTE</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>except that an additional "\0" will be appended to the string when
len > cur and pv[cur] is "\0".</p>
<p>Note that the final string may be up to 7 chars longer than pvlim.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">pv_display</span><span class="s">(</span><span class="w">SV</span> *<span class="w">dsv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">pv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">cur</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">pvlim</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pv_escape"></a><b>pv_escape
</b>
<p>Escapes at most the first "count" chars of pv and puts the results into
dsv such that the size of the escaped string will not exceed "max" chars
and will not contain any incomplete escape sequences. The number of bytes
escaped will be returned in the STRLEN *escaped parameter if it is not null.
When the dsv parameter is null no escaping actually occurs, but the number
of bytes that would be escaped were it not null will be calculated.</p>
<p>If flags contains PERL_PV_ESCAPE_QUOTE then any double quotes in the string
will also be escaped.</p>
<p>Normally the SV will be cleared before the escaped string is prepared,
but when PERL_PV_ESCAPE_NOCLEAR is set this will not occur.</p>
<p>If PERL_PV_ESCAPE_UNI is set then the input string is treated as UTF-8
if PERL_PV_ESCAPE_UNI_DETECT is set then the input string is scanned
using <code class="inline"><span class="i">is_utf8_string</span><span class="s">(</span><span class="s">)</span></code>
to determine if it is UTF-8.</p>
<p>If PERL_PV_ESCAPE_ALL is set then all input chars will be output
using <code class="inline">\<span class="w">x01F1</span></code>
style escapes, otherwise if PERL_PV_ESCAPE_NONASCII is set, only
non-ASCII chars will be escaped using this style; otherwise, only chars above
255 will be so escaped; other non printable chars will use octal or
common escaped patterns like <code class="inline">\<span class="w">n</span></code>
.
Otherwise, if PERL_PV_ESCAPE_NOBACKSLASH
then all chars below 255 will be treated as printable and
will be output as literals.</p>
<p>If PERL_PV_ESCAPE_FIRSTCHAR is set then only the first char of the
string will be escaped, regardless of max. If the output is to be in hex,
then it will be returned as a plain hex
sequence. Thus the output will either be a single char,
an octal escape sequence, a special escape like <code class="inline">\<span class="w">n</span></code>
or a hex value.</p>
<p>If PERL_PV_ESCAPE_RE is set then the escape char used will be a '%' and
not a '\\'. This is because regexes very often contain backslashed
sequences, whereas '%' is not a particularly common character in patterns.</p>
<p>Returns a pointer to the escaped text as held by dsv.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">pv_escape</span><span class="s">(</span><span class="w">SV</span> *<span class="w">dsv</span><span class="cm">,</span> <span class="w">char</span> <span class="w">const</span> * <span class="w">const</span> <span class="w">str</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">count</span><span class="cm">,</span> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">max</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> * <span class="w">const</span> <span class="w">escaped</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pv_pretty"></a><b>pv_pretty
</b>
<p>Converts a string into something presentable, handling escaping via
pv_escape() and supporting quoting and ellipses.</p>
<p>If the PERL_PV_PRETTY_QUOTE flag is set then the result will be
double quoted with any double quotes in the string escaped. Otherwise
if the PERL_PV_PRETTY_LTGT flag is set then the result be wrapped in
angle brackets.</p>
<p>If the PERL_PV_PRETTY_ELLIPSES flag is set and not all characters in
string were output then an ellipsis <code class="inline">...</code>
will be appended to the
string. Note that this happens AFTER it has been quoted.</p>
<p>If start_color is non-null then it will be inserted after the opening
quote (if there is one) but before the escaped text. If end_color
is non-null then it will be inserted after the escaped text but before
any quotes or ellipses.</p>
<p>Returns a pointer to the prettified text as held by dsv.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">pv_pretty</span><span class="s">(</span><span class="w">SV</span> *<span class="w">dsv</span><span class="cm">,</span> <span class="w">char</span> <span class="w">const</span> * <span class="w">const</span> <span class="w">str</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">count</span><span class="cm">,</span> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">max</span><span class="cm">,</span></li><li> <span class="w">char</span> <span class="w">const</span> * <span class="w">const</span> <span class="w">start_color</span><span class="cm">,</span></li><li> <span class="w">char</span> <span class="w">const</span> * <span class="w">const</span> <span class="w">end_color</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Embedding-Functions"></a><h1>Embedding Functions</h1>
<ul>
<li><a name="cv_clone"></a><b>cv_clone
</b>
<p>Clone a CV, making a lexical closure. <i>proto</i> supplies the prototype
of the function: its code, pad structure, and other attributes.
The prototype is combined with a capture of outer lexicals to which the
code refers, which are taken from the currently-executing instance of
the immediately surrounding code.</p>
<pre class="verbatim"><ol><li> <span class="w">CV</span> * <span class="i">cv_clone</span><span class="s">(</span><span class="w">CV</span> *<span class="w">proto</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cv_name"></a><b>cv_name
</b>
<p>Returns an SV containing the name of the CV, mainly for use in error
reporting. The CV may actually be a GV instead, in which case the returned
SV holds the GV's name. Anything other than a GV or CV is treated as a
string already holding the sub name, but this could change in the future.</p>
<p>An SV may be passed as a second argument. If so, the name will be assigned
to it and it will be returned. Otherwise the returned SV will be a new
mortal.</p>
<p>If the <i>flags</i> include CV_NAME_NOTQUAL, then the package name will not be
included. If the first argument is neither a CV nor a GV, this flag is
ignored (subject to change).</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">cv_name</span><span class="s">(</span><span class="w">CV</span> *<span class="w">cv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">sv</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cv_undef"></a><b>cv_undef
</b>
<p>Clear out all the active components of a CV. This can happen either
by an explicit <code class="inline"><a class="l_k" href="functions/undef.html">undef</a> <span class="i">&foo</span></code>
, or by the reference count going to zero.
In the former case, we keep the CvOUTSIDE pointer, so that any anonymous
children can still follow the full lexical scope chain.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">cv_undef</span><span class="s">(</span><span class="w">CV</span>* <span class="w">cv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="find_rundefsv"></a><b>find_rundefsv
</b>
<p>Find and return the variable that is named <code class="inline"><span class="i">$_</span></code>
in the lexical scope
of the currently-executing function. This may be a lexical <code class="inline"><span class="i">$_</span></code>
,
or will otherwise be the global one.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">find_rundefsv</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="find_rundefsvoffset"></a><b>find_rundefsvoffset
</b>
<p>DEPRECATED! It is planned to remove this function from a
future release of Perl. Do not use it for new code; remove it from
existing code.</p>
<p>Find the position of the lexical <code class="inline"><span class="i">$_</span></code>
in the pad of the
currently-executing function. Returns the offset in the current pad,
or <code class="inline"><span class="w">NOT_IN_PAD</span></code>
if there is no lexical <code class="inline"><span class="i">$_</span></code>
in scope (in which case
the global one should be used instead).
<a href="#find_rundefsv">find_rundefsv</a> is likely to be more convenient.</p>
<p>NOTE: the perl_ form of this function is deprecated.</p>
<pre class="verbatim"><ol><li> <span class="w">PADOFFSET</span> <span class="i">find_rundefsvoffset</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="intro_my"></a><b>intro_my
</b>
<p>"Introduce" <code class="inline"><a class="l_k" href="functions/my.html">my</a></code> variables to visible status. This is called during parsing
at the end of each statement to make lexical variables visible to subsequent
statements.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">intro_my</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="load_module"></a><b>load_module
</b>
<p>Loads the module whose name is pointed to by the string part of name.
Note that the actual module name, not its filename, should be given.
Eg, "Foo::Bar" instead of "Foo/Bar.pm". flags can be any of
PERL_LOADMOD_DENY, PERL_LOADMOD_NOIMPORT, or PERL_LOADMOD_IMPORT_OPS
(or 0 for no flags). ver, if specified
and not NULL, provides version semantics
similar to <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">Foo::Bar</span> <span class="w">VERSION</span></code>
. The optional trailing SV*
arguments can be used to specify arguments to the module's import()
method, similar to <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">Foo::Bar</span> <span class="w">VERSION</span> <span class="w">LIST</span></code>
. They must be
terminated with a final NULL pointer. Note that this list can only
be omitted when the PERL_LOADMOD_NOIMPORT flag has been used.
Otherwise at least a single NULL pointer to designate the default
import list is required.</p>
<p>The reference count for each specified <code class="inline"><span class="w">SV</span>*</code>
parameter is decremented.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">load_module</span><span class="s">(</span><span class="w">U32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">name</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">ver</span><span class="cm">,</span> ...<span class="s">)</span></li></ol></pre></li>
<li><a name="newPADNAMELIST"></a><b>newPADNAMELIST
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Creates a new pad name list. <code class="inline"><span class="w">max</span></code>
is the highest index for which space
is allocated.</p>
<pre class="verbatim"><ol><li> <span class="w">PADNAMELIST</span> * <span class="i">newPADNAMELIST</span><span class="s">(</span><span class="w">size_t</span> <span class="w">max</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newPADNAMEouter"></a><b>newPADNAMEouter
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Constructs and returns a new pad name. Only use this function for names
that refer to outer lexicals. (See also <a href="#newPADNAMEpvn">newPADNAMEpvn</a>.) <i>outer</i> is
the outer pad name that this one mirrors. The returned pad name has the
PADNAMEt_OUTER flag already set.</p>
<pre class="verbatim"><ol><li> <span class="w">PADNAME</span> * <span class="i">newPADNAMEouter</span><span class="s">(</span><span class="w">PADNAME</span> *<span class="w">outer</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newPADNAMEpvn"></a><b>newPADNAMEpvn
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Constructs and returns a new pad name. <i>s</i> must be a UTF8 string. Do not
use this for pad names that point to outer lexicals. See
<a href="#newPADNAMEouter">newPADNAMEouter</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">PADNAME</span> * <span class="i">newPADNAMEpvn</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="q">s, STRLEN len)</span></li></ol></pre></li>
<li><a name="nothreadhook"></a><b>nothreadhook
</b>
<p>Stub that provides thread hook for perl_destruct when there are
no threads.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">nothreadhook</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="padnamelist_fetch"></a><b>padnamelist_fetch
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Fetches the pad name from the given index.</p>
<pre class="verbatim"><ol><li> <span class="w">PADNAME</span> * <span class="i">padnamelist_fetch</span><span class="s">(</span><span class="w">PADNAMELIST</span> *<span class="w">pnl</span><span class="cm">,</span></li><li> <span class="w">SSize_t</span> <span class="w">key</span><span class="s">)</span></li></ol></pre></li>
<li><a name="padnamelist_store"></a><b>padnamelist_store
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Stores the pad name (which may be null) at the given index, freeing any
existing pad name in that slot.</p>
<pre class="verbatim"><ol><li> <span class="w">PADNAME</span> ** <span class="i">padnamelist_store</span><span class="s">(</span><span class="w">PADNAMELIST</span> *<span class="w">pnl</span><span class="cm">,</span></li><li> <span class="w">SSize_t</span> <span class="w">key</span><span class="cm">,</span> <span class="w">PADNAME</span> *<span class="w">val</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pad_add_anon"></a><b>pad_add_anon
</b>
<p>Allocates a place in the currently-compiling pad (via <a href="#pad_alloc">pad_alloc</a>)
for an anonymous function that is lexically scoped inside the
currently-compiling function.
The function <i>func</i> is linked into the pad, and its <code class="inline"><span class="w">CvOUTSIDE</span></code>
link
to the outer scope is weakened to avoid a reference loop.</p>
<p>One reference count is stolen, so you may need to do <code class="inline"><span class="i">SvREFCNT_inc</span><span class="s">(</span><span class="w">func</span><span class="s">)</span></code>
.</p>
<p><i>optype</i> should be an opcode indicating the type of operation that the
pad entry is to support. This doesn't affect operational semantics,
but is used for debugging.</p>
<pre class="verbatim"><ol><li> <span class="w">PADOFFSET</span> <span class="i">pad_add_anon</span><span class="s">(</span><span class="w">CV</span> *<span class="w">func</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">optype</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pad_add_name_pv"></a><b>pad_add_name_pv
</b>
<p>Exactly like <a href="#pad_add_name_pvn">pad_add_name_pvn</a>, but takes a nul-terminated string
instead of a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">PADOFFSET</span> <span class="i">pad_add_name_pv</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">name</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="cm">,</span></li><li> <span class="w">HV</span> *<span class="w">typestash</span><span class="cm">,</span> <span class="w">HV</span> *<span class="w">ourstash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pad_add_name_pvn"></a><b>pad_add_name_pvn
</b>
<p>Allocates a place in the currently-compiling pad for a named lexical
variable. Stores the name and other metadata in the name part of the
pad, and makes preparations to manage the variable's lexical scoping.
Returns the offset of the allocated pad slot.</p>
<p><i>namepv</i>/<i>namelen</i> specify the variable's name, including leading sigil.
If <i>typestash</i> is non-null, the name is for a typed lexical, and this
identifies the type. If <i>ourstash</i> is non-null, it's a lexical reference
to a package variable, and this identifies the package. The following
flags can be OR'ed together:</p>
<pre class="verbatim"><ol><li><a name="package-var"></a> <span class="w">padadd_OUR</span> <span class="w">redundantly</span> <span class="w">specifies</span> <a class="l_k" href="functions/if.html">if</a> <span class="w">it's</span> <span class="w">a</span> package <span class="i">var</span></li><li> <span class="w">padadd_STATE</span> <span class="w">variable</span> <span class="w">will</span> <span class="w">retain</span> <span class="w">value</span> <span class="w">persistently</span></li><li> <span class="w">padadd_NO_DUP_CHECK</span> <span class="w">skip</span> <span class="w">check</span> <a class="l_k" href="functions/for.html">for</a> <span class="w">lexical</span> <span class="w">shadowing</span></li><li></li><li> <span class="w">PADOFFSET</span> <span class="i">pad_add_name_pvn</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">namepv</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">namelen</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="cm">,</span></li><li> <span class="w">HV</span> *<span class="w">typestash</span><span class="cm">,</span> <span class="w">HV</span> *<span class="w">ourstash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pad_add_name_sv"></a><b>pad_add_name_sv
</b>
<p>Exactly like <a href="#pad_add_name_pvn">pad_add_name_pvn</a>, but takes the name string in the form
of an SV instead of a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">PADOFFSET</span> <span class="i">pad_add_name_sv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">name</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="cm">,</span></li><li> <span class="w">HV</span> *<span class="w">typestash</span><span class="cm">,</span> <span class="w">HV</span> *<span class="w">ourstash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pad_alloc"></a><b>pad_alloc
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Allocates a place in the currently-compiling pad,
returning the offset of the allocated pad slot.
No name is initially attached to the pad slot.
<i>tmptype</i> is a set of flags indicating the kind of pad entry required,
which will be set in the value SV for the allocated pad entry:</p>
<pre class="verbatim"><ol><li> <span class="w">SVs_PADMY</span> <span class="w">named</span> <span class="w">lexical</span> <span class="w">variable</span> <span class="s">(</span><span class="q">"my"</span><span class="cm">,</span> <span class="q">"our"</span><span class="cm">,</span> <span class="q">"state"</span><span class="s">)</span></li><li> <span class="w">SVs_PADTMP</span> <span class="w">unnamed</span> <span class="w">temporary</span> <span class="w">store</span></li><li> <span class="w">SVf_READONLY</span> <span class="w">constant</span> <span class="w">shared</span> <span class="w">between</span> <span class="w">recursion</span> <span class="w">levels</span></li></ol></pre><p><code class="inline"><span class="w">SVf_READONLY</span></code>
has been supported here only since perl 5.20. To work with
earlier versions as well, use <code class="inline"><span class="w">SVf_READONLY</span>|<span class="w">SVs_PADTMP</span></code>
. <code class="inline"><span class="w">SVf_READONLY</span></code>
does not cause the SV in the pad slot to be marked read-only, but simply
tells <code class="inline"><span class="w">pad_alloc</span></code>
that it <i>will</i> be made read-only (by the caller), or at
least should be treated as such.</p>
<p><i>optype</i> should be an opcode indicating the type of operation that the
pad entry is to support. This doesn't affect operational semantics,
but is used for debugging.</p>
<pre class="verbatim"><ol><li> <span class="w">PADOFFSET</span> <span class="i">pad_alloc</span><span class="s">(</span><span class="w">I32</span> <span class="w">optype</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">tmptype</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pad_findmy_pv"></a><b>pad_findmy_pv
</b>
<p>Exactly like <a href="#pad_findmy_pvn">pad_findmy_pvn</a>, but takes a nul-terminated string
instead of a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">PADOFFSET</span> <span class="i">pad_findmy_pv</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">name</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pad_findmy_pvn"></a><b>pad_findmy_pvn
</b>
<p>Given the name of a lexical variable, find its position in the
currently-compiling pad.
<i>namepv</i>/<i>namelen</i> specify the variable's name, including leading sigil.
<i>flags</i> is reserved and must be zero.
If it is not in the current pad but appears in the pad of any lexically
enclosing scope, then a pseudo-entry for it is added in the current pad.
Returns the offset in the current pad,
or <code class="inline"><span class="w">NOT_IN_PAD</span></code>
if no such lexical is in scope.</p>
<pre class="verbatim"><ol><li> <span class="w">PADOFFSET</span> <span class="i">pad_findmy_pvn</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">namepv</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">namelen</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pad_findmy_sv"></a><b>pad_findmy_sv
</b>
<p>Exactly like <a href="#pad_findmy_pvn">pad_findmy_pvn</a>, but takes the name string in the form
of an SV instead of a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">PADOFFSET</span> <span class="i">pad_findmy_sv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">name</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pad_setsv"></a><b>pad_setsv
</b>
<p>Set the value at offset <i>po</i> in the current (compiling or executing) pad.
Use the macro PAD_SETSV() rather than calling this function directly.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">pad_setsv</span><span class="s">(</span><span class="w">PADOFFSET</span> <span class="w">po</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pad_sv"></a><b>pad_sv
</b>
<p>Get the value at offset <i>po</i> in the current (compiling or executing) pad.
Use macro PAD_SV instead of calling this function directly.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">pad_sv</span><span class="s">(</span><span class="w">PADOFFSET</span> <span class="w">po</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pad_tidy"></a><b>pad_tidy
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Tidy up a pad at the end of compilation of the code to which it belongs.
Jobs performed here are: remove most stuff from the pads of anonsub
prototypes; give it a @_; mark temporaries as such. <i>type</i> indicates
the kind of subroutine:</p>
<pre class="verbatim"><ol><li> <span class="w">padtidy_SUB</span> <span class="w">ordinary</span> <span class="w">subroutine</span></li><li> <span class="w">padtidy_SUBCLONE</span> <a class="l_k" href="functions/prototype.html">prototype</a> <a class="l_k" href="functions/for.html">for</a> <span class="w">lexical</span> <span class="w">closure</span></li><li> <span class="w">padtidy_FORMAT</span> <a class="l_k" href="functions/format.html">format</a></li><li></li><li><span class="hh"> void pad_tidy(padtidy_type type)</span></li></ol></pre></li>
<li><a name="perl_alloc"></a><b>perl_alloc
</b>
<p>Allocates a new Perl interpreter. See <a href="perlembed.html">perlembed</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">PerlInterpreter</span>* <span class="i">perl_alloc</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="perl_construct"></a><b>perl_construct
</b>
<p>Initializes a new Perl interpreter. See <a href="perlembed.html">perlembed</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">perl_construct</span><span class="s">(</span><span class="w">PerlInterpreter</span> *<span class="w">my_perl</span><span class="s">)</span></li></ol></pre></li>
<li><a name="perl_destruct"></a><b>perl_destruct
</b>
<p>Shuts down a Perl interpreter. See <a href="perlembed.html">perlembed</a>.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">perl_destruct</span><span class="s">(</span><span class="w">PerlInterpreter</span> *<span class="w">my_perl</span><span class="s">)</span></li></ol></pre></li>
<li><a name="perl_free"></a><b>perl_free
</b>
<p>Releases a Perl interpreter. See <a href="perlembed.html">perlembed</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">perl_free</span><span class="s">(</span><span class="w">PerlInterpreter</span> *<span class="w">my_perl</span><span class="s">)</span></li></ol></pre></li>
<li><a name="perl_parse"></a><b>perl_parse
</b>
<p>Tells a Perl interpreter to parse a Perl script. See <a href="perlembed.html">perlembed</a>.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">perl_parse</span><span class="s">(</span><span class="w">PerlInterpreter</span> *<span class="w">my_perl</span><span class="cm">,</span></li><li> <span class="w">XSINIT_t</span> <span class="w">xsinit</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">argc</span><span class="cm">,</span></li><li> <span class="w">char</span>** <span class="w">argv</span><span class="cm">,</span> <span class="w">char</span>** <span class="w">env</span><span class="s">)</span></li></ol></pre></li>
<li><a name="perl_run"></a><b>perl_run
</b>
<p>Tells a Perl interpreter to run. See <a href="perlembed.html">perlembed</a>.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">perl_run</span><span class="s">(</span><span class="w">PerlInterpreter</span> *<span class="w">my_perl</span><span class="s">)</span></li></ol></pre></li>
<li><a name="require_pv"></a><b>require_pv
</b>
<p>Tells Perl to <code class="inline"><a class="l_k" href="functions/require.html">require</a></code> the file named by the string argument. It is
analogous to the Perl code <code class="inline"><a class="l_k" href="functions/eval.html">eval</a> <span class="q">"require '$file'"</span></code>
. It's even
implemented that way; consider using load_module instead.</p>
<p>NOTE: the perl_ form of this function is deprecated.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">require_pv</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">pv</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Exception-Handling-(simple)-Macros"></a><h1>Exception Handling (simple) Macros</h1>
<ul>
<li><a name="dXCPT"></a><b>dXCPT
</b>
<p>Set up necessary local variables for exception handling.
See <a href="perlguts.html#Exception-Handling">Exception Handling in perlguts</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">dXCPT</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="XCPT_CATCH"></a><b>XCPT_CATCH
</b>
<p>Introduces a catch block. See <a href="perlguts.html#Exception-Handling">Exception Handling in perlguts</a>.</p>
</li>
<li><a name="XCPT_RETHROW"></a><b>XCPT_RETHROW
</b>
<p>Rethrows a previously caught exception. See <a href="perlguts.html#Exception-Handling">Exception Handling in perlguts</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">XCPT_RETHROW</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="XCPT_TRY_END"></a><b>XCPT_TRY_END
</b>
<p>Ends a try block. See <a href="perlguts.html#Exception-Handling">Exception Handling in perlguts</a>.</p>
</li>
<li><a name="XCPT_TRY_START"></a><b>XCPT_TRY_START
</b>
<p>Starts a try block. See <a href="perlguts.html#Exception-Handling">Exception Handling in perlguts</a>.</p>
</li>
</ul>
<a name="Global-Variables"></a><h1>Global Variables</h1>
<p>These variables are global to an entire process. They are shared between
all interpreters and all threads in a process.</p>
<ul>
<li><a name="PL_check"></a><b>PL_check
</b>
<p>Array, indexed by opcode, of functions that will be called for the "check"
phase of optree building during compilation of Perl code. For most (but
not all) types of op, once the op has been initially built and populated
with child ops it will be filtered through the check function referenced
by the appropriate element of this array. The new op is passed in as the
sole argument to the check function, and the check function returns the
completed op. The check function may (as the name suggests) check the op
for validity and signal errors. It may also initialise or modify parts of
the ops, or perform more radical surgery such as adding or removing child
ops, or even throw the op away and return a different op in its place.</p>
<p>This array of function pointers is a convenient place to hook into the
compilation process. An XS module can put its own custom check function
in place of any of the standard ones, to influence the compilation of a
particular type of op. However, a custom check function must never fully
replace a standard check function (or even a custom check function from
another module). A module modifying checking must instead <b>wrap</b> the
preexisting check function. A custom check function must be selective
about when to apply its custom behaviour. In the usual case where
it decides not to do anything special with an op, it must chain the
preexisting op function. Check functions are thus linked in a chain,
with the core's base checker at the end.</p>
<p>For thread safety, modules should not write directly to this array.
Instead, use the function <a href="#wrap_op_checker">wrap_op_checker</a>.</p>
</li>
<li><a name="PL_keyword_plugin"></a><b>PL_keyword_plugin
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Function pointer, pointing at a function used to handle extended keywords.
The function should be declared as</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">keyword_plugin_function</span><span class="s">(</span><span class="w">pTHX_</span></li><li> <span class="w">char</span> *<span class="w">keyword_ptr</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">keyword_len</span><span class="cm">,</span></li><li> <span class="w">OP</span> **<span class="w">op_ptr</span><span class="s">)</span></li></ol></pre><p>The function is called from the tokeniser, whenever a possible keyword
is seen. <code class="inline"><span class="w">keyword_ptr</span></code>
points at the word in the parser's input
buffer, and <code class="inline"><span class="w">keyword_len</span></code>
gives its length; it is not null-terminated.
The function is expected to examine the word, and possibly other state
such as <a href="perlvar.html#%25%5eH">%^H</a>, to decide whether it wants to handle it
as an extended keyword. If it does not, the function should return
<code class="inline"><span class="w">KEYWORD_PLUGIN_DECLINE</span></code>
, and the normal parser process will continue.</p>
<p>If the function wants to handle the keyword, it first must
parse anything following the keyword that is part of the syntax
introduced by the keyword. See <a href="#Lexer-interface">Lexer interface</a> for details.</p>
<p>When a keyword is being handled, the plugin function must build
a tree of <code class="inline"><span class="w">OP</span></code>
structures, representing the code that was parsed.
The root of the tree must be stored in <code class="inline"><span class="i">*op_ptr</span></code>
. The function then
returns a constant indicating the syntactic role of the construct that
it has parsed: <code class="inline"><span class="w">KEYWORD_PLUGIN_STMT</span></code>
if it is a complete statement, or
<code class="inline"><span class="w">KEYWORD_PLUGIN_EXPR</span></code>
if it is an expression. Note that a statement
construct cannot be used inside an expression (except via <code class="inline"><a class="l_k" href="functions/do.html">do</a> <span class="w">BLOCK</span></code>
and similar), and an expression is not a complete statement (it requires
at least a terminating semicolon).</p>
<p>When a keyword is handled, the plugin function may also have
(compile-time) side effects. It may modify <code class="inline"><span class="i">%^H</span></code>
, define functions, and
so on. Typically, if side effects are the main purpose of a handler,
it does not wish to generate any ops to be included in the normal
compilation. In this case it is still required to supply an op tree,
but it suffices to generate a single null op.</p>
<p>That's how the <code class="inline"><span class="i">*PL_keyword_plugin</span></code>
function needs to behave overall.
Conventionally, however, one does not completely replace the existing
handler function. Instead, take a copy of <code class="inline"><span class="w">PL_keyword_plugin</span></code>
before
assigning your own function pointer to it. Your handler function should
look for keywords that it is interested in and handle those. Where it
is not interested, it should call the saved plugin function, passing on
the arguments it received. Thus <code class="inline"><span class="w">PL_keyword_plugin</span></code>
actually points
at a chain of handler functions, all of which have an opportunity to
handle keywords, and only the last function in the chain (built into
the Perl core) will normally return <code class="inline"><span class="w">KEYWORD_PLUGIN_DECLINE</span></code>
.</p>
</li>
</ul>
<a name="GV-Functions"></a><h1>GV Functions</h1>
<p>A GV is a structure which corresponds to to a Perl typeglob, ie *foo.
It is a structure that holds a pointer to a scalar, an array, a hash etc,
corresponding to $foo, @foo, %foo.</p>
<p>GVs are usually found as values in stashes (symbol table hashes) where
Perl stores its global variables.</p>
<ul>
<li><a name="GvAV"></a><b>GvAV
</b>
<p>Return the AV from the GV.</p>
<pre class="verbatim"><ol><li> <span class="w">AV</span>* <span class="i">GvAV</span><span class="s">(</span><span class="w">GV</span>* <span class="w">gv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="GvCV"></a><b>GvCV
</b>
<p>Return the CV from the GV.</p>
<pre class="verbatim"><ol><li> <span class="w">CV</span>* <span class="i">GvCV</span><span class="s">(</span><span class="w">GV</span>* <span class="w">gv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="GvHV"></a><b>GvHV
</b>
<p>Return the HV from the GV.</p>
<pre class="verbatim"><ol><li> <span class="w">HV</span>* <span class="i">GvHV</span><span class="s">(</span><span class="w">GV</span>* <span class="w">gv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="GvSV"></a><b>GvSV
</b>
<p>Return the SV from the GV.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">GvSV</span><span class="s">(</span><span class="w">GV</span>* <span class="w">gv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_const_sv"></a><b>gv_const_sv
</b>
<p>If <code class="inline"><span class="w">gv</span></code>
is a typeglob whose subroutine entry is a constant sub eligible for
inlining, or <code class="inline"><span class="w">gv</span></code>
is a placeholder reference that would be promoted to such
a typeglob, then returns the value returned by the sub. Otherwise, returns
NULL.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">gv_const_sv</span><span class="s">(</span><span class="w">GV</span>* <span class="w">gv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_fetchmeth"></a><b>gv_fetchmeth
</b>
<p>Like <a href="#gv_fetchmeth_pvn">gv_fetchmeth_pvn</a>, but lacks a flags parameter.</p>
<pre class="verbatim"><ol><li> <span class="w">GV</span>* <span class="i">gv_fetchmeth</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">level</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_fetchmethod_autoload"></a><b>gv_fetchmethod_autoload
</b>
<p>Returns the glob which contains the subroutine to call to invoke the method
on the <code class="inline"><span class="w">stash</span></code>
. In fact in the presence of autoloading this may be the
glob for "AUTOLOAD". In this case the corresponding variable $AUTOLOAD is
already setup.</p>
<p>The third parameter of <code class="inline"><span class="w">gv_fetchmethod_autoload</span></code>
determines whether
AUTOLOAD lookup is performed if the given method is not present: non-zero
means yes, look for AUTOLOAD; zero means no, don't look for AUTOLOAD.
Calling <code class="inline"><span class="w">gv_fetchmethod</span></code>
is equivalent to calling <code class="inline"><span class="w">gv_fetchmethod_autoload</span></code>
with a non-zero <code class="inline"><span class="w">autoload</span></code>
parameter.</p>
<p>These functions grant <code class="inline"><span class="q">"SUPER"</span></code>
token
as a prefix of the method name. Note
that if you want to keep the returned glob for a long time, you need to
check for it being "AUTOLOAD", since at the later time the call may load a
different subroutine due to $AUTOLOAD changing its value. Use the glob
created as a side effect to do this.</p>
<p>These functions have the same side-effects as <code class="inline"><span class="w">gv_fetchmeth</span></code>
with
<code class="inline"><span class="w">level</span>==<span class="n">0</span></code>
. The warning against passing the GV returned by
<code class="inline"><span class="w">gv_fetchmeth</span></code>
to <code class="inline"><span class="w">call_sv</span></code>
applies equally to these functions.</p>
<pre class="verbatim"><ol><li> <span class="w">GV</span>* <span class="i">gv_fetchmethod_autoload</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span></li><li> <span class="w">I32</span> <span class="w">autoload</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_fetchmeth_autoload"></a><b>gv_fetchmeth_autoload
</b>
<p>This is the old form of <a href="#gv_fetchmeth_pvn_autoload">gv_fetchmeth_pvn_autoload</a>, which has no flags
parameter.</p>
<pre class="verbatim"><ol><li> <span class="w">GV</span>* <span class="i">gv_fetchmeth_autoload</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">level</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_fetchmeth_pv"></a><b>gv_fetchmeth_pv
</b>
<p>Exactly like <a href="#gv_fetchmeth_pvn">gv_fetchmeth_pvn</a>, but takes a nul-terminated string
instead of a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">GV</span>* <span class="i">gv_fetchmeth_pv</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span></li><li> <span class="w">I32</span> <span class="w">level</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_fetchmeth_pvn"></a><b>gv_fetchmeth_pvn
</b>
<p>Returns the glob with the given <code class="inline"><span class="w">name</span></code>
and a defined subroutine or
<code class="inline"><span class="w">NULL</span></code>
. The glob lives in the given <code class="inline"><span class="w">stash</span></code>
, or in the stashes
accessible via @ISA and UNIVERSAL::.</p>
<p>The argument <code class="inline"><span class="w">level</span></code>
should be either 0 or -1. If <code class="inline"><span class="w">level</span>==<span class="n">0</span></code>
, as a
side-effect creates a glob with the given <code class="inline"><span class="w">name</span></code>
in the given <code class="inline"><span class="w">stash</span></code>
which in the case of success contains an alias for the subroutine, and sets
up caching info for this glob.</p>
<p>The only significant values for <code class="inline"><span class="w">flags</span></code>
are GV_SUPER and SVf_UTF8.</p>
<p>GV_SUPER indicates that we want to look up the method in the superclasses
of the <code class="inline"><span class="w">stash</span></code>
.</p>
<p>The
GV returned from <code class="inline"><span class="w">gv_fetchmeth</span></code>
may be a method cache entry, which is not
visible to Perl code. So when calling <code class="inline"><span class="w">call_sv</span></code>
, you should not use
the GV directly; instead, you should use the method's CV, which can be
obtained from the GV with the <code class="inline"><span class="w">GvCV</span></code>
macro.</p>
<pre class="verbatim"><ol><li> <span class="w">GV</span>* <span class="i">gv_fetchmeth_pvn</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">level</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_fetchmeth_pvn_autoload"></a><b>gv_fetchmeth_pvn_autoload
</b>
<p>Same as gv_fetchmeth_pvn(), but looks for autoloaded subroutines too.
Returns a glob for the subroutine.</p>
<p>For an autoloaded subroutine without a GV, will create a GV even
if <code class="inline"><span class="w">level</span> < <span class="n">0</span></code>
. For an autoloaded subroutine without a stub, GvCV()
of the result may be zero.</p>
<p>Currently, the only significant value for <code class="inline"><span class="w">flags</span></code>
is SVf_UTF8.</p>
<pre class="verbatim"><ol><li> <span class="w">GV</span>* <span class="i">gv_fetchmeth_pvn_autoload</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">level</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_fetchmeth_pv_autoload"></a><b>gv_fetchmeth_pv_autoload
</b>
<p>Exactly like <a href="#gv_fetchmeth_pvn_autoload">gv_fetchmeth_pvn_autoload</a>, but takes a nul-terminated string
instead of a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">GV</span>* <span class="i">gv_fetchmeth_pv_autoload</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span></li><li> <span class="w">I32</span> <span class="w">level</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_fetchmeth_sv"></a><b>gv_fetchmeth_sv
</b>
<p>Exactly like <a href="#gv_fetchmeth_pvn">gv_fetchmeth_pvn</a>, but takes the name string in the form
of an SV instead of a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">GV</span>* <span class="i">gv_fetchmeth_sv</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">namesv</span><span class="cm">,</span></li><li> <span class="w">I32</span> <span class="w">level</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_fetchmeth_sv_autoload"></a><b>gv_fetchmeth_sv_autoload
</b>
<p>Exactly like <a href="#gv_fetchmeth_pvn_autoload">gv_fetchmeth_pvn_autoload</a>, but takes the name string in the form
of an SV instead of a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">GV</span>* <span class="i">gv_fetchmeth_sv_autoload</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">namesv</span><span class="cm">,</span></li><li> <span class="w">I32</span> <span class="w">level</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_init"></a><b>gv_init
</b>
<p>The old form of gv_init_pvn(). It does not work with UTF8 strings, as it
has no flags parameter. If the <code class="inline"><span class="w">multi</span></code>
parameter is set, the
GV_ADDMULTI flag will be passed to gv_init_pvn().</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">gv_init</span><span class="s">(</span><span class="w">GV</span>* <span class="w">gv</span><span class="cm">,</span> <span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">multi</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_init_pv"></a><b>gv_init_pv
</b>
<p>Same as gv_init_pvn(), but takes a nul-terminated string for the name
instead of separate char * and length parameters.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">gv_init_pv</span><span class="s">(</span><span class="w">GV</span>* <span class="w">gv</span><span class="cm">,</span> <span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_init_pvn"></a><b>gv_init_pvn
</b>
<p>Converts a scalar into a typeglob. This is an incoercible typeglob;
assigning a reference to it will assign to one of its slots, instead of
overwriting it as happens with typeglobs created by SvSetSV. Converting
any scalar that is SvOK() may produce unpredictable results and is reserved
for perl's internal use.</p>
<p><code class="inline"><span class="w">gv</span></code>
is the scalar to be converted.</p>
<p><code class="inline"><span class="w">stash</span></code>
is the parent stash/package, if any.</p>
<p><code class="inline"><span class="w">name</span></code>
and <code class="inline"><span class="w">len</span></code>
give the name. The name must be unqualified;
that is, it must not include the package name. If <code class="inline"><span class="w">gv</span></code>
is a
stash element, it is the caller's responsibility to ensure that the name
passed to this function matches the name of the element. If it does not
match, perl's internal bookkeeping will get out of sync.</p>
<p><code class="inline"><span class="w">flags</span></code>
can be set to SVf_UTF8 if <code class="inline"><span class="w">name</span></code>
is a UTF8 string, or
the return value of SvUTF8(sv). It can also take the
GV_ADDMULTI flag, which means to pretend that the GV has been
seen before (i.e., suppress "Used once" warnings).</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">gv_init_pvn</span><span class="s">(</span><span class="w">GV</span>* <span class="w">gv</span><span class="cm">,</span> <span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_init_sv"></a><b>gv_init_sv
</b>
<p>Same as gv_init_pvn(), but takes an SV * for the name instead of separate
char * and length parameters. <code class="inline"><span class="w">flags</span></code>
is currently unused.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">gv_init_sv</span><span class="s">(</span><span class="w">GV</span>* <span class="w">gv</span><span class="cm">,</span> <span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">namesv</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_stashpv"></a><b>gv_stashpv
</b>
<p>Returns a pointer to the stash for a specified package. Uses <code class="inline"><span class="w">strlen</span></code>
to
determine the length of <code class="inline"><span class="w">name</span></code>
, then calls <code class="inline"><span class="i">gv_stashpvn</span><span class="s">(</span><span class="s">)</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">HV</span>* <span class="i">gv_stashpv</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_stashpvn"></a><b>gv_stashpvn
</b>
<p>Returns a pointer to the stash for a specified package. The <code class="inline"><span class="w">namelen</span></code>
parameter indicates the length of the <code class="inline"><span class="w">name</span></code>
, in bytes. <code class="inline"><span class="w">flags</span></code>
is passed
to <code class="inline"><span class="i">gv_fetchpvn_flags</span><span class="s">(</span><span class="s">)</span></code>
, so if set to <code class="inline"><span class="w">GV_ADD</span></code>
then the package will be
created if it does not already exist. If the package does not exist and
<code class="inline"><span class="w">flags</span></code>
is 0 (or any other setting that does not create packages) then NULL
is returned.</p>
<p>Flags may be one of:</p>
<pre class="verbatim"><ol><li> <span class="w">GV_ADD</span></li><li> <span class="w">SVf_UTF8</span></li><li> <span class="w">GV_NOADD_NOINIT</span></li><li> <span class="w">GV_NOINIT</span></li><li> <span class="w">GV_NOEXPAND</span></li><li> <span class="w">GV_ADDMG</span></li></ol></pre><p>The most important of which are probably GV_ADD and SVf_UTF8.</p>
<p>Note, use of <code class="inline"><span class="w">gv_stashsv</span></code>
instead of <code class="inline"><span class="w">gv_stashpvn</span></code>
where possible is strongly
recommended for performance reasons.</p>
<pre class="verbatim"><ol><li> <span class="w">HV</span>* <span class="i">gv_stashpvn</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">namelen</span><span class="cm">,</span></li><li> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_stashpvs"></a><b>gv_stashpvs
</b>
<p>Like <code class="inline"><span class="w">gv_stashpvn</span></code>
, but takes a literal string instead of a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">HV</span>* <span class="i">gv_stashpvs</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">create</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_stashsv"></a><b>gv_stashsv
</b>
<p>Returns a pointer to the stash for a specified package. See <code class="inline"><span class="w">gv_stashpvn</span></code>
.</p>
<p>Note this interface is strongly preferred over <code class="inline"><span class="w">gv_stashpvn</span></code>
for performance reasons.</p>
<pre class="verbatim"><ol><li> <span class="w">HV</span>* <span class="i">gv_stashsv</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="setdefout"></a><b>setdefout
</b>
<p>Sets PL_defoutgv, the default file handle for output, to the passed in
typeglob. As PL_defoutgv "owns" a reference on its typeglob, the reference
count of the passed in typeglob is increased by one, and the reference count
of the typeglob that PL_defoutgv points to is decreased by one.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">setdefout</span><span class="s">(</span><span class="w">GV</span>* <span class="w">gv</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Handy-Values"></a><h1>Handy Values</h1>
<ul>
<li><a name="Nullav"></a><b>Nullav
</b>
<p>Null AV pointer.</p>
<p>(deprecated - use <code class="inline">(AV *)NULL</code> instead)</p>
</li>
<li><a name="Nullch"></a><b>Nullch
</b>
<p>Null character pointer. (No longer available when <code class="inline"><span class="w">PERL_CORE</span></code>
is
defined.)</p>
</li>
<li><a name="Nullcv"></a><b>Nullcv
</b>
<p>Null CV pointer.</p>
<p>(deprecated - use <code class="inline">(CV *)NULL</code> instead)</p>
</li>
<li><a name="Nullhv"></a><b>Nullhv
</b>
<p>Null HV pointer.</p>
<p>(deprecated - use <code class="inline">(HV *)NULL</code> instead)</p>
</li>
<li><a name="Nullsv"></a><b>Nullsv
</b>
<p>Null SV pointer. (No longer available when <code class="inline"><span class="w">PERL_CORE</span></code>
is defined.)</p>
</li>
</ul>
<a name="Hash-Manipulation-Functions"></a><h1>Hash Manipulation Functions</h1>
<p>A HV structure represents a Perl hash. It consists mainly of an array
of pointers, each of which points to a linked list of HE structures. The
array is indexed by the hash function of the key, so each linked list
represents all the hash entries with the same hash value. Each HE contains
a pointer to the actual value, plus a pointer to a HEK structure which
holds the key and hash value.</p>
<ul>
<li><a name="cop_fetch_label"></a><b>cop_fetch_label
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Returns the label attached to a cop.
The flags pointer may be set to <code class="inline"><span class="w">SVf_UTF8</span></code>
or 0.</p>
<pre class="verbatim"><ol><li> <span class="w">const</span> <span class="w">char</span> * <span class="i">cop_fetch_label</span><span class="s">(</span><span class="w">COP</span> *<span class="w">const</span> <span class="w">cop</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> *<span class="w">len</span><span class="cm">,</span> <span class="w">U32</span> *<span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cop_store_label"></a><b>cop_store_label
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Save a label into a <code class="inline"><span class="w">cop_hints_hash</span></code>
.
You need to set flags to <code class="inline"><span class="w">SVf_UTF8</span></code>
for a utf-8 label.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">cop_store_label</span><span class="s">(</span><span class="w">COP</span> *<span class="w">const</span> <span class="w">cop</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">label</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="get_hv"></a><b>get_hv
</b>
<p>Returns the HV of the specified Perl hash. <code class="inline"><span class="w">flags</span></code>
are passed to
<code class="inline"><span class="w">gv_fetchpv</span></code>
. If <code class="inline"><span class="w">GV_ADD</span></code>
is set and the
Perl variable does not exist then it will be created. If <code class="inline"><span class="w">flags</span></code>
is zero
and the variable does not exist then NULL is returned.</p>
<p>NOTE: the perl_ form of this function is deprecated.</p>
<pre class="verbatim"><ol><li> <span class="w">HV</span>* <span class="i">get_hv</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">name</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="HEf_SVKEY"></a><b>HEf_SVKEY
</b>
<p>This flag, used in the length slot of hash entries and magic structures,
specifies the structure contains an <code class="inline"><span class="w">SV</span>*</code>
pointer where a <code class="inline"><span class="w">char</span>*</code>
pointer
is to be expected. (For information only--not to be used).</p>
</li>
<li><a name="HeHASH"></a><b>HeHASH
</b>
<p>Returns the computed hash stored in the hash entry.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">HeHASH</span><span class="s">(</span><span class="w">HE</span>* <span class="w">he</span><span class="s">)</span></li></ol></pre></li>
<li><a name="HeKEY"></a><b>HeKEY
</b>
<p>Returns the actual pointer stored in the key slot of the hash entry. The
pointer may be either <code class="inline"><span class="w">char</span>*</code>
or <code class="inline"><span class="w">SV</span>*</code>
, depending on the value of
<code class="inline"><span class="i">HeKLEN</span><span class="s">(</span><span class="s">)</span></code>
. Can be assigned to. The <code class="inline"><span class="i">HePV</span><span class="s">(</span><span class="s">)</span></code>
or <code class="inline"><span class="i">HeSVKEY</span><span class="s">(</span><span class="s">)</span></code>
macros are
usually preferable for finding the value of a key.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span>* <span class="i">HeKEY</span><span class="s">(</span><span class="w">HE</span>* <span class="w">he</span><span class="s">)</span></li></ol></pre></li>
<li><a name="HeKLEN"></a><b>HeKLEN
</b>
<p>If this is negative, and amounts to <code class="inline"><span class="w">HEf_SVKEY</span></code>
, it indicates the entry
holds an <code class="inline"><span class="w">SV</span>*</code>
key. Otherwise, holds the actual length of the key. Can
be assigned to. The <code class="inline"><span class="i">HePV</span><span class="s">(</span><span class="s">)</span></code>
macro is usually preferable for finding key
lengths.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">HeKLEN</span><span class="s">(</span><span class="w">HE</span>* <span class="w">he</span><span class="s">)</span></li></ol></pre></li>
<li><a name="HePV"></a><b>HePV
</b>
<p>Returns the key slot of the hash entry as a <code class="inline"><span class="w">char</span>*</code>
value, doing any
necessary dereferencing of possibly <code class="inline"><span class="w">SV</span>*</code>
keys. The length of the string
is placed in <code class="inline"><span class="w">len</span></code>
(this is a macro, so do <i>not</i> use <code class="inline"><span class="i">&len</span></code>
). If you do
not care about what the length of the key is, you may use the global
variable <code class="inline"><span class="w">PL_na</span></code>
, though this is rather less efficient than using a local
variable. Remember though, that hash keys in perl are free to contain
embedded nulls, so using <code class="inline"><span class="i">strlen</span><span class="s">(</span><span class="s">)</span></code>
or similar is not a good way to find
the length of hash keys. This is very similar to the <code class="inline"><span class="i">SvPV</span><span class="s">(</span><span class="s">)</span></code>
macro
described elsewhere in this document. See also <code class="inline"><span class="w">HeUTF8</span></code>
.</p>
<p>If you are using <code class="inline"><span class="w">HePV</span></code>
to get values to pass to <code class="inline"><span class="i">newSVpvn</span><span class="s">(</span><span class="s">)</span></code>
to create a
new SV, you should consider using <code class="inline"><span class="i">newSVhek</span><span class="s">(</span><span class="i">HeKEY_hek</span><span class="s">(</span><span class="w">he</span><span class="s">)</span><span class="s">)</span></code>
as it is more
efficient.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">HePV</span><span class="s">(</span><span class="w">HE</span>* <span class="w">he</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="HeSVKEY"></a><b>HeSVKEY
</b>
<p>Returns the key as an <code class="inline"><span class="w">SV</span>*</code>
, or <code class="inline"><span class="w">NULL</span></code>
if the hash entry does not
contain an <code class="inline"><span class="w">SV</span>*</code>
key.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">HeSVKEY</span><span class="s">(</span><span class="w">HE</span>* <span class="w">he</span><span class="s">)</span></li></ol></pre></li>
<li><a name="HeSVKEY_force"></a><b>HeSVKEY_force
</b>
<p>Returns the key as an <code class="inline"><span class="w">SV</span>*</code>
. Will create and return a temporary mortal
<code class="inline"><span class="w">SV</span>*</code>
if the hash entry contains only a <code class="inline"><span class="w">char</span>*</code>
key.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">HeSVKEY_force</span><span class="s">(</span><span class="w">HE</span>* <span class="w">he</span><span class="s">)</span></li></ol></pre></li>
<li><a name="HeSVKEY_set"></a><b>HeSVKEY_set
</b>
<p>Sets the key to a given <code class="inline"><span class="w">SV</span>*</code>
, taking care to set the appropriate flags to
indicate the presence of an <code class="inline"><span class="w">SV</span>*</code>
key, and returns the same
<code class="inline"><span class="w">SV</span>*</code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">HeSVKEY_set</span><span class="s">(</span><span class="w">HE</span>* <span class="w">he</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="HeUTF8"></a><b>HeUTF8
</b>
<p>Returns whether the <code class="inline"><span class="w">char</span> *</code>
value returned by <code class="inline"><span class="w">HePV</span></code>
is encoded in UTF-8,
doing any necessary dereferencing of possibly <code class="inline"><span class="w">SV</span>*</code>
keys. The value returned
will be 0 or non-0, not necessarily 1 (or even a value with any low bits set),
so <b>do not</b> blindly assign this to a <code class="inline"><span class="w">bool</span></code>
variable, as <code class="inline"><span class="w">bool</span></code>
may be a
typedef for <code class="inline"><span class="w">char</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">HeUTF8</span><span class="s">(</span><span class="w">HE</span>* <span class="w">he</span><span class="s">)</span></li></ol></pre></li>
<li><a name="HeVAL"></a><b>HeVAL
</b>
<p>Returns the value slot (type <code class="inline"><span class="w">SV</span>*</code>
)
stored in the hash entry. Can be assigned
to.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> *<span class="w">foo</span>= <span class="i">HeVAL</span><span class="s">(</span><span class="w">hv</span><span class="s">)</span><span class="sc">;</span></li><li> <span class="i">HeVAL</span><span class="s">(</span><span class="w">hv</span><span class="s">)</span>= <span class="w">sv</span><span class="sc">;</span></li><li></li><li></li><li> <span class="w">SV</span>* <span class="i">HeVAL</span><span class="s">(</span><span class="w">HE</span>* <span class="w">he</span><span class="s">)</span></li></ol></pre></li>
<li><a name="HvENAME"></a><b>HvENAME
</b>
<p>Returns the effective name of a stash, or NULL if there is none. The
effective name represents a location in the symbol table where this stash
resides. It is updated automatically when packages are aliased or deleted.
A stash that is no longer in the symbol table has no effective name. This
name is preferable to <code class="inline"><span class="w">HvNAME</span></code>
for use in MRO linearisations and isa
caches.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">HvENAME</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="HvENAMELEN"></a><b>HvENAMELEN
</b>
<p>Returns the length of the stash's effective name.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">HvENAMELEN</span><span class="s">(</span><span class="w">HV</span> *<span class="w">stash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="HvENAMEUTF8"></a><b>HvENAMEUTF8
</b>
<p>Returns true if the effective name is in UTF8 encoding.</p>
<pre class="verbatim"><ol><li> <span class="w">unsigned</span> <span class="w">char</span> <span class="i">HvENAMEUTF8</span><span class="s">(</span><span class="w">HV</span> *<span class="w">stash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="HvNAME"></a><b>HvNAME
</b>
<p>Returns the package name of a stash, or NULL if <code class="inline"><span class="w">stash</span></code>
isn't a stash.
See <code class="inline"><span class="w">SvSTASH</span></code>
, <code class="inline"><span class="w">CvSTASH</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">HvNAME</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="HvNAMELEN"></a><b>HvNAMELEN
</b>
<p>Returns the length of the stash's name.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">HvNAMELEN</span><span class="s">(</span><span class="w">HV</span> *<span class="w">stash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="HvNAMEUTF8"></a><b>HvNAMEUTF8
</b>
<p>Returns true if the name is in UTF8 encoding.</p>
<pre class="verbatim"><ol><li> <span class="w">unsigned</span> <span class="w">char</span> <span class="i">HvNAMEUTF8</span><span class="s">(</span><span class="w">HV</span> *<span class="w">stash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_assert"></a><b>hv_assert
</b>
<p>Check that a hash is in an internally consistent state.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">hv_assert</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_clear"></a><b>hv_clear
</b>
<p>Frees the all the elements of a hash, leaving it empty.
The XS equivalent of <code class="inline"><span class="i">%hash</span> = <span class="s">(</span><span class="s">)</span></code>
. See also <a href="#hv_undef">hv_undef</a>.</p>
<p>If any destructors are triggered as a result, the hv itself may
be freed.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">hv_clear</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_clear_placeholders"></a><b>hv_clear_placeholders
</b>
<p>Clears any placeholders from a hash. If a restricted hash has any of its keys
marked as readonly and the key is subsequently deleted, the key is not actually
deleted but is marked by assigning it a value of &PL_sv_placeholder. This tags
it so it will be ignored by future operations such as iterating over the hash,
but will still allow the hash to have a value reassigned to the key at some
future point. This function clears any such placeholder keys from the hash.
See Hash::Util::lock_keys() for an example of its use.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">hv_clear_placeholders</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_copy_hints_hv"></a><b>hv_copy_hints_hv
</b>
<p>A specialised version of <a href="#newHVhv">newHVhv</a> for copying <code class="inline"><span class="i">%^H</span></code>
. <i>ohv</i> must be
a pointer to a hash (which may have <code class="inline"><span class="i">%^H</span></code>
magic, but should be generally
non-magical), or <code class="inline"><span class="w">NULL</span></code>
(interpreted as an empty hash). The content
of <i>ohv</i> is copied to a new hash, which has the <code class="inline"><span class="i">%^H</span></code>
-specific magic
added to it. A pointer to the new hash is returned.</p>
<pre class="verbatim"><ol><li> <span class="w">HV</span> * <span class="i">hv_copy_hints_hv</span><span class="s">(</span><span class="w">HV</span> *<span class="w">ohv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_delete"></a><b>hv_delete
</b>
<p>Deletes a key/value pair in the hash. The value's SV is removed from
the hash, made mortal, and returned to the caller. The absolute
value of <code class="inline"><span class="w">klen</span></code>
is the length of the key. If <code class="inline"><span class="w">klen</span></code>
is negative the
key is assumed to be in UTF-8-encoded Unicode. The <code class="inline"><span class="w">flags</span></code>
value
will normally be zero; if set to G_DISCARD then NULL will be returned.
NULL will also be returned if the key is not found.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">hv_delete</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">key</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">klen</span><span class="cm">,</span></li><li> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_delete_ent"></a><b>hv_delete_ent
</b>
<p>Deletes a key/value pair in the hash. The value SV is removed from the hash,
made mortal, and returned to the caller. The <code class="inline"><span class="w">flags</span></code>
value will normally be
zero; if set to G_DISCARD then NULL will be returned. NULL will also be
returned if the key is not found. <code class="inline"><span class="w">hash</span></code>
can be a valid precomputed hash
value, or 0 to ask for it to be computed.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">hv_delete_ent</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">keysv</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">hash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_exists"></a><b>hv_exists
</b>
<p>Returns a boolean indicating whether the specified hash key exists. The
absolute value of <code class="inline"><span class="w">klen</span></code>
is the length of the key. If <code class="inline"><span class="w">klen</span></code>
is
negative the key is assumed to be in UTF-8-encoded Unicode.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">hv_exists</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">key</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">klen</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_exists_ent"></a><b>hv_exists_ent
</b>
<p>Returns a boolean indicating whether
the specified hash key exists. <code class="inline"><span class="w">hash</span></code>
can be a valid precomputed hash value, or 0 to ask for it to be
computed.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">hv_exists_ent</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">keysv</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">hash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_fetch"></a><b>hv_fetch
</b>
<p>Returns the SV which corresponds to the specified key in the hash.
The absolute value of <code class="inline"><span class="w">klen</span></code>
is the length of the key. If <code class="inline"><span class="w">klen</span></code>
is
negative the key is assumed to be in UTF-8-encoded Unicode. If
<code class="inline"><span class="w">lval</span></code>
is set then the fetch will be part of a store. This means that if
there is no value in the hash associated with the given key, then one is
created and a pointer to it is returned. The <code class="inline"><span class="w">SV</span>*</code>
it points to can be
assigned to. But always check that the
return value is non-null before dereferencing it to an <code class="inline"><span class="w">SV</span>*</code>
.</p>
<p>See <a href="perlguts.html#Understanding-the-Magic-of-Tied-Hashes-and-Arrays">Understanding the Magic of Tied Hashes and Arrays in perlguts</a> for more
information on how to use this function on tied hashes.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>** <span class="i">hv_fetch</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">key</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">klen</span><span class="cm">,</span></li><li> <span class="w">I32</span> <span class="w">lval</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_fetchs"></a><b>hv_fetchs
</b>
<p>Like <code class="inline"><span class="w">hv_fetch</span></code>
, but takes a literal string instead of a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>** <span class="i">hv_fetchs</span><span class="s">(</span><span class="w">HV</span>* <span class="w">tb</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">key</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">lval</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_fetch_ent"></a><b>hv_fetch_ent
</b>
<p>Returns the hash entry which corresponds to the specified key in the hash.
<code class="inline"><span class="w">hash</span></code>
must be a valid precomputed hash number for the given <code class="inline"><span class="w">key</span></code>
, or 0
if you want the function to compute it. IF <code class="inline"><span class="w">lval</span></code>
is set then the fetch
will be part of a store. Make sure the return value is non-null before
accessing it. The return value when <code class="inline"><span class="w">hv</span></code>
is a tied hash is a pointer to a
static location, so be sure to make a copy of the structure if you need to
store it somewhere.</p>
<p>See <a href="perlguts.html#Understanding-the-Magic-of-Tied-Hashes-and-Arrays">Understanding the Magic of Tied Hashes and Arrays in perlguts</a> for more
information on how to use this function on tied hashes.</p>
<pre class="verbatim"><ol><li> <span class="w">HE</span>* <span class="i">hv_fetch_ent</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">keysv</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">lval</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">hash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_fill"></a><b>hv_fill
</b>
<p>Returns the number of hash buckets that
happen to be in use. This function is
wrapped by the macro <code class="inline"><span class="w">HvFILL</span></code>
.</p>
<p>Previously this value was always stored in the HV structure, which created an
overhead on every hash (and pretty much every object) for something that was
rarely used. Now we calculate it on demand the first
time that it is needed, and cache it if that calculation
is going to be costly to repeat. The cached
value is updated by insertions and deletions, but (currently) discarded if
the hash is split.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">hv_fill</span><span class="s">(</span><span class="w">HV</span> *<span class="w">const</span> <span class="w">hv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_iterinit"></a><b>hv_iterinit
</b>
<p>Prepares a starting point to traverse a hash table. Returns the number of
keys in the hash (i.e. the same as <code class="inline"><span class="i">HvUSEDKEYS</span><span class="s">(</span><span class="w">hv</span><span class="s">)</span></code>
). The return value is
currently only meaningful for hashes without tie magic.</p>
<p>NOTE: Before version 5.004_65, <code class="inline"><span class="w">hv_iterinit</span></code>
used to return the number of
hash buckets that happen to be in use. If you still need that esoteric
value, you can get it through the macro <code class="inline"><span class="i">HvFILL</span><span class="s">(</span><span class="w">hv</span><span class="s">)</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">hv_iterinit</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_iterkey"></a><b>hv_iterkey
</b>
<p>Returns the key from the current position of the hash iterator. See
<code class="inline"><span class="w">hv_iterinit</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">hv_iterkey</span><span class="s">(</span><span class="w">HE</span>* <span class="w">entry</span><span class="cm">,</span> <span class="w">I32</span>* <span class="w">retlen</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_iterkeysv"></a><b>hv_iterkeysv
</b>
<p>Returns the key as an <code class="inline"><span class="w">SV</span>*</code>
from the current position of the hash
iterator. The return value will always be a mortal copy of the key. Also
see <code class="inline"><span class="w">hv_iterinit</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">hv_iterkeysv</span><span class="s">(</span><span class="w">HE</span>* <span class="w">entry</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_iternext"></a><b>hv_iternext
</b>
<p>Returns entries from a hash iterator. See <code class="inline"><span class="w">hv_iterinit</span></code>
.</p>
<p>You may call <code class="inline"><span class="w">hv_delete</span></code>
or <code class="inline"><span class="w">hv_delete_ent</span></code>
on the hash entry that the
iterator currently points to, without losing your place or invalidating your
iterator. Note that in this case the current entry is deleted from the hash
with your iterator holding the last reference to it. Your iterator is flagged
to free the entry on the next call to <code class="inline"><span class="w">hv_iternext</span></code>
, so you must not discard
your iterator immediately else the entry will leak - call <code class="inline"><span class="w">hv_iternext</span></code>
to
trigger the resource deallocation.</p>
<pre class="verbatim"><ol><li> <span class="w">HE</span>* <span class="i">hv_iternext</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_iternextsv"></a><b>hv_iternextsv
</b>
<p>Performs an <code class="inline"><span class="w">hv_iternext</span></code>
, <code class="inline"><span class="w">hv_iterkey</span></code>
, and <code class="inline"><span class="w">hv_iterval</span></code>
in one
operation.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">hv_iternextsv</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="cm">,</span> <span class="w">char</span> **<span class="w">key</span><span class="cm">,</span> <span class="w">I32</span> *<span class="w">retlen</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_iternext_flags"></a><b>hv_iternext_flags
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Returns entries from a hash iterator. See <code class="inline"><span class="w">hv_iterinit</span></code>
and <code class="inline"><span class="w">hv_iternext</span></code>
.
The <code class="inline"><span class="w">flags</span></code>
value will normally be zero; if HV_ITERNEXT_WANTPLACEHOLDERS is
set the placeholders keys (for restricted hashes) will be returned in addition
to normal keys. By default placeholders are automatically skipped over.
Currently a placeholder is implemented with a value that is
<code class="inline"><span class="i">&PL_sv_placeholder</span></code>
. Note that the implementation of placeholders and
restricted hashes may change, and the implementation currently is
insufficiently abstracted for any change to be tidy.</p>
<pre class="verbatim"><ol><li> <span class="w">HE</span>* <span class="i">hv_iternext_flags</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_iterval"></a><b>hv_iterval
</b>
<p>Returns the value from the current position of the hash iterator. See
<code class="inline"><span class="w">hv_iterkey</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">hv_iterval</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="cm">,</span> <span class="w">HE</span> *<span class="w">entry</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_magic"></a><b>hv_magic
</b>
<p>Adds magic to a hash. See <code class="inline"><span class="w">sv_magic</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">hv_magic</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="cm">,</span> <span class="w">GV</span> *<span class="w">gv</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">how</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_scalar"></a><b>hv_scalar
</b>
<p>Evaluates the hash in scalar context and returns the result. Handles magic
when the hash is tied.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">hv_scalar</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_store"></a><b>hv_store
</b>
<p>Stores an SV in a hash. The hash key is specified as <code class="inline"><span class="w">key</span></code>
and the
absolute value of <code class="inline"><span class="w">klen</span></code>
is the length of the key. If <code class="inline"><span class="w">klen</span></code>
is
negative the key is assumed to be in UTF-8-encoded Unicode. The
<code class="inline"><span class="w">hash</span></code>
parameter is the precomputed hash value; if it is zero then
Perl will compute it.</p>
<p>The return value will be
NULL if the operation failed or if the value did not need to be actually
stored within the hash (as in the case of tied hashes). Otherwise it can
be dereferenced to get the original <code class="inline"><span class="w">SV</span>*</code>
. Note that the caller is
responsible for suitably incrementing the reference count of <code class="inline"><span class="w">val</span></code>
before
the call, and decrementing it if the function returned NULL. Effectively
a successful hv_store takes ownership of one reference to <code class="inline"><span class="w">val</span></code>
. This is
usually what you want; a newly created SV has a reference count of one, so
if all your code does is create SVs then store them in a hash, hv_store
will own the only reference to the new SV, and your code doesn't need to do
anything further to tidy up. hv_store is not implemented as a call to
hv_store_ent, and does not create a temporary SV for the key, so if your
key data is not already in SV form then use hv_store in preference to
hv_store_ent.</p>
<p>See <a href="perlguts.html#Understanding-the-Magic-of-Tied-Hashes-and-Arrays">Understanding the Magic of Tied Hashes and Arrays in perlguts</a> for more
information on how to use this function on tied hashes.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>** <span class="i">hv_store</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">key</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">klen</span><span class="cm">,</span></li><li> <span class="w">SV</span> *<span class="w">val</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">hash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_stores"></a><b>hv_stores
</b>
<p>Like <code class="inline"><span class="w">hv_store</span></code>
, but takes a literal string instead of a string/length pair
and omits the hash parameter.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>** <span class="i">hv_stores</span><span class="s">(</span><span class="w">HV</span>* <span class="w">tb</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">key</span><span class="cm">,</span></li><li> <span class="w">NULLOK</span> <span class="w">SV</span>* <span class="w">val</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_store_ent"></a><b>hv_store_ent
</b>
<p>Stores <code class="inline"><span class="w">val</span></code>
in a hash. The hash key is specified as <code class="inline"><span class="w">key</span></code>
. The <code class="inline"><span class="w">hash</span></code>
parameter is the precomputed hash value; if it is zero then Perl will
compute it. The return value is the new hash entry so created. It will be
NULL if the operation failed or if the value did not need to be actually
stored within the hash (as in the case of tied hashes). Otherwise the
contents of the return value can be accessed using the <code class="inline">He?</code> macros
described here. Note that the caller is responsible for suitably
incrementing the reference count of <code class="inline"><span class="w">val</span></code>
before the call, and
decrementing it if the function returned NULL. Effectively a successful
hv_store_ent takes ownership of one reference to <code class="inline"><span class="w">val</span></code>
. This is
usually what you want; a newly created SV has a reference count of one, so
if all your code does is create SVs then store them in a hash, hv_store
will own the only reference to the new SV, and your code doesn't need to do
anything further to tidy up. Note that hv_store_ent only reads the <code class="inline"><span class="w">key</span></code>
;
unlike <code class="inline"><span class="w">val</span></code>
it does not take ownership of it, so maintaining the correct
reference count on <code class="inline"><span class="w">key</span></code>
is entirely the caller's responsibility. hv_store
is not implemented as a call to hv_store_ent, and does not create a temporary
SV for the key, so if your key data is not already in SV form then use
hv_store in preference to hv_store_ent.</p>
<p>See <a href="perlguts.html#Understanding-the-Magic-of-Tied-Hashes-and-Arrays">Understanding the Magic of Tied Hashes and Arrays in perlguts</a> for more
information on how to use this function on tied hashes.</p>
<pre class="verbatim"><ol><li> <span class="w">HE</span>* <span class="i">hv_store_ent</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">key</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">val</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">hash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="hv_undef"></a><b>hv_undef
</b>
<p>Undefines the hash. The XS equivalent of <code class="inline"><a class="l_k" href="functions/undef.html">undef(%hash)</a></code>.</p>
<p>As well as freeing all the elements of the hash (like hv_clear()), this
also frees any auxiliary data and storage associated with the hash.</p>
<p>If any destructors are triggered as a result, the hv itself may
be freed.</p>
<p>See also <a href="#hv_clear">hv_clear</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">hv_undef</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newHV"></a><b>newHV
</b>
<p>Creates a new HV. The reference count is set to 1.</p>
<pre class="verbatim"><ol><li> <span class="w">HV</span>* <span class="i">newHV</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Hook-manipulation"></a><h1>Hook manipulation</h1>
<p>These functions provide convenient and thread-safe means of manipulating
hook variables.</p>
<ul>
<li><a name="wrap_op_checker"></a><b>wrap_op_checker
</b>
<p>Puts a C function into the chain of check functions for a specified op
type. This is the preferred way to manipulate the <a href="#PL_check">PL_check</a> array.
<i>opcode</i> specifies which type of op is to be affected. <i>new_checker</i>
is a pointer to the C function that is to be added to that opcode's
check chain, and <i>old_checker_p</i> points to the storage location where a
pointer to the next function in the chain will be stored. The value of
<i>new_pointer</i> is written into the <a href="#PL_check">PL_check</a> array, while the value
previously stored there is written to <i>*old_checker_p</i>.</p>
<p>The function should be defined like this:</p>
<pre class="verbatim"><ol><li> <span class="w">static</span> <span class="w">OP</span> *<span class="i">new_checker</span><span class="s">(</span><span class="w">pTHX_</span> <span class="w">OP</span> *<span class="w">op</span><span class="s">)</span> <span class="s">{</span> ... <span class="s">}</span></li></ol></pre><p>It is intended to be called in this manner:</p>
<pre class="verbatim"><ol><li> <span class="i">new_checker</span><span class="s">(</span><span class="w">aTHX_</span> <span class="w">op</span><span class="s">)</span></li></ol></pre><p><i>old_checker_p</i> should be defined like this:</p>
<pre class="verbatim"><ol><li> <span class="w">static</span> <span class="w">Perl_check_t</span> <span class="w">old_checker_p</span><span class="sc">;</span></li></ol></pre><p><a href="#PL_check">PL_check</a> is global to an entire process, and a module wishing to
hook op checking may find itself invoked more than once per process,
typically in different threads. To handle that situation, this function
is idempotent. The location <i>*old_checker_p</i> must initially (once
per process) contain a null pointer. A C variable of static duration
(declared at file scope, typically also marked <code class="inline"><span class="w">static</span></code>
to give
it internal linkage) will be implicitly initialised appropriately,
if it does not have an explicit initialiser. This function will only
actually modify the check chain if it finds <i>*old_checker_p</i> to be null.
This function is also thread safe on the small scale. It uses appropriate
locking to avoid race conditions in accessing <a href="#PL_check">PL_check</a>.</p>
<p>When this function is called, the function referenced by <i>new_checker</i>
must be ready to be called, except for <i>*old_checker_p</i> being unfilled.
In a threading situation, <i>new_checker</i> may be called immediately,
even before this function has returned. <i>*old_checker_p</i> will always
be appropriately set before <i>new_checker</i> is called. If <i>new_checker</i>
decides not to do anything special with an op that it is given (which
is the usual case for most uses of op check hooking), it must chain the
check function referenced by <i>*old_checker_p</i>.</p>
<p>If you want to influence compilation of calls to a specific subroutine,
then use <a href="#cv_set_call_checker">cv_set_call_checker</a> rather than hooking checking of all
<code class="inline"><span class="w">entersub</span></code>
ops.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">wrap_op_checker</span><span class="s">(</span><span class="w">Optype</span> <span class="w">opcode</span><span class="cm">,</span></li><li> <span class="w">Perl_check_t</span> <span class="w">new_checker</span><span class="cm">,</span></li><li> <span class="w">Perl_check_t</span> *<span class="w">old_checker_p</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Lexer-interface"></a><h1>Lexer interface</h1>
<p>This is the lower layer of the Perl parser, managing characters and tokens.</p>
<ul>
<li><a name="lex_bufutf8"></a><b>lex_bufutf8
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Indicates whether the octets in the lexer buffer
(<a href="#PL_parser-%3elinestr">PL_parser->linestr</a>) should be interpreted as the UTF-8 encoding
of Unicode characters. If not, they should be interpreted as Latin-1
characters. This is analogous to the <code class="inline"><span class="w">SvUTF8</span></code>
flag for scalars.</p>
<p>In UTF-8 mode, it is not guaranteed that the lexer buffer actually
contains valid UTF-8. Lexing code must be robust in the face of invalid
encoding.</p>
<p>The actual <code class="inline"><span class="w">SvUTF8</span></code>
flag of the <a href="#PL_parser-%3elinestr">PL_parser->linestr</a> scalar
is significant, but not the whole story regarding the input character
encoding. Normally, when a file is being read, the scalar contains octets
and its <code class="inline"><span class="w">SvUTF8</span></code>
flag is off, but the octets should be interpreted as
UTF-8 if the <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">utf8</span></code>
pragma is in effect. During a string eval,
however, the scalar may have the <code class="inline"><span class="w">SvUTF8</span></code>
flag on, and in this case its
octets should be interpreted as UTF-8 unless the <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">bytes</span></code>
pragma
is in effect. This logic may change in the future; use this function
instead of implementing the logic yourself.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">lex_bufutf8</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="lex_discard_to"></a><b>lex_discard_to
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Discards the first part of the <a href="#PL_parser-%3elinestr">PL_parser->linestr</a> buffer,
up to <i>ptr</i>. The remaining content of the buffer will be moved, and
all pointers into the buffer updated appropriately. <i>ptr</i> must not
be later in the buffer than the position of <a href="#PL_parser-%3ebufptr">PL_parser->bufptr</a>:
it is not permitted to discard text that has yet to be lexed.</p>
<p>Normally it is not necessarily to do this directly, because it suffices to
use the implicit discarding behaviour of <a href="#lex_next_chunk">lex_next_chunk</a> and things
based on it. However, if a token stretches across multiple lines,
and the lexing code has kept multiple lines of text in the buffer for
that purpose, then after completion of the token it would be wise to
explicitly discard the now-unneeded earlier lines, to avoid future
multi-line tokens growing the buffer without bound.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">lex_discard_to</span><span class="s">(</span><span class="w">char</span> *<span class="w">ptr</span><span class="s">)</span></li></ol></pre></li>
<li><a name="lex_grow_linestr"></a><b>lex_grow_linestr
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Reallocates the lexer buffer (<a href="#PL_parser-%3elinestr">PL_parser->linestr</a>) to accommodate
at least <i>len</i> octets (including terminating <code class="inline"><span class="w">NUL</span></code>
). Returns a
pointer to the reallocated buffer. This is necessary before making
any direct modification of the buffer that would increase its length.
<a href="#lex_stuff_pvn">lex_stuff_pvn</a> provides a more convenient way to insert text into
the buffer.</p>
<p>Do not use <code class="inline"><span class="w">SvGROW</span></code>
or <code class="inline"><span class="w">sv_grow</span></code>
directly on <code class="inline"><span class="w">PL_parser</span><span class="w">->linestr</span></code>
;
this function updates all of the lexer's variables that point directly
into the buffer.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span> * <span class="i">lex_grow_linestr</span><span class="s">(</span><span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="lex_next_chunk"></a><b>lex_next_chunk
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Reads in the next chunk of text to be lexed, appending it to
<a href="#PL_parser-%3elinestr">PL_parser->linestr</a>. This should be called when lexing code has
looked to the end of the current chunk and wants to know more. It is
usual, but not necessary, for lexing to have consumed the entirety of
the current chunk at this time.</p>
<p>If <a href="#PL_parser-%3ebufptr">PL_parser->bufptr</a> is pointing to the very end of the current
chunk (i.e., the current chunk has been entirely consumed), normally the
current chunk will be discarded at the same time that the new chunk is
read in. If <i>flags</i> includes <code class="inline"><span class="w">LEX_KEEP_PREVIOUS</span></code>
, the current chunk
will not be discarded. If the current chunk has not been entirely
consumed, then it will not be discarded regardless of the flag.</p>
<p>Returns true if some new text was added to the buffer, or false if the
buffer has reached the end of the input text.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">lex_next_chunk</span><span class="s">(</span><span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="lex_peek_unichar"></a><b>lex_peek_unichar
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Looks ahead one (Unicode) character in the text currently being lexed.
Returns the codepoint (unsigned integer value) of the next character,
or -1 if lexing has reached the end of the input text. To consume the
peeked character, use <a href="#lex_read_unichar">lex_read_unichar</a>.</p>
<p>If the next character is in (or extends into) the next chunk of input
text, the next chunk will be read in. Normally the current chunk will be
discarded at the same time, but if <i>flags</i> includes <code class="inline"><span class="w">LEX_KEEP_PREVIOUS</span></code>
then the current chunk will not be discarded.</p>
<p>If the input is being interpreted as UTF-8 and a UTF-8 encoding error
is encountered, an exception is generated.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">lex_peek_unichar</span><span class="s">(</span><span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="lex_read_space"></a><b>lex_read_space
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Reads optional spaces, in Perl style, in the text currently being
lexed. The spaces may include ordinary whitespace characters and
Perl-style comments. <code class="inline"><span class="c">#line</span></code>
directives are processed if encountered.
<a href="#PL_parser-%3ebufptr">PL_parser->bufptr</a> is moved past the spaces, so that it points
at a non-space character (or the end of the input text).</p>
<p>If spaces extend into the next chunk of input text, the next chunk will
be read in. Normally the current chunk will be discarded at the same
time, but if <i>flags</i> includes <code class="inline"><span class="w">LEX_KEEP_PREVIOUS</span></code>
then the current
chunk will not be discarded.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">lex_read_space</span><span class="s">(</span><span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="lex_read_to"></a><b>lex_read_to
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Consume text in the lexer buffer, from <a href="#PL_parser-%3ebufptr">PL_parser->bufptr</a> up
to <i>ptr</i>. This advances <a href="#PL_parser-%3ebufptr">PL_parser->bufptr</a> to match <i>ptr</i>,
performing the correct bookkeeping whenever a newline character is passed.
This is the normal way to consume lexed text.</p>
<p>Interpretation of the buffer's octets can be abstracted out by
using the slightly higher-level functions <a href="#lex_peek_unichar">lex_peek_unichar</a> and
<a href="#lex_read_unichar">lex_read_unichar</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">lex_read_to</span><span class="s">(</span><span class="w">char</span> *<span class="w">ptr</span><span class="s">)</span></li></ol></pre></li>
<li><a name="lex_read_unichar"></a><b>lex_read_unichar
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Reads the next (Unicode) character in the text currently being lexed.
Returns the codepoint (unsigned integer value) of the character read,
and moves <a href="#PL_parser-%3ebufptr">PL_parser->bufptr</a> past the character, or returns -1
if lexing has reached the end of the input text. To non-destructively
examine the next character, use <a href="#lex_peek_unichar">lex_peek_unichar</a> instead.</p>
<p>If the next character is in (or extends into) the next chunk of input
text, the next chunk will be read in. Normally the current chunk will be
discarded at the same time, but if <i>flags</i> includes <code class="inline"><span class="w">LEX_KEEP_PREVIOUS</span></code>
then the current chunk will not be discarded.</p>
<p>If the input is being interpreted as UTF-8 and a UTF-8 encoding error
is encountered, an exception is generated.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">lex_read_unichar</span><span class="s">(</span><span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="lex_start"></a><b>lex_start
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Creates and initialises a new lexer/parser state object, supplying
a context in which to lex and parse from a new source of Perl code.
A pointer to the new state object is placed in <a href="#PL_parser">PL_parser</a>. An entry
is made on the save stack so that upon unwinding the new state object
will be destroyed and the former value of <a href="#PL_parser">PL_parser</a> will be restored.
Nothing else need be done to clean up the parsing context.</p>
<p>The code to be parsed comes from <i>line</i> and <i>rsfp</i>. <i>line</i>, if
non-null, provides a string (in SV form) containing code to be parsed.
A copy of the string is made, so subsequent modification of <i>line</i>
does not affect parsing. <i>rsfp</i>, if non-null, provides an input stream
from which code will be read to be parsed. If both are non-null, the
code in <i>line</i> comes first and must consist of complete lines of input,
and <i>rsfp</i> supplies the remainder of the source.</p>
<p>The <i>flags</i> parameter is reserved for future use. Currently it is only
used by perl internally, so extensions should always pass zero.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">lex_start</span><span class="s">(</span><span class="w">SV</span> *<span class="w">line</span><span class="cm">,</span> <span class="w">PerlIO</span> *<span class="w">rsfp</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="lex_stuff_pv"></a><b>lex_stuff_pv
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Insert characters into the lexer buffer (<a href="#PL_parser-%3elinestr">PL_parser->linestr</a>),
immediately after the current lexing point (<a href="#PL_parser-%3ebufptr">PL_parser->bufptr</a>),
reallocating the buffer if necessary. This means that lexing code that
runs later will see the characters as if they had appeared in the input.
It is not recommended to do this as part of normal parsing, and most
uses of this facility run the risk of the inserted characters being
interpreted in an unintended manner.</p>
<p>The string to be inserted is represented by octets starting at <i>pv</i>
and continuing to the first nul. These octets are interpreted as either
UTF-8 or Latin-1, according to whether the <code class="inline"><span class="w">LEX_STUFF_UTF8</span></code>
flag is set
in <i>flags</i>. The characters are recoded for the lexer buffer, according
to how the buffer is currently being interpreted (<a href="#lex_bufutf8">lex_bufutf8</a>).
If it is not convenient to nul-terminate a string to be inserted, the
<a href="#lex_stuff_pvn">lex_stuff_pvn</a> function is more appropriate.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">lex_stuff_pv</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">pv</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="lex_stuff_pvn"></a><b>lex_stuff_pvn
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Insert characters into the lexer buffer (<a href="#PL_parser-%3elinestr">PL_parser->linestr</a>),
immediately after the current lexing point (<a href="#PL_parser-%3ebufptr">PL_parser->bufptr</a>),
reallocating the buffer if necessary. This means that lexing code that
runs later will see the characters as if they had appeared in the input.
It is not recommended to do this as part of normal parsing, and most
uses of this facility run the risk of the inserted characters being
interpreted in an unintended manner.</p>
<p>The string to be inserted is represented by <i>len</i> octets starting
at <i>pv</i>. These octets are interpreted as either UTF-8 or Latin-1,
according to whether the <code class="inline"><span class="w">LEX_STUFF_UTF8</span></code>
flag is set in <i>flags</i>.
The characters are recoded for the lexer buffer, according to how the
buffer is currently being interpreted (<a href="#lex_bufutf8">lex_bufutf8</a>). If a string
to be inserted is available as a Perl scalar, the <a href="#lex_stuff_sv">lex_stuff_sv</a>
function is more convenient.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">lex_stuff_pvn</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">pv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="lex_stuff_pvs"></a><b>lex_stuff_pvs
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Like <a href="#lex_stuff_pvn">lex_stuff_pvn</a>, but takes a literal string instead of a
string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">lex_stuff_pvs</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">pv</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="lex_stuff_sv"></a><b>lex_stuff_sv
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Insert characters into the lexer buffer (<a href="#PL_parser-%3elinestr">PL_parser->linestr</a>),
immediately after the current lexing point (<a href="#PL_parser-%3ebufptr">PL_parser->bufptr</a>),
reallocating the buffer if necessary. This means that lexing code that
runs later will see the characters as if they had appeared in the input.
It is not recommended to do this as part of normal parsing, and most
uses of this facility run the risk of the inserted characters being
interpreted in an unintended manner.</p>
<p>The string to be inserted is the string value of <i>sv</i>. The characters
are recoded for the lexer buffer, according to how the buffer is currently
being interpreted (<a href="#lex_bufutf8">lex_bufutf8</a>). If a string to be inserted is
not already a Perl scalar, the <a href="#lex_stuff_pvn">lex_stuff_pvn</a> function avoids the
need to construct a scalar.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">lex_stuff_sv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="lex_unstuff"></a><b>lex_unstuff
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Discards text about to be lexed, from <a href="#PL_parser-%3ebufptr">PL_parser->bufptr</a> up to
<i>ptr</i>. Text following <i>ptr</i> will be moved, and the buffer shortened.
This hides the discarded text from any lexing code that runs later,
as if the text had never appeared.</p>
<p>This is not the normal way to consume lexed text. For that, use
<a href="#lex_read_to">lex_read_to</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">lex_unstuff</span><span class="s">(</span><span class="w">char</span> *<span class="w">ptr</span><span class="s">)</span></li></ol></pre></li>
<li><a name="parse_arithexpr"></a><b>parse_arithexpr
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Parse a Perl arithmetic expression. This may contain operators of precedence
down to the bit shift operators. The expression must be followed (and thus
terminated) either by a comparison or lower-precedence operator or by
something that would normally terminate an expression such as semicolon.
If <i>flags</i> includes <code class="inline"><span class="w">PARSE_OPTIONAL</span></code>
then the expression is optional,
otherwise it is mandatory. It is up to the caller to ensure that the
dynamic parser state (<a href="#PL_parser">PL_parser</a> et al) is correctly set to reflect
the source of the code to be parsed and the lexical context for the
expression.</p>
<p>The op tree representing the expression is returned. If an optional
expression is absent, a null pointer is returned, otherwise the pointer
will be non-null.</p>
<p>If an error occurs in parsing or compilation, in most cases a valid op
tree is returned anyway. The error is reflected in the parser state,
normally resulting in a single exception at the top level of parsing
which covers all the compilation errors that occurred. Some compilation
errors, however, will throw an exception immediately.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">parse_arithexpr</span><span class="s">(</span><span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="parse_barestmt"></a><b>parse_barestmt
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Parse a single unadorned Perl statement. This may be a normal imperative
statement or a declaration that has compile-time effect. It does not
include any label or other affixture. It is up to the caller to ensure
that the dynamic parser state (<a href="#PL_parser">PL_parser</a> et al) is correctly set to
reflect the source of the code to be parsed and the lexical context for
the statement.</p>
<p>The op tree representing the statement is returned. This may be a
null pointer if the statement is null, for example if it was actually
a subroutine definition (which has compile-time side effects). If not
null, it will be ops directly implementing the statement, suitable to
pass to <a href="#newSTATEOP">newSTATEOP</a>. It will not normally include a <code class="inline"><span class="w">nextstate</span></code>
or
equivalent op (except for those embedded in a scope contained entirely
within the statement).</p>
<p>If an error occurs in parsing or compilation, in most cases a valid op
tree (most likely null) is returned anyway. The error is reflected in
the parser state, normally resulting in a single exception at the top
level of parsing which covers all the compilation errors that occurred.
Some compilation errors, however, will throw an exception immediately.</p>
<p>The <i>flags</i> parameter is reserved for future use, and must always
be zero.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">parse_barestmt</span><span class="s">(</span><span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="parse_block"></a><b>parse_block
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Parse a single complete Perl code block. This consists of an opening
brace, a sequence of statements, and a closing brace. The block
constitutes a lexical scope, so <code class="inline"><a class="l_k" href="functions/my.html">my</a></code> variables and various compile-time
effects can be contained within it. It is up to the caller to ensure
that the dynamic parser state (<a href="#PL_parser">PL_parser</a> et al) is correctly set to
reflect the source of the code to be parsed and the lexical context for
the statement.</p>
<p>The op tree representing the code block is returned. This is always a
real op, never a null pointer. It will normally be a <code class="inline"><span class="w">lineseq</span></code>
list,
including <code class="inline"><span class="w">nextstate</span></code>
or equivalent ops. No ops to construct any kind
of runtime scope are included by virtue of it being a block.</p>
<p>If an error occurs in parsing or compilation, in most cases a valid op
tree (most likely null) is returned anyway. The error is reflected in
the parser state, normally resulting in a single exception at the top
level of parsing which covers all the compilation errors that occurred.
Some compilation errors, however, will throw an exception immediately.</p>
<p>The <i>flags</i> parameter is reserved for future use, and must always
be zero.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">parse_block</span><span class="s">(</span><span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="parse_fullexpr"></a><b>parse_fullexpr
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Parse a single complete Perl expression. This allows the full
expression grammar, including the lowest-precedence operators such
as <code class="inline">or</code>
. The expression must be followed (and thus terminated) by a
token that an expression would normally be terminated by: end-of-file,
closing bracketing punctuation, semicolon, or one of the keywords that
signals a postfix expression-statement modifier. If <i>flags</i> includes
<code class="inline"><span class="w">PARSE_OPTIONAL</span></code>
then the expression is optional, otherwise it is
mandatory. It is up to the caller to ensure that the dynamic parser
state (<a href="#PL_parser">PL_parser</a> et al) is correctly set to reflect the source of
the code to be parsed and the lexical context for the expression.</p>
<p>The op tree representing the expression is returned. If an optional
expression is absent, a null pointer is returned, otherwise the pointer
will be non-null.</p>
<p>If an error occurs in parsing or compilation, in most cases a valid op
tree is returned anyway. The error is reflected in the parser state,
normally resulting in a single exception at the top level of parsing
which covers all the compilation errors that occurred. Some compilation
errors, however, will throw an exception immediately.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">parse_fullexpr</span><span class="s">(</span><span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="parse_fullstmt"></a><b>parse_fullstmt
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Parse a single complete Perl statement. This may be a normal imperative
statement or a declaration that has compile-time effect, and may include
optional labels. It is up to the caller to ensure that the dynamic
parser state (<a href="#PL_parser">PL_parser</a> et al) is correctly set to reflect the source
of the code to be parsed and the lexical context for the statement.</p>
<p>The op tree representing the statement is returned. This may be a
null pointer if the statement is null, for example if it was actually
a subroutine definition (which has compile-time side effects). If not
null, it will be the result of a <a href="#newSTATEOP">newSTATEOP</a> call, normally including
a <code class="inline"><span class="w">nextstate</span></code>
or equivalent op.</p>
<p>If an error occurs in parsing or compilation, in most cases a valid op
tree (most likely null) is returned anyway. The error is reflected in
the parser state, normally resulting in a single exception at the top
level of parsing which covers all the compilation errors that occurred.
Some compilation errors, however, will throw an exception immediately.</p>
<p>The <i>flags</i> parameter is reserved for future use, and must always
be zero.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">parse_fullstmt</span><span class="s">(</span><span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="parse_label"></a><b>parse_label
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Parse a single label, possibly optional, of the type that may prefix a
Perl statement. It is up to the caller to ensure that the dynamic parser
state (<a href="#PL_parser">PL_parser</a> et al) is correctly set to reflect the source of
the code to be parsed. If <i>flags</i> includes <code class="inline"><span class="w">PARSE_OPTIONAL</span></code>
then the
label is optional, otherwise it is mandatory.</p>
<p>The name of the label is returned in the form of a fresh scalar. If an
optional label is absent, a null pointer is returned.</p>
<p>If an error occurs in parsing, which can only occur if the label is
mandatory, a valid label is returned anyway. The error is reflected in
the parser state, normally resulting in a single exception at the top
level of parsing which covers all the compilation errors that occurred.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">parse_label</span><span class="s">(</span><span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="parse_listexpr"></a><b>parse_listexpr
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Parse a Perl list expression. This may contain operators of precedence
down to the comma operator. The expression must be followed (and thus
terminated) either by a low-precedence logic operator such as <code class="inline">or</code>
or by
something that would normally terminate an expression such as semicolon.
If <i>flags</i> includes <code class="inline"><span class="w">PARSE_OPTIONAL</span></code>
then the expression is optional,
otherwise it is mandatory. It is up to the caller to ensure that the
dynamic parser state (<a href="#PL_parser">PL_parser</a> et al) is correctly set to reflect
the source of the code to be parsed and the lexical context for the
expression.</p>
<p>The op tree representing the expression is returned. If an optional
expression is absent, a null pointer is returned, otherwise the pointer
will be non-null.</p>
<p>If an error occurs in parsing or compilation, in most cases a valid op
tree is returned anyway. The error is reflected in the parser state,
normally resulting in a single exception at the top level of parsing
which covers all the compilation errors that occurred. Some compilation
errors, however, will throw an exception immediately.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">parse_listexpr</span><span class="s">(</span><span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="parse_stmtseq"></a><b>parse_stmtseq
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Parse a sequence of zero or more Perl statements. These may be normal
imperative statements, including optional labels, or declarations
that have compile-time effect, or any mixture thereof. The statement
sequence ends when a closing brace or end-of-file is encountered in a
place where a new statement could have validly started. It is up to
the caller to ensure that the dynamic parser state (<a href="#PL_parser">PL_parser</a> et al)
is correctly set to reflect the source of the code to be parsed and the
lexical context for the statements.</p>
<p>The op tree representing the statement sequence is returned. This may
be a null pointer if the statements were all null, for example if there
were no statements or if there were only subroutine definitions (which
have compile-time side effects). If not null, it will be a <code class="inline"><span class="w">lineseq</span></code>
list, normally including <code class="inline"><span class="w">nextstate</span></code>
or equivalent ops.</p>
<p>If an error occurs in parsing or compilation, in most cases a valid op
tree is returned anyway. The error is reflected in the parser state,
normally resulting in a single exception at the top level of parsing
which covers all the compilation errors that occurred. Some compilation
errors, however, will throw an exception immediately.</p>
<p>The <i>flags</i> parameter is reserved for future use, and must always
be zero.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">parse_stmtseq</span><span class="s">(</span><span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="parse_termexpr"></a><b>parse_termexpr
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Parse a Perl term expression. This may contain operators of precedence
down to the assignment operators. The expression must be followed (and thus
terminated) either by a comma or lower-precedence operator or by
something that would normally terminate an expression such as semicolon.
If <i>flags</i> includes <code class="inline"><span class="w">PARSE_OPTIONAL</span></code>
then the expression is optional,
otherwise it is mandatory. It is up to the caller to ensure that the
dynamic parser state (<a href="#PL_parser">PL_parser</a> et al) is correctly set to reflect
the source of the code to be parsed and the lexical context for the
expression.</p>
<p>The op tree representing the expression is returned. If an optional
expression is absent, a null pointer is returned, otherwise the pointer
will be non-null.</p>
<p>If an error occurs in parsing or compilation, in most cases a valid op
tree is returned anyway. The error is reflected in the parser state,
normally resulting in a single exception at the top level of parsing
which covers all the compilation errors that occurred. Some compilation
errors, however, will throw an exception immediately.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">parse_termexpr</span><span class="s">(</span><span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PL_parser"></a><b>PL_parser
</b>
<p>Pointer to a structure encapsulating the state of the parsing operation
currently in progress. The pointer can be locally changed to perform
a nested parse without interfering with the state of an outer parse.
Individual members of <code class="inline"><span class="w">PL_parser</span></code>
have their own documentation.</p>
</li>
<li><a name="PL_parser-%3ebufend"></a><b>PL_parser->bufend
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Direct pointer to the end of the chunk of text currently being lexed, the
end of the lexer buffer. This is equal to <code class="inline"><span class="i">SvPVX</span><span class="s">(</span><span class="w">PL_parser</span><span class="w">->linestr</span><span class="s">)</span>
+ <span class="i">SvCUR</span><span class="s">(</span><span class="w">PL_parser</span><span class="w">->linestr</span><span class="s">)</span></code>
. A <code class="inline"><span class="w">NUL</span></code>
character (zero octet) is
always located at the end of the buffer, and does not count as part of
the buffer's contents.</p>
</li>
<li><a name="PL_parser-%3ebufptr"></a><b>PL_parser->bufptr
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Points to the current position of lexing inside the lexer buffer.
Characters around this point may be freely examined, within
the range delimited by <code class="inline">SvPVX(<a href="#PL_parser-%3elinestr">PL_parser->linestr</a>)</code> and
<a href="#PL_parser-%3ebufend">PL_parser->bufend</a>. The octets of the buffer may be intended to be
interpreted as either UTF-8 or Latin-1, as indicated by <a href="#lex_bufutf8">lex_bufutf8</a>.</p>
<p>Lexing code (whether in the Perl core or not) moves this pointer past
the characters that it consumes. It is also expected to perform some
bookkeeping whenever a newline character is consumed. This movement
can be more conveniently performed by the function <a href="#lex_read_to">lex_read_to</a>,
which handles newlines appropriately.</p>
<p>Interpretation of the buffer's octets can be abstracted out by
using the slightly higher-level functions <a href="#lex_peek_unichar">lex_peek_unichar</a> and
<a href="#lex_read_unichar">lex_read_unichar</a>.</p>
</li>
<li><a name="PL_parser-%3elinestart"></a><b>PL_parser->linestart
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Points to the start of the current line inside the lexer buffer.
This is useful for indicating at which column an error occurred, and
not much else. This must be updated by any lexing code that consumes
a newline; the function <a href="#lex_read_to">lex_read_to</a> handles this detail.</p>
</li>
<li><a name="PL_parser-%3elinestr"></a><b>PL_parser->linestr
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Buffer scalar containing the chunk currently under consideration of the
text currently being lexed. This is always a plain string scalar (for
which <code class="inline"><span class="w">SvPOK</span></code>
is true). It is not intended to be used as a scalar by
normal scalar means; instead refer to the buffer directly by the pointer
variables described below.</p>
<p>The lexer maintains various <code class="inline"><span class="w">char</span>*</code>
pointers to things in the
<code class="inline"><span class="w">PL_parser</span><span class="w">->linestr</span></code>
buffer. If <code class="inline"><span class="w">PL_parser</span><span class="w">->linestr</span></code>
is ever
reallocated, all of these pointers must be updated. Don't attempt to
do this manually, but rather use <a href="#lex_grow_linestr">lex_grow_linestr</a> if you need to
reallocate the buffer.</p>
<p>The content of the text chunk in the buffer is commonly exactly one
complete line of input, up to and including a newline terminator,
but there are situations where it is otherwise. The octets of the
buffer may be intended to be interpreted as either UTF-8 or Latin-1.
The function <a href="#lex_bufutf8">lex_bufutf8</a> tells you which. Do not use the <code class="inline"><span class="w">SvUTF8</span></code>
flag on this scalar, which may disagree with it.</p>
<p>For direct examination of the buffer, the variable
<a href="#PL_parser-%3ebufend">PL_parser->bufend</a> points to the end of the buffer. The current
lexing position is pointed to by <a href="#PL_parser-%3ebufptr">PL_parser->bufptr</a>. Direct use
of these pointers is usually preferable to examination of the scalar
through normal scalar means.</p>
</li>
</ul>
<a name="Locale-related-functions-and-macros"></a><h1>Locale-related functions and macros</h1>
<ul>
<li><a name="DECLARATION_FOR_LC_NUMERIC_MANIPULATION"></a><b>DECLARATION_FOR_LC_NUMERIC_MANIPULATION
</b>
<p>This macro should be used as a statement. It declares a private variable
(whose name begins with an underscore) that is needed by the other macros in
this section. Failing to include this correctly should lead to a syntax error.
For compatibility with C89 C compilers it should be placed in a block before
any executable statements.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="w">DECLARATION_FOR_LC_NUMERIC_MANIPULATION</span></li></ol></pre></li>
<li><a name="RESTORE_LC_NUMERIC"></a><b>RESTORE_LC_NUMERIC
</b>
<p>This is used in conjunction with one of the macros
<a href="#STORE_LC_NUMERIC_SET_TO_NEEDED">STORE_LC_NUMERIC_SET_TO_NEEDED</a>
and
<a href="#STORE_LC_NUMERIC_FORCE_TO_UNDERLYING">STORE_LC_NUMERIC_FORCE_TO_UNDERLYING</a></p>
<p>to properly restore the <code class="inline"><span class="w">LC_NUMERIC</span></code>
state.</p>
<p>A call to <a href="#DECLARATION_FOR_LC_NUMERIC_MANIPULATION">DECLARATION_FOR_LC_NUMERIC_MANIPULATION</a> must have been made to
declare at compile time a private variable used by this macro and the two
<code class="inline"><span class="w">STORE</span></code>
ones. This macro should be called as a single statement, not an
expression, but with an empty argument list, like this:</p>
<pre class="verbatim"><ol><li> <span class="s">{</span></li><li> <span class="w">DECLARATION_FOR_LC_NUMERIC_MANIPULATION</span><span class="sc">;</span></li><li> ...</li><li> <span class="i">RESTORE_LC_NUMERIC</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span></li><li> ...</li><li> <span class="s">}</span></li><li></li><li> <span class="w">void</span> <span class="i">RESTORE_LC_NUMERIC</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="STORE_LC_NUMERIC_FORCE_TO_UNDERLYING"></a><b>STORE_LC_NUMERIC_FORCE_TO_UNDERLYING
</b>
<p>This is used by XS code that that is <code class="inline"><span class="w">LC_NUMERIC</span></code>
locale-aware to force the
locale for category <code class="inline"><span class="w">LC_NUMERIC</span></code>
to be what perl thinks is the current
underlying locale. (The perl interpreter could be wrong about what the
underlying locale actually is if some C or XS code has called the C library
function <i>setlocale(3)</i> behind its back; calling <a href="#sync_locale">sync_locale</a> before calling
this macro will update perl's records.)</p>
<p>A call to <a href="#DECLARATION_FOR_LC_NUMERIC_MANIPULATION">DECLARATION_FOR_LC_NUMERIC_MANIPULATION</a> must have been made to
declare at compile time a private variable used by this macro. This macro
should be called as a single statement, not an expression, but with an empty
argument list, like this:</p>
<pre class="verbatim"><ol><li> <span class="s">{</span></li><li> <span class="w">DECLARATION_FOR_LC_NUMERIC_MANIPULATION</span><span class="sc">;</span></li><li> ...</li><li> <span class="i">STORE_LC_NUMERIC_FORCE_TO_UNDERLYING</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span></li><li> ...</li><li> <span class="i">RESTORE_LC_NUMERIC</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span></li><li> ...</li><li> <span class="s">}</span></li></ol></pre><p>The private variable is used to save the current locale state, so
that the requisite matching call to <a href="#RESTORE_LC_NUMERIC">RESTORE_LC_NUMERIC</a> can restore it.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">STORE_LC_NUMERIC_FORCE_TO_UNDERLYING</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="STORE_LC_NUMERIC_SET_TO_NEEDED"></a><b>STORE_LC_NUMERIC_SET_TO_NEEDED
</b>
<p>This is used to help wrap XS or C code that that is <code class="inline"><span class="w">LC_NUMERIC</span></code>
locale-aware.
This locale category is generally kept set to the C locale by Perl for
backwards compatibility, and because most XS code that reads floating point
values can cope only with the decimal radix character being a dot.</p>
<p>This macro makes sure the current <code class="inline"><span class="w">LC_NUMERIC</span></code>
state is set properly, to be
aware of locale if the call to the XS or C code from the Perl program is
from within the scope of a <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">locale</span></code>
; or to ignore locale if the call is
instead from outside such scope.</p>
<p>This macro is the start of wrapping the C or XS code; the wrap ending is done
by calling the <a href="#RESTORE_LC_NUMERIC">RESTORE_LC_NUMERIC</a> macro after the operation. Otherwise
the state can be changed that will adversely affect other XS code.</p>
<p>A call to <a href="#DECLARATION_FOR_LC_NUMERIC_MANIPULATION">DECLARATION_FOR_LC_NUMERIC_MANIPULATION</a> must have been made to
declare at compile time a private variable used by this macro. This macro
should be called as a single statement, not an expression, but with an empty
argument list, like this:</p>
<pre class="verbatim"><ol><li> <span class="s">{</span></li><li> <span class="w">DECLARATION_FOR_LC_NUMERIC_MANIPULATION</span><span class="sc">;</span></li><li> ...</li><li> <span class="i">STORE_LC_NUMERIC_SET_TO_NEEDED</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span></li><li> ...</li><li> <span class="i">RESTORE_LC_NUMERIC</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span></li><li> ...</li><li> <span class="s">}</span></li><li></li><li> <span class="w">void</span> <span class="i">STORE_LC_NUMERIC_SET_TO_NEEDED</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sync_locale"></a><b>sync_locale
</b>
<p>Changing the program's locale should be avoided by XS code. Nevertheless,
certain non-Perl libraries called from XS, such as <code class="inline"><span class="w">Gtk</span></code>
do so. When this
happens, Perl needs to be told that the locale has changed. Use this function
to do so, before returning to Perl.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sync_locale</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Magical-Functions"></a><h1>Magical Functions</h1>
<ul>
<li><a name="mg_clear"></a><b>mg_clear
</b>
<p>Clear something magical that the SV represents. See <code class="inline"><span class="w">sv_magic</span></code>
.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">mg_clear</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mg_copy"></a><b>mg_copy
</b>
<p>Copies the magic from one SV to another. See <code class="inline"><span class="w">sv_magic</span></code>
.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">mg_copy</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">nsv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">key</span><span class="cm">,</span></li><li> <span class="w">I32</span> <span class="w">klen</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mg_find"></a><b>mg_find
</b>
<p>Finds the magic pointer for type matching the SV. See <code class="inline"><span class="w">sv_magic</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">MAGIC</span>* <span class="i">mg_find</span><span class="s">(</span><span class="w">const</span> <span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mg_findext"></a><b>mg_findext
</b>
<p>Finds the magic pointer of <code class="inline"><span class="w">type</span></code>
with the given <code class="inline"><span class="w">vtbl</span></code>
for the <code class="inline"><span class="w">SV</span></code>
. See
<code class="inline"><span class="w">sv_magicext</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">MAGIC</span>* <span class="i">mg_findext</span><span class="s">(</span><span class="w">const</span> <span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">type</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">MGVTBL</span> *<span class="w">vtbl</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mg_free"></a><b>mg_free
</b>
<p>Free any magic storage used by the SV. See <code class="inline"><span class="w">sv_magic</span></code>
.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">mg_free</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mg_free_type"></a><b>mg_free_type
</b>
<p>Remove any magic of type <i>how</i> from the SV <i>sv</i>. See <a href="#sv_magic">sv_magic</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">mg_free_type</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">how</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mg_get"></a><b>mg_get
</b>
<p>Do magic before a value is retrieved from the SV. The type of SV must
be >= SVt_PVMG. See <code class="inline"><span class="w">sv_magic</span></code>
.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">mg_get</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mg_length"></a><b>mg_length
</b>
<p>DEPRECATED! It is planned to remove this function from a
future release of Perl. Do not use it for new code; remove it from
existing code.</p>
<p>Reports on the SV's length in bytes, calling length magic if available,
but does not set the UTF8 flag on the sv. It will fall back to 'get'
magic if there is no 'length' magic, but with no indication as to
whether it called 'get' magic. It assumes the sv is a PVMG or
higher. Use sv_len() instead.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">mg_length</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mg_magical"></a><b>mg_magical
</b>
<p>Turns on the magical status of an SV. See <code class="inline"><span class="w">sv_magic</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">mg_magical</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mg_set"></a><b>mg_set
</b>
<p>Do magic after a value is assigned to the SV. See <code class="inline"><span class="w">sv_magic</span></code>
.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">mg_set</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvGETMAGIC"></a><b>SvGETMAGIC
</b>
<p>Invokes <code class="inline"><span class="w">mg_get</span></code>
on an SV if it has 'get' magic. For example, this
will call <code class="inline"><span class="w">FETCH</span></code>
on a tied variable. This macro evaluates its
argument more than once.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvGETMAGIC</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvLOCK"></a><b>SvLOCK
</b>
<p>Arranges for a mutual exclusion lock to be obtained on sv if a suitable module
has been loaded.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvLOCK</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvSETMAGIC"></a><b>SvSETMAGIC
</b>
<p>Invokes <code class="inline"><span class="w">mg_set</span></code>
on an SV if it has 'set' magic. This is necessary
after modifying a scalar, in case it is a magical variable like <code class="inline"><span class="i">$|</span></code>
or a tied variable (it calls <code class="inline"><span class="w">STORE</span></code>
). This macro evaluates its
argument more than once.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvSETMAGIC</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvSetMagicSV"></a><b>SvSetMagicSV
</b>
<p>Like <code class="inline"><span class="w">SvSetSV</span></code>
, but does any set magic required afterwards.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvSetMagicSV</span><span class="s">(</span><span class="w">SV</span>* <span class="w">dsv</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">ssv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvSetMagicSV_nosteal"></a><b>SvSetMagicSV_nosteal
</b>
<p>Like <code class="inline"><span class="w">SvSetSV_nosteal</span></code>
, but does any set magic required afterwards.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvSetMagicSV_nosteal</span><span class="s">(</span><span class="w">SV</span>* <span class="w">dsv</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">ssv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvSetSV"></a><b>SvSetSV
</b>
<p>Calls <code class="inline"><span class="w">sv_setsv</span></code>
if dsv is not the same as ssv. May evaluate arguments
more than once. Does not handle 'set' magic on the destination SV.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvSetSV</span><span class="s">(</span><span class="w">SV</span>* <span class="w">dsv</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">ssv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvSetSV_nosteal"></a><b>SvSetSV_nosteal
</b>
<p>Calls a non-destructive version of <code class="inline"><span class="w">sv_setsv</span></code>
if dsv is not the same as
ssv. May evaluate arguments more than once.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvSetSV_nosteal</span><span class="s">(</span><span class="w">SV</span>* <span class="w">dsv</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">ssv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvSHARE"></a><b>SvSHARE
</b>
<p>Arranges for sv to be shared between threads if a suitable module
has been loaded.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvSHARE</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvUNLOCK"></a><b>SvUNLOCK
</b>
<p>Releases a mutual exclusion lock on sv if a suitable module
has been loaded.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvUNLOCK</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Memory-Management"></a><h1>Memory Management</h1>
<ul>
<li><a name="Copy"></a><b>Copy
</b>
<p>The XSUB-writer's interface to the C <code class="inline"><span class="w">memcpy</span></code>
function. The <code class="inline"><span class="w">src</span></code>
is the
source, <code class="inline"><span class="w">dest</span></code>
is the destination, <code class="inline"><span class="w">nitems</span></code>
is the number of items, and
<code class="inline"><span class="w">type</span></code>
is the type. May fail on overlapping copies. See also <code class="inline"><span class="w">Move</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">Copy</span><span class="s">(</span><span class="w">void</span>* <span class="w">src</span><span class="cm">,</span> <span class="w">void</span>* <span class="w">dest</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">nitems</span><span class="cm">,</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="CopyD"></a><b>CopyD
</b>
<p>Like <code class="inline"><span class="w">Copy</span></code>
but returns dest. Useful
for encouraging compilers to tail-call
optimise.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> * <span class="i">CopyD</span><span class="s">(</span><span class="w">void</span>* <span class="w">src</span><span class="cm">,</span> <span class="w">void</span>* <span class="w">dest</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">nitems</span><span class="cm">,</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="Move"></a><b>Move
</b>
<p>The XSUB-writer's interface to the C <code class="inline"><span class="w">memmove</span></code>
function. The <code class="inline"><span class="w">src</span></code>
is the
source, <code class="inline"><span class="w">dest</span></code>
is the destination, <code class="inline"><span class="w">nitems</span></code>
is the number of items, and
<code class="inline"><span class="w">type</span></code>
is the type. Can do overlapping moves. See also <code class="inline"><span class="w">Copy</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">Move</span><span class="s">(</span><span class="w">void</span>* <span class="w">src</span><span class="cm">,</span> <span class="w">void</span>* <span class="w">dest</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">nitems</span><span class="cm">,</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="MoveD"></a><b>MoveD
</b>
<p>Like <code class="inline"><span class="w">Move</span></code>
but returns dest. Useful
for encouraging compilers to tail-call
optimise.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> * <span class="i">MoveD</span><span class="s">(</span><span class="w">void</span>* <span class="w">src</span><span class="cm">,</span> <span class="w">void</span>* <span class="w">dest</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">nitems</span><span class="cm">,</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="Newx"></a><b>Newx
</b>
<p>The XSUB-writer's interface to the C <code class="inline"><span class="w">malloc</span></code>
function.</p>
<p>Memory obtained by this should <b>ONLY</b> be freed with <a href="#Safefree">Safefree</a>.</p>
<p>In 5.9.3, Newx() and friends replace the older New() API, and drops
the first parameter, <i>x</i>, a debug aid which allowed callers to identify
themselves. This aid has been superseded by a new build option,
PERL_MEM_LOG (see <a href="perlhacktips.html#PERL_MEM_LOG">PERL_MEM_LOG in perlhacktips</a>). The older API is still
there for use in XS modules supporting older perls.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">Newx</span><span class="s">(</span><span class="w">void</span>* <span class="w">ptr</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">nitems</span><span class="cm">,</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="Newxc"></a><b>Newxc
</b>
<p>The XSUB-writer's interface to the C <code class="inline"><span class="w">malloc</span></code>
function, with
cast. See also <code class="inline"><span class="w">Newx</span></code>
.</p>
<p>Memory obtained by this should <b>ONLY</b> be freed with <a href="#Safefree">Safefree</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">Newxc</span><span class="s">(</span><span class="w">void</span>* <span class="w">ptr</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">nitems</span><span class="cm">,</span> <span class="w">type</span><span class="cm">,</span> <span class="w">cast</span><span class="s">)</span></li></ol></pre></li>
<li><a name="Newxz"></a><b>Newxz
</b>
<p>The XSUB-writer's interface to the C <code class="inline"><span class="w">malloc</span></code>
function. The allocated
memory is zeroed with <code class="inline"><span class="w">memzero</span></code>
. See also <code class="inline"><span class="w">Newx</span></code>
.</p>
<p>Memory obtained by this should <b>ONLY</b> be freed with <a href="#Safefree">Safefree</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">Newxz</span><span class="s">(</span><span class="w">void</span>* <span class="w">ptr</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">nitems</span><span class="cm">,</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="Poison"></a><b>Poison
</b>
<p>PoisonWith(0xEF) for catching access to freed memory.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">Poison</span><span class="s">(</span><span class="w">void</span>* <span class="w">dest</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">nitems</span><span class="cm">,</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PoisonFree"></a><b>PoisonFree
</b>
<p>PoisonWith(0xEF) for catching access to freed memory.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">PoisonFree</span><span class="s">(</span><span class="w">void</span>* <span class="w">dest</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">nitems</span><span class="cm">,</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PoisonNew"></a><b>PoisonNew
</b>
<p>PoisonWith(0xAB) for catching access to allocated but uninitialized memory.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">PoisonNew</span><span class="s">(</span><span class="w">void</span>* <span class="w">dest</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">nitems</span><span class="cm">,</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PoisonWith"></a><b>PoisonWith
</b>
<p>Fill up memory with a byte pattern (a byte repeated over and over
again) that hopefully catches attempts to access uninitialized memory.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">PoisonWith</span><span class="s">(</span><span class="w">void</span>* <span class="w">dest</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">nitems</span><span class="cm">,</span> <span class="w">type</span><span class="cm">,</span></li><li> <span class="w">U8</span> <span class="w">byte</span><span class="s">)</span></li></ol></pre></li>
<li><a name="Renew"></a><b>Renew
</b>
<p>The XSUB-writer's interface to the C <code class="inline"><span class="w">realloc</span></code>
function.</p>
<p>Memory obtained by this should <b>ONLY</b> be freed with <a href="#Safefree">Safefree</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">Renew</span><span class="s">(</span><span class="w">void</span>* <span class="w">ptr</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">nitems</span><span class="cm">,</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="Renewc"></a><b>Renewc
</b>
<p>The XSUB-writer's interface to the C <code class="inline"><span class="w">realloc</span></code>
function, with
cast.</p>
<p>Memory obtained by this should <b>ONLY</b> be freed with <a href="#Safefree">Safefree</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">Renewc</span><span class="s">(</span><span class="w">void</span>* <span class="w">ptr</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">nitems</span><span class="cm">,</span> <span class="w">type</span><span class="cm">,</span> <span class="w">cast</span><span class="s">)</span></li></ol></pre></li>
<li><a name="Safefree"></a><b>Safefree
</b>
<p>The XSUB-writer's interface to the C <code class="inline"><span class="w">free</span></code>
function.</p>
<p>This should <b>ONLY</b> be used on memory obtained using <a href="#Newx">Newx</a> and friends.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">Safefree</span><span class="s">(</span><span class="w">void</span>* <span class="w">ptr</span><span class="s">)</span></li></ol></pre></li>
<li><a name="savepv"></a><b>savepv
</b>
<p>Perl's version of <code class="inline"><span class="i">strdup</span><span class="s">(</span><span class="s">)</span></code>
. Returns a pointer to a newly allocated
string which is a duplicate of <code class="inline"><span class="w">pv</span></code>
. The size of the string is
determined by <code class="inline"><span class="i">strlen</span><span class="s">(</span><span class="s">)</span></code>
, which means it may not contain embedded <code class="inline"><span class="w">NUL</span></code>
characters and must have a trailing <code class="inline"><span class="w">NUL</span></code>
. The memory allocated for the new
string can be freed with the <code class="inline"><span class="i">Safefree</span><span class="s">(</span><span class="s">)</span></code>
function.</p>
<p>On some platforms, Windows for example, all allocated memory owned by a thread
is deallocated when that thread ends. So if you need that not to happen, you
need to use the shared memory functions, such as <code class="inline"><a href="#savesharedpv">savesharedpv</a></code>.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">savepv</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">pv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="savepvn"></a><b>savepvn
</b>
<p>Perl's version of what <code class="inline"><span class="i">strndup</span><span class="s">(</span><span class="s">)</span></code>
would be if it existed. Returns a
pointer to a newly allocated string which is a duplicate of the first
<code class="inline"><span class="w">len</span></code>
bytes from <code class="inline"><span class="w">pv</span></code>
, plus a trailing
<code class="inline"><span class="w">NUL</span></code>
byte. The memory allocated for
the new string can be freed with the <code class="inline"><span class="i">Safefree</span><span class="s">(</span><span class="s">)</span></code>
function.</p>
<p>On some platforms, Windows for example, all allocated memory owned by a thread
is deallocated when that thread ends. So if you need that not to happen, you
need to use the shared memory functions, such as <code class="inline"><a href="#savesharedpvn">savesharedpvn</a></code>.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">savepvn</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">pv</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="savepvs"></a><b>savepvs
</b>
<p>Like <code class="inline"><span class="w">savepvn</span></code>
, but takes a literal <code class="inline"><span class="w">NUL</span></code>
-terminated string instead of a
string/length pair.</p>
<pre class="verbatim"><ol><li> char* savepvs(const char* s)</li></ol></pre></li>
<li><a name="savesharedpv"></a><b>savesharedpv
</b>
<p>A version of <code class="inline"><span class="i">savepv</span><span class="s">(</span><span class="s">)</span></code>
which allocates the duplicate string in memory
which is shared between threads.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">savesharedpv</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">pv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="savesharedpvn"></a><b>savesharedpvn
</b>
<p>A version of <code class="inline"><span class="i">savepvn</span><span class="s">(</span><span class="s">)</span></code>
which allocates the duplicate string in memory
which is shared between threads. (With the specific difference that a NULL
pointer is not acceptable)</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">savesharedpvn</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">pv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="savesharedpvs"></a><b>savesharedpvs
</b>
<p>A version of <code class="inline"><span class="i">savepvs</span><span class="s">(</span><span class="s">)</span></code>
which allocates the duplicate string in memory
which is shared between threads.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">savesharedpvs</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="q">s)</span></li></ol></pre></li>
<li><a name="savesharedsvpv"></a><b>savesharedsvpv
</b>
<p>A version of <code class="inline"><span class="i">savesharedpv</span><span class="s">(</span><span class="s">)</span></code>
which allocates the duplicate string in
memory which is shared between threads.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">savesharedsvpv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="savesvpv"></a><b>savesvpv
</b>
<p>A version of <code class="inline"><span class="i">savepv</span><span class="s">(</span><span class="s">)</span></code>
/<code class="inline"><span class="i">savepvn</span><span class="s">(</span><span class="s">)</span></code>
which gets the string to duplicate from
the passed in SV using <code class="inline"><span class="i">SvPV</span><span class="s">(</span><span class="s">)</span></code>
</p>
<p>On some platforms, Windows for example, all allocated memory owned by a thread
is deallocated when that thread ends. So if you need that not to happen, you
need to use the shared memory functions, such as <code class="inline"><a href="#savesharedsvpv">savesharedsvpv</a></code>.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">savesvpv</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="StructCopy"></a><b>StructCopy
</b>
<p>This is an architecture-independent macro to copy one structure to another.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">StructCopy</span><span class="s">(</span><span class="w">type</span> *<span class="w">src</span><span class="cm">,</span> <span class="w">type</span> *<span class="w">dest</span><span class="cm">,</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="Zero"></a><b>Zero
</b>
<p>The XSUB-writer's interface to the C <code class="inline"><span class="w">memzero</span></code>
function. The <code class="inline"><span class="w">dest</span></code>
is the
destination, <code class="inline"><span class="w">nitems</span></code>
is the number of items, and <code class="inline"><span class="w">type</span></code>
is the type.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">Zero</span><span class="s">(</span><span class="w">void</span>* <span class="w">dest</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">nitems</span><span class="cm">,</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="ZeroD"></a><b>ZeroD
</b>
<p>Like <code class="inline"><span class="w">Zero</span></code>
but returns dest. Useful
for encouraging compilers to tail-call
optimise.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> * <span class="i">ZeroD</span><span class="s">(</span><span class="w">void</span>* <span class="w">dest</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">nitems</span><span class="cm">,</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Miscellaneous-Functions"></a><h1>Miscellaneous Functions</h1>
<ul>
<li><a name="dump_c_backtrace"></a><b>dump_c_backtrace
</b>
<p>Dumps the C backtrace to the given fp.</p>
<p>Returns true if a backtrace could be retrieved, false if not.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">dump_c_backtrace</span><span class="s">(</span><span class="w">PerlIO</span>* <span class="w">fp</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">max_depth</span><span class="cm">,</span></li><li> <a class="l_k" href="functions/int.html">int</a> <span class="w">skip</span><span class="s">)</span></li></ol></pre></li>
<li><a name="fbm_compile"></a><b>fbm_compile
</b>
<p>Analyses the string in order to make fast searches on it using fbm_instr()
-- the Boyer-Moore algorithm.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">fbm_compile</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="fbm_instr"></a><b>fbm_instr
</b>
<p>Returns the location of the SV in the string delimited by <code class="inline"><span class="w">big</span></code>
and
<code class="inline"><span class="w">bigend</span></code>
. It returns <code class="inline"><span class="w">NULL</span></code>
if the string can't be found. The <code class="inline"><span class="w">sv</span></code>
does not have to be fbm_compiled, but the search will not be as fast
then.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">fbm_instr</span><span class="s">(</span><span class="w">unsigned</span> <span class="w">char</span>* <span class="w">big</span><span class="cm">,</span></li><li> <span class="w">unsigned</span> <span class="w">char</span>* <span class="w">bigend</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">littlestr</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="foldEQ"></a><b>foldEQ
</b>
<p>Returns true if the leading len bytes of the strings s1 and s2 are the same
case-insensitively; false otherwise. Uppercase and lowercase ASCII range bytes
match themselves and their opposite case counterparts. Non-cased and non-ASCII
range bytes match only themselves.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">foldEQ</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">a</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">b</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="foldEQ_locale"></a><b>foldEQ_locale
</b>
<p>Returns true if the leading len bytes of the strings s1 and s2 are the same
case-insensitively in the current locale; false otherwise.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">foldEQ_locale</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">a</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">b</span><span class="cm">,</span></li><li> <span class="w">I32</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="form"></a><b>form
</b>
<p>Takes a sprintf-style format pattern and conventional
(non-SV) arguments and returns the formatted string.</p>
<pre class="verbatim"><ol><li> (char *) Perl_form(pTHX_ const char* pat, ...)</li></ol></pre><p>can be used any place a string (char *) is required:</p>
<pre class="verbatim"><ol><li> char * s = Perl_form("%d.%d",major,minor);</li></ol></pre><p>Uses a single private buffer so if you want to format several strings you
must explicitly copy the earlier strings away (and free the copies when you
are done).</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">form</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">pat</span><span class="cm">,</span> ...<span class="s">)</span></li></ol></pre></li>
<li><a name="getcwd_sv"></a><b>getcwd_sv
</b>
<p>Fill the sv with current working directory</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">getcwd_sv</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="get_c_backtrace_dump"></a><b>get_c_backtrace_dump
</b>
<p>Returns a SV a dump of |depth| frames of the call stack, skipping
the |skip| innermost ones. depth of 20 is usually enough.</p>
<p>The appended output looks like:</p>
<p>...
1 10e004812:0082 Perl_croak util.c:1716 /usr/bin/perl
2 10df8d6d2:1d72 perl_parse perl.c:3975 /usr/bin/perl
...</p>
<p>The fields are tab-separated. The first column is the depth (zero
being the innermost non-skipped frame). In the hex:offset, the hex is
where the program counter was in S_parse_body, and the :offset (might
be missing) tells how much inside the S_parse_body the program counter was.</p>
<p>The util.c:1716 is the source code file and line number.</p>
<p>The /usr/bin/perl is obvious (hopefully).</p>
<p>Unknowns are <code class="inline"><span class="q">"-"</span></code>
. Unknowns can happen unfortunately quite easily:
if the platform doesn't support retrieving the information;
if the binary is missing the debug information;
if the optimizer has transformed the code by for example inlining.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">get_c_backtrace_dump</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> <span class="w">max_depth</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">skip</span><span class="s">)</span></li></ol></pre></li>
<li><a name="ibcmp"></a><b>ibcmp
</b>
<p>This is a synonym for (! foldEQ())</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">ibcmp</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">a</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">b</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="ibcmp_locale"></a><b>ibcmp_locale
</b>
<p>This is a synonym for (! foldEQ_locale())</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">ibcmp_locale</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">a</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">b</span><span class="cm">,</span></li><li> <span class="w">I32</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="is_safe_syscall"></a><b>is_safe_syscall
</b>
<p>Test that the given <code class="inline"><span class="w">pv</span></code>
doesn't contain any internal <code class="inline"><span class="w">NUL</span></code>
characters.
If it does, set <code class="inline"><span class="w">errno</span></code>
to ENOENT, optionally warn, and return FALSE.</p>
<p>Return TRUE if the name is safe.</p>
<p>Used by the IS_SAFE_SYSCALL() macro.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">is_safe_syscall</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">pv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">what</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">op_name</span><span class="s">)</span></li></ol></pre></li>
<li><a name="memEQ"></a><b>memEQ
</b>
<p>Test two buffers (which may contain embedded <code class="inline"><span class="w">NUL</span></code>
characters, to see if they
are equal. The <code class="inline"><span class="w">len</span></code>
parameter indicates the number of bytes to compare.
Returns zero if equal, or non-zero if non-equal.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">memEQ</span><span class="s">(</span><span class="w">char</span>* <span class="w">s1</span><span class="cm">,</span> <span class="w">char</span>* <span class="w">s2</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="memNE"></a><b>memNE
</b>
<p>Test two buffers (which may contain embedded <code class="inline"><span class="w">NUL</span></code>
characters, to see if they
are not equal. The <code class="inline"><span class="w">len</span></code>
parameter indicates the number of bytes to compare.
Returns zero if non-equal, or non-zero if equal.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">memNE</span><span class="s">(</span><span class="w">char</span>* <span class="w">s1</span><span class="cm">,</span> <span class="w">char</span>* <span class="w">s2</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mess"></a><b>mess
</b>
<p>Take a sprintf-style format pattern and argument list. These are used to
generate a string message. If the message does not end with a newline,
then it will be extended with some indication of the current location
in the code, as described for <a href="#mess_sv">mess_sv</a>.</p>
<p>Normally, the resulting message is returned in a new mortal SV.
During global destruction a single SV may be shared between uses of
this function.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">mess</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">pat</span><span class="cm">,</span> ...<span class="s">)</span></li></ol></pre></li>
<li><a name="mess_sv"></a><b>mess_sv
</b>
<p>Expands a message, intended for the user, to include an indication of
the current location in the code, if the message does not already appear
to be complete.</p>
<p><code class="inline"><span class="w">basemsg</span></code>
is the initial message or object. If it is a reference, it
will be used as-is and will be the result of this function. Otherwise it
is used as a string, and if it already ends with a newline, it is taken
to be complete, and the result of this function will be the same string.
If the message does not end with a newline, then a segment such as <code class="inline"><span class="w">at</span>
<span class="w">foo</span>.<span class="w">pl</span> <span class="w">line</span> <span class="n">37</span></code>
will be appended, and possibly other clauses indicating
the current state of execution. The resulting message will end with a
dot and a newline.</p>
<p>Normally, the resulting message is returned in a new mortal SV.
During global destruction a single SV may be shared between uses of this
function. If <code class="inline"><span class="w">consume</span></code>
is true, then the function is permitted (but not
required) to modify and return <code class="inline"><span class="w">basemsg</span></code>
instead of allocating a new SV.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">mess_sv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">basemsg</span><span class="cm">,</span> <span class="w">bool</span> <span class="w">consume</span><span class="s">)</span></li></ol></pre></li>
<li><a name="my_snprintf"></a><b>my_snprintf
</b>
<p>The C library <code class="inline"><span class="w">snprintf</span></code>
functionality, if available and
standards-compliant (uses <code class="inline"><span class="w">vsnprintf</span></code>
, actually). However, if the
<code class="inline"><span class="w">vsnprintf</span></code>
is not available, will unfortunately use the unsafe
<code class="inline"><span class="w">vsprintf</span></code>
which can overrun the buffer (there is an overrun check,
but that may be too late). Consider using <code class="inline"><span class="w">sv_vcatpvf</span></code>
instead, or
getting <code class="inline"><span class="w">vsnprintf</span></code>
.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">my_snprintf</span><span class="s">(</span><span class="w">char</span> *<span class="w">buffer</span><span class="cm">,</span> <span class="w">const</span> <span class="w">Size_t</span> <span class="w">len</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *format, ...)</li></ol></pre></li>
<li><a name="my_sprintf"></a><b>my_sprintf
</b>
<p>The C library <code class="inline"><a class="l_k" href="functions/sprintf.html">sprintf</a></code>, wrapped if necessary, to ensure that it will return
the length of the string written to the buffer. Only rare pre-ANSI systems
need the wrapper function - usually this is a direct call to <code class="inline"><a class="l_k" href="functions/sprintf.html">sprintf</a></code>.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">my_sprintf</span><span class="s">(</span><span class="w">char</span> *<span class="w">buffer</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">pat</span><span class="cm">,</span> ...<span class="s">)</span></li></ol></pre></li>
<li><a name="my_strlcat"></a><b>my_strlcat
</b>
<p>The C library <code class="inline"><span class="w">strlcat</span></code>
if available, or a Perl implementation of it.
This operates on C <code class="inline"><span class="w">NUL</span></code>
-terminated strings.</p>
<p><code class="inline"><span class="i">my_strlcat</span><span class="s">(</span><span class="s">)</span></code>
appends string <code class="inline"><span class="w">src</span></code>
to the end of <code class="inline"><span class="w">dst</span></code>
. It will append at
most <code class="inline"><span class="w">size</span> - <span class="i">strlen</span><span class="s">(</span><span class="w">dst</span><span class="s">)</span> - <span class="n">1</span></code>
characters. It will then <code class="inline"><span class="w">NUL</span></code>
-terminate,
unless <code class="inline"><span class="w">size</span></code>
is 0 or the original <code class="inline"><span class="w">dst</span></code>
string was longer than <code class="inline"><span class="w">size</span></code>
(in
practice this should not happen as it means that either <code class="inline"><span class="w">size</span></code>
is incorrect or
that <code class="inline"><span class="w">dst</span></code>
is not a proper <code class="inline"><span class="w">NUL</span></code>
-terminated string).</p>
<p>Note that <code class="inline"><span class="w">size</span></code>
is the full size of the destination buffer and
the result is guaranteed to be <code class="inline"><span class="w">NUL</span></code>
-terminated if there is room. Note that
room for the <code class="inline"><span class="w">NUL</span></code>
should be included in <code class="inline"><span class="w">size</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">Size_t</span> <span class="i">my_strlcat</span><span class="s">(</span><span class="w">char</span> *<span class="w">dst</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">src</span><span class="cm">,</span></li><li> <span class="w">Size_t</span> <span class="w">size</span><span class="s">)</span></li></ol></pre></li>
<li><a name="my_strlcpy"></a><b>my_strlcpy
</b>
<p>The C library <code class="inline"><span class="w">strlcpy</span></code>
if available, or a Perl implementation of it.
This operates on C <code class="inline"><span class="w">NUL</span></code>
-terminated strings.</p>
<p><code class="inline"><span class="i">my_strlcpy</span><span class="s">(</span><span class="s">)</span></code>
copies up to <code class="inline"><span class="w">size</span> - <span class="n">1</span></code>
characters from the string <code class="inline"><span class="w">src</span></code>
to <code class="inline"><span class="w">dst</span></code>
, <code class="inline"><span class="w">NUL</span></code>
-terminating the result if <code class="inline"><span class="w">size</span></code>
is not 0.</p>
<pre class="verbatim"><ol><li> <span class="w">Size_t</span> <span class="i">my_strlcpy</span><span class="s">(</span><span class="w">char</span> *<span class="w">dst</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">src</span><span class="cm">,</span></li><li> <span class="w">Size_t</span> <span class="w">size</span><span class="s">)</span></li></ol></pre></li>
<li><a name="my_vsnprintf"></a><b>my_vsnprintf
</b>
<p>The C library <code class="inline"><span class="w">vsnprintf</span></code>
if available and standards-compliant.
However, if if the <code class="inline"><span class="w">vsnprintf</span></code>
is not available, will unfortunately
use the unsafe <code class="inline"><span class="w">vsprintf</span></code>
which can overrun the buffer (there is an
overrun check, but that may be too late). Consider using
<code class="inline"><span class="w">sv_vcatpvf</span></code>
instead, or getting <code class="inline"><span class="w">vsnprintf</span></code>
.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">my_vsnprintf</span><span class="s">(</span><span class="w">char</span> *<span class="w">buffer</span><span class="cm">,</span> <span class="w">const</span> <span class="w">Size_t</span> <span class="w">len</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *format, va_list ap)</li></ol></pre></li>
<li><a name="PERL_SYS_INIT"></a><b>PERL_SYS_INIT
</b>
<p>Provides system-specific tune up of the C runtime environment necessary to
run Perl interpreters. This should be called only once, before creating
any Perl interpreters.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">PERL_SYS_INIT</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> <span class="i">*argc</span><span class="cm">,</span> <span class="w">char</span>**<span class="i">* argv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PERL_SYS_INIT3"></a><b>PERL_SYS_INIT3
</b>
<p>Provides system-specific tune up of the C runtime environment necessary to
run Perl interpreters. This should be called only once, before creating
any Perl interpreters.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">PERL_SYS_INIT3</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> <span class="i">*argc</span><span class="cm">,</span> <span class="w">char</span>**<span class="i">* argv</span><span class="cm">,</span></li><li> <span class="w">char</span>**<span class="i">* env</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PERL_SYS_TERM"></a><b>PERL_SYS_TERM
</b>
<p>Provides system-specific clean up of the C runtime environment after
running Perl interpreters. This should be called only once, after
freeing any remaining Perl interpreters.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">PERL_SYS_TERM</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="quadmath_format_needed"></a><b>quadmath_format_needed
</b>
<p>quadmath_format_needed() returns true if the format string seems to
contain at least one non-Q-prefixed %[efgaEFGA] format specifier,
or returns false otherwise.</p>
<p>The format specifier detection is not complete printf-syntax detection,
but it should catch most common cases.</p>
<p>If true is returned, those arguments <b>should</b> in theory be processed
with quadmath_snprintf(), but in case there is more than one such
format specifier (see <a href="#quadmath_format_single">quadmath_format_single</a>), and if there is
anything else beyond that one (even just a single byte), they
<b>cannot</b> be processed because quadmath_snprintf() is very strict,
accepting only one format spec, and nothing else.
In this case, the code should probably fail.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">quadmath_format_needed</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* format)</li></ol></pre></li>
<li><a name="quadmath_format_single"></a><b>quadmath_format_single
</b>
<p>quadmath_snprintf() is very strict about its format string and will
fail, returning -1, if the format is invalid. It acccepts exactly
one format spec.</p>
<p>quadmath_format_single() checks that the intended single spec looks
sane: begins with <code class="inline"><span class="i">%</span></code>
, has only one <code class="inline"><span class="i">%</span></code>
, ends with <code class="inline"><span class="s">[</span><span class="w">efgaEFGA</span><span class="s">]</span></code>
,
and has <code class="inline"><span class="w">Q</span></code>
before it. This is not a full "printf syntax check",
just the basics.</p>
<p>Returns the format if it is valid, NULL if not.</p>
<p>quadmath_format_single() can and will actually patch in the missing
<code class="inline"><span class="w">Q</span></code>
, if necessary. In this case it will return the modified copy of
the format, <b>which the caller will need to free.</b></p>
<p>See also <a href="#quadmath_format_needed">quadmath_format_needed</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">const</span> <span class="w">char</span>* <span class="i">quadmath_format_single</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* format)</li></ol></pre></li>
<li><a name="READ_XDIGIT"></a><b>READ_XDIGIT
</b>
<p>Returns the value of an ASCII-range hex digit and advances the string pointer.
Behaviour is only well defined when isXDIGIT(*str) is true.</p>
<pre class="verbatim"><ol><li> <span class="w">U8</span> <span class="i">READ_XDIGIT</span><span class="s">(</span><span class="w">char</span> <span class="w">str</span>*<span class="s">)</span></li></ol></pre></li>
<li><a name="strEQ"></a><b>strEQ
</b>
<p>Test two strings to see if they are equal. Returns true or false.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">strEQ</span><span class="s">(</span><span class="w">char</span>* <span class="w">s1</span><span class="cm">,</span> <span class="w">char</span>* <span class="w">s2</span><span class="s">)</span></li></ol></pre></li>
<li><a name="strGE"></a><b>strGE
</b>
<p>Test two strings to see if the first, <code class="inline"><span class="w">s1</span></code>
, is greater than or equal to
the second, <code class="inline"><span class="w">s2</span></code>
. Returns true or false.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">strGE</span><span class="s">(</span><span class="w">char</span>* <span class="w">s1</span><span class="cm">,</span> <span class="w">char</span>* <span class="w">s2</span><span class="s">)</span></li></ol></pre></li>
<li><a name="strGT"></a><b>strGT
</b>
<p>Test two strings to see if the first, <code class="inline"><span class="w">s1</span></code>
, is greater than the second,
<code class="inline"><span class="w">s2</span></code>
. Returns true or false.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">strGT</span><span class="s">(</span><span class="w">char</span>* <span class="w">s1</span><span class="cm">,</span> <span class="w">char</span>* <span class="w">s2</span><span class="s">)</span></li></ol></pre></li>
<li><a name="strLE"></a><b>strLE
</b>
<p>Test two strings to see if the first, <code class="inline"><span class="w">s1</span></code>
, is less than or equal to the
second, <code class="inline"><span class="w">s2</span></code>
. Returns true or false.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">strLE</span><span class="s">(</span><span class="w">char</span>* <span class="w">s1</span><span class="cm">,</span> <span class="w">char</span>* <span class="w">s2</span><span class="s">)</span></li></ol></pre></li>
<li><a name="strLT"></a><b>strLT
</b>
<p>Test two strings to see if the first, <code class="inline"><span class="w">s1</span></code>
, is less than the second,
<code class="inline"><span class="w">s2</span></code>
. Returns true or false.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">strLT</span><span class="s">(</span><span class="w">char</span>* <span class="w">s1</span><span class="cm">,</span> <span class="w">char</span>* <span class="w">s2</span><span class="s">)</span></li></ol></pre></li>
<li><a name="strNE"></a><b>strNE
</b>
<p>Test two strings to see if they are different. Returns true or
false.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">strNE</span><span class="s">(</span><span class="w">char</span>* <span class="w">s1</span><span class="cm">,</span> <span class="w">char</span>* <span class="w">s2</span><span class="s">)</span></li></ol></pre></li>
<li><a name="strnEQ"></a><b>strnEQ
</b>
<p>Test two strings to see if they are equal. The <code class="inline"><span class="w">len</span></code>
parameter indicates
the number of bytes to compare. Returns true or false. (A wrapper for
<code class="inline"><span class="w">strncmp</span></code>
).</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">strnEQ</span><span class="s">(</span><span class="w">char</span>* <span class="w">s1</span><span class="cm">,</span> <span class="w">char</span>* <span class="w">s2</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="strnNE"></a><b>strnNE
</b>
<p>Test two strings to see if they are different. The <code class="inline"><span class="w">len</span></code>
parameter
indicates the number of bytes to compare. Returns true or false. (A
wrapper for <code class="inline"><span class="w">strncmp</span></code>
).</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">strnNE</span><span class="s">(</span><span class="w">char</span>* <span class="w">s1</span><span class="cm">,</span> <span class="w">char</span>* <span class="w">s2</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_destroyable"></a><b>sv_destroyable
</b>
<p>Dummy routine which reports that object can be destroyed when there is no
sharing module present. It ignores its single SV argument, and returns
'true'. Exists to avoid test for a NULL function pointer and because it
could potentially warn under some level of strict-ness.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">sv_destroyable</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_nosharing"></a><b>sv_nosharing
</b>
<p>Dummy routine which "shares" an SV when there is no sharing module present.
Or "locks" it. Or "unlocks" it. In other
words, ignores its single SV argument.
Exists to avoid test for a NULL function pointer and because it could
potentially warn under some level of strict-ness.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_nosharing</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="vmess"></a><b>vmess
</b>
<p><code class="inline"><span class="w">pat</span></code>
and <code class="inline"><span class="w">args</span></code>
are a sprintf-style format pattern and encapsulated
argument list. These are used to generate a string message. If the
message does not end with a newline, then it will be extended with
some indication of the current location in the code, as described for
<a href="#mess_sv">mess_sv</a>.</p>
<p>Normally, the resulting message is returned in a new mortal SV.
During global destruction a single SV may be shared between uses of
this function.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">vmess</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">pat</span><span class="cm">,</span> <span class="w">va_list</span> *<span class="w">args</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="MRO-Functions"></a><h1>MRO Functions</h1>
<p>These functions are related to the method resolution order of perl classes</p>
<ul>
<li><a name="mro_get_linear_isa"></a><b>mro_get_linear_isa
</b>
<p>Returns the mro linearisation for the given stash. By default, this
will be whatever <code class="inline"><span class="w">mro_get_linear_isa_dfs</span></code>
returns unless some
other MRO is in effect for the stash. The return value is a
read-only AV*.</p>
<p>You are responsible for <code class="inline"><span class="i">SvREFCNT_inc</span><span class="s">(</span><span class="s">)</span></code>
on the
return value if you plan to store it anywhere
semi-permanently (otherwise it might be deleted
out from under you the next time the cache is
invalidated).</p>
<pre class="verbatim"><ol><li> <span class="w">AV</span>* <span class="i">mro_get_linear_isa</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mro_method_changed_in"></a><b>mro_method_changed_in
</b>
<p>Invalidates method caching on any child classes
of the given stash, so that they might notice
the changes in this one.</p>
<p>Ideally, all instances of <code class="inline"><span class="w">PL_sub_generation</span>++</code>
in
perl source outside of <i>mro.c</i> should be
replaced by calls to this.</p>
<p>Perl automatically handles most of the common
ways a method might be redefined. However, there
are a few ways you could change a method in a stash
without the cache code noticing, in which case you
need to call this method afterwards:</p>
<p>1) Directly manipulating the stash HV entries from
XS code.</p>
<p>2) Assigning a reference to a readonly scalar
constant into a stash entry in order to create
a constant subroutine (like constant.pm
does).</p>
<p>This same method is available from pure perl
via, <code class="inline"><span class="i">mro::method_changed_in</span><span class="s">(</span><span class="w">classname</span><span class="s">)</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">mro_method_changed_in</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mro_register"></a><b>mro_register
</b>
<p>Registers a custom mro plugin. See <a href="perlmroapi.html">perlmroapi</a> for details.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">mro_register</span><span class="s">(</span><span class="w">const</span> <span class="w">struct</span> <span class="w">mro_alg</span> *<span class="w">mro</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Multicall-Functions"></a><h1>Multicall Functions</h1>
<ul>
<li><a name="dMULTICALL"></a><b>dMULTICALL
</b>
<p>Declare local variables for a multicall. See <a href="perlcall.html#LIGHTWEIGHT-CALLBACKS">LIGHTWEIGHT CALLBACKS in perlcall</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">dMULTICALL</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="MULTICALL"></a><b>MULTICALL
</b>
<p>Make a lightweight callback. See <a href="perlcall.html#LIGHTWEIGHT-CALLBACKS">LIGHTWEIGHT CALLBACKS in perlcall</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">MULTICALL</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="POP_MULTICALL"></a><b>POP_MULTICALL
</b>
<p>Closing bracket for a lightweight callback.
See <a href="perlcall.html#LIGHTWEIGHT-CALLBACKS">LIGHTWEIGHT CALLBACKS in perlcall</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">POP_MULTICALL</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="PUSH_MULTICALL"></a><b>PUSH_MULTICALL
</b>
<p>Opening bracket for a lightweight callback.
See <a href="perlcall.html#LIGHTWEIGHT-CALLBACKS">LIGHTWEIGHT CALLBACKS in perlcall</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">PUSH_MULTICALL</span><span class="sc">;</span></li></ol></pre></li>
</ul>
<a name="Numeric-functions"></a><h1>Numeric functions</h1>
<ul>
<li><a name="grok_bin"></a><b>grok_bin
</b>
<p>converts a string representing a binary number to numeric form.</p>
<p>On entry <i>start</i> and <i>*len</i> give the string to scan, <i>*flags</i> gives
conversion flags, and <i>result</i> should be NULL or a pointer to an NV.
The scan stops at the end of the string, or the first invalid character.
Unless <code class="inline"><span class="w">PERL_SCAN_SILENT_ILLDIGIT</span></code>
is set in <i>*flags</i>, encountering an
invalid character will also trigger a warning.
On return <i>*len</i> is set to the length of the scanned string,
and <i>*flags</i> gives output flags.</p>
<p>If the value is <= <code class="inline"><span class="w">UV_MAX</span></code>
it is returned as a UV, the output flags are clear,
and nothing is written to <i>*result</i>. If the value is > UV_MAX <code class="inline"><span class="w">grok_bin</span></code>
returns UV_MAX, sets <code class="inline"><span class="w">PERL_SCAN_GREATER_THAN_UV_MAX</span></code>
in the output flags,
and writes the value to <i>*result</i> (or the value is discarded if <i>result</i>
is NULL).</p>
<p>The binary number may optionally be prefixed with "0b" or "b" unless
<code class="inline"><span class="w">PERL_SCAN_DISALLOW_PREFIX</span></code>
is set in <i>*flags</i> on entry. If
<code class="inline"><span class="w">PERL_SCAN_ALLOW_UNDERSCORES</span></code>
is set in <i>*flags</i> then the binary
number may use '_' characters to separate digits.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">grok_bin</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">start</span><span class="cm">,</span> <span class="w">STRLEN</span>* <span class="w">len_p</span><span class="cm">,</span></li><li> <span class="w">I32</span>* <span class="w">flags</span><span class="cm">,</span> <span class="w">NV</span> *<span class="w">result</span><span class="s">)</span></li></ol></pre></li>
<li><a name="grok_hex"></a><b>grok_hex
</b>
<p>converts a string representing a hex number to numeric form.</p>
<p>On entry <i>start</i> and <i>*len_p</i> give the string to scan, <i>*flags</i> gives
conversion flags, and <i>result</i> should be NULL or a pointer to an NV.
The scan stops at the end of the string, or the first invalid character.
Unless <code class="inline"><span class="w">PERL_SCAN_SILENT_ILLDIGIT</span></code>
is set in <i>*flags</i>, encountering an
invalid character will also trigger a warning.
On return <i>*len</i> is set to the length of the scanned string,
and <i>*flags</i> gives output flags.</p>
<p>If the value is <= UV_MAX it is returned as a UV, the output flags are clear,
and nothing is written to <i>*result</i>. If the value is > UV_MAX <code class="inline"><span class="w">grok_hex</span></code>
returns UV_MAX, sets <code class="inline"><span class="w">PERL_SCAN_GREATER_THAN_UV_MAX</span></code>
in the output flags,
and writes the value to <i>*result</i> (or the value is discarded if <i>result</i>
is NULL).</p>
<p>The hex number may optionally be prefixed with "0x" or "x" unless
<code class="inline"><span class="w">PERL_SCAN_DISALLOW_PREFIX</span></code>
is set in <i>*flags</i> on entry. If
<code class="inline"><span class="w">PERL_SCAN_ALLOW_UNDERSCORES</span></code>
is set in <i>*flags</i> then the hex
number may use '_' characters to separate digits.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">grok_hex</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">start</span><span class="cm">,</span> <span class="w">STRLEN</span>* <span class="w">len_p</span><span class="cm">,</span></li><li> <span class="w">I32</span>* <span class="w">flags</span><span class="cm">,</span> <span class="w">NV</span> *<span class="w">result</span><span class="s">)</span></li></ol></pre></li>
<li><a name="grok_infnan"></a><b>grok_infnan
</b>
<p>Helper for grok_number(), accepts various ways of spelling "infinity"
or "not a number", and returns one of the following flag combinations:</p>
<pre class="verbatim"><ol><li> <span class="w">IS_NUMBER_INFINITE</span></li><li> <span class="w">IS_NUMBER_NAN</span></li><li> <span class="w">IS_NUMBER_INFINITE</span> | <span class="w">IS_NUMBER_NEG</span></li><li> <span class="w">IS_NUMBER_NAN</span> | <span class="w">IS_NUMBER_NEG</span></li><li> <span class="n">0</span></li></ol></pre><p>possibly |-ed with IS_NUMBER_TRAILING.</p>
<p>If an infinity or a not-a-number is recognized, the *sp will point to
one byte past the end of the recognized string. If the recognition fails,
zero is returned, and the *sp will not move.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">grok_infnan</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>** <span class="w">sp</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<a class="l_k" href="functions/send.html">send</a><span class="s">)</span></li></ol></pre></li>
<li><a name="grok_number"></a><b>grok_number
</b>
<p>Identical to grok_number_flags() with flags set to zero.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">grok_number</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">pv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span></li><li> <span class="w">UV</span> *<span class="w">valuep</span><span class="s">)</span></li></ol></pre></li>
<li><a name="grok_number_flags"></a><b>grok_number_flags
</b>
<p>Recognise (or not) a number. The type of the number is returned
(0 if unrecognised), otherwise it is a bit-ORed combination of
IS_NUMBER_IN_UV, IS_NUMBER_GREATER_THAN_UV_MAX, IS_NUMBER_NOT_INT,
IS_NUMBER_NEG, IS_NUMBER_INFINITY, IS_NUMBER_NAN (defined in perl.h).</p>
<p>If the value of the number can fit in a UV, it is returned in the *valuep
IS_NUMBER_IN_UV will be set to indicate that *valuep is valid, IS_NUMBER_IN_UV
will never be set unless *valuep is valid, but *valuep may have been assigned
to during processing even though IS_NUMBER_IN_UV is not set on return.
If valuep is NULL, IS_NUMBER_IN_UV will be set for the same cases as when
valuep is non-NULL, but no actual assignment (or SEGV) will occur.</p>
<p>IS_NUMBER_NOT_INT will be set with IS_NUMBER_IN_UV if trailing decimals were
seen (in which case *valuep gives the true value truncated to an integer), and
IS_NUMBER_NEG if the number is negative (in which case *valuep holds the
absolute value). IS_NUMBER_IN_UV is not set if e notation was used or the
number is larger than a UV.</p>
<p><code class="inline"><span class="w">flags</span></code>
allows only <code class="inline"><span class="w">PERL_SCAN_TRAILING</span></code>
, which allows for trailing
non-numeric text on an otherwise successful <i>grok</i>, setting
<code class="inline"><span class="w">IS_NUMBER_TRAILING</span></code>
on the result.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">grok_number_flags</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">pv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span></li><li> <span class="w">UV</span> *<span class="w">valuep</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="grok_numeric_radix"></a><b>grok_numeric_radix
</b>
<p>Scan and skip for a numeric decimal separator (radix).</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">grok_numeric_radix</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> **<span class="w">sp</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<a class="l_k" href="functions/send.html">send</a><span class="s">)</span></li></ol></pre></li>
<li><a name="grok_oct"></a><b>grok_oct
</b>
<p>converts a string representing an octal number to numeric form.</p>
<p>On entry <i>start</i> and <i>*len</i> give the string to scan, <i>*flags</i> gives
conversion flags, and <i>result</i> should be NULL or a pointer to an NV.
The scan stops at the end of the string, or the first invalid character.
Unless <code class="inline"><span class="w">PERL_SCAN_SILENT_ILLDIGIT</span></code>
is set in <i>*flags</i>, encountering an
8 or 9 will also trigger a warning.
On return <i>*len</i> is set to the length of the scanned string,
and <i>*flags</i> gives output flags.</p>
<p>If the value is <= UV_MAX it is returned as a UV, the output flags are clear,
and nothing is written to <i>*result</i>. If the value is > UV_MAX <code class="inline"><span class="w">grok_oct</span></code>
returns UV_MAX, sets <code class="inline"><span class="w">PERL_SCAN_GREATER_THAN_UV_MAX</span></code>
in the output flags,
and writes the value to <i>*result</i> (or the value is discarded if <i>result</i>
is NULL).</p>
<p>If <code class="inline"><span class="w">PERL_SCAN_ALLOW_UNDERSCORES</span></code>
is set in <i>*flags</i> then the octal
number may use '_' characters to separate digits.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">grok_oct</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">start</span><span class="cm">,</span> <span class="w">STRLEN</span>* <span class="w">len_p</span><span class="cm">,</span></li><li> <span class="w">I32</span>* <span class="w">flags</span><span class="cm">,</span> <span class="w">NV</span> *<span class="w">result</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isinfnan"></a><b>isinfnan
</b>
<p>Perl_isinfnan() is utility function that returns true if the NV
argument is either an infinity or a NaN, false otherwise. To test
in more detail, use Perl_isinf() and Perl_isnan().</p>
<p>This is also the logical inverse of Perl_isfinite().</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">isinfnan</span><span class="s">(</span><span class="w">NV</span> <span class="w">nv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="Perl_signbit"></a><b>Perl_signbit
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Return a non-zero integer if the sign bit on an NV is set, and 0 if
it is not.</p>
<p>If Configure detects this system has a signbit() that will work with
our NVs, then we just use it via the #define in perl.h. Otherwise,
fall back on this implementation. The main use of this function
is catching -0.0.</p>
<p>Configure notes: This function is called 'Perl_signbit' instead of a
plain 'signbit' because it is easy to imagine a system having a signbit()
function or macro that doesn't happen to work with our particular choice
of NVs. We shouldn't just re-#define signbit as Perl_signbit and expect
the standard system headers to be happy. Also, this is a no-context
function (no pTHX_) because Perl_signbit() is usually re-#defined in
perl.h as a simple macro call to the system's signbit().
Users should just always call Perl_signbit().</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">Perl_signbit</span><span class="s">(</span><span class="w">NV</span> <span class="w">f</span><span class="s">)</span></li></ol></pre></li>
<li><a name="scan_bin"></a><b>scan_bin
</b>
<p>For backwards compatibility. Use <code class="inline"><span class="w">grok_bin</span></code>
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">NV</span> <span class="i">scan_bin</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">start</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span>* <span class="w">retlen</span><span class="s">)</span></li></ol></pre></li>
<li><a name="scan_hex"></a><b>scan_hex
</b>
<p>For backwards compatibility. Use <code class="inline"><span class="w">grok_hex</span></code>
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">NV</span> <span class="i">scan_hex</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">start</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span>* <span class="w">retlen</span><span class="s">)</span></li></ol></pre></li>
<li><a name="scan_oct"></a><b>scan_oct
</b>
<p>For backwards compatibility. Use <code class="inline"><span class="w">grok_oct</span></code>
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">NV</span> <span class="i">scan_oct</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">start</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span>* <span class="w">retlen</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Obsolete-backwards-compatibility-functions"></a><h1>Obsolete backwards compatibility functions</h1>
<p>Some of these are also deprecated. You can exclude these from
your compiled Perl by adding this option to Configure:
<code class="inline">-<span class="w">Accflags</span>=<span class="q">'-DNO_MATHOMS'</span></code>
</p>
<ul>
<li><a name="custom_op_desc"></a><b>custom_op_desc
</b>
<p>Return the description of a given custom op. This was once used by the
OP_DESC macro, but is no longer: it has only been kept for
compatibility, and should not be used.</p>
<pre class="verbatim"><ol><li> <span class="w">const</span> <span class="w">char</span> * <span class="i">custom_op_desc</span><span class="s">(</span><span class="w">const</span> <span class="w">OP</span> *<span class="w">o</span><span class="s">)</span></li></ol></pre></li>
<li><a name="custom_op_name"></a><b>custom_op_name
</b>
<p>Return the name for a given custom op. This was once used by the OP_NAME
macro, but is no longer: it has only been kept for compatibility, and
should not be used.</p>
<pre class="verbatim"><ol><li> <span class="w">const</span> <span class="w">char</span> * <span class="i">custom_op_name</span><span class="s">(</span><span class="w">const</span> <span class="w">OP</span> *<span class="w">o</span><span class="s">)</span></li></ol></pre></li>
<li><a name="gv_fetchmethod"></a><b>gv_fetchmethod
</b>
<p>See <a href="#gv_fetchmethod_autoload">gv_fetchmethod_autoload</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">GV</span>* <span class="i">gv_fetchmethod</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="s">)</span></li></ol></pre></li>
<li><a name="is_utf8_char"></a><b>is_utf8_char
</b>
<p>DEPRECATED! It is planned to remove this function from a
future release of Perl. Do not use it for new code; remove it from
existing code.</p>
<p>Tests if some arbitrary number of bytes begins in a valid UTF-8
character. Note that an INVARIANT (i.e. ASCII on non-EBCDIC machines)
character is a valid UTF-8 character. The actual number of bytes in the UTF-8
character will be returned if it is valid, otherwise 0.</p>
<p>This function is deprecated due to the possibility that malformed input could
cause reading beyond the end of the input buffer. Use <a href="#isUTF8_CHAR">isUTF8_CHAR</a>
instead.</p>
<pre class="verbatim"><ol><li> STRLEN is_utf8_char(const U8 *s)</li></ol></pre></li>
<li><a name="is_utf8_char_buf"></a><b>is_utf8_char_buf
</b>
<p>This is identical to the macro <a href="#isUTF8_CHAR">isUTF8_CHAR</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">is_utf8_char_buf</span><span class="s">(</span><span class="w">const</span> <span class="w">U8</span> *<span class="w">buf</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">U8</span> *<span class="w">buf_end</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pack_cat"></a><b>pack_cat
</b>
<p>The engine implementing pack() Perl function. Note: parameters
next_in_list and flags are not used. This call should not be used; use
packlist instead.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">pack_cat</span><span class="s">(</span><span class="w">SV</span> *<span class="w">cat</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">pat</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">patend</span><span class="cm">,</span> <span class="w">SV</span> **<span class="w">beglist</span><span class="cm">,</span></li><li> <span class="w">SV</span> **<span class="w">endlist</span><span class="cm">,</span> <span class="w">SV</span> **<span class="i">*next_in_list</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pad_compname_type"></a><b>pad_compname_type
</b>
<p>Looks up the type of the lexical variable at position <i>po</i> in the
currently-compiling pad. If the variable is typed, the stash of the
class to which it is typed is returned. If not, <code class="inline"><span class="w">NULL</span></code>
is returned.</p>
<pre class="verbatim"><ol><li> <span class="w">HV</span> * <span class="i">pad_compname_type</span><span class="s">(</span><span class="w">PADOFFSET</span> <span class="w">po</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_2pvbyte_nolen"></a><b>sv_2pvbyte_nolen
</b>
<p>Return a pointer to the byte-encoded representation of the SV.
May cause the SV to be downgraded from UTF-8 as a side-effect.</p>
<p>Usually accessed via the <code class="inline"><span class="w">SvPVbyte_nolen</span></code>
macro.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_2pvbyte_nolen</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_2pvutf8_nolen"></a><b>sv_2pvutf8_nolen
</b>
<p>Return a pointer to the UTF-8-encoded representation of the SV.
May cause the SV to be upgraded to UTF-8 as a side-effect.</p>
<p>Usually accessed via the <code class="inline"><span class="w">SvPVutf8_nolen</span></code>
macro.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_2pvutf8_nolen</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_2pv_nolen"></a><b>sv_2pv_nolen
</b>
<p>Like <code class="inline"><span class="i">sv_2pv</span><span class="s">(</span><span class="s">)</span></code>
, but doesn't return the length too. You should usually
use the macro wrapper <code class="inline"><span class="i">SvPV_nolen</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span></code>
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_2pv_nolen</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_catpvn_mg"></a><b>sv_catpvn_mg
</b>
<p>Like <code class="inline"><span class="w">sv_catpvn</span></code>
, but also handles 'set' magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_catpvn_mg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">ptr</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_catsv_mg"></a><b>sv_catsv_mg
</b>
<p>Like <code class="inline"><span class="w">sv_catsv</span></code>
, but also handles 'set' magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_catsv_mg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">dsv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">ssv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_force_normal"></a><b>sv_force_normal
</b>
<p>Undo various types of fakery on an SV: if the PV is a shared string, make
a private copy; if we're a ref, stop refing; if we're a glob, downgrade to
an xpvmg. See also <code class="inline"><span class="w">sv_force_normal_flags</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_force_normal</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_iv"></a><b>sv_iv
</b>
<p>A private implementation of the <code class="inline"><span class="w">SvIVx</span></code>
macro for compilers which can't
cope with complex macro expressions. Always use the macro instead.</p>
<pre class="verbatim"><ol><li> <span class="w">IV</span> <span class="i">sv_iv</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_nolocking"></a><b>sv_nolocking
</b>
<p>Dummy routine which "locks" an SV when there is no locking module present.
Exists to avoid test for a NULL function pointer and because it could
potentially warn under some level of strict-ness.</p>
<p>"Superseded" by sv_nosharing().</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_nolocking</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_nounlocking"></a><b>sv_nounlocking
</b>
<p>Dummy routine which "unlocks" an SV when there is no locking module present.
Exists to avoid test for a NULL function pointer and because it could
potentially warn under some level of strict-ness.</p>
<p>"Superseded" by sv_nosharing().</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_nounlocking</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_nv"></a><b>sv_nv
</b>
<p>A private implementation of the <code class="inline"><span class="w">SvNVx</span></code>
macro for compilers which can't
cope with complex macro expressions. Always use the macro instead.</p>
<pre class="verbatim"><ol><li> <span class="w">NV</span> <span class="i">sv_nv</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_pv"></a><b>sv_pv
</b>
<p>Use the <code class="inline"><span class="w">SvPV_nolen</span></code>
macro instead</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_pv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_pvbyte"></a><b>sv_pvbyte
</b>
<p>Use <code class="inline"><span class="w">SvPVbyte_nolen</span></code>
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_pvbyte</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_pvbyten"></a><b>sv_pvbyten
</b>
<p>A private implementation of the <code class="inline"><span class="w">SvPVbyte</span></code>
macro for compilers
which can't cope with complex macro expressions. Always use the macro
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_pvbyten</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> *<span class="w">lp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_pvn"></a><b>sv_pvn
</b>
<p>A private implementation of the <code class="inline"><span class="w">SvPV</span></code>
macro for compilers which can't
cope with complex macro expressions. Always use the macro instead.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_pvn</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> *<span class="w">lp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_pvutf8"></a><b>sv_pvutf8
</b>
<p>Use the <code class="inline"><span class="w">SvPVutf8_nolen</span></code>
macro instead</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_pvutf8</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_pvutf8n"></a><b>sv_pvutf8n
</b>
<p>A private implementation of the <code class="inline"><span class="w">SvPVutf8</span></code>
macro for compilers
which can't cope with complex macro expressions. Always use the macro
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_pvutf8n</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> *<span class="w">lp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_taint"></a><b>sv_taint
</b>
<p>Taint an SV. Use <code class="inline"><span class="w">SvTAINTED_on</span></code>
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_taint</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_unref"></a><b>sv_unref
</b>
<p>Unsets the RV status of the SV, and decrements the reference count of
whatever was being referenced by the RV. This can almost be thought of
as a reversal of <code class="inline"><span class="w">newSVrv</span></code>
. This is <code class="inline"><span class="w">sv_unref_flags</span></code>
with the <code class="inline"><span class="w">flag</span></code>
being zero. See <code class="inline"><span class="w">SvROK_off</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_unref</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_usepvn"></a><b>sv_usepvn
</b>
<p>Tells an SV to use <code class="inline"><span class="w">ptr</span></code>
to find its string value. Implemented by
calling <code class="inline"><span class="w">sv_usepvn_flags</span></code>
with <code class="inline"><span class="w">flags</span></code>
of 0, hence does not handle 'set'
magic. See <code class="inline"><span class="w">sv_usepvn_flags</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_usepvn</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">char</span>* <span class="w">ptr</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_usepvn_mg"></a><b>sv_usepvn_mg
</b>
<p>Like <code class="inline"><span class="w">sv_usepvn</span></code>
, but also handles 'set' magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_usepvn_mg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="cm">,</span> <span class="w">char</span> *<span class="w">ptr</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_uv"></a><b>sv_uv
</b>
<p>A private implementation of the <code class="inline"><span class="w">SvUVx</span></code>
macro for compilers which can't
cope with complex macro expressions. Always use the macro instead.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">sv_uv</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="unpack_str"></a><b>unpack_str
</b>
<p>The engine implementing unpack() Perl function. Note: parameters strbeg,
new_s and ocnt are not used. This call should not be used, use
unpackstring instead.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">unpack_str</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">pat</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">patend</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="q">s, const char *strbeg,</span></li><li> <span class="q"> const char *strend,</span> <span class="w">char</span> **<span class="w">new_s</span><span class="cm">,</span></li><li> <span class="w">I32</span> <span class="w">ocnt</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="utf8_to_uvchr"></a><b>utf8_to_uvchr
</b>
<p>DEPRECATED! It is planned to remove this function from a
future release of Perl. Do not use it for new code; remove it from
existing code.</p>
<p>Returns the native code point of the first character in the string <code class="inline"><a class="l_k" href="functions/s.html">s</a></code>
which is assumed to be in UTF-8 encoding; <code class="inline"><span class="w">retlen</span></code>
will be set to the
length, in bytes, of that character.</p>
<p>Some, but not all, UTF-8 malformations are detected, and in fact, some
malformed input could cause reading beyond the end of the input buffer, which
is why this function is deprecated. Use <a href="#utf8_to_uvchr_buf">utf8_to_uvchr_buf</a> instead.</p>
<p>If <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> points to one of the detected malformations, and UTF8 warnings are
enabled, zero is returned and <code class="inline"><span class="i">*retlen</span></code>
is set (if <code class="inline"><span class="w">retlen</span></code>
isn't
NULL) to -1. If those warnings are off, the computed value if well-defined (or
the Unicode REPLACEMENT CHARACTER, if not) is silently returned, and <code class="inline"><span class="i">*retlen</span></code>
is set (if <code class="inline"><span class="w">retlen</span></code>
isn't NULL) so that (<code class="inline"><a class="l_k" href="functions/s.html">s</a></code> + <code class="inline"><span class="i">*retlen</span></code>
) is the
next possible position in <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> that could begin a non-malformed character.
See <a href="#utf8n_to_uvchr">utf8n_to_uvchr</a> for details on when the REPLACEMENT CHARACTER is returned.</p>
<pre class="verbatim"><ol><li> UV utf8_to_uvchr(const U8 *s, STRLEN *retlen)</li></ol></pre></li>
<li><a name="utf8_to_uvuni"></a><b>utf8_to_uvuni
</b>
<p>DEPRECATED! It is planned to remove this function from a
future release of Perl. Do not use it for new code; remove it from
existing code.</p>
<p>Returns the Unicode code point of the first character in the string <code class="inline"><a class="l_k" href="functions/s.html">s</a></code>
which is assumed to be in UTF-8 encoding; <code class="inline"><span class="w">retlen</span></code>
will be set to the
length, in bytes, of that character.</p>
<p>Some, but not all, UTF-8 malformations are detected, and in fact, some
malformed input could cause reading beyond the end of the input buffer, which
is one reason why this function is deprecated. The other is that only in
extremely limited circumstances should the Unicode versus native code point be
of any interest to you. See <a href="#utf8_to_uvuni_buf">utf8_to_uvuni_buf</a> for alternatives.</p>
<p>If <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> points to one of the detected malformations, and UTF8 warnings are
enabled, zero is returned and <code class="inline"><span class="i">*retlen</span></code>
is set (if <code class="inline"><span class="w">retlen</span></code>
doesn't point to
NULL) to -1. If those warnings are off, the computed value if well-defined (or
the Unicode REPLACEMENT CHARACTER, if not) is silently returned, and <code class="inline"><span class="i">*retlen</span></code>
is set (if <code class="inline"><span class="w">retlen</span></code>
isn't NULL) so that (<code class="inline"><a class="l_k" href="functions/s.html">s</a></code> + <code class="inline"><span class="i">*retlen</span></code>
) is the
next possible position in <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> that could begin a non-malformed character.
See <a href="#utf8n_to_uvchr">utf8n_to_uvchr</a> for details on when the REPLACEMENT CHARACTER is returned.</p>
<pre class="verbatim"><ol><li> UV utf8_to_uvuni(const U8 *s, STRLEN *retlen)</li></ol></pre></li>
</ul>
<a name="Optree-construction"></a><h1>Optree construction</h1>
<ul>
<li><a name="newASSIGNOP"></a><b>newASSIGNOP
</b>
<p>Constructs, checks, and returns an assignment op. <i>left</i> and <i>right</i>
supply the parameters of the assignment; they are consumed by this
function and become part of the constructed op tree.</p>
<p>If <i>optype</i> is <code class="inline"><span class="w">OP_ANDASSIGN</span></code>
, <code class="inline"><span class="w">OP_ORASSIGN</span></code>
, or <code class="inline"><span class="w">OP_DORASSIGN</span></code>
, then
a suitable conditional optree is constructed. If <i>optype</i> is the opcode
of a binary operator, such as <code class="inline"><span class="w">OP_BIT_OR</span></code>
, then an op is constructed that
performs the binary operation and assigns the result to the left argument.
Either way, if <i>optype</i> is non-zero then <i>flags</i> has no effect.</p>
<p>If <i>optype</i> is zero, then a plain scalar or list assignment is
constructed. Which type of assignment it is is automatically determined.
<i>flags</i> gives the eight bits of <code class="inline"><span class="w">op_flags</span></code>
, except that <code class="inline"><span class="w">OPf_KIDS</span></code>
will be set automatically, and, shifted up eight bits, the eight bits
of <code class="inline"><span class="w">op_private</span></code>
, except that the bit with value 1 or 2 is automatically
set as required.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newASSIGNOP</span><span class="s">(</span><span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">left</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">optype</span><span class="cm">,</span></li><li> <span class="w">OP</span> *<span class="w">right</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newBINOP"></a><b>newBINOP
</b>
<p>Constructs, checks, and returns an op of any binary type. <i>type</i>
is the opcode. <i>flags</i> gives the eight bits of <code class="inline"><span class="w">op_flags</span></code>
, except
that <code class="inline"><span class="w">OPf_KIDS</span></code>
will be set automatically, and, shifted up eight bits,
the eight bits of <code class="inline"><span class="w">op_private</span></code>
, except that the bit with value 1 or
2 is automatically set as required. <i>first</i> and <i>last</i> supply up to
two ops to be the direct children of the binary op; they are consumed
by this function and become part of the constructed op tree.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newBINOP</span><span class="s">(</span><span class="w">I32</span> <span class="w">type</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">first</span><span class="cm">,</span></li><li> <span class="w">OP</span> *<a class="l_k" href="functions/last.html">last</a><span class="s">)</span></li></ol></pre></li>
<li><a name="newCONDOP"></a><b>newCONDOP
</b>
<p>Constructs, checks, and returns a conditional-expression (<code class="inline"><span class="w">cond_expr</span></code>
)
op. <i>flags</i> gives the eight bits of <code class="inline"><span class="w">op_flags</span></code>
, except that <code class="inline"><span class="w">OPf_KIDS</span></code>
will be set automatically, and, shifted up eight bits, the eight bits of
<code class="inline"><span class="w">op_private</span></code>
, except that the bit with value 1 is automatically set.
<i>first</i> supplies the expression selecting between the two branches,
and <i>trueop</i> and <i>falseop</i> supply the branches; they are consumed by
this function and become part of the constructed op tree.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newCONDOP</span><span class="s">(</span><span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">first</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">trueop</span><span class="cm">,</span></li><li> <span class="w">OP</span> *<span class="w">falseop</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newDEFSVOP"></a><b>newDEFSVOP
</b>
<p>Constructs and returns an op to access <code class="inline"><span class="i">$_</span></code>
, either as a lexical
variable (if declared as <code class="inline"><a class="l_k" href="functions/my.html">my</a> <span class="i">$_</span></code>
) in the current scope, or the
global <code class="inline"><span class="i">$_</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newDEFSVOP</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newFOROP"></a><b>newFOROP
</b>
<p>Constructs, checks, and returns an op tree expressing a <code class="inline">foreach</code>
loop (iteration through a list of values). This is a heavyweight loop,
with structure that allows exiting the loop by <code class="inline"><a class="l_k" href="functions/last.html">last</a></code> and suchlike.</p>
<p><i>sv</i> optionally supplies the variable that will be aliased to each
item in turn; if null, it defaults to <code class="inline"><span class="i">$_</span></code>
(either lexical or global).
<i>expr</i> supplies the list of values to iterate over. <i>block</i> supplies
the main body of the loop, and <i>cont</i> optionally supplies a <code class="inline"><a class="l_k" href="functions/continue.html">continue</a></code>
block that operates as a second half of the body. All of these optree
inputs are consumed by this function and become part of the constructed
op tree.</p>
<p><i>flags</i> gives the eight bits of <code class="inline"><span class="w">op_flags</span></code>
for the <code class="inline"><span class="w">leaveloop</span></code>
op and, shifted up eight bits, the eight bits of <code class="inline"><span class="w">op_private</span></code>
for
the <code class="inline"><span class="w">leaveloop</span></code>
op, except that (in both cases) some bits will be set
automatically.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newFOROP</span><span class="s">(</span><span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">sv</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">expr</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">block</span><span class="cm">,</span></li><li> <span class="w">OP</span> *<span class="w">cont</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newGIVENOP"></a><b>newGIVENOP
</b>
<p>Constructs, checks, and returns an op tree expressing a <code class="inline">given</code>
block.
<i>cond</i> supplies the expression that will be locally assigned to a lexical
variable, and <i>block</i> supplies the body of the <code class="inline">given</code>
construct; they
are consumed by this function and become part of the constructed op tree.
<i>defsv_off</i> is the pad offset of the scalar lexical variable that will
be affected. If it is 0, the global $_ will be used.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newGIVENOP</span><span class="s">(</span><span class="w">OP</span> *<span class="w">cond</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">block</span><span class="cm">,</span></li><li> <span class="w">PADOFFSET</span> <span class="w">defsv_off</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newGVOP"></a><b>newGVOP
</b>
<p>Constructs, checks, and returns an op of any type that involves an
embedded reference to a GV. <i>type</i> is the opcode. <i>flags</i> gives the
eight bits of <code class="inline"><span class="w">op_flags</span></code>
. <i>gv</i> identifies the GV that the op should
reference; calling this function does not transfer ownership of any
reference to it.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newGVOP</span><span class="s">(</span><span class="w">I32</span> <span class="w">type</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">GV</span> *<span class="w">gv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newLISTOP"></a><b>newLISTOP
</b>
<p>Constructs, checks, and returns an op of any list type. <i>type</i> is
the opcode. <i>flags</i> gives the eight bits of <code class="inline"><span class="w">op_flags</span></code>
, except that
<code class="inline"><span class="w">OPf_KIDS</span></code>
will be set automatically if required. <i>first</i> and <i>last</i>
supply up to two ops to be direct children of the list op; they are
consumed by this function and become part of the constructed op tree.</p>
<p>For most list operators, the check function expects all the kid ops to be
present already, so calling <code class="inline"><span class="i">newLISTOP</span><span class="s">(</span><span class="w">OP_JOIN</span><span class="cm">,</span> ...<span class="s">)</span></code>
(e.g.) is not
appropriate. What you want to do in that case is create an op of type
OP_LIST, append more children to it, and then call <a href="#op_convert_list">op_convert_list</a>.
See <a href="#op_convert_list">op_convert_list</a> for more information.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newLISTOP</span><span class="s">(</span><span class="w">I32</span> <span class="w">type</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">first</span><span class="cm">,</span></li><li> <span class="w">OP</span> *<a class="l_k" href="functions/last.html">last</a><span class="s">)</span></li></ol></pre></li>
<li><a name="newLOGOP"></a><b>newLOGOP
</b>
<p>Constructs, checks, and returns a logical (flow control) op. <i>type</i>
is the opcode. <i>flags</i> gives the eight bits of <code class="inline"><span class="w">op_flags</span></code>
, except
that <code class="inline"><span class="w">OPf_KIDS</span></code>
will be set automatically, and, shifted up eight bits,
the eight bits of <code class="inline"><span class="w">op_private</span></code>
, except that the bit with value 1 is
automatically set. <i>first</i> supplies the expression controlling the
flow, and <i>other</i> supplies the side (alternate) chain of ops; they are
consumed by this function and become part of the constructed op tree.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newLOGOP</span><span class="s">(</span><span class="w">I32</span> <span class="w">type</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">first</span><span class="cm">,</span></li><li> <span class="w">OP</span> *<span class="w">other</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newLOOPEX"></a><b>newLOOPEX
</b>
<p>Constructs, checks, and returns a loop-exiting op (such as <code class="inline"><a class="l_k" href="functions/goto.html">goto</a></code>
or <code class="inline"><a class="l_k" href="functions/last.html">last</a></code>). <i>type</i> is the opcode. <i>label</i> supplies the parameter
determining the target of the op; it is consumed by this function and
becomes part of the constructed op tree.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newLOOPEX</span><span class="s">(</span><span class="w">I32</span> <span class="w">type</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">label</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newLOOPOP"></a><b>newLOOPOP
</b>
<p>Constructs, checks, and returns an op tree expressing a loop. This is
only a loop in the control flow through the op tree; it does not have
the heavyweight loop structure that allows exiting the loop by <code class="inline"><a class="l_k" href="functions/last.html">last</a></code>
and suchlike. <i>flags</i> gives the eight bits of <code class="inline"><span class="w">op_flags</span></code>
for the
top-level op, except that some bits will be set automatically as required.
<i>expr</i> supplies the expression controlling loop iteration, and <i>block</i>
supplies the body of the loop; they are consumed by this function and
become part of the constructed op tree. <i>debuggable</i> is currently
unused and should always be 1.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newLOOPOP</span><span class="s">(</span><span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">debuggable</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">expr</span><span class="cm">,</span></li><li> <span class="w">OP</span> *<span class="w">block</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newMETHOP"></a><b>newMETHOP
</b>
<p>Constructs, checks, and returns an op of method type with a method name
evaluated at runtime. <i>type</i> is the opcode. <i>flags</i> gives the eight
bits of <code class="inline"><span class="w">op_flags</span></code>
, except that <code class="inline"><span class="w">OPf_KIDS</span></code>
will be set automatically,
and, shifted up eight bits, the eight bits of <code class="inline"><span class="w">op_private</span></code>
, except that
the bit with value 1 is automatically set. <i>dynamic_meth</i> supplies an
op which evaluates method name; it is consumed by this function and
become part of the constructed op tree.
Supported optypes: OP_METHOD.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newMETHOP</span><span class="s">(</span><span class="w">I32</span> <span class="w">type</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">first</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newMETHOP_named"></a><b>newMETHOP_named
</b>
<p>Constructs, checks, and returns an op of method type with a constant
method name. <i>type</i> is the opcode. <i>flags</i> gives the eight bits of
<code class="inline"><span class="w">op_flags</span></code>
, and, shifted up eight bits, the eight bits of
<code class="inline"><span class="w">op_private</span></code>
. <i>const_meth</i> supplies a constant method name;
it must be a shared COW string.
Supported optypes: OP_METHOD_NAMED.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newMETHOP_named</span><span class="s">(</span><span class="w">I32</span> <span class="w">type</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span></li><li> <span class="w">SV</span> *<span class="w">const_meth</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newNULLLIST"></a><b>newNULLLIST
</b>
<p>Constructs, checks, and returns a new <code class="inline"><span class="w">stub</span></code>
op, which represents an
empty list expression.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newNULLLIST</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newOP"></a><b>newOP
</b>
<p>Constructs, checks, and returns an op of any base type (any type that
has no extra fields). <i>type</i> is the opcode. <i>flags</i> gives the
eight bits of <code class="inline"><span class="w">op_flags</span></code>
, and, shifted up eight bits, the eight bits
of <code class="inline"><span class="w">op_private</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newOP</span><span class="s">(</span><span class="w">I32</span> <span class="w">type</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newPADOP"></a><b>newPADOP
</b>
<p>Constructs, checks, and returns an op of any type that involves a
reference to a pad element. <i>type</i> is the opcode. <i>flags</i> gives the
eight bits of <code class="inline"><span class="w">op_flags</span></code>
. A pad slot is automatically allocated, and
is populated with <i>sv</i>; this function takes ownership of one reference
to it.</p>
<p>This function only exists if Perl has been compiled to use ithreads.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newPADOP</span><span class="s">(</span><span class="w">I32</span> <span class="w">type</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newPMOP"></a><b>newPMOP
</b>
<p>Constructs, checks, and returns an op of any pattern matching type.
<i>type</i> is the opcode. <i>flags</i> gives the eight bits of <code class="inline"><span class="w">op_flags</span></code>
and, shifted up eight bits, the eight bits of <code class="inline"><span class="w">op_private</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newPMOP</span><span class="s">(</span><span class="w">I32</span> <span class="w">type</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newPVOP"></a><b>newPVOP
</b>
<p>Constructs, checks, and returns an op of any type that involves an
embedded C-level pointer (PV). <i>type</i> is the opcode. <i>flags</i> gives
the eight bits of <code class="inline"><span class="w">op_flags</span></code>
. <i>pv</i> supplies the C-level pointer, which
must have been allocated using <code class="inline"><span class="w">PerlMemShared_malloc</span></code>
; the memory will
be freed when the op is destroyed.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newPVOP</span><span class="s">(</span><span class="w">I32</span> <span class="w">type</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">char</span> *<span class="w">pv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newRANGE"></a><b>newRANGE
</b>
<p>Constructs and returns a <code class="inline"><span class="w">range</span></code>
op, with subordinate <code class="inline"><span class="w">flip</span></code>
and
<code class="inline"><span class="w">flop</span></code>
ops. <i>flags</i> gives the eight bits of <code class="inline"><span class="w">op_flags</span></code>
for the
<code class="inline"><span class="w">flip</span></code>
op and, shifted up eight bits, the eight bits of <code class="inline"><span class="w">op_private</span></code>
for both the <code class="inline"><span class="w">flip</span></code>
and <code class="inline"><span class="w">range</span></code>
ops, except that the bit with value
1 is automatically set. <i>left</i> and <i>right</i> supply the expressions
controlling the endpoints of the range; they are consumed by this function
and become part of the constructed op tree.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newRANGE</span><span class="s">(</span><span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">left</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">right</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newSLICEOP"></a><b>newSLICEOP
</b>
<p>Constructs, checks, and returns an <code class="inline"><span class="w">lslice</span></code>
(list slice) op. <i>flags</i>
gives the eight bits of <code class="inline"><span class="w">op_flags</span></code>
, except that <code class="inline"><span class="w">OPf_KIDS</span></code>
will
be set automatically, and, shifted up eight bits, the eight bits of
<code class="inline"><span class="w">op_private</span></code>
, except that the bit with value 1 or 2 is automatically
set as required. <i>listval</i> and <i>subscript</i> supply the parameters of
the slice; they are consumed by this function and become part of the
constructed op tree.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newSLICEOP</span><span class="s">(</span><span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">subscript</span><span class="cm">,</span></li><li> <span class="w">OP</span> *<span class="w">listval</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newSTATEOP"></a><b>newSTATEOP
</b>
<p>Constructs a state op (COP). The state op is normally a <code class="inline"><span class="w">nextstate</span></code>
op,
but will be a <code class="inline"><span class="w">dbstate</span></code>
op if debugging is enabled for currently-compiled
code. The state op is populated from <code class="inline"><span class="w">PL_curcop</span></code>
(or <code class="inline"><span class="w">PL_compiling</span></code>
).
If <i>label</i> is non-null, it supplies the name of a label to attach to
the state op; this function takes ownership of the memory pointed at by
<i>label</i>, and will free it. <i>flags</i> gives the eight bits of <code class="inline"><span class="w">op_flags</span></code>
for the state op.</p>
<p>If <i>o</i> is null, the state op is returned. Otherwise the state op is
combined with <i>o</i> into a <code class="inline"><span class="w">lineseq</span></code>
list op, which is returned. <i>o</i>
is consumed by this function and becomes part of the returned op tree.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newSTATEOP</span><span class="s">(</span><span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">char</span> *<span class="w">label</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">o</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newSVOP"></a><b>newSVOP
</b>
<p>Constructs, checks, and returns an op of any type that involves an
embedded SV. <i>type</i> is the opcode. <i>flags</i> gives the eight bits
of <code class="inline"><span class="w">op_flags</span></code>
. <i>sv</i> gives the SV to embed in the op; this function
takes ownership of one reference to it.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newSVOP</span><span class="s">(</span><span class="w">I32</span> <span class="w">type</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newUNOP"></a><b>newUNOP
</b>
<p>Constructs, checks, and returns an op of any unary type. <i>type</i> is
the opcode. <i>flags</i> gives the eight bits of <code class="inline"><span class="w">op_flags</span></code>
, except that
<code class="inline"><span class="w">OPf_KIDS</span></code>
will be set automatically if required, and, shifted up eight
bits, the eight bits of <code class="inline"><span class="w">op_private</span></code>
, except that the bit with value 1
is automatically set. <i>first</i> supplies an optional op to be the direct
child of the unary op; it is consumed by this function and become part
of the constructed op tree.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newUNOP</span><span class="s">(</span><span class="w">I32</span> <span class="w">type</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">first</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newUNOP_AUX"></a><b>newUNOP_AUX
</b>
<p>Similar to <code class="inline"><span class="w">newUNOP</span></code>
, but creates an UNOP_AUX struct instead, with op_aux
initialised to aux</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span>* <span class="i">newUNOP_AUX</span><span class="s">(</span><span class="w">I32</span> <span class="w">type</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">OP</span>* <span class="w">first</span><span class="cm">,</span></li><li> <span class="w">UNOP_AUX_item</span> *<span class="w">aux</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newWHENOP"></a><b>newWHENOP
</b>
<p>Constructs, checks, and returns an op tree expressing a <code class="inline">when</code>
block.
<i>cond</i> supplies the test expression, and <i>block</i> supplies the block
that will be executed if the test evaluates to true; they are consumed
by this function and become part of the constructed op tree. <i>cond</i>
will be interpreted DWIMically, often as a comparison against <code class="inline"><span class="i">$_</span></code>
,
and may be null to generate a <code class="inline"><span class="w">default</span></code>
block.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newWHENOP</span><span class="s">(</span><span class="w">OP</span> *<span class="w">cond</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">block</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newWHILEOP"></a><b>newWHILEOP
</b>
<p>Constructs, checks, and returns an op tree expressing a <code class="inline">while</code>
loop.
This is a heavyweight loop, with structure that allows exiting the loop
by <code class="inline"><a class="l_k" href="functions/last.html">last</a></code> and suchlike.</p>
<p><i>loop</i> is an optional preconstructed <code class="inline"><span class="w">enterloop</span></code>
op to use in the
loop; if it is null then a suitable op will be constructed automatically.
<i>expr</i> supplies the loop's controlling expression. <i>block</i> supplies the
main body of the loop, and <i>cont</i> optionally supplies a <code class="inline"><a class="l_k" href="functions/continue.html">continue</a></code> block
that operates as a second half of the body. All of these optree inputs
are consumed by this function and become part of the constructed op tree.</p>
<p><i>flags</i> gives the eight bits of <code class="inline"><span class="w">op_flags</span></code>
for the <code class="inline"><span class="w">leaveloop</span></code>
op and, shifted up eight bits, the eight bits of <code class="inline"><span class="w">op_private</span></code>
for
the <code class="inline"><span class="w">leaveloop</span></code>
op, except that (in both cases) some bits will be set
automatically. <i>debuggable</i> is currently unused and should always be 1.
<i>has_my</i> can be supplied as true to force the
loop body to be enclosed in its own scope.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">newWHILEOP</span><span class="s">(</span><span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">debuggable</span><span class="cm">,</span></li><li> <span class="w">LOOP</span> *<span class="w">loop</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">expr</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">block</span><span class="cm">,</span></li><li> <span class="w">OP</span> *<span class="w">cont</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">has_my</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Optree-Manipulation-Functions"></a><h1>Optree Manipulation Functions</h1>
<ul>
<li><a name="alloccopstash"></a><b>alloccopstash
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Available only under threaded builds, this function allocates an entry in
<code class="inline"><span class="w">PL_stashpad</span></code>
for the stash passed to it.</p>
<pre class="verbatim"><ol><li> <span class="w">PADOFFSET</span> <span class="i">alloccopstash</span><span class="s">(</span><span class="w">HV</span> *<span class="w">hv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="block_end"></a><b>block_end
</b>
<p>Handles compile-time scope exit. <i>floor</i>
is the savestack index returned by
<code class="inline"><span class="w">block_start</span></code>
, and <i>seq</i> is the body of the block. Returns the block,
possibly modified.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">block_end</span><span class="s">(</span><span class="w">I32</span> <span class="w">floor</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">seq</span><span class="s">)</span></li></ol></pre></li>
<li><a name="block_start"></a><b>block_start
</b>
<p>Handles compile-time scope entry.
Arranges for hints to be restored on block
exit and also handles pad sequence numbers to make lexical variables scope
right. Returns a savestack index for use with <code class="inline"><span class="w">block_end</span></code>
.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">block_start</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> <span class="w">full</span><span class="s">)</span></li></ol></pre></li>
<li><a name="ck_entersub_args_list"></a><b>ck_entersub_args_list
</b>
<p>Performs the default fixup of the arguments part of an <code class="inline"><span class="w">entersub</span></code>
op tree. This consists of applying list context to each of the
argument ops. This is the standard treatment used on a call marked
with <code class="inline"><span class="i">&</span></code>
, or a method call, or a call through a subroutine reference,
or any other call where the callee can't be identified at compile time,
or a call where the callee has no prototype.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">ck_entersub_args_list</span><span class="s">(</span><span class="w">OP</span> *<span class="w">entersubop</span><span class="s">)</span></li></ol></pre></li>
<li><a name="ck_entersub_args_proto"></a><b>ck_entersub_args_proto
</b>
<p>Performs the fixup of the arguments part of an <code class="inline"><span class="w">entersub</span></code>
op tree
based on a subroutine prototype. This makes various modifications to
the argument ops, from applying context up to inserting <code class="inline"><span class="w">refgen</span></code>
ops,
and checking the number and syntactic types of arguments, as directed by
the prototype. This is the standard treatment used on a subroutine call,
not marked with <code class="inline"><span class="i">&</span></code>
, where the callee can be identified at compile time
and has a prototype.</p>
<p><i>protosv</i> supplies the subroutine prototype to be applied to the call.
It may be a normal defined scalar, of which the string value will be used.
Alternatively, for convenience, it may be a subroutine object (a <code class="inline"><span class="w">CV</span>*</code>
that has been cast to <code class="inline"><span class="w">SV</span>*</code>
) which has a prototype. The prototype
supplied, in whichever form, does not need to match the actual callee
referenced by the op tree.</p>
<p>If the argument ops disagree with the prototype, for example by having
an unacceptable number of arguments, a valid op tree is returned anyway.
The error is reflected in the parser state, normally resulting in a single
exception at the top level of parsing which covers all the compilation
errors that occurred. In the error message, the callee is referred to
by the name defined by the <i>namegv</i> parameter.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">ck_entersub_args_proto</span><span class="s">(</span><span class="w">OP</span> *<span class="w">entersubop</span><span class="cm">,</span></li><li> <span class="w">GV</span> *<span class="w">namegv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">protosv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="ck_entersub_args_proto_or_list"></a><b>ck_entersub_args_proto_or_list
</b>
<p>Performs the fixup of the arguments part of an <code class="inline"><span class="w">entersub</span></code>
op tree either
based on a subroutine prototype or using default list-context processing.
This is the standard treatment used on a subroutine call, not marked
with <code class="inline"><span class="i">&</span></code>
, where the callee can be identified at compile time.</p>
<p><i>protosv</i> supplies the subroutine prototype to be applied to the call,
or indicates that there is no prototype. It may be a normal scalar,
in which case if it is defined then the string value will be used
as a prototype, and if it is undefined then there is no prototype.
Alternatively, for convenience, it may be a subroutine object (a <code class="inline"><span class="w">CV</span>*</code>
that has been cast to <code class="inline"><span class="w">SV</span>*</code>
), of which the prototype will be used if it
has one. The prototype (or lack thereof) supplied, in whichever form,
does not need to match the actual callee referenced by the op tree.</p>
<p>If the argument ops disagree with the prototype, for example by having
an unacceptable number of arguments, a valid op tree is returned anyway.
The error is reflected in the parser state, normally resulting in a single
exception at the top level of parsing which covers all the compilation
errors that occurred. In the error message, the callee is referred to
by the name defined by the <i>namegv</i> parameter.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">ck_entersub_args_proto_or_list</span><span class="s">(</span><span class="w">OP</span> *<span class="w">entersubop</span><span class="cm">,</span></li><li> <span class="w">GV</span> *<span class="w">namegv</span><span class="cm">,</span></li><li> <span class="w">SV</span> *<span class="w">protosv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cv_const_sv"></a><b>cv_const_sv
</b>
<p>If <code class="inline"><span class="w">cv</span></code>
is a constant sub eligible for inlining, returns the constant
value returned by the sub. Otherwise, returns NULL.</p>
<p>Constant subs can be created with <code class="inline"><span class="w">newCONSTSUB</span></code>
or as described in
<a href="perlsub.html#Constant-Functions">Constant Functions in perlsub</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">cv_const_sv</span><span class="s">(</span><span class="w">const</span> <span class="w">CV</span> *<span class="w">const</span> <span class="w">cv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cv_get_call_checker"></a><b>cv_get_call_checker
</b>
<p>Retrieves the function that will be used to fix up a call to <i>cv</i>.
Specifically, the function is applied to an <code class="inline"><span class="w">entersub</span></code>
op tree for a
subroutine call, not marked with <code class="inline"><span class="i">&</span></code>
, where the callee can be identified
at compile time as <i>cv</i>.</p>
<p>The C-level function pointer is returned in <i>*ckfun_p</i>, and an SV
argument for it is returned in <i>*ckobj_p</i>. The function is intended
to be called in this manner:</p>
<pre class="verbatim"><ol><li> <span class="w">entersubop</span> = <span class="s">(</span><span class="i">*ckfun_p</span><span class="s">)</span><span class="s">(</span><span class="w">aTHX_</span> <span class="w">entersubop</span><span class="cm">,</span> <span class="w">namegv</span><span class="cm">,</span> <span class="s">(</span><span class="i">*ckobj_p</span><span class="s">)</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>In this call, <i>entersubop</i> is a pointer to the <code class="inline"><span class="w">entersub</span></code>
op,
which may be replaced by the check function, and <i>namegv</i> is a GV
supplying the name that should be used by the check function to refer
to the callee of the <code class="inline"><span class="w">entersub</span></code>
op if it needs to emit any diagnostics.
It is permitted to apply the check function in non-standard situations,
such as to a call to a different subroutine or to a method call.</p>
<p>By default, the function is
<a href="#ck_entersub_args_proto_or_list">Perl_ck_entersub_args_proto_or_list</a>,
and the SV parameter is <i>cv</i> itself. This implements standard
prototype processing. It can be changed, for a particular subroutine,
by <a href="#cv_set_call_checker">cv_set_call_checker</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">cv_get_call_checker</span><span class="s">(</span><span class="w">CV</span> *<span class="w">cv</span><span class="cm">,</span></li><li> <span class="w">Perl_call_checker</span> *<span class="w">ckfun_p</span><span class="cm">,</span></li><li> <span class="w">SV</span> **<span class="w">ckobj_p</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cv_set_call_checker"></a><b>cv_set_call_checker
</b>
<p>The original form of <a href="#cv_set_call_checker_flags">cv_set_call_checker_flags</a>, which passes it the
<code class="inline"><span class="w">CALL_CHECKER_REQUIRE_GV</span></code>
flag for backward-compatibility.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">cv_set_call_checker</span><span class="s">(</span><span class="w">CV</span> *<span class="w">cv</span><span class="cm">,</span></li><li> <span class="w">Perl_call_checker</span> <span class="w">ckfun</span><span class="cm">,</span></li><li> <span class="w">SV</span> *<span class="w">ckobj</span><span class="s">)</span></li></ol></pre></li>
<li><a name="cv_set_call_checker_flags"></a><b>cv_set_call_checker_flags
</b>
<p>Sets the function that will be used to fix up a call to <i>cv</i>.
Specifically, the function is applied to an <code class="inline"><span class="w">entersub</span></code>
op tree for a
subroutine call, not marked with <code class="inline"><span class="i">&</span></code>
, where the callee can be identified
at compile time as <i>cv</i>.</p>
<p>The C-level function pointer is supplied in <i>ckfun</i>, and an SV argument
for it is supplied in <i>ckobj</i>. The function should be defined like this:</p>
<pre class="verbatim"><ol><li> <span class="w">STATIC</span> <span class="w">OP</span> * <span class="i">ckfun</span><span class="s">(</span><span class="w">pTHX_</span> <span class="w">OP</span> *<span class="w">op</span><span class="cm">,</span> <span class="w">GV</span> *<span class="w">namegv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">ckobj</span><span class="s">)</span></li></ol></pre><p>It is intended to be called in this manner:</p>
<pre class="verbatim"><ol><li> <span class="w">entersubop</span> = <span class="i">ckfun</span><span class="s">(</span><span class="w">aTHX_</span> <span class="w">entersubop</span><span class="cm">,</span> <span class="w">namegv</span><span class="cm">,</span> <span class="w">ckobj</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>In this call, <i>entersubop</i> is a pointer to the <code class="inline"><span class="w">entersub</span></code>
op,
which may be replaced by the check function, and <i>namegv</i> supplies
the name that should be used by the check function to refer
to the callee of the <code class="inline"><span class="w">entersub</span></code>
op if it needs to emit any diagnostics.
It is permitted to apply the check function in non-standard situations,
such as to a call to a different subroutine or to a method call.</p>
<p><i>namegv</i> may not actually be a GV. For efficiency, perl may pass a
CV or other SV instead. Whatever is passed can be used as the first
argument to <a href="#cv_name">cv_name</a>. You can force perl to pass a GV by including
<code class="inline"><span class="w">CALL_CHECKER_REQUIRE_GV</span></code>
in the <i>flags</i>.</p>
<p>The current setting for a particular CV can be retrieved by
<a href="#cv_get_call_checker">cv_get_call_checker</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">cv_set_call_checker_flags</span><span class="s">(</span></li><li> <span class="w">CV</span> *<span class="w">cv</span><span class="cm">,</span> <span class="w">Perl_call_checker</span> <span class="w">ckfun</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">ckobj</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span></li><li> <span class="s">)</span></li></ol></pre></li>
<li><a name="LINKLIST"></a><b>LINKLIST
</b>
<p>Given the root of an optree, link the tree in execution order using the
<code class="inline"><span class="w">op_next</span></code>
pointers and return the first op executed. If this has
already been done, it will not be redone, and <code class="inline"><span class="w">o</span><span class="w">->op_next</span></code>
will be
returned. If <code class="inline"><span class="w">o</span><span class="w">->op_next</span></code>
is not already set, <i>o</i> should be at
least an <code class="inline"><span class="w">UNOP</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span>* <span class="i">LINKLIST</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newCONSTSUB"></a><b>newCONSTSUB
</b>
<p>See <a href="#newCONSTSUB_flags">newCONSTSUB_flags</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">CV</span>* <span class="i">newCONSTSUB</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newCONSTSUB_flags"></a><b>newCONSTSUB_flags
</b>
<p>Creates a constant sub equivalent to Perl <code class="inline"><a name="FOO"></a>sub <span class="m">FOO ()</span> <span class="s">{</span> <span class="n">123</span> <span class="s">}</span></code>
which is
eligible for inlining at compile-time.</p>
<p>Currently, the only useful value for <code class="inline"><span class="w">flags</span></code>
is SVf_UTF8.</p>
<p>The newly created subroutine takes ownership of a reference to the passed in
SV.</p>
<p>Passing NULL for SV creates a constant sub equivalent to <code class="inline"><a name="BAR"></a>sub <span class="m">BAR ()</span> <span class="s">{</span><span class="s">}</span></code>
,
which won't be called if used as a destructor, but will suppress the overhead
of a call to <code class="inline">AUTOLOAD</code>
. (This form, however, isn't eligible for inlining at
compile time.)</p>
<pre class="verbatim"><ol><li> <span class="w">CV</span>* <span class="i">newCONSTSUB_flags</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newXS"></a><b>newXS
</b>
<p>Used by <code class="inline"><span class="w">xsubpp</span></code>
to hook up XSUBs as Perl subs. <i>filename</i> needs to be
static storage, as it is used directly as CvFILE(), without a copy being made.</p>
</li>
<li><a name="OpHAS_SIBLING"></a><b>OpHAS_SIBLING
</b>
<p>Returns true if o has a sibling</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">OpHAS_SIBLING</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="s">)</span></li></ol></pre></li>
<li><a name="OpLASTSIB_set"></a><b>OpLASTSIB_set
</b>
<p>Marks o as having no further siblings. On <code class="inline"><span class="w">PERL_OP_PARENT</span></code>
builds, marks
o as having the specified parent. See also <code class="inline"><span class="w">OpMORESIB_set</span></code>
and
<code class="inline"><span class="w">OpMAYBESIB_set</span></code>
. For a higher-level interface, see
<code class="inline"><span class="w">op_sibling_splice</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">OpLASTSIB_set</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">parent</span><span class="s">)</span></li></ol></pre></li>
<li><a name="OpMAYBESIB_set"></a><b>OpMAYBESIB_set
</b>
<p>Conditionally does <code class="inline"><span class="w">OpMORESIB_set</span></code>
or <code class="inline"><span class="w">OpLASTSIB_set</span></code>
depending on whether
sib is non-null. For a higher-level interface, see <code class="inline"><span class="w">op_sibling_splice</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">OpMAYBESIB_set</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">sib</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">parent</span><span class="s">)</span></li></ol></pre></li>
<li><a name="OpMORESIB_set"></a><b>OpMORESIB_set
</b>
<p>Sets the sibling of o to the non-zero value sib. See also <code class="inline"><span class="w">OpLASTSIB_set</span></code>
and <code class="inline"><span class="w">OpMAYBESIB_set</span></code>
. For a higher-level interface, see
<code class="inline"><span class="w">op_sibling_splice</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">OpMORESIB_set</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">sib</span><span class="s">)</span></li></ol></pre></li>
<li><a name="OpSIBLING"></a><b>OpSIBLING
</b>
<p>Returns the sibling of o, or NULL if there is no sibling</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span>* <span class="i">OpSIBLING</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="s">)</span></li></ol></pre></li>
<li><a name="op_append_elem"></a><b>op_append_elem
</b>
<p>Append an item to the list of ops contained directly within a list-type
op, returning the lengthened list. <i>first</i> is the list-type op,
and <i>last</i> is the op to append to the list. <i>optype</i> specifies the
intended opcode for the list. If <i>first</i> is not already a list of the
right type, it will be upgraded into one. If either <i>first</i> or <i>last</i>
is null, the other is returned unchanged.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">op_append_elem</span><span class="s">(</span><span class="w">I32</span> <span class="w">optype</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">first</span><span class="cm">,</span> <span class="w">OP</span> *<a class="l_k" href="functions/last.html">last</a><span class="s">)</span></li></ol></pre></li>
<li><a name="op_append_list"></a><b>op_append_list
</b>
<p>Concatenate the lists of ops contained directly within two list-type ops,
returning the combined list. <i>first</i> and <i>last</i> are the list-type ops
to concatenate. <i>optype</i> specifies the intended opcode for the list.
If either <i>first</i> or <i>last</i> is not already a list of the right type,
it will be upgraded into one. If either <i>first</i> or <i>last</i> is null,
the other is returned unchanged.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">op_append_list</span><span class="s">(</span><span class="w">I32</span> <span class="w">optype</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">first</span><span class="cm">,</span> <span class="w">OP</span> *<a class="l_k" href="functions/last.html">last</a><span class="s">)</span></li></ol></pre></li>
<li><a name="OP_CLASS"></a><b>OP_CLASS
</b>
<p>Return the class of the provided OP: that is, which of the *OP
structures it uses. For core ops this currently gets the information out
of PL_opargs, which does not always accurately reflect the type used.
For custom ops the type is returned from the registration, and it is up
to the registree to ensure it is accurate. The value returned will be
one of the OA_* constants from op.h.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">OP_CLASS</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="s">)</span></li></ol></pre></li>
<li><a name="op_contextualize"></a><b>op_contextualize
</b>
<p>Applies a syntactic context to an op tree representing an expression.
<i>o</i> is the op tree, and <i>context</i> must be <code class="inline"><span class="w">G_SCALAR</span></code>
, <code class="inline"><span class="w">G_ARRAY</span></code>
,
or <code class="inline"><span class="w">G_VOID</span></code>
to specify the context to apply. The modified op tree
is returned.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">op_contextualize</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">context</span><span class="s">)</span></li></ol></pre></li>
<li><a name="op_convert_list"></a><b>op_convert_list
</b>
<p>Converts <i>o</i> into a list op if it is not one already, and then converts it
into the specified <i>type</i>, calling its check function, allocating a target if
it needs one, and folding constants.</p>
<p>A list-type op is usually constructed one kid at a time via <code class="inline"><span class="w">newLISTOP</span></code>
,
<code class="inline"><span class="w">op_prepend_elem</span></code>
and <code class="inline"><span class="w">op_append_elem</span></code>
. Then finally it is passed to
<code class="inline"><span class="w">op_convert_list</span></code>
to make it the right type.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">op_convert_list</span><span class="s">(</span><span class="w">I32</span> <span class="w">type</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">o</span><span class="s">)</span></li></ol></pre></li>
<li><a name="OP_DESC"></a><b>OP_DESC
</b>
<p>Return a short description of the provided OP.</p>
<pre class="verbatim"><ol><li> <span class="w">const</span> <span class="w">char</span> * <span class="i">OP_DESC</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="s">)</span></li></ol></pre></li>
<li><a name="op_free"></a><b>op_free
</b>
<p>Free an op. Only use this when an op is no longer linked to from any
optree.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">op_free</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="s">)</span></li></ol></pre></li>
<li><a name="op_linklist"></a><b>op_linklist
</b>
<p>This function is the implementation of the <a href="#LINKLIST">LINKLIST</a> macro. It should
not be called directly.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span>* <span class="i">op_linklist</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="s">)</span></li></ol></pre></li>
<li><a name="op_lvalue"></a><b>op_lvalue
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Propagate lvalue ("modifiable") context to an op and its children.
<i>type</i> represents the context type, roughly based on the type of op that
would do the modifying, although <code class="inline"><a class="l_k" href="functions/local.html">local()</a></code> is represented by OP_NULL,
because it has no op type of its own (it is signalled by a flag on
the lvalue op).</p>
<p>This function detects things that can't be modified, such as <code class="inline"><span class="i">$x</span>+<span class="n">1</span></code>
, and
generates errors for them. For example, <code class="inline"><span class="i">$x</span>+<span class="n">1</span> = <span class="n">2</span></code>
would cause it to be
called with an op of type OP_ADD and a <code class="inline"><span class="w">type</span></code>
argument of OP_SASSIGN.</p>
<p>It also flags things that need to behave specially in an lvalue context,
such as <code class="inline"><span class="i">$$x</span> = <span class="n">5</span></code>
which might have to vivify a reference in <code class="inline"><span class="i">$x</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">op_lvalue</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="OP_NAME"></a><b>OP_NAME
</b>
<p>Return the name of the provided OP. For core ops this looks up the name
from the op_type; for custom ops from the op_ppaddr.</p>
<pre class="verbatim"><ol><li> <span class="w">const</span> <span class="w">char</span> * <span class="i">OP_NAME</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="s">)</span></li></ol></pre></li>
<li><a name="op_null"></a><b>op_null
</b>
<p>Neutralizes an op when it is no longer needed, but is still linked to from
other ops.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">op_null</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="s">)</span></li></ol></pre></li>
<li><a name="op_parent"></a><b>op_parent
</b>
<p>Returns the parent OP of o, if it has a parent. Returns NULL otherwise.
This function is only available on perls built with <code class="inline">-<span class="w">DPERL_OP_PARENT</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span>* <span class="i">op_parent</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="s">)</span></li></ol></pre></li>
<li><a name="op_prepend_elem"></a><b>op_prepend_elem
</b>
<p>Prepend an item to the list of ops contained directly within a list-type
op, returning the lengthened list. <i>first</i> is the op to prepend to the
list, and <i>last</i> is the list-type op. <i>optype</i> specifies the intended
opcode for the list. If <i>last</i> is not already a list of the right type,
it will be upgraded into one. If either <i>first</i> or <i>last</i> is null,
the other is returned unchanged.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">op_prepend_elem</span><span class="s">(</span><span class="w">I32</span> <span class="w">optype</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">first</span><span class="cm">,</span> <span class="w">OP</span> *<a class="l_k" href="functions/last.html">last</a><span class="s">)</span></li></ol></pre></li>
<li><a name="op_scope"></a><b>op_scope
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Wraps up an op tree with some additional ops so that at runtime a dynamic
scope will be created. The original ops run in the new dynamic scope,
and then, provided that they exit normally, the scope will be unwound.
The additional ops used to create and unwind the dynamic scope will
normally be an <code class="inline"><span class="w">enter</span></code>
/<code class="inline"><span class="w">leave</span></code>
pair, but a <code class="inline"><span class="w">scope</span></code>
op may be used
instead if the ops are simple enough to not need the full dynamic scope
structure.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">op_scope</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="s">)</span></li></ol></pre></li>
<li><a name="op_sibling_splice"></a><b>op_sibling_splice
</b>
<p>A general function for editing the structure of an existing chain of
op_sibling nodes. By analogy with the perl-level splice() function, allows
you to delete zero or more sequential nodes, replacing them with zero or
more different nodes. Performs the necessary op_first/op_last
housekeeping on the parent node and op_sibling manipulation on the
children. The last deleted node will be marked as as the last node by
updating the op_sibling/op_sibparent or op_moresib field as appropriate.</p>
<p>Note that op_next is not manipulated, and nodes are not freed; that is the
responsibility of the caller. It also won't create a new list op for an
empty list etc; use higher-level functions like op_append_elem() for that.</p>
<p>parent is the parent node of the sibling chain. It may passed as NULL if
the splicing doesn't affect the first or last op in the chain.</p>
<p>start is the node preceding the first node to be spliced. Node(s)
following it will be deleted, and ops will be inserted after it. If it is
NULL, the first node onwards is deleted, and nodes are inserted at the
beginning.</p>
<p>del_count is the number of nodes to delete. If zero, no nodes are deleted.
If -1 or greater than or equal to the number of remaining kids, all
remaining kids are deleted.</p>
<p>insert is the first of a chain of nodes to be inserted in place of the nodes.
If NULL, no nodes are inserted.</p>
<p>The head of the chain of deleted ops is returned, or NULL if no ops were
deleted.</p>
<p>For example:</p>
<pre class="verbatim"><ol><li> <span class="w">action</span> <span class="w">before</span> <span class="w">after</span> <span class="w">returns</span></li><li> ------ ----- ----- -------</li><li></li><li> <span class="w">P</span> <span class="w">P</span></li><li> <a class="l_k" href="functions/splice.html">splice</a><span class="s">(</span><span class="w">P</span><span class="cm">,</span> <span class="w">A</span><span class="cm">,</span> <span class="n">2</span><span class="cm">,</span> <span class="w">X</span>-<span class="w">Y</span>-<span class="w">Z</span><span class="s">)</span> | | <span class="w">B</span>-C</li><li> <span class="w">A</span>-B-C-<span class="w">D</span> <span class="w">A</span><a class="l_k" href="functions/-X.html">-X</a>-<span class="w">Y</span>-<span class="w">Z</span>-<span class="w">D</span></li><li></li><li> <span class="w">P</span> <span class="w">P</span></li><li> <a class="l_k" href="functions/splice.html">splice</a><span class="s">(</span><span class="w">P</span><span class="cm">,</span> <span class="w">NULL</span><span class="cm">,</span> <span class="n">1</span><span class="cm">,</span> <span class="w">X</span>-<span class="w">Y</span><span class="s">)</span> | | <span class="w">A</span></li><li> <span class="w">A</span>-B-C-<span class="w">D</span> <span class="w">X</span>-<span class="w">Y</span>-B-C-<span class="w">D</span></li><li></li><li> <span class="w">P</span> <span class="w">P</span></li><li> <a class="l_k" href="functions/splice.html">splice</a><span class="s">(</span><span class="w">P</span><span class="cm">,</span> <span class="w">NULL</span><span class="cm">,</span> <span class="n">3</span><span class="cm">,</span> <span class="w">NULL</span><span class="s">)</span> | | <span class="w">A</span>-B-C</li><li> <span class="w">A</span>-B-C-<span class="w">D</span> <span class="w">D</span></li><li></li><li> <span class="w">P</span> <span class="w">P</span></li><li> <a class="l_k" href="functions/splice.html">splice</a><span class="s">(</span><span class="w">P</span><span class="cm">,</span> <span class="w">B</span><span class="cm">,</span> <span class="n">0</span><span class="cm">,</span> <span class="w">X</span>-<span class="w">Y</span><span class="s">)</span> | | <span class="w">NULL</span></li><li> <span class="w">A</span>-B-C-<span class="w">D</span> <span class="w">A</span>-B<a class="l_k" href="functions/-X.html">-X</a>-<span class="w">Y</span>-C-<span class="w">D</span></li></ol></pre><p>For lower-level direct manipulation of <code class="inline"><span class="w">op_sibparent</span></code>
and <code class="inline"><span class="w">op_moresib</span></code>
,
see <code class="inline"><span class="w">OpMORESIB_set</span></code>
, <code class="inline"><span class="w">OpLASTSIB_set</span></code>
, <code class="inline"><span class="w">OpMAYBESIB_set</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span>* <span class="i">op_sibling_splice</span><span class="s">(</span><span class="w">OP</span> *<span class="w">parent</span><span class="cm">,</span> <span class="w">OP</span> *<span class="w">start</span><span class="cm">,</span></li><li> <a class="l_k" href="functions/int.html">int</a> <span class="w">del_count</span><span class="cm">,</span> <span class="w">OP</span>* <span class="w">insert</span><span class="s">)</span></li></ol></pre></li>
<li><a name="OP_TYPE_IS"></a><b>OP_TYPE_IS
</b>
<p>Returns true if the given OP is not a NULL pointer
and if it is of the given type.</p>
<p>The negation of this macro, <code class="inline"><span class="w">OP_TYPE_ISNT</span></code>
is also available
as well as <code class="inline"><span class="w">OP_TYPE_IS_NN</span></code>
and <code class="inline"><span class="w">OP_TYPE_ISNT_NN</span></code>
which elide
the NULL pointer check.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">OP_TYPE_IS</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="cm">,</span> <span class="w">Optype</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="OP_TYPE_IS_OR_WAS"></a><b>OP_TYPE_IS_OR_WAS
</b>
<p>Returns true if the given OP is not a NULL pointer and
if it is of the given type or used to be before being
replaced by an OP of type OP_NULL.</p>
<p>The negation of this macro, <code class="inline"><span class="w">OP_TYPE_ISNT_AND_WASNT</span></code>
is also available as well as <code class="inline"><span class="w">OP_TYPE_IS_OR_WAS_NN</span></code>
and <code class="inline"><span class="w">OP_TYPE_ISNT_AND_WASNT_NN</span></code>
which elide
the NULL pointer check.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">OP_TYPE_IS_OR_WAS</span><span class="s">(</span><span class="w">OP</span> *<span class="w">o</span><span class="cm">,</span> <span class="w">Optype</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="rv2cv_op_cv"></a><b>rv2cv_op_cv
</b>
<p>Examines an op, which is expected to identify a subroutine at runtime,
and attempts to determine at compile time which subroutine it identifies.
This is normally used during Perl compilation to determine whether
a prototype can be applied to a function call. <i>cvop</i> is the op
being considered, normally an <code class="inline"><span class="w">rv2cv</span></code>
op. A pointer to the identified
subroutine is returned, if it could be determined statically, and a null
pointer is returned if it was not possible to determine statically.</p>
<p>Currently, the subroutine can be identified statically if the RV that the
<code class="inline"><span class="w">rv2cv</span></code>
is to operate on is provided by a suitable <code class="inline"><span class="w">gv</span></code>
or <code class="inline"><span class="w">const</span></code>
op.
A <code class="inline"><span class="w">gv</span></code>
op is suitable if the GV's CV slot is populated. A <code class="inline"><span class="w">const</span></code>
op is
suitable if the constant value must be an RV pointing to a CV. Details of
this process may change in future versions of Perl. If the <code class="inline"><span class="w">rv2cv</span></code>
op
has the <code class="inline"><span class="w">OPpENTERSUB_AMPER</span></code>
flag set then no attempt is made to identify
the subroutine statically: this flag is used to suppress compile-time
magic on a subroutine call, forcing it to use default runtime behaviour.</p>
<p>If <i>flags</i> has the bit <code class="inline"><span class="w">RV2CVOPCV_MARK_EARLY</span></code>
set, then the handling
of a GV reference is modified. If a GV was examined and its CV slot was
found to be empty, then the <code class="inline"><span class="w">gv</span></code>
op has the <code class="inline"><span class="w">OPpEARLY_CV</span></code>
flag set.
If the op is not optimised away, and the CV slot is later populated with
a subroutine having a prototype, that flag eventually triggers the warning
"called too early to check prototype".</p>
<p>If <i>flags</i> has the bit <code class="inline"><span class="w">RV2CVOPCV_RETURN_NAME_GV</span></code>
set, then instead
of returning a pointer to the subroutine it returns a pointer to the
GV giving the most appropriate name for the subroutine in this context.
Normally this is just the <code class="inline"><span class="w">CvGV</span></code>
of the subroutine, but for an anonymous
(<code class="inline"><span class="w">CvANON</span></code>
) subroutine that is referenced through a GV it will be the
referencing GV. The resulting <code class="inline"><span class="w">GV</span>*</code>
is cast to <code class="inline"><span class="w">CV</span>*</code>
to be returned.
A null pointer is returned as usual if there is no statically-determinable
subroutine.</p>
<pre class="verbatim"><ol><li> <span class="w">CV</span> * <span class="i">rv2cv_op_cv</span><span class="s">(</span><span class="w">OP</span> *<span class="w">cvop</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Pack-and-Unpack"></a><h1>Pack and Unpack</h1>
<ul>
<li><a name="packlist"></a><b>packlist
</b>
<p>The engine implementing pack() Perl function.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">packlist</span><span class="s">(</span><span class="w">SV</span> *<span class="w">cat</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">pat</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">patend</span><span class="cm">,</span> <span class="w">SV</span> **<span class="w">beglist</span><span class="cm">,</span></li><li> <span class="w">SV</span> **<span class="w">endlist</span><span class="s">)</span></li></ol></pre></li>
<li><a name="unpackstring"></a><b>unpackstring
</b>
<p>The engine implementing the unpack() Perl function.</p>
<p>Using the template pat..patend, this function unpacks the string
s..strend into a number of mortal SVs, which it pushes onto the perl
argument (@_) stack (so you will need to issue a <code class="inline"><span class="w">PUTBACK</span></code>
before and
<code class="inline"><span class="w">SPAGAIN</span></code>
after the call to this function). It returns the number of
pushed elements.</p>
<p>The strend and patend pointers should point to the byte following the last
character of each string.</p>
<p>Although this function returns its values on the perl argument stack, it
doesn't take any parameters from that stack (and thus in particular
there's no need to do a PUSHMARK before calling it, unlike <a href="#call_pv">call_pv</a> for
example).</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">unpackstring</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">pat</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">patend</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="q">s,</span></li><li> <span class="q"> const char *strend, U32 flags)</span></li></ol></pre></li>
</ul>
<a name="Pad-Data-Structures"></a><h1>Pad Data Structures</h1>
<ul>
<li><a name="CvPADLIST"></a><b>CvPADLIST
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>CV's can have CvPADLIST(cv) set to point to a PADLIST. This is the CV's
scratchpad, which stores lexical variables and opcode temporary and
per-thread values.</p>
<p>For these purposes "formats" are a kind-of CV; eval""s are too (except they're
not callable at will and are always thrown away after the eval"" is done
executing). Require'd files are simply evals without any outer lexical
scope.</p>
<p>XSUBs do not have a CvPADLIST. dXSTARG fetches values from PL_curpad,
but that is really the callers pad (a slot of which is allocated by
every entersub). Do not get or set CvPADLIST if a CV is an XSUB (as
determined by <code class="inline"><span class="i">CvISXSUB</span><span class="s">(</span><span class="s">)</span></code>
), CvPADLIST slot is reused for a different
internal purpose in XSUBs.</p>
<p>The PADLIST has a C array where pads are stored.</p>
<p>The 0th entry of the PADLIST is a PADNAMELIST
which represents the "names" or rather
the "static type information" for lexicals. The individual elements of a
PADNAMELIST are PADNAMEs. Future
refactorings might stop the PADNAMELIST from being stored in the PADLIST's
array, so don't rely on it. See <a href="#PadlistNAMES">PadlistNAMES</a>.</p>
<p>The CvDEPTH'th entry of a PADLIST is a PAD (an AV) which is the stack frame
at that depth of recursion into the CV. The 0th slot of a frame AV is an
AV which is @_. Other entries are storage for variables and op targets.</p>
<p>Iterating over the PADNAMELIST iterates over all possible pad
items. Pad slots for targets (SVs_PADTMP)
and GVs end up having &PL_padname_undef "names", while slots for constants
have &PL_padname_const "names" (see pad_alloc()). That &PL_padname_undef
and &PL_padname_const are used is an implementation detail subject to
change. To test for them, use <code class="inline">!<span class="i">PadnamePV</span><span class="s">(</span><span class="w">name</span><span class="s">)</span></code>
and <code class="inline"><span class="i">PadnamePV</span><span class="s">(</span><span class="w">name</span><span class="s">)</span>
&& !<span class="i">PadnameLEN</span><span class="s">(</span><span class="w">name</span><span class="s">)</span></code>
, respectively.</p>
<p>Only my/our variable slots get valid names.
The rest are op targets/GVs/constants which are statically allocated
or resolved at compile time. These don't have names by which they
can be looked up from Perl code at run time through eval"" the way
my/our variables can be. Since they can't be looked up by "name"
but only by their index allocated at compile time (which is usually
in PL_op->op_targ), wasting a name SV for them doesn't make sense.</p>
<p>The pad names in the PADNAMELIST have their PV holding the name of
the variable. The COP_SEQ_RANGE_LOW and _HIGH fields form a range
(low+1..high inclusive) of cop_seq numbers for which the name is
valid. During compilation, these fields may hold the special value
PERL_PADSEQ_INTRO to indicate various stages:</p>
<pre class="verbatim"><ol><li> <span class="w">COP_SEQ_RANGE_LOW</span> <span class="w">_HIGH</span></li><li> ----------------- -----</li><li> <span class="w">PERL_PADSEQ_INTRO</span> <span class="n">0</span> <span class="w">variable</span> <a class="l_k" href="functions/not.html">not</a> <span class="w">yet</span> <span class="w">introduced</span><span class="co">:</span></li><li> <span class="s">{</span> <a class="l_k" href="functions/my.html">my</a> <span class="s">(</span><span class="i">$x</span></li><li> <span class="w">valid</span>-<span class="w">seq</span><span class="c"># PERL_PADSEQ_INTRO variable in scope:</span></li><li> <span class="s">{</span> <a class="l_k" href="functions/my.html">my</a> <span class="s">(</span><span class="i">$x</span><span class="s">)</span></li><li> <span class="w">valid</span>-<span class="w">seq</span><span class="c"># valid-seq# compilation of scope complete:</span></li><li> <span class="s">{</span> <a class="l_k" href="functions/my.html">my</a> <span class="s">(</span><span class="i">$x</span><span class="s">)</span> <span class="s">}</span></li></ol></pre><p>For typed lexicals PadnameTYPE points at the type stash. For <code class="inline"><a class="l_k" href="functions/our.html">our</a></code>
lexicals, PadnameOURSTASH points at the stash of the associated global (so
that duplicate <code class="inline"><a class="l_k" href="functions/our.html">our</a></code> declarations in the same package can be detected).
PadnameGEN is sometimes used to store the generation number during
compilation.</p>
<p>If PadnameOUTER is set on the pad name, then that slot in the frame AV
is a REFCNT'ed reference to a lexical from "outside". Such entries
are sometimes referred to as 'fake'. In this case, the name does not
use 'low' and 'high' to store a cop_seq range, since it is in scope
throughout. Instead 'high' stores some flags containing info about
the real lexical (is it declared in an anon, and is it capable of being
instantiated multiple times?), and for fake ANONs, 'low' contains the index
within the parent's pad where the lexical's value is stored, to make
cloning quicker.</p>
<p>If the 'name' is '&' the corresponding entry in the PAD
is a CV representing a possible closure.</p>
<p>Note that formats are treated as anon subs, and are cloned each time
write is called (if necessary).</p>
<p>The flag SVs_PADSTALE is cleared on lexicals each time the my() is executed,
and set on scope exit. This allows the
'Variable $x is not available' warning
to be generated in evals, such as</p>
<pre class="verbatim"><ol><li><a name="f"></a> <span class="s">{</span> <a class="l_k" href="functions/my.html">my</a> <span class="i">$x</span> = <span class="n">1</span><span class="sc">;</span> sub <span class="m">f</span> <span class="s">{</span> <a class="l_k" href="functions/eval.html">eval</a> <span class="q">'$x'</span><span class="s">}</span> <span class="s">}</span> <span class="i">f</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>For state vars, SVs_PADSTALE is overloaded to mean 'not yet initialised',
but this internal state is stored in a separate pad entry.</p>
<pre class="verbatim"><ol><li> <span class="w">PADLIST</span> * <span class="i">CvPADLIST</span><span class="s">(</span><span class="w">CV</span> *<span class="w">cv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadARRAY"></a><b>PadARRAY
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>The C array of pad entries.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> ** <span class="i">PadARRAY</span><span class="s">(</span><span class="w">PAD</span> <span class="w">pad</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadlistARRAY"></a><b>PadlistARRAY
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>The C array of a padlist, containing the pads. Only subscript it with
numbers >= 1, as the 0th entry is not guaranteed to remain usable.</p>
<pre class="verbatim"><ol><li> <span class="w">PAD</span> ** <span class="i">PadlistARRAY</span><span class="s">(</span><span class="w">PADLIST</span> <span class="w">padlist</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadlistMAX"></a><b>PadlistMAX
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>The index of the last allocated space in the padlist. Note that the last
pad may be in an earlier slot. Any entries following it will be NULL in
that case.</p>
<pre class="verbatim"><ol><li> <span class="w">SSize_t</span> <span class="i">PadlistMAX</span><span class="s">(</span><span class="w">PADLIST</span> <span class="w">padlist</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadlistNAMES"></a><b>PadlistNAMES
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>The names associated with pad entries.</p>
<pre class="verbatim"><ol><li> <span class="w">PADNAMELIST</span> * <span class="i">PadlistNAMES</span><span class="s">(</span><span class="w">PADLIST</span> <span class="w">padlist</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadlistNAMESARRAY"></a><b>PadlistNAMESARRAY
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>The C array of pad names.</p>
<pre class="verbatim"><ol><li> <span class="w">PADNAME</span> ** <span class="i">PadlistNAMESARRAY</span><span class="s">(</span><span class="w">PADLIST</span> <span class="w">padlist</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadlistNAMESMAX"></a><b>PadlistNAMESMAX
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>The index of the last pad name.</p>
<pre class="verbatim"><ol><li> <span class="w">SSize_t</span> <span class="i">PadlistNAMESMAX</span><span class="s">(</span><span class="w">PADLIST</span> <span class="w">padlist</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadlistREFCNT"></a><b>PadlistREFCNT
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>The reference count of the padlist. Currently this is always 1.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">PadlistREFCNT</span><span class="s">(</span><span class="w">PADLIST</span> <span class="w">padlist</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadMAX"></a><b>PadMAX
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>The index of the last pad entry.</p>
<pre class="verbatim"><ol><li> <span class="w">SSize_t</span> <span class="i">PadMAX</span><span class="s">(</span><span class="w">PAD</span> <span class="w">pad</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadnameLEN"></a><b>PadnameLEN
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>The length of the name.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">PadnameLEN</span><span class="s">(</span><span class="w">PADNAME</span> <span class="w">pn</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadnamelistARRAY"></a><b>PadnamelistARRAY
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>The C array of pad names.</p>
<pre class="verbatim"><ol><li> <span class="w">PADNAME</span> ** <span class="i">PadnamelistARRAY</span><span class="s">(</span><span class="w">PADNAMELIST</span> <span class="w">pnl</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadnamelistMAX"></a><b>PadnamelistMAX
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>The index of the last pad name.</p>
<pre class="verbatim"><ol><li> <span class="w">SSize_t</span> <span class="i">PadnamelistMAX</span><span class="s">(</span><span class="w">PADNAMELIST</span> <span class="w">pnl</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadnamelistREFCNT"></a><b>PadnamelistREFCNT
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>The reference count of the pad name list.</p>
<pre class="verbatim"><ol><li> <span class="w">SSize_t</span> <span class="i">PadnamelistREFCNT</span><span class="s">(</span><span class="w">PADNAMELIST</span> <span class="w">pnl</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadnamelistREFCNT_dec"></a><b>PadnamelistREFCNT_dec
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Lowers the reference count of the pad name list.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">PadnamelistREFCNT_dec</span><span class="s">(</span><span class="w">PADNAMELIST</span> <span class="w">pnl</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadnamePV"></a><b>PadnamePV
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>The name stored in the pad name struct. This returns NULL for a target
slot.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span> * <span class="i">PadnamePV</span><span class="s">(</span><span class="w">PADNAME</span> <span class="w">pn</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadnameREFCNT"></a><b>PadnameREFCNT
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>The reference count of the pad name.</p>
<pre class="verbatim"><ol><li> <span class="w">SSize_t</span> <span class="i">PadnameREFCNT</span><span class="s">(</span><span class="w">PADNAME</span> <span class="w">pn</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadnameREFCNT_dec"></a><b>PadnameREFCNT_dec
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Lowers the reference count of the pad name.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">PadnameREFCNT_dec</span><span class="s">(</span><span class="w">PADNAME</span> <span class="w">pn</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadnameSV"></a><b>PadnameSV
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Returns the pad name as a mortal SV.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">PadnameSV</span><span class="s">(</span><span class="w">PADNAME</span> <span class="w">pn</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PadnameUTF8"></a><b>PadnameUTF8
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Whether PadnamePV is in UTF8. Currently, this is always true.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">PadnameUTF8</span><span class="s">(</span><span class="w">PADNAME</span> <span class="w">pn</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pad_add_name_pvs"></a><b>pad_add_name_pvs
</b>
<p>Exactly like <a href="#pad_add_name_pvn">pad_add_name_pvn</a>, but takes a literal string instead
of a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">PADOFFSET</span> <span class="i">pad_add_name_pvs</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">name</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="cm">,</span></li><li> <span class="w">HV</span> *<span class="w">typestash</span><span class="cm">,</span> <span class="w">HV</span> *<span class="w">ourstash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pad_findmy_pvs"></a><b>pad_findmy_pvs
</b>
<p>Exactly like <a href="#pad_findmy_pvn">pad_findmy_pvn</a>, but takes a literal string instead
of a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">PADOFFSET</span> <span class="i">pad_findmy_pvs</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">name</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pad_new"></a><b>pad_new
</b>
<p>Create a new padlist, updating the global variables for the
currently-compiling padlist to point to the new padlist. The following
flags can be OR'ed together:</p>
<pre class="verbatim"><ol><li> <span class="w">padnew_CLONE</span> <span class="w">this</span> <span class="w">pad</span> <span class="w">is</span> <a class="l_k" href="functions/for.html">for</a> <span class="w">a</span> <span class="w">cloned</span> <span class="w">CV</span></li><li> <span class="w">padnew_SAVE</span> <span class="w">save</span> <span class="w">old</span> <span class="w">globals</span> <span class="w">on</span> <span class="w">the</span> <span class="w">save</span> <span class="w">stack</span></li><li> <span class="w">padnew_SAVESUB</span> <span class="w">also</span> <span class="w">save</span> <span class="w">extra</span> <span class="w">stuff</span> <a class="l_k" href="functions/for.html">for</a> <span class="w">start</span> <span class="w">of</span> <a class="l_k" href="functions/sub.html">sub</a></li><li></li><li> <span class="i">PADLIST</span> * <span class="i">pad_new</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PL_comppad"></a><b>PL_comppad
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>During compilation, this points to the array containing the values
part of the pad for the currently-compiling code. (At runtime a CV may
have many such value arrays; at compile time just one is constructed.)
At runtime, this points to the array containing the currently-relevant
values for the pad for the currently-executing code.</p>
</li>
<li><a name="PL_comppad_name"></a><b>PL_comppad_name
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>During compilation, this points to the array containing the names part
of the pad for the currently-compiling code.</p>
</li>
<li><a name="PL_curpad"></a><b>PL_curpad
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Points directly to the body of the <a href="#PL_comppad">PL_comppad</a> array.
(I.e., this is <code class="inline"><span class="i">PAD_ARRAY</span><span class="s">(</span><span class="w">PL_comppad</span><span class="s">)</span></code>
.)</p>
</li>
</ul>
<a name="Per-Interpreter-Variables"></a><h1>Per-Interpreter Variables</h1>
<ul>
<li><a name="PL_modglobal"></a><b>PL_modglobal
</b>
<p><code class="inline"><span class="w">PL_modglobal</span></code>
is a general purpose, interpreter global HV for use by
extensions that need to keep information on a per-interpreter basis.
In a pinch, it can also be used as a symbol table for extensions
to share data among each other. It is a good idea to use keys
prefixed by the package name of the extension that owns the data.</p>
<pre class="verbatim"><ol><li> <span class="w">HV</span>* <span class="w">PL_modglobal</span></li></ol></pre></li>
<li><a name="PL_na"></a><b>PL_na
</b>
<p>A convenience variable which is typically used with <code class="inline"><span class="w">SvPV</span></code>
when one
doesn't care about the length of the string. It is usually more efficient
to either declare a local variable and use that instead or to use the
<code class="inline"><span class="w">SvPV_nolen</span></code>
macro.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="w">PL_na</span></li></ol></pre></li>
<li><a name="PL_opfreehook"></a><b>PL_opfreehook
</b>
<p>When non-<code class="inline"><span class="w">NULL</span></code>
, the function pointed by this variable will be called each time an OP is freed with the corresponding OP as the argument.
This allows extensions to free any extra attribute they have locally attached to an OP.
It is also assured to first fire for the parent OP and then for its kids.</p>
<p>When you replace this variable, it is considered a good practice to store the possibly previously installed hook and that you recall it inside your own.</p>
<pre class="verbatim"><ol><li> <span class="w">Perl_ophook_t</span> <span class="w">PL_opfreehook</span></li></ol></pre></li>
<li><a name="PL_peepp"></a><b>PL_peepp
</b>
<p>Pointer to the per-subroutine peephole optimiser. This is a function
that gets called at the end of compilation of a Perl subroutine (or
equivalently independent piece of Perl code) to perform fixups of
some ops and to perform small-scale optimisations. The function is
called once for each subroutine that is compiled, and is passed, as sole
parameter, a pointer to the op that is the entry point to the subroutine.
It modifies the op tree in place.</p>
<p>The peephole optimiser should never be completely replaced. Rather,
add code to it by wrapping the existing optimiser. The basic way to do
this can be seen in <a href="perlguts.html#Compile-pass-3%3a-peephole-optimization">Compile pass 3: peephole optimization in perlguts</a>.
If the new code wishes to operate on ops throughout the subroutine's
structure, rather than just at the top level, it is likely to be more
convenient to wrap the <a href="#PL_rpeepp">PL_rpeepp</a> hook.</p>
<pre class="verbatim"><ol><li> <span class="w">peep_t</span> <span class="w">PL_peepp</span></li></ol></pre></li>
<li><a name="PL_rpeepp"></a><b>PL_rpeepp
</b>
<p>Pointer to the recursive peephole optimiser. This is a function
that gets called at the end of compilation of a Perl subroutine (or
equivalently independent piece of Perl code) to perform fixups of some
ops and to perform small-scale optimisations. The function is called
once for each chain of ops linked through their <code class="inline"><span class="w">op_next</span></code>
fields;
it is recursively called to handle each side chain. It is passed, as
sole parameter, a pointer to the op that is at the head of the chain.
It modifies the op tree in place.</p>
<p>The peephole optimiser should never be completely replaced. Rather,
add code to it by wrapping the existing optimiser. The basic way to do
this can be seen in <a href="perlguts.html#Compile-pass-3%3a-peephole-optimization">Compile pass 3: peephole optimization in perlguts</a>.
If the new code wishes to operate only on ops at a subroutine's top level,
rather than throughout the structure, it is likely to be more convenient
to wrap the <a href="#PL_peepp">PL_peepp</a> hook.</p>
<pre class="verbatim"><ol><li> <span class="w">peep_t</span> <span class="w">PL_rpeepp</span></li></ol></pre></li>
<li><a name="PL_sv_no"></a><b>PL_sv_no
</b>
<p>This is the <code class="inline"><span class="w">false</span></code>
SV. See <code class="inline"><span class="w">PL_sv_yes</span></code>
. Always refer to this as
<code class="inline"><span class="i">&PL_sv_no</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> <span class="w">PL_sv_no</span></li></ol></pre></li>
<li><a name="PL_sv_undef"></a><b>PL_sv_undef
</b>
<p>This is the <code class="inline"><a class="l_k" href="functions/undef.html">undef</a></code> SV. Always refer to this as <code class="inline"><span class="i">&PL_sv_undef</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> <span class="w">PL_sv_undef</span></li></ol></pre></li>
<li><a name="PL_sv_yes"></a><b>PL_sv_yes
</b>
<p>This is the <code class="inline"><span class="w">true</span></code>
SV. See <code class="inline"><span class="w">PL_sv_no</span></code>
. Always refer to this as
<code class="inline"><span class="i">&PL_sv_yes</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> <span class="w">PL_sv_yes</span></li></ol></pre></li>
</ul>
<a name="REGEXP-Functions"></a><h1>REGEXP Functions</h1>
<ul>
<li><a name="SvRX"></a><b>SvRX
</b>
<p>Convenience macro to get the REGEXP from a SV. This is approximately
equivalent to the following snippet:</p>
<pre class="verbatim"><ol><li> if <span class="s">(</span><span class="i">SvMAGICAL</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span><span class="s">)</span></li><li> <span class="i">mg_get</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span><span class="sc">;</span></li><li> if <span class="s">(</span><span class="i">SvROK</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span><span class="s">)</span></li><li> <span class="w">sv</span> = <span class="i">MUTABLE_SV</span><span class="s">(</span><span class="i">SvRV</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span><span class="s">)</span><span class="sc">;</span></li><li> if <span class="s">(</span><span class="i">SvTYPE</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span> == <span class="w">SVt_REGEXP</span><span class="s">)</span></li><li> <a class="l_k" href="functions/return.html">return</a> <span class="s">(</span><span class="w">REGEXP</span>*<span class="s">)</span> <span class="w">sv</span><span class="sc">;</span></li></ol></pre><p>NULL will be returned if a REGEXP* is not found.</p>
<pre class="verbatim"><ol><li> <span class="w">REGEXP</span> * <span class="i">SvRX</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvRXOK"></a><b>SvRXOK
</b>
<p>Returns a boolean indicating whether the SV (or the one it references)
is a REGEXP.</p>
<p>If you want to do something with the REGEXP* later use SvRX instead
and check for NULL.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">SvRXOK</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Stack-Manipulation-Macros"></a><h1>Stack Manipulation Macros</h1>
<ul>
<li><a name="dMARK"></a><b>dMARK
</b>
<p>Declare a stack marker variable, <code class="inline"><span class="w">mark</span></code>
, for the XSUB. See <code class="inline"><span class="w">MARK</span></code>
and
<code class="inline"><span class="w">dORIGMARK</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">dMARK</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="dORIGMARK"></a><b>dORIGMARK
</b>
<p>Saves the original stack mark for the XSUB. See <code class="inline"><span class="w">ORIGMARK</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">dORIGMARK</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="dSP"></a><b>dSP
</b>
<p>Declares a local copy of perl's stack pointer for the XSUB, available via
the <code class="inline"><span class="w">SP</span></code>
macro. See <code class="inline"><span class="w">SP</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">dSP</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="EXTEND"></a><b>EXTEND
</b>
<p>Used to extend the argument stack for an XSUB's return values. Once
used, guarantees that there is room for at least <code class="inline"><span class="w">nitems</span></code>
to be pushed
onto the stack.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">EXTEND</span><span class="s">(</span><span class="w">SP</span><span class="cm">,</span> <span class="w">SSize_t</span> <span class="w">nitems</span><span class="s">)</span></li></ol></pre></li>
<li><a name="MARK"></a><b>MARK
</b>
<p>Stack marker variable for the XSUB. See <code class="inline"><span class="w">dMARK</span></code>
.</p>
</li>
<li><a name="mPUSHi"></a><b>mPUSHi
</b>
<p>Push an integer onto the stack. The stack must have room for this element.
Does not use <code class="inline"><span class="w">TARG</span></code>
. See also <code class="inline"><span class="w">PUSHi</span></code>
, <code class="inline"><span class="w">mXPUSHi</span></code>
and <code class="inline"><span class="w">XPUSHi</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">mPUSHi</span><span class="s">(</span><span class="w">IV</span> <span class="w">iv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mPUSHn"></a><b>mPUSHn
</b>
<p>Push a double onto the stack. The stack must have room for this element.
Does not use <code class="inline"><span class="w">TARG</span></code>
. See also <code class="inline"><span class="w">PUSHn</span></code>
, <code class="inline"><span class="w">mXPUSHn</span></code>
and <code class="inline"><span class="w">XPUSHn</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">mPUSHn</span><span class="s">(</span><span class="w">NV</span> <span class="w">nv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mPUSHp"></a><b>mPUSHp
</b>
<p>Push a string onto the stack. The stack must have room for this element.
The <code class="inline"><span class="w">len</span></code>
indicates the length of the string. Does not use <code class="inline"><span class="w">TARG</span></code>
.
See also <code class="inline"><span class="w">PUSHp</span></code>
, <code class="inline"><span class="w">mXPUSHp</span></code>
and <code class="inline"><span class="w">XPUSHp</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">mPUSHp</span><span class="s">(</span><span class="w">char</span>* <span class="w">str</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mPUSHs"></a><b>mPUSHs
</b>
<p>Push an SV onto the stack and mortalizes the SV. The stack must have room
for this element. Does not use <code class="inline"><span class="w">TARG</span></code>
. See also <code class="inline"><span class="w">PUSHs</span></code>
and <code class="inline"><span class="w">mXPUSHs</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">mPUSHs</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mPUSHu"></a><b>mPUSHu
</b>
<p>Push an unsigned integer onto the stack. The stack must have room for this
element. Does not use <code class="inline"><span class="w">TARG</span></code>
. See also <code class="inline"><span class="w">PUSHu</span></code>
, <code class="inline"><span class="w">mXPUSHu</span></code>
and <code class="inline"><span class="w">XPUSHu</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">mPUSHu</span><span class="s">(</span><span class="w">UV</span> <span class="w">uv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mXPUSHi"></a><b>mXPUSHi
</b>
<p>Push an integer onto the stack, extending the stack if necessary.
Does not use <code class="inline"><span class="w">TARG</span></code>
. See also <code class="inline"><span class="w">XPUSHi</span></code>
, <code class="inline"><span class="w">mPUSHi</span></code>
and <code class="inline"><span class="w">PUSHi</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">mXPUSHi</span><span class="s">(</span><span class="w">IV</span> <span class="w">iv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mXPUSHn"></a><b>mXPUSHn
</b>
<p>Push a double onto the stack, extending the stack if necessary.
Does not use <code class="inline"><span class="w">TARG</span></code>
. See also <code class="inline"><span class="w">XPUSHn</span></code>
, <code class="inline"><span class="w">mPUSHn</span></code>
and <code class="inline"><span class="w">PUSHn</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">mXPUSHn</span><span class="s">(</span><span class="w">NV</span> <span class="w">nv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mXPUSHp"></a><b>mXPUSHp
</b>
<p>Push a string onto the stack, extending the stack if necessary. The <code class="inline"><span class="w">len</span></code>
indicates the length of the string. Does not use <code class="inline"><span class="w">TARG</span></code>
. See also <code class="inline"><span class="w">XPUSHp</span></code>
,
<code class="inline"><span class="w">mPUSHp</span></code>
and <code class="inline"><span class="w">PUSHp</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">mXPUSHp</span><span class="s">(</span><span class="w">char</span>* <span class="w">str</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mXPUSHs"></a><b>mXPUSHs
</b>
<p>Push an SV onto the stack, extending the stack if necessary and mortalizes
the SV. Does not use <code class="inline"><span class="w">TARG</span></code>
. See also <code class="inline"><span class="w">XPUSHs</span></code>
and <code class="inline"><span class="w">mPUSHs</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">mXPUSHs</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="mXPUSHu"></a><b>mXPUSHu
</b>
<p>Push an unsigned integer onto the stack, extending the stack if necessary.
Does not use <code class="inline"><span class="w">TARG</span></code>
. See also <code class="inline"><span class="w">XPUSHu</span></code>
, <code class="inline"><span class="w">mPUSHu</span></code>
and <code class="inline"><span class="w">PUSHu</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">mXPUSHu</span><span class="s">(</span><span class="w">UV</span> <span class="w">uv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="ORIGMARK"></a><b>ORIGMARK
</b>
<p>The original stack mark for the XSUB. See <code class="inline"><span class="w">dORIGMARK</span></code>
.</p>
</li>
<li><a name="POPi"></a><b>POPi
</b>
<p>Pops an integer off the stack.</p>
<pre class="verbatim"><ol><li> <span class="w">IV</span> <span class="w">POPi</span></li></ol></pre></li>
<li><a name="POPl"></a><b>POPl
</b>
<p>Pops a long off the stack.</p>
<pre class="verbatim"><ol><li> <span class="w">long</span> <span class="w">POPl</span></li></ol></pre></li>
<li><a name="POPn"></a><b>POPn
</b>
<p>Pops a double off the stack.</p>
<pre class="verbatim"><ol><li> <span class="w">NV</span> <span class="w">POPn</span></li></ol></pre></li>
<li><a name="POPp"></a><b>POPp
</b>
<p>Pops a string off the stack.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="w">POPp</span></li></ol></pre></li>
<li><a name="POPpbytex"></a><b>POPpbytex
</b>
<p>Pops a string off the stack which must consist of bytes i.e. characters < 256.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="w">POPpbytex</span></li></ol></pre></li>
<li><a name="POPpx"></a><b>POPpx
</b>
<p>Pops a string off the stack. Identical to POPp. There are two names for
historical reasons.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="w">POPpx</span></li></ol></pre></li>
<li><a name="POPs"></a><b>POPs
</b>
<p>Pops an SV off the stack.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="w">POPs</span></li></ol></pre></li>
<li><a name="PUSHi"></a><b>PUSHi
</b>
<p>Push an integer onto the stack. The stack must have room for this element.
Handles 'set' magic. Uses <code class="inline"><span class="w">TARG</span></code>
, so <code class="inline"><span class="w">dTARGET</span></code>
or <code class="inline"><span class="w">dXSTARG</span></code>
should be
called to declare it. Do not call multiple <code class="inline"><span class="w">TARG</span></code>
-oriented macros to
return lists from XSUB's - see <code class="inline"><span class="w">mPUSHi</span></code>
instead. See also <code class="inline"><span class="w">XPUSHi</span></code>
and
<code class="inline"><span class="w">mXPUSHi</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">PUSHi</span><span class="s">(</span><span class="w">IV</span> <span class="w">iv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PUSHMARK"></a><b>PUSHMARK
</b>
<p>Opening bracket for arguments on a callback. See <code class="inline"><span class="w">PUTBACK</span></code>
and
<a href="perlcall.html">perlcall</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">PUSHMARK</span><span class="s">(</span><span class="w">SP</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PUSHmortal"></a><b>PUSHmortal
</b>
<p>Push a new mortal SV onto the stack. The stack must have room for this
element. Does not use <code class="inline"><span class="w">TARG</span></code>
. See also <code class="inline"><span class="w">PUSHs</span></code>
, <code class="inline"><span class="w">XPUSHmortal</span></code>
and <code class="inline"><span class="w">XPUSHs</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">PUSHmortal</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PUSHn"></a><b>PUSHn
</b>
<p>Push a double onto the stack. The stack must have room for this element.
Handles 'set' magic. Uses <code class="inline"><span class="w">TARG</span></code>
, so <code class="inline"><span class="w">dTARGET</span></code>
or <code class="inline"><span class="w">dXSTARG</span></code>
should be
called to declare it. Do not call multiple <code class="inline"><span class="w">TARG</span></code>
-oriented macros to
return lists from XSUB's - see <code class="inline"><span class="w">mPUSHn</span></code>
instead. See also <code class="inline"><span class="w">XPUSHn</span></code>
and
<code class="inline"><span class="w">mXPUSHn</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">PUSHn</span><span class="s">(</span><span class="w">NV</span> <span class="w">nv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PUSHp"></a><b>PUSHp
</b>
<p>Push a string onto the stack. The stack must have room for this element.
The <code class="inline"><span class="w">len</span></code>
indicates the length of the string. Handles 'set' magic. Uses
<code class="inline"><span class="w">TARG</span></code>
, so <code class="inline"><span class="w">dTARGET</span></code>
or <code class="inline"><span class="w">dXSTARG</span></code>
should be called to declare it. Do not
call multiple <code class="inline"><span class="w">TARG</span></code>
-oriented macros to return lists from XSUB's - see
<code class="inline"><span class="w">mPUSHp</span></code>
instead. See also <code class="inline"><span class="w">XPUSHp</span></code>
and <code class="inline"><span class="w">mXPUSHp</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">PUSHp</span><span class="s">(</span><span class="w">char</span>* <span class="w">str</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PUSHs"></a><b>PUSHs
</b>
<p>Push an SV onto the stack. The stack must have room for this element.
Does not handle 'set' magic. Does not use <code class="inline"><span class="w">TARG</span></code>
. See also <code class="inline"><span class="w">PUSHmortal</span></code>
,
<code class="inline"><span class="w">XPUSHs</span></code>
and <code class="inline"><span class="w">XPUSHmortal</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">PUSHs</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PUSHu"></a><b>PUSHu
</b>
<p>Push an unsigned integer onto the stack. The stack must have room for this
element. Handles 'set' magic. Uses <code class="inline"><span class="w">TARG</span></code>
, so <code class="inline"><span class="w">dTARGET</span></code>
or <code class="inline"><span class="w">dXSTARG</span></code>
should be called to declare it. Do not call multiple <code class="inline"><span class="w">TARG</span></code>
-oriented
macros to return lists from XSUB's - see <code class="inline"><span class="w">mPUSHu</span></code>
instead. See also
<code class="inline"><span class="w">XPUSHu</span></code>
and <code class="inline"><span class="w">mXPUSHu</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">PUSHu</span><span class="s">(</span><span class="w">UV</span> <span class="w">uv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="PUTBACK"></a><b>PUTBACK
</b>
<p>Closing bracket for XSUB arguments. This is usually handled by <code class="inline"><span class="w">xsubpp</span></code>
.
See <code class="inline"><span class="w">PUSHMARK</span></code>
and <a href="perlcall.html">perlcall</a> for other uses.</p>
<pre class="verbatim"><ol><li> <span class="w">PUTBACK</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="SP"></a><b>SP
</b>
<p>Stack pointer. This is usually handled by <code class="inline"><span class="w">xsubpp</span></code>
. See <code class="inline"><span class="w">dSP</span></code>
and
<code class="inline"><span class="w">SPAGAIN</span></code>
.</p>
</li>
<li><a name="SPAGAIN"></a><b>SPAGAIN
</b>
<p>Refetch the stack pointer. Used after a callback. See <a href="perlcall.html">perlcall</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">SPAGAIN</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="XPUSHi"></a><b>XPUSHi
</b>
<p>Push an integer onto the stack, extending the stack if necessary. Handles
'set' magic. Uses <code class="inline"><span class="w">TARG</span></code>
, so <code class="inline"><span class="w">dTARGET</span></code>
or <code class="inline"><span class="w">dXSTARG</span></code>
should be called to
declare it. Do not call multiple <code class="inline"><span class="w">TARG</span></code>
-oriented macros to return lists
from XSUB's - see <code class="inline"><span class="w">mXPUSHi</span></code>
instead. See also <code class="inline"><span class="w">PUSHi</span></code>
and <code class="inline"><span class="w">mPUSHi</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XPUSHi</span><span class="s">(</span><span class="w">IV</span> <span class="w">iv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XPUSHmortal"></a><b>XPUSHmortal
</b>
<p>Push a new mortal SV onto the stack, extending the stack if necessary.
Does not use <code class="inline"><span class="w">TARG</span></code>
. See also <code class="inline"><span class="w">XPUSHs</span></code>
, <code class="inline"><span class="w">PUSHmortal</span></code>
and <code class="inline"><span class="w">PUSHs</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XPUSHmortal</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XPUSHn"></a><b>XPUSHn
</b>
<p>Push a double onto the stack, extending the stack if necessary. Handles
'set' magic. Uses <code class="inline"><span class="w">TARG</span></code>
, so <code class="inline"><span class="w">dTARGET</span></code>
or <code class="inline"><span class="w">dXSTARG</span></code>
should be called to
declare it. Do not call multiple <code class="inline"><span class="w">TARG</span></code>
-oriented macros to return lists
from XSUB's - see <code class="inline"><span class="w">mXPUSHn</span></code>
instead. See also <code class="inline"><span class="w">PUSHn</span></code>
and <code class="inline"><span class="w">mPUSHn</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XPUSHn</span><span class="s">(</span><span class="w">NV</span> <span class="w">nv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XPUSHp"></a><b>XPUSHp
</b>
<p>Push a string onto the stack, extending the stack if necessary. The <code class="inline"><span class="w">len</span></code>
indicates the length of the string. Handles 'set' magic. Uses <code class="inline"><span class="w">TARG</span></code>
, so
<code class="inline"><span class="w">dTARGET</span></code>
or <code class="inline"><span class="w">dXSTARG</span></code>
should be called to declare it. Do not call
multiple <code class="inline"><span class="w">TARG</span></code>
-oriented macros to return lists from XSUB's - see
<code class="inline"><span class="w">mXPUSHp</span></code>
instead. See also <code class="inline"><span class="w">PUSHp</span></code>
and <code class="inline"><span class="w">mPUSHp</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XPUSHp</span><span class="s">(</span><span class="w">char</span>* <span class="w">str</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XPUSHs"></a><b>XPUSHs
</b>
<p>Push an SV onto the stack, extending the stack if necessary. Does not
handle 'set' magic. Does not use <code class="inline"><span class="w">TARG</span></code>
. See also <code class="inline"><span class="w">XPUSHmortal</span></code>
,
<code class="inline"><span class="w">PUSHs</span></code>
and <code class="inline"><span class="w">PUSHmortal</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XPUSHs</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XPUSHu"></a><b>XPUSHu
</b>
<p>Push an unsigned integer onto the stack, extending the stack if necessary.
Handles 'set' magic. Uses <code class="inline"><span class="w">TARG</span></code>
, so <code class="inline"><span class="w">dTARGET</span></code>
or <code class="inline"><span class="w">dXSTARG</span></code>
should be
called to declare it. Do not call multiple <code class="inline"><span class="w">TARG</span></code>
-oriented macros to
return lists from XSUB's - see <code class="inline"><span class="w">mXPUSHu</span></code>
instead. See also <code class="inline"><span class="w">PUSHu</span></code>
and
<code class="inline"><span class="w">mPUSHu</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XPUSHu</span><span class="s">(</span><span class="w">UV</span> <span class="w">uv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XSRETURN"></a><b>XSRETURN
</b>
<p>Return from XSUB, indicating number of items on the stack. This is usually
handled by <code class="inline"><span class="w">xsubpp</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XSRETURN</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> <span class="w">nitems</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XSRETURN_EMPTY"></a><b>XSRETURN_EMPTY
</b>
<p>Return an empty list from an XSUB immediately.</p>
<pre class="verbatim"><ol><li> <span class="w">XSRETURN_EMPTY</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="XSRETURN_IV"></a><b>XSRETURN_IV
</b>
<p>Return an integer from an XSUB immediately. Uses <code class="inline"><span class="w">XST_mIV</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XSRETURN_IV</span><span class="s">(</span><span class="w">IV</span> <span class="w">iv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XSRETURN_NO"></a><b>XSRETURN_NO
</b>
<p>Return <code class="inline"><span class="i">&PL_sv_no</span></code>
from an XSUB immediately. Uses <code class="inline"><span class="w">XST_mNO</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">XSRETURN_NO</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="XSRETURN_NV"></a><b>XSRETURN_NV
</b>
<p>Return a double from an XSUB immediately. Uses <code class="inline"><span class="w">XST_mNV</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XSRETURN_NV</span><span class="s">(</span><span class="w">NV</span> <span class="w">nv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XSRETURN_PV"></a><b>XSRETURN_PV
</b>
<p>Return a copy of a string from an XSUB immediately. Uses <code class="inline"><span class="w">XST_mPV</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XSRETURN_PV</span><span class="s">(</span><span class="w">char</span>* <span class="w">str</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XSRETURN_UNDEF"></a><b>XSRETURN_UNDEF
</b>
<p>Return <code class="inline"><span class="i">&PL_sv_undef</span></code>
from an XSUB immediately. Uses <code class="inline"><span class="w">XST_mUNDEF</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">XSRETURN_UNDEF</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="XSRETURN_UV"></a><b>XSRETURN_UV
</b>
<p>Return an integer from an XSUB immediately. Uses <code class="inline"><span class="w">XST_mUV</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XSRETURN_UV</span><span class="s">(</span><span class="w">IV</span> <span class="w">uv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XSRETURN_YES"></a><b>XSRETURN_YES
</b>
<p>Return <code class="inline"><span class="i">&PL_sv_yes</span></code>
from an XSUB immediately. Uses <code class="inline"><span class="w">XST_mYES</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">XSRETURN_YES</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="XST_mIV"></a><b>XST_mIV
</b>
<p>Place an integer into the specified position <code class="inline"><a class="l_k" href="functions/pos.html">pos</a></code> on the stack. The
value is stored in a new mortal SV.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XST_mIV</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> <a class="l_k" href="functions/pos.html">pos</a><span class="cm">,</span> <span class="w">IV</span> <span class="w">iv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XST_mNO"></a><b>XST_mNO
</b>
<p>Place <code class="inline"><span class="i">&PL_sv_no</span></code>
into the specified position <code class="inline"><a class="l_k" href="functions/pos.html">pos</a></code> on the
stack.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XST_mNO</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> <a class="l_k" href="functions/pos.html">pos</a><span class="s">)</span></li></ol></pre></li>
<li><a name="XST_mNV"></a><b>XST_mNV
</b>
<p>Place a double into the specified position <code class="inline"><a class="l_k" href="functions/pos.html">pos</a></code> on the stack. The value
is stored in a new mortal SV.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XST_mNV</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> <a class="l_k" href="functions/pos.html">pos</a><span class="cm">,</span> <span class="w">NV</span> <span class="w">nv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XST_mPV"></a><b>XST_mPV
</b>
<p>Place a copy of a string into the specified position <code class="inline"><a class="l_k" href="functions/pos.html">pos</a></code> on the stack.
The value is stored in a new mortal SV.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XST_mPV</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> <a class="l_k" href="functions/pos.html">pos</a><span class="cm">,</span> <span class="w">char</span>* <span class="w">str</span><span class="s">)</span></li></ol></pre></li>
<li><a name="XST_mUNDEF"></a><b>XST_mUNDEF
</b>
<p>Place <code class="inline"><span class="i">&PL_sv_undef</span></code>
into the specified position <code class="inline"><a class="l_k" href="functions/pos.html">pos</a></code> on the
stack.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XST_mUNDEF</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> <a class="l_k" href="functions/pos.html">pos</a><span class="s">)</span></li></ol></pre></li>
<li><a name="XST_mYES"></a><b>XST_mYES
</b>
<p>Place <code class="inline"><span class="i">&PL_sv_yes</span></code>
into the specified position <code class="inline"><a class="l_k" href="functions/pos.html">pos</a></code> on the
stack.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">XST_mYES</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> <a class="l_k" href="functions/pos.html">pos</a><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="SV-Flags"></a><h1>SV Flags</h1>
<ul>
<li><a name="svtype"></a><b>svtype
</b>
<p>An enum of flags for Perl types. These are found in the file <b>sv.h</b>
in the <code class="inline"><span class="w">svtype</span></code>
enum. Test these flags with the <code class="inline"><span class="w">SvTYPE</span></code>
macro.</p>
<p>The types are:</p>
<pre class="verbatim"><ol><li> <span class="w">SVt_NULL</span></li><li> <span class="w">SVt_IV</span></li><li> <span class="w">SVt_NV</span></li><li> <span class="w">SVt_RV</span></li><li> <span class="w">SVt_PV</span></li><li> <span class="w">SVt_PVIV</span></li><li> <span class="w">SVt_PVNV</span></li><li> <span class="w">SVt_PVMG</span></li><li> <span class="w">SVt_INVLIST</span></li><li> <span class="w">SVt_REGEXP</span></li><li> <span class="w">SVt_PVGV</span></li><li> <span class="w">SVt_PVLV</span></li><li> <span class="w">SVt_PVAV</span></li><li> <span class="w">SVt_PVHV</span></li><li> <span class="w">SVt_PVCV</span></li><li> <span class="w">SVt_PVFM</span></li><li> <span class="w">SVt_PVIO</span></li></ol></pre><p>These are most easily explained from the bottom up.</p>
<p>SVt_PVIO is for I/O objects, SVt_PVFM for formats, SVt_PVCV for
subroutines, SVt_PVHV for hashes and SVt_PVAV for arrays.</p>
<p>All the others are scalar types, that is, things that can be bound to a
<code class="inline"><span class="i">$</span></code>
variable. For these, the internal types are mostly orthogonal to
types in the Perl language.</p>
<p>Hence, checking <code class="inline"><span class="i">SvTYPE</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span> < <span class="w">SVt_PVAV</span></code>
is the best way to see whether
something is a scalar.</p>
<p>SVt_PVGV represents a typeglob. If !SvFAKE(sv), then it is a real,
incoercible typeglob. If SvFAKE(sv), then it is a scalar to which a
typeglob has been assigned. Assigning to it again will stop it from being
a typeglob. SVt_PVLV represents a scalar that delegates to another scalar
behind the scenes. It is used, e.g., for the return value of <code class="inline"><a class="l_k" href="functions/substr.html">substr</a></code> and
for tied hash and array elements. It can hold any scalar value, including
a typeglob. SVt_REGEXP is for regular
expressions. SVt_INVLIST is for Perl
core internal use only.</p>
<p>SVt_PVMG represents a "normal" scalar (not a typeglob, regular expression,
or delegate). Since most scalars do not need all the internal fields of a
PVMG, we save memory by allocating smaller structs when possible. All the
other types are just simpler forms of SVt_PVMG, with fewer internal fields.
SVt_NULL can only hold undef. SVt_IV can hold undef, an integer, or a
reference. (SVt_RV is an alias for SVt_IV, which exists for backward
compatibility.) SVt_NV can hold any of those or a double. SVt_PV can only
hold undef or a string. SVt_PVIV is a superset of SVt_PV and SVt_IV.
SVt_PVNV is similar. SVt_PVMG can hold anything SVt_PVNV can hold, but it
can, but does not have to, be blessed or magical.</p>
</li>
<li><a name="SVt_INVLIST"></a><b>SVt_INVLIST
</b>
<p>Type flag for scalars. See <a href="#svtype">svtype</a>.</p>
</li>
<li><a name="SVt_IV"></a><b>SVt_IV
</b>
<p>Type flag for scalars. See <a href="#svtype">svtype</a>.</p>
</li>
<li><a name="SVt_NULL"></a><b>SVt_NULL
</b>
<p>Type flag for scalars. See <a href="#svtype">svtype</a>.</p>
</li>
<li><a name="SVt_NV"></a><b>SVt_NV
</b>
<p>Type flag for scalars. See <a href="#svtype">svtype</a>.</p>
</li>
<li><a name="SVt_PV"></a><b>SVt_PV
</b>
<p>Type flag for scalars. See <a href="#svtype">svtype</a>.</p>
</li>
<li><a name="SVt_PVAV"></a><b>SVt_PVAV
</b>
<p>Type flag for arrays. See <a href="#svtype">svtype</a>.</p>
</li>
<li><a name="SVt_PVCV"></a><b>SVt_PVCV
</b>
<p>Type flag for subroutines. See <a href="#svtype">svtype</a>.</p>
</li>
<li><a name="SVt_PVFM"></a><b>SVt_PVFM
</b>
<p>Type flag for formats. See <a href="#svtype">svtype</a>.</p>
</li>
<li><a name="SVt_PVGV"></a><b>SVt_PVGV
</b>
<p>Type flag for typeglobs. See <a href="#svtype">svtype</a>.</p>
</li>
<li><a name="SVt_PVHV"></a><b>SVt_PVHV
</b>
<p>Type flag for hashes. See <a href="#svtype">svtype</a>.</p>
</li>
<li><a name="SVt_PVIO"></a><b>SVt_PVIO
</b>
<p>Type flag for I/O objects. See <a href="#svtype">svtype</a>.</p>
</li>
<li><a name="SVt_PVIV"></a><b>SVt_PVIV
</b>
<p>Type flag for scalars. See <a href="#svtype">svtype</a>.</p>
</li>
<li><a name="SVt_PVLV"></a><b>SVt_PVLV
</b>
<p>Type flag for scalars. See <a href="#svtype">svtype</a>.</p>
</li>
<li><a name="SVt_PVMG"></a><b>SVt_PVMG
</b>
<p>Type flag for scalars. See <a href="#svtype">svtype</a>.</p>
</li>
<li><a name="SVt_PVNV"></a><b>SVt_PVNV
</b>
<p>Type flag for scalars. See <a href="#svtype">svtype</a>.</p>
</li>
<li><a name="SVt_REGEXP"></a><b>SVt_REGEXP
</b>
<p>Type flag for regular expressions. See <a href="#svtype">svtype</a>.</p>
</li>
</ul>
<a name="SV-Manipulation-Functions"></a><h1>SV Manipulation Functions</h1>
<ul>
<li><a name="boolSV"></a><b>boolSV
</b>
<p>Returns a true SV if <code class="inline"><span class="w">b</span></code>
is a true value, or a false SV if <code class="inline"><span class="w">b</span></code>
is 0.</p>
<p>See also <code class="inline"><span class="w">PL_sv_yes</span></code>
and <code class="inline"><span class="w">PL_sv_no</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">boolSV</span><span class="s">(</span><span class="w">bool</span> <span class="w">b</span><span class="s">)</span></li></ol></pre></li>
<li><a name="croak_xs_usage"></a><b>croak_xs_usage
</b>
<p>A specialised variant of <code class="inline"><span class="i">croak</span><span class="s">(</span><span class="s">)</span></code>
for emitting the usage message for xsubs</p>
<pre class="verbatim"><ol><li> <span class="i">croak_xs_usage</span><span class="s">(</span><span class="w">cv</span><span class="cm">,</span> <span class="q">"eee_yow"</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>works out the package name and subroutine name from <code class="inline"><span class="w">cv</span></code>
, and then calls
<code class="inline"><span class="i">croak</span><span class="s">(</span><span class="s">)</span></code>
. Hence if <code class="inline"><span class="w">cv</span></code>
is <code class="inline"><span class="i">&ouch::awk</span></code>
, it would call <code class="inline"><span class="w">croak</span></code>
as:</p>
<pre class="verbatim"><ol><li> <span class="i">Perl_croak</span><span class="s">(</span><span class="w">aTHX_</span> <span class="q">"Usage: %"</span><span class="w">SVf</span><span class="q">"::%"</span><span class="w">SVf</span><span class="q">"(%s)"</span><span class="cm">,</span> <span class="q">"ouch"</span> <span class="q">"awk"</span><span class="cm">,</span></li><li> <span class="q">"eee_yow"</span><span class="s">)</span><span class="sc">;</span></li><li></li><li> <span class="w">void</span> <span class="i">croak_xs_usage</span><span class="s">(</span><span class="w">const</span> <span class="w">CV</span> *<span class="w">const</span> <span class="w">cv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">params</span><span class="s">)</span></li></ol></pre></li>
<li><a name="get_sv"></a><b>get_sv
</b>
<p>Returns the SV of the specified Perl scalar. <code class="inline"><span class="w">flags</span></code>
are passed to
<code class="inline"><span class="w">gv_fetchpv</span></code>
. If <code class="inline"><span class="w">GV_ADD</span></code>
is set and the
Perl variable does not exist then it will be created. If <code class="inline"><span class="w">flags</span></code>
is zero
and the variable does not exist then NULL is returned.</p>
<p>NOTE: the perl_ form of this function is deprecated.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">get_sv</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">name</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newRV_inc"></a><b>newRV_inc
</b>
<p>Creates an RV wrapper for an SV. The reference count for the original SV is
incremented.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">newRV_inc</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newSVpadname"></a><b>newSVpadname
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Creates a new SV containing the pad name.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">newSVpadname</span><span class="s">(</span><span class="w">PADNAME</span> *<span class="w">pn</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newSVpvn_utf8"></a><b>newSVpvn_utf8
</b>
<p>Creates a new SV and copies a string (which may contain <code class="inline"><span class="w">NUL</span></code>
(<code class="inline">\<span class="n">0</span></code>
)
characters) into it. If utf8 is true, calls
<code class="inline"><span class="w">SvUTF8_on</span></code>
on the new SV. Implemented as a wrapper around <code class="inline"><span class="w">newSVpvn_flags</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">newSVpvn_utf8</span><span class="s">(</span><span class="w">NULLOK</span> <span class="w">const</span> <span class="w">char</span>* <span class="q">s, STRLEN len,</span></li><li> <span class="q"> U32 utf8)</span></li></ol></pre></li>
<li><a name="SvCUR"></a><b>SvCUR
</b>
<p>Returns the length of the string which is in the SV. See <code class="inline"><span class="w">SvLEN</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">SvCUR</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvCUR_set"></a><b>SvCUR_set
</b>
<p>Set the current length of the string which is in the SV. See <code class="inline"><span class="w">SvCUR</span></code>
and <code class="inline"><span class="w">SvIV_set</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvCUR_set</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvEND"></a><b>SvEND
</b>
<p>Returns a pointer to the spot just after the last character in
the string which is in the SV, where there is usually a trailing
<code class="inline"><span class="w">NUL</span></code>
character (even though Perl scalars do not strictly require it).
See <code class="inline"><span class="w">SvCUR</span></code>
. Access the character as *(SvEND(sv)).</p>
<p>Warning: If <code class="inline"><span class="w">SvCUR</span></code>
is equal to <code class="inline"><span class="w">SvLEN</span></code>
, then <code class="inline"><span class="w">SvEND</span></code>
points to
unallocated memory.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvEND</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvGAMAGIC"></a><b>SvGAMAGIC
</b>
<p>Returns true if the SV has get magic or
overloading. If either is true then
the scalar is active data, and has the potential to return a new value every
time it is accessed. Hence you must be careful to
only read it once per user logical operation and work
with that returned value. If neither is true then
the scalar's value cannot change unless written to.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">SvGAMAGIC</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvGROW"></a><b>SvGROW
</b>
<p>Expands the character buffer in the SV so that it has room for the
indicated number of bytes (remember to reserve space for an extra trailing
<code class="inline"><span class="w">NUL</span></code>
character). Calls <code class="inline"><span class="w">sv_grow</span></code>
to perform the expansion if necessary.
Returns a pointer to the character
buffer. SV must be of type >= SVt_PV. One
alternative is to call <code class="inline"><span class="w">sv_grow</span></code>
if you are not sure of the type of SV.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span> * <span class="i">SvGROW</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvIOK"></a><b>SvIOK
</b>
<p>Returns a U32 value indicating whether the SV contains an integer.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">SvIOK</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvIOKp"></a><b>SvIOKp
</b>
<p>Returns a U32 value indicating whether the SV contains an integer. Checks
the <b>private</b> setting. Use <code class="inline"><span class="w">SvIOK</span></code>
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">SvIOKp</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvIOK_notUV"></a><b>SvIOK_notUV
</b>
<p>Returns a boolean indicating whether the SV contains a signed integer.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">SvIOK_notUV</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvIOK_off"></a><b>SvIOK_off
</b>
<p>Unsets the IV status of an SV.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvIOK_off</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvIOK_on"></a><b>SvIOK_on
</b>
<p>Tells an SV that it is an integer.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvIOK_on</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvIOK_only"></a><b>SvIOK_only
</b>
<p>Tells an SV that it is an integer and disables all other OK bits.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvIOK_only</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvIOK_only_UV"></a><b>SvIOK_only_UV
</b>
<p>Tells an SV that it is an unsigned integer and disables all other OK bits.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvIOK_only_UV</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvIOK_UV"></a><b>SvIOK_UV
</b>
<p>Returns a boolean indicating whether the SV contains an integer that must be
interpreted as unsigned. A non-negative integer whose value is within the
range of both an IV and a UV may be be flagged as either SvUOK or SVIOK.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">SvIOK_UV</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvIsCOW"></a><b>SvIsCOW
</b>
<p>Returns a U32 value indicating whether the SV is Copy-On-Write (either shared
hash key scalars, or full Copy On Write scalars if 5.9.0 is configured for
COW).</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">SvIsCOW</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvIsCOW_shared_hash"></a><b>SvIsCOW_shared_hash
</b>
<p>Returns a boolean indicating whether the SV is Copy-On-Write shared hash key
scalar.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">SvIsCOW_shared_hash</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvIV"></a><b>SvIV
</b>
<p>Coerces the given SV to an integer and returns it. See <code class="inline"><span class="w">SvIVx</span></code>
for a
version which guarantees to evaluate sv only once.</p>
<pre class="verbatim"><ol><li> <span class="w">IV</span> <span class="i">SvIV</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvIVX"></a><b>SvIVX
</b>
<p>Returns the raw value in the SV's IV slot, without checks or conversions.
Only use when you are sure SvIOK is true. See also <code class="inline"><span class="i">SvIV</span><span class="s">(</span><span class="s">)</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">IV</span> <span class="i">SvIVX</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvIVx"></a><b>SvIVx
</b>
<p>Coerces the given SV to an integer and returns it.
Guarantees to evaluate <code class="inline"><span class="w">sv</span></code>
only once. Only use
this if <code class="inline"><span class="w">sv</span></code>
is an expression with side effects,
otherwise use the more efficient <code class="inline"><span class="w">SvIV</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">IV</span> <span class="i">SvIVx</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvIV_nomg"></a><b>SvIV_nomg
</b>
<p>Like <code class="inline"><span class="w">SvIV</span></code>
but doesn't process magic.</p>
<pre class="verbatim"><ol><li> <span class="w">IV</span> <span class="i">SvIV_nomg</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvIV_set"></a><b>SvIV_set
</b>
<p>Set the value of the IV pointer in sv to val. It is possible to perform
the same function of this macro with an lvalue assignment to <code class="inline"><span class="w">SvIVX</span></code>
.
With future Perls, however, it will be more efficient to use
<code class="inline"><span class="w">SvIV_set</span></code>
instead of the lvalue assignment to <code class="inline"><span class="w">SvIVX</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvIV_set</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">IV</span> <span class="w">val</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvLEN"></a><b>SvLEN
</b>
<p>Returns the size of the string buffer in the SV, not including any part
attributable to <code class="inline"><span class="w">SvOOK</span></code>
. See <code class="inline"><span class="w">SvCUR</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">SvLEN</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvLEN_set"></a><b>SvLEN_set
</b>
<p>Set the actual length of the string which is in the SV. See <code class="inline"><span class="w">SvIV_set</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvLEN_set</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvMAGIC_set"></a><b>SvMAGIC_set
</b>
<p>Set the value of the MAGIC pointer in sv to val. See <code class="inline"><span class="w">SvIV_set</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvMAGIC_set</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">MAGIC</span>* <span class="w">val</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvNIOK"></a><b>SvNIOK
</b>
<p>Returns a U32 value indicating whether the SV contains a number, integer or
double.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">SvNIOK</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvNIOKp"></a><b>SvNIOKp
</b>
<p>Returns a U32 value indicating whether the SV contains a number, integer or
double. Checks the <b>private</b> setting. Use <code class="inline"><span class="w">SvNIOK</span></code>
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">SvNIOKp</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvNIOK_off"></a><b>SvNIOK_off
</b>
<p>Unsets the NV/IV status of an SV.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvNIOK_off</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvNOK"></a><b>SvNOK
</b>
<p>Returns a U32 value indicating whether the SV contains a double.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">SvNOK</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvNOKp"></a><b>SvNOKp
</b>
<p>Returns a U32 value indicating whether the SV contains a double. Checks the
<b>private</b> setting. Use <code class="inline"><span class="w">SvNOK</span></code>
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">SvNOKp</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvNOK_off"></a><b>SvNOK_off
</b>
<p>Unsets the NV status of an SV.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvNOK_off</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvNOK_on"></a><b>SvNOK_on
</b>
<p>Tells an SV that it is a double.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvNOK_on</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvNOK_only"></a><b>SvNOK_only
</b>
<p>Tells an SV that it is a double and disables all other OK bits.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvNOK_only</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvNV"></a><b>SvNV
</b>
<p>Coerce the given SV to a double and return it. See <code class="inline"><span class="w">SvNVx</span></code>
for a version
which guarantees to evaluate sv only once.</p>
<pre class="verbatim"><ol><li> <span class="w">NV</span> <span class="i">SvNV</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvNVX"></a><b>SvNVX
</b>
<p>Returns the raw value in the SV's NV slot, without checks or conversions.
Only use when you are sure SvNOK is true. See also <code class="inline"><span class="i">SvNV</span><span class="s">(</span><span class="s">)</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">NV</span> <span class="i">SvNVX</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvNVx"></a><b>SvNVx
</b>
<p>Coerces the given SV to a double and returns it.
Guarantees to evaluate <code class="inline"><span class="w">sv</span></code>
only once. Only use
this if <code class="inline"><span class="w">sv</span></code>
is an expression with side effects,
otherwise use the more efficient <code class="inline"><span class="w">SvNV</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">NV</span> <span class="i">SvNVx</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvNV_nomg"></a><b>SvNV_nomg
</b>
<p>Like <code class="inline"><span class="w">SvNV</span></code>
but doesn't process magic.</p>
<pre class="verbatim"><ol><li> <span class="w">NV</span> <span class="i">SvNV_nomg</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvNV_set"></a><b>SvNV_set
</b>
<p>Set the value of the NV pointer in sv to val. See <code class="inline"><span class="w">SvIV_set</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvNV_set</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">NV</span> <span class="w">val</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvOK"></a><b>SvOK
</b>
<p>Returns a U32 value indicating whether the value is defined. This is
only meaningful for scalars.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">SvOK</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvOOK"></a><b>SvOOK
</b>
<p>Returns a U32 indicating whether the pointer to the string buffer is offset.
This hack is used internally to speed up removal of characters from the
beginning of a SvPV. When SvOOK is true, then the start of the
allocated string buffer is actually <code class="inline"><span class="i">SvOOK_offset</span><span class="s">(</span><span class="s">)</span></code>
bytes before SvPVX.
This offset used to be stored in SvIVX, but is now stored within the spare
part of the buffer.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">SvOOK</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvOOK_offset"></a><b>SvOOK_offset
</b>
<p>Reads into <i>len</i> the offset from SvPVX back to the true start of the
allocated buffer, which will be non-zero if <code class="inline"><span class="w">sv_chop</span></code>
has been used to
efficiently remove characters from start of the buffer. Implemented as a
macro, which takes the address of <i>len</i>, which must be of type <code class="inline"><span class="w">STRLEN</span></code>
.
Evaluates <i>sv</i> more than once. Sets <i>len</i> to 0 if <code class="inline"><span class="i">SvOOK</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span></code>
is false.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvOOK_offset</span><span class="s">(</span><span class="w">NN</span> <span class="w">SV</span>*<span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPOK"></a><b>SvPOK
</b>
<p>Returns a U32 value indicating whether the SV contains a character
string.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">SvPOK</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPOKp"></a><b>SvPOKp
</b>
<p>Returns a U32 value indicating whether the SV contains a character string.
Checks the <b>private</b> setting. Use <code class="inline"><span class="w">SvPOK</span></code>
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">SvPOKp</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPOK_off"></a><b>SvPOK_off
</b>
<p>Unsets the PV status of an SV.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvPOK_off</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPOK_on"></a><b>SvPOK_on
</b>
<p>Tells an SV that it is a string.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvPOK_on</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPOK_only"></a><b>SvPOK_only
</b>
<p>Tells an SV that it is a string and disables all other OK bits.
Will also turn off the UTF-8 status.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvPOK_only</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPOK_only_UTF8"></a><b>SvPOK_only_UTF8
</b>
<p>Tells an SV that it is a string and disables all other OK bits,
and leaves the UTF-8 status as it was.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvPOK_only_UTF8</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPV"></a><b>SvPV
</b>
<p>Returns a pointer to the string in the SV, or a stringified form of
the SV if the SV does not contain a string. The SV may cache the
stringified version becoming <code class="inline"><span class="w">SvPOK</span></code>
. Handles 'get' magic. The
<code class="inline"><span class="w">len</span></code>
variable will be set to the length of the string (this is a macro, so
don't use <code class="inline"><span class="i">&len</span></code>
). See also <code class="inline"><span class="w">SvPVx</span></code>
for a version which guarantees to
evaluate sv only once.</p>
<p>Note that there is no guarantee that the return value of <code class="inline"><span class="i">SvPV</span><span class="s">(</span><span class="s">)</span></code>
is
equal to <code class="inline"><span class="i">SvPVX</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span></code>
, or that <code class="inline"><span class="i">SvPVX</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span></code>
contains valid data, or that
successive calls to <code class="inline"><span class="i">SvPV</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span></code>
will return the same pointer value each
time. This is due to the way that things like overloading and
Copy-On-Write are handled. In these cases, the return value may point to
a temporary buffer or similar. If you absolutely need the SvPVX field to
be valid (for example, if you intend to write to it), then see
<a href="#SvPV_force">SvPV_force</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPV</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPVbyte"></a><b>SvPVbyte
</b>
<p>Like <code class="inline"><span class="w">SvPV</span></code>
, but converts sv to byte representation first if necessary.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPVbyte</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPVbytex"></a><b>SvPVbytex
</b>
<p>Like <code class="inline"><span class="w">SvPV</span></code>
, but converts sv to byte representation first if necessary.
Guarantees to evaluate sv only once; use the more efficient <code class="inline"><span class="w">SvPVbyte</span></code>
otherwise.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPVbytex</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPVbytex_force"></a><b>SvPVbytex_force
</b>
<p>Like <code class="inline"><span class="w">SvPV_force</span></code>
, but converts sv to byte representation first if necessary.
Guarantees to evaluate sv only once; use the more efficient <code class="inline"><span class="w">SvPVbyte_force</span></code>
otherwise.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPVbytex_force</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPVbyte_force"></a><b>SvPVbyte_force
</b>
<p>Like <code class="inline"><span class="w">SvPV_force</span></code>
, but converts sv to byte representation first if necessary.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPVbyte_force</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPVbyte_nolen"></a><b>SvPVbyte_nolen
</b>
<p>Like <code class="inline"><span class="w">SvPV_nolen</span></code>
, but converts sv to byte representation first if necessary.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPVbyte_nolen</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPVutf8"></a><b>SvPVutf8
</b>
<p>Like <code class="inline"><span class="w">SvPV</span></code>
, but converts sv to utf8 first if necessary.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPVutf8</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPVutf8x"></a><b>SvPVutf8x
</b>
<p>Like <code class="inline"><span class="w">SvPV</span></code>
, but converts sv to utf8 first if necessary.
Guarantees to evaluate sv only once; use the more efficient <code class="inline"><span class="w">SvPVutf8</span></code>
otherwise.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPVutf8x</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPVutf8x_force"></a><b>SvPVutf8x_force
</b>
<p>Like <code class="inline"><span class="w">SvPV_force</span></code>
, but converts sv to utf8 first if necessary.
Guarantees to evaluate sv only once; use the more efficient <code class="inline"><span class="w">SvPVutf8_force</span></code>
otherwise.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPVutf8x_force</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPVutf8_force"></a><b>SvPVutf8_force
</b>
<p>Like <code class="inline"><span class="w">SvPV_force</span></code>
, but converts sv to utf8 first if necessary.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPVutf8_force</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPVutf8_nolen"></a><b>SvPVutf8_nolen
</b>
<p>Like <code class="inline"><span class="w">SvPV_nolen</span></code>
, but converts sv to utf8 first if necessary.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPVutf8_nolen</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPVX"></a><b>SvPVX
</b>
<p>Returns a pointer to the physical string in the SV. The SV must contain a
string. Prior to 5.9.3 it is not safe
to execute this macro unless the SV's
type >= SVt_PV.</p>
<p>This is also used to store the name of an autoloaded subroutine in an XS
AUTOLOAD routine. See <a href="perlguts.html#Autoloading-with-XSUBs">Autoloading with XSUBs in perlguts</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPVX</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPVx"></a><b>SvPVx
</b>
<p>A version of <code class="inline"><span class="w">SvPV</span></code>
which guarantees to evaluate <code class="inline"><span class="w">sv</span></code>
only once.
Only use this if <code class="inline"><span class="w">sv</span></code>
is an expression with side effects, otherwise use the
more efficient <code class="inline"><span class="w">SvPV</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPVx</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPV_force"></a><b>SvPV_force
</b>
<p>Like <code class="inline"><span class="w">SvPV</span></code>
but will force the SV into containing a string (<code class="inline"><span class="w">SvPOK</span></code>
), and
only a string (<code class="inline"><span class="w">SvPOK_only</span></code>
), by hook or by crook. You need force if you are
going to update the <code class="inline"><span class="w">SvPVX</span></code>
directly. Processes get magic.</p>
<p>Note that coercing an arbitrary scalar into a plain PV will potentially
strip useful data from it. For example if the SV was <code class="inline"><span class="w">SvROK</span></code>
, then the
referent will have its reference count decremented, and the SV itself may
be converted to an <code class="inline"><span class="w">SvPOK</span></code>
scalar with a string buffer containing a value
such as <code class="inline"><span class="q">"ARRAY(0x1234)"</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPV_force</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPV_force_nomg"></a><b>SvPV_force_nomg
</b>
<p>Like <code class="inline"><span class="w">SvPV_force</span></code>
, but doesn't process get magic.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPV_force_nomg</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPV_nolen"></a><b>SvPV_nolen
</b>
<p>Like <code class="inline"><span class="w">SvPV</span></code>
but doesn't set a length variable.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPV_nolen</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPV_nomg"></a><b>SvPV_nomg
</b>
<p>Like <code class="inline"><span class="w">SvPV</span></code>
but doesn't process magic.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPV_nomg</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPV_nomg_nolen"></a><b>SvPV_nomg_nolen
</b>
<p>Like <code class="inline"><span class="w">SvPV_nolen</span></code>
but doesn't process magic.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">SvPV_nomg_nolen</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvPV_set"></a><b>SvPV_set
</b>
<p>This is probably not what you want to use, you probably wanted
<a href="#sv_usepvn_flags">sv_usepvn_flags</a> or <a href="#sv_setpvn">sv_setpvn</a> or <a href="#sv_setpvs">sv_setpvs</a>.</p>
<p>Set the value of the PV pointer in <code class="inline"><span class="w">sv</span></code>
to the Perl allocated
<code class="inline"><span class="w">NUL</span></code>
-terminated string <code class="inline"><span class="w">val</span></code>
. See also <code class="inline"><span class="w">SvIV_set</span></code>
.</p>
<p>Remember to free the previous PV buffer. There are many things to check.
Beware that the existing pointer may be involved in copy-on-write or other
mischief, so do <code class="inline"><span class="i">SvOOK_off</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span></code>
and use <code class="inline"><span class="w">sv_force_normal</span></code>
or
<code class="inline"><span class="w">SvPV_force</span></code>
(or check the SvIsCOW flag) first to make sure this
modification is safe. Then finally, if it is not a COW, call <code class="inline"><span class="w">SvPV_free</span></code>
to
free the previous PV buffer.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvPV_set</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">char</span>* <span class="w">val</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvREFCNT"></a><b>SvREFCNT
</b>
<p>Returns the value of the object's reference count.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">SvREFCNT</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvREFCNT_dec"></a><b>SvREFCNT_dec
</b>
<p>Decrements the reference count of the given SV. <i>sv</i> may be NULL.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvREFCNT_dec</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvREFCNT_dec_NN"></a><b>SvREFCNT_dec_NN
</b>
<p>Same as SvREFCNT_dec, but can only be used if you know <i>sv</i>
is not NULL. Since we don't have to check the NULLness, it's faster
and smaller.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvREFCNT_dec_NN</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvREFCNT_inc"></a><b>SvREFCNT_inc
</b>
<p>Increments the reference count of the given SV, returning the SV.</p>
<p>All of the following SvREFCNT_inc* macros are optimized versions of
SvREFCNT_inc, and can be replaced with SvREFCNT_inc.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">SvREFCNT_inc</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvREFCNT_inc_NN"></a><b>SvREFCNT_inc_NN
</b>
<p>Same as SvREFCNT_inc, but can only be used if you know <i>sv</i>
is not NULL. Since we don't have to check the NULLness, it's faster
and smaller.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">SvREFCNT_inc_NN</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvREFCNT_inc_simple"></a><b>SvREFCNT_inc_simple
</b>
<p>Same as SvREFCNT_inc, but can only be used with expressions without side
effects. Since we don't have to store a temporary value, it's faster.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">SvREFCNT_inc_simple</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvREFCNT_inc_simple_NN"></a><b>SvREFCNT_inc_simple_NN
</b>
<p>Same as SvREFCNT_inc_simple, but can only be used if you know <i>sv</i>
is not NULL. Since we don't have to check the NULLness, it's faster
and smaller.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">SvREFCNT_inc_simple_NN</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvREFCNT_inc_simple_void"></a><b>SvREFCNT_inc_simple_void
</b>
<p>Same as SvREFCNT_inc_simple, but can only be used if you don't need the
return value. The macro doesn't need to return a meaningful value.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvREFCNT_inc_simple_void</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvREFCNT_inc_simple_void_NN"></a><b>SvREFCNT_inc_simple_void_NN
</b>
<p>Same as SvREFCNT_inc, but can only be used if you don't need the return
value, and you know that <i>sv</i> is not NULL. The macro doesn't need
to return a meaningful value, or check for NULLness, so it's smaller
and faster.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvREFCNT_inc_simple_void_NN</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvREFCNT_inc_void"></a><b>SvREFCNT_inc_void
</b>
<p>Same as SvREFCNT_inc, but can only be used if you don't need the
return value. The macro doesn't need to return a meaningful value.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvREFCNT_inc_void</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvREFCNT_inc_void_NN"></a><b>SvREFCNT_inc_void_NN
</b>
<p>Same as SvREFCNT_inc, but can only be used if you don't need the return
value, and you know that <i>sv</i> is not NULL. The macro doesn't need
to return a meaningful value, or check for NULLness, so it's smaller
and faster.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvREFCNT_inc_void_NN</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvROK"></a><b>SvROK
</b>
<p>Tests if the SV is an RV.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">SvROK</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvROK_off"></a><b>SvROK_off
</b>
<p>Unsets the RV status of an SV.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvROK_off</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvROK_on"></a><b>SvROK_on
</b>
<p>Tells an SV that it is an RV.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvROK_on</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvRV"></a><b>SvRV
</b>
<p>Dereferences an RV to return the SV.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">SvRV</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvRV_set"></a><b>SvRV_set
</b>
<p>Set the value of the RV pointer in sv to val. See <code class="inline"><span class="w">SvIV_set</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvRV_set</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">val</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvSTASH"></a><b>SvSTASH
</b>
<p>Returns the stash of the SV.</p>
<pre class="verbatim"><ol><li> <span class="w">HV</span>* <span class="i">SvSTASH</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvSTASH_set"></a><b>SvSTASH_set
</b>
<p>Set the value of the STASH pointer in sv to val. See <code class="inline"><span class="w">SvIV_set</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvSTASH_set</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">HV</span>* <span class="w">val</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvTAINT"></a><b>SvTAINT
</b>
<p>Taints an SV if tainting is enabled, and if some input to the current
expression is tainted--usually a variable, but possibly also implicit
inputs such as locale settings. <code class="inline"><span class="w">SvTAINT</span></code>
propagates that taintedness to
the outputs of an expression in a pessimistic fashion; i.e., without paying
attention to precisely which outputs are influenced by which inputs.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvTAINT</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvTAINTED"></a><b>SvTAINTED
</b>
<p>Checks to see if an SV is tainted. Returns TRUE if it is, FALSE if
not.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">SvTAINTED</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvTAINTED_off"></a><b>SvTAINTED_off
</b>
<p>Untaints an SV. Be <i>very</i> careful with this routine, as it short-circuits
some of Perl's fundamental security features. XS module authors should not
use this function unless they fully understand all the implications of
unconditionally untainting the value. Untainting should be done in the
standard perl fashion, via a carefully crafted regexp, rather than directly
untainting variables.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvTAINTED_off</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvTAINTED_on"></a><b>SvTAINTED_on
</b>
<p>Marks an SV as tainted if tainting is enabled.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvTAINTED_on</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvTRUE"></a><b>SvTRUE
</b>
<p>Returns a boolean indicating whether Perl would evaluate the SV as true or
false. See SvOK() for a defined/undefined test. Handles 'get' magic
unless the scalar is already SvPOK, SvIOK or SvNOK (the public, not the
private flags).</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">SvTRUE</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvTRUE_nomg"></a><b>SvTRUE_nomg
</b>
<p>Returns a boolean indicating whether Perl would evaluate the SV as true or
false. See SvOK() for a defined/undefined test. Does not handle 'get' magic.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">SvTRUE_nomg</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvTYPE"></a><b>SvTYPE
</b>
<p>Returns the type of the SV. See <code class="inline"><span class="w">svtype</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">svtype</span> <span class="i">SvTYPE</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvUOK"></a><b>SvUOK
</b>
<p>Returns a boolean indicating whether the SV contains an integer that must be
interpreted as unsigned. A non-negative integer whose value is within the
range of both an IV and a UV may be be flagged as either SvUOK or SVIOK.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">SvUOK</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvUPGRADE"></a><b>SvUPGRADE
</b>
<p>Used to upgrade an SV to a more complex form. Uses <code class="inline"><span class="w">sv_upgrade</span></code>
to
perform the upgrade if necessary. See <code class="inline"><span class="w">svtype</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvUPGRADE</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">svtype</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvUTF8"></a><b>SvUTF8
</b>
<p>Returns a U32 value indicating the UTF-8 status of an SV. If things are set-up
properly, this indicates whether or not the SV contains UTF-8 encoded data.
You should use this <i>after</i> a call to SvPV() or one of its variants, in
case any call to string overloading updates the internal flag.</p>
<p>If you want to take into account the <a href="bytes.html">bytes</a> pragma, use <code class="inline"><a href="#DO_UTF8">DO_UTF8</a></code>
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">U32</span> <span class="i">SvUTF8</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvUTF8_off"></a><b>SvUTF8_off
</b>
<p>Unsets the UTF-8 status of an SV (the data is not changed, just the flag).
Do not use frivolously.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvUTF8_off</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvUTF8_on"></a><b>SvUTF8_on
</b>
<p>Turn on the UTF-8 status of an SV (the data is not changed, just the flag).
Do not use frivolously.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvUTF8_on</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvUV"></a><b>SvUV
</b>
<p>Coerces the given SV to an unsigned integer and returns it. See <code class="inline"><span class="w">SvUVx</span></code>
for a version which guarantees to evaluate sv only once.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">SvUV</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvUVX"></a><b>SvUVX
</b>
<p>Returns the raw value in the SV's UV slot, without checks or conversions.
Only use when you are sure SvIOK is true. See also <code class="inline"><span class="i">SvUV</span><span class="s">(</span><span class="s">)</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">SvUVX</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvUVx"></a><b>SvUVx
</b>
<p>Coerces the given SV to an unsigned integer and
returns it. Guarantees to evaluate <code class="inline"><span class="w">sv</span></code>
only once. Only
use this if <code class="inline"><span class="w">sv</span></code>
is an expression with side effects,
otherwise use the more efficient <code class="inline"><span class="w">SvUV</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">SvUVx</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvUV_nomg"></a><b>SvUV_nomg
</b>
<p>Like <code class="inline"><span class="w">SvUV</span></code>
but doesn't process magic.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">SvUV_nomg</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvUV_set"></a><b>SvUV_set
</b>
<p>Set the value of the UV pointer in sv to val. See <code class="inline"><span class="w">SvIV_set</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">SvUV_set</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">UV</span> <span class="w">val</span><span class="s">)</span></li></ol></pre></li>
<li><a name="SvVOK"></a><b>SvVOK
</b>
<p>Returns a boolean indicating whether the SV contains a v-string.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">SvVOK</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_catpvn_nomg"></a><b>sv_catpvn_nomg
</b>
<p>Like <code class="inline"><span class="w">sv_catpvn</span></code>
but doesn't process magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_catpvn_nomg</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">ptr</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_catpv_nomg"></a><b>sv_catpv_nomg
</b>
<p>Like <code class="inline"><span class="w">sv_catpv</span></code>
but doesn't process magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_catpv_nomg</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">ptr</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_catsv_nomg"></a><b>sv_catsv_nomg
</b>
<p>Like <code class="inline"><span class="w">sv_catsv</span></code>
but doesn't process magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_catsv_nomg</span><span class="s">(</span><span class="w">SV</span>* <span class="w">dsv</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">ssv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_derived_from"></a><b>sv_derived_from
</b>
<p>Exactly like <a href="#sv_derived_from_pv">sv_derived_from_pv</a>, but doesn't take a <code class="inline"><span class="w">flags</span></code>
parameter.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">sv_derived_from</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">name</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_derived_from_pv"></a><b>sv_derived_from_pv
</b>
<p>Exactly like <a href="#sv_derived_from_pvn">sv_derived_from_pvn</a>, but takes a nul-terminated string
instead of a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">sv_derived_from_pv</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">name</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_derived_from_pvn"></a><b>sv_derived_from_pvn
</b>
<p>Returns a boolean indicating whether the SV is derived from the specified class
<i>at the C level</i>. To check derivation at the Perl level, call <code class="inline"><span class="i">isa</span><span class="s">(</span><span class="s">)</span></code>
as a
normal Perl method.</p>
<p>Currently, the only significant value for <code class="inline"><span class="w">flags</span></code>
is SVf_UTF8.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">sv_derived_from_pvn</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">name</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_derived_from_sv"></a><b>sv_derived_from_sv
</b>
<p>Exactly like <a href="#sv_derived_from_pvn">sv_derived_from_pvn</a>, but takes the name string in the form
of an SV instead of a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">sv_derived_from_sv</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">namesv</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_does"></a><b>sv_does
</b>
<p>Like <a href="#sv_does_pv">sv_does_pv</a>, but doesn't take a <code class="inline"><span class="w">flags</span></code>
parameter.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">sv_does</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">name</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_does_pv"></a><b>sv_does_pv
</b>
<p>Like <a href="#sv_does_sv">sv_does_sv</a>, but takes a nul-terminated string instead of an SV.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">sv_does_pv</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">name</span><span class="cm">,</span></li><li> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_does_pvn"></a><b>sv_does_pvn
</b>
<p>Like <a href="#sv_does_sv">sv_does_sv</a>, but takes a string/length pair instead of an SV.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">sv_does_pvn</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">name</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_does_sv"></a><b>sv_does_sv
</b>
<p>Returns a boolean indicating whether the SV performs a specific, named role.
The SV can be a Perl object or the name of a Perl class.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">sv_does_sv</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">namesv</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_report_used"></a><b>sv_report_used
</b>
<p>Dump the contents of all SVs not yet freed (debugging aid).</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_report_used</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setsv_nomg"></a><b>sv_setsv_nomg
</b>
<p>Like <code class="inline"><span class="w">sv_setsv</span></code>
but doesn't process magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setsv_nomg</span><span class="s">(</span><span class="w">SV</span>* <span class="w">dsv</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">ssv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_utf8_upgrade_nomg"></a><b>sv_utf8_upgrade_nomg
</b>
<p>Like sv_utf8_upgrade, but doesn't do magic on <code class="inline"><span class="w">sv</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">sv_utf8_upgrade_nomg</span><span class="s">(</span><span class="w">NN</span> <span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="SV-Body-Allocation"></a><h1>SV-Body Allocation</h1>
<ul>
<li><a name="looks_like_number"></a><b>looks_like_number
</b>
<p>Test if the content of an SV looks like a number (or is a number).
<code class="inline"><span class="w">Inf</span></code>
and <code class="inline"><span class="w">Infinity</span></code>
are treated as numbers (so will not issue a
non-numeric warning), even if your atof() doesn't grok them. Get-magic is
ignored.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">looks_like_number</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newRV_noinc"></a><b>newRV_noinc
</b>
<p>Creates an RV wrapper for an SV. The reference count for the original
SV is <b>not</b> incremented.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">newRV_noinc</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">tmpRef</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newSV"></a><b>newSV
</b>
<p>Creates a new SV. A non-zero <code class="inline"><span class="w">len</span></code>
parameter indicates the number of
bytes of preallocated string space the SV should have. An extra byte for a
trailing <code class="inline"><span class="w">NUL</span></code>
is also reserved. (SvPOK is not set for the SV even if string
space is allocated.) The reference count for the new SV is set to 1.</p>
<p>In 5.9.3, newSV() replaces the older NEWSV() API, and drops the first
parameter, <i>x</i>, a debug aid which allowed callers to identify themselves.
This aid has been superseded by a new build option, PERL_MEM_LOG (see
<a href="perlhacktips.html#PERL_MEM_LOG">PERL_MEM_LOG in perlhacktips</a>). The older API is still there for use in XS
modules supporting older perls.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">newSV</span><span class="s">(</span><span class="w">const</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newSVhek"></a><b>newSVhek
</b>
<p>Creates a new SV from the hash key structure. It will generate scalars that
point to the shared string table where possible. Returns a new (undefined)
SV if the hek is NULL.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">newSVhek</span><span class="s">(</span><span class="w">const</span> <span class="w">HEK</span> *<span class="w">const</span> <span class="w">hek</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newSViv"></a><b>newSViv
</b>
<p>Creates a new SV and copies an integer into it. The reference count for the
SV is set to 1.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">newSViv</span><span class="s">(</span><span class="w">const</span> <span class="w">IV</span> <span class="w">i</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newSVnv"></a><b>newSVnv
</b>
<p>Creates a new SV and copies a floating point value into it.
The reference count for the SV is set to 1.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">newSVnv</span><span class="s">(</span><span class="w">const</span> <span class="w">NV</span> <span class="w">n</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newSVpv"></a><b>newSVpv
</b>
<p>Creates a new SV and copies a string (which may contain <code class="inline"><span class="w">NUL</span></code>
(<code class="inline">\<span class="n">0</span></code>
)
characters) into it. The reference count for the
SV is set to 1. If <code class="inline"><span class="w">len</span></code>
is zero, Perl will compute the length using
strlen(), (which means if you use this option, that <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> can't have embedded
<code class="inline"><span class="w">NUL</span></code>
characters and has to have a terminating <code class="inline"><span class="w">NUL</span></code>
byte).</p>
<p>For efficiency, consider using <code class="inline"><span class="w">newSVpvn</span></code>
instead.</p>
<pre class="verbatim"><ol><li> SV* newSVpv(const char *const s, const STRLEN len)</li></ol></pre></li>
<li><a name="newSVpvf"></a><b>newSVpvf
</b>
<p>Creates a new SV and initializes it with the string formatted like
<code class="inline"><a class="l_k" href="functions/sprintf.html">sprintf</a></code>.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">newSVpvf</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">pat</span><span class="cm">,</span> ...<span class="s">)</span></li></ol></pre></li>
<li><a name="newSVpvn"></a><b>newSVpvn
</b>
<p>Creates a new SV and copies a string into it, which may contain <code class="inline"><span class="w">NUL</span></code>
characters
(<code class="inline">\<span class="n">0</span></code>
) and other binary data. The reference count for the SV is set to 1.
Note that if <code class="inline"><span class="w">len</span></code>
is zero, Perl will create a zero length (Perl) string. You
are responsible for ensuring that the source buffer is at least
<code class="inline"><span class="w">len</span></code>
bytes long. If the <code class="inline"><span class="w">buffer</span></code>
argument is NULL the new SV will be
undefined.</p>
<pre class="verbatim"><ol><li> SV* newSVpvn(const char *const s, const STRLEN len)</li></ol></pre></li>
<li><a name="newSVpvn_flags"></a><b>newSVpvn_flags
</b>
<p>Creates a new SV and copies a string (which may contain <code class="inline"><span class="w">NUL</span></code>
(<code class="inline">\<span class="n">0</span></code>
)
characters) into it. The reference count for the
SV is set to 1. Note that if <code class="inline"><span class="w">len</span></code>
is zero, Perl will create a zero length
string. You are responsible for ensuring that the source string is at least
<code class="inline"><span class="w">len</span></code>
bytes long. If the <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> argument is NULL the new SV will be undefined.
Currently the only flag bits accepted are <code class="inline"><span class="w">SVf_UTF8</span></code>
and <code class="inline"><span class="w">SVs_TEMP</span></code>
.
If <code class="inline"><span class="w">SVs_TEMP</span></code>
is set, then <code class="inline"><span class="i">sv_2mortal</span><span class="s">(</span><span class="s">)</span></code>
is called on the result before
returning. If <code class="inline"><span class="w">SVf_UTF8</span></code>
is set, <code class="inline"><a class="l_k" href="functions/s.html">s</a></code>
is considered to be in UTF-8 and the
<code class="inline"><span class="w">SVf_UTF8</span></code>
flag will be set on the new SV.
<code class="inline"><span class="i">newSVpvn_utf8</span><span class="s">(</span><span class="s">)</span></code>
is a convenience wrapper for this function, defined as</p>
<pre class="verbatim"><ol><li> <span class="c">#define newSVpvn_utf8(s, len, u) \</span></li><li> <span class="i">newSVpvn_flags</span><span class="s">(</span><span class="s">(</span><span class="q">s), (len), (u)</span> ? <span class="w">SVf_UTF8</span> <span class="co">:</span> <span class="n">0</span><span class="s">)</span></li><li></li><li> <span class="w">SV</span>* <span class="i">newSVpvn_flags</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="q">s,</span></li><li> <span class="q"> const STRLEN len,</span></li><li> <span class="q"> const U32 flags)</span></li></ol></pre></li>
<li><a name="newSVpvn_share"></a><b>newSVpvn_share
</b>
<p>Creates a new SV with its SvPVX_const pointing to a shared string in the string
table. If the string does not already exist in the table, it is
created first. Turns on the SvIsCOW flag (or READONLY
and FAKE in 5.16 and earlier). If the <code class="inline"><span class="w">hash</span></code>
parameter
is non-zero, that value is used; otherwise the hash is computed.
The string's hash can later be retrieved from the SV
with the <code class="inline"><span class="i">SvSHARED_HASH</span><span class="s">(</span><span class="s">)</span></code>
macro. The idea here is
that as the string table is used for shared hash keys these strings will have
SvPVX_const == HeKEY and hash lookup will avoid string compare.</p>
<pre class="verbatim"><ol><li> SV* newSVpvn_share(const char* s, I32 len, U32 hash)</li></ol></pre></li>
<li><a name="newSVpvs"></a><b>newSVpvs
</b>
<p>Like <code class="inline"><span class="w">newSVpvn</span></code>
, but takes a literal <code class="inline"><span class="w">NUL</span></code>
-terminated string instead of a
string/length pair.</p>
<pre class="verbatim"><ol><li> SV* newSVpvs(const char* s)</li></ol></pre></li>
<li><a name="newSVpvs_flags"></a><b>newSVpvs_flags
</b>
<p>Like <code class="inline"><span class="w">newSVpvn_flags</span></code>
, but takes a literal <code class="inline"><span class="w">NUL</span></code>
-terminated string instead of
a string/length pair.</p>
<pre class="verbatim"><ol><li> SV* newSVpvs_flags(const char* s, U32 flags)</li></ol></pre></li>
<li><a name="newSVpvs_share"></a><b>newSVpvs_share
</b>
<p>Like <code class="inline"><span class="w">newSVpvn_share</span></code>
, but takes a literal <code class="inline"><span class="w">NUL</span></code>
-terminated string instead of
a string/length pair and omits the hash parameter.</p>
<pre class="verbatim"><ol><li> SV* newSVpvs_share(const char* s)</li></ol></pre></li>
<li><a name="newSVpv_share"></a><b>newSVpv_share
</b>
<p>Like <code class="inline"><span class="w">newSVpvn_share</span></code>
, but takes a <code class="inline"><span class="w">NUL</span></code>
-terminated string instead of a
string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">newSVpv_share</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="q">s, U32 hash)</span></li></ol></pre></li>
<li><a name="newSVrv"></a><b>newSVrv
</b>
<p>Creates a new SV for the existing RV, <code class="inline"><span class="w">rv</span></code>
, to point to. If <code class="inline"><span class="w">rv</span></code>
is not an
RV then it will be upgraded to one. If <code class="inline"><span class="w">classname</span></code>
is non-null then the new
SV will be blessed in the specified package. The new SV is returned and its
reference count is 1. The reference count 1 is owned by <code class="inline"><span class="w">rv</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">newSVrv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">rv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">classname</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newSVsv"></a><b>newSVsv
</b>
<p>Creates a new SV which is an exact duplicate of the original SV.
(Uses <code class="inline"><span class="w">sv_setsv</span></code>
.)</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">newSVsv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">old</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newSVuv"></a><b>newSVuv
</b>
<p>Creates a new SV and copies an unsigned integer into it.
The reference count for the SV is set to 1.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">newSVuv</span><span class="s">(</span><span class="w">const</span> <span class="w">UV</span> <span class="w">u</span><span class="s">)</span></li></ol></pre></li>
<li><a name="newSV_type"></a><b>newSV_type
</b>
<p>Creates a new SV, of the type specified. The reference count for the new SV
is set to 1.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">newSV_type</span><span class="s">(</span><span class="w">const</span> <span class="w">svtype</span> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_2bool"></a><b>sv_2bool
</b>
<p>This macro is only used by sv_true() or its macro equivalent, and only if
the latter's argument is neither SvPOK, SvIOK nor SvNOK.
It calls sv_2bool_flags with the SV_GMAGIC flag.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">sv_2bool</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_2bool_flags"></a><b>sv_2bool_flags
</b>
<p>This function is only used by sv_true() and friends, and only if
the latter's argument is neither SvPOK, SvIOK nor SvNOK. If the flags
contain SV_GMAGIC, then it does an mg_get() first.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">sv_2bool_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_2cv"></a><b>sv_2cv
</b>
<p>Using various gambits, try to get a CV from an SV; in addition, try if
possible to set <code class="inline"><span class="i">*st</span></code>
and <code class="inline"><span class="i">*gvp</span></code>
to the stash and GV associated with it.
The flags in <code class="inline"><span class="w">lref</span></code>
are passed to gv_fetchsv.</p>
<pre class="verbatim"><ol><li> <span class="w">CV</span>* <span class="i">sv_2cv</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">HV</span> **<span class="w">const</span> <span class="w">st</span><span class="cm">,</span> <span class="w">GV</span> **<span class="w">const</span> <span class="w">gvp</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">I32</span> <span class="w">lref</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_2io"></a><b>sv_2io
</b>
<p>Using various gambits, try to get an IO from an SV: the IO slot if its a
GV; or the recursive result if we're an RV; or the IO slot of the symbol
named after the PV if we're a string.</p>
<p>'Get' magic is ignored on the sv passed in, but will be called on
<code class="inline"><span class="i">SvRV</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span></code>
if sv is an RV.</p>
<pre class="verbatim"><ol><li> <span class="w">IO</span>* <span class="i">sv_2io</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_2iv_flags"></a><b>sv_2iv_flags
</b>
<p>Return the integer value of an SV, doing any necessary string
conversion. If flags includes SV_GMAGIC, does an mg_get() first.
Normally used via the <code class="inline"><span class="i">SvIV</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span></code>
and <code class="inline"><span class="i">SvIVx</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span></code>
macros.</p>
<pre class="verbatim"><ol><li> <span class="w">IV</span> <span class="i">sv_2iv_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_2mortal"></a><b>sv_2mortal
</b>
<p>Marks an existing SV as mortal. The SV will be destroyed "soon", either
by an explicit call to FREETMPS, or by an implicit call at places such as
statement boundaries. SvTEMP() is turned on which means that the SV's
string buffer can be "stolen" if this SV is copied. See also <code class="inline"><span class="w">sv_newmortal</span></code>
and <code class="inline"><span class="w">sv_mortalcopy</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">sv_2mortal</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_2nv_flags"></a><b>sv_2nv_flags
</b>
<p>Return the num value of an SV, doing any necessary string or integer
conversion. If flags includes SV_GMAGIC, does an mg_get() first.
Normally used via the <code class="inline"><span class="i">SvNV</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span></code>
and <code class="inline"><span class="i">SvNVx</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span></code>
macros.</p>
<pre class="verbatim"><ol><li> <span class="w">NV</span> <span class="i">sv_2nv_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_2pvbyte"></a><b>sv_2pvbyte
</b>
<p>Return a pointer to the byte-encoded representation of the SV, and set *lp
to its length. May cause the SV to be downgraded from UTF-8 as a
side-effect.</p>
<p>Usually accessed via the <code class="inline"><span class="w">SvPVbyte</span></code>
macro.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_2pvbyte</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> *<span class="w">const</span> <span class="w">lp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_2pvutf8"></a><b>sv_2pvutf8
</b>
<p>Return a pointer to the UTF-8-encoded representation of the SV, and set *lp
to its length. May cause the SV to be upgraded to UTF-8 as a side-effect.</p>
<p>Usually accessed via the <code class="inline"><span class="w">SvPVutf8</span></code>
macro.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_2pvutf8</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> *<span class="w">const</span> <span class="w">lp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_2pv_flags"></a><b>sv_2pv_flags
</b>
<p>Returns a pointer to the string value of an SV, and sets *lp to its length.
If flags includes SV_GMAGIC, does an mg_get() first. Coerces sv to a
string if necessary. Normally invoked via the <code class="inline"><span class="w">SvPV_flags</span></code>
macro.
<code class="inline"><span class="i">sv_2pv</span><span class="s">(</span><span class="s">)</span></code>
and <code class="inline"><span class="w">sv_2pv_nomg</span></code>
usually end up here too.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_2pv_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> *<span class="w">const</span> <span class="w">lp</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_2uv_flags"></a><b>sv_2uv_flags
</b>
<p>Return the unsigned integer value of an SV, doing any necessary string
conversion. If flags includes SV_GMAGIC, does an mg_get() first.
Normally used via the <code class="inline"><span class="i">SvUV</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span></code>
and <code class="inline"><span class="i">SvUVx</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span></code>
macros.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">sv_2uv_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_backoff"></a><b>sv_backoff
</b>
<p>Remove any string offset. You should normally use the <code class="inline"><span class="w">SvOOK_off</span></code>
macro
wrapper instead.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">sv_backoff</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_bless"></a><b>sv_bless
</b>
<p>Blesses an SV into a specified package. The SV must be an RV. The package
must be designated by its stash (see <code class="inline"><span class="i">gv_stashpv</span><span class="s">(</span><span class="s">)</span></code>
). The reference count
of the SV is unaffected.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">sv_bless</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">HV</span> *<span class="w">const</span> <span class="w">stash</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_catpv"></a><b>sv_catpv
</b>
<p>Concatenates the <code class="inline"><span class="w">NUL</span></code>
-terminated string onto the end of the string which is
in the SV.
If the SV has the UTF-8 status set, then the bytes appended should be
valid UTF-8. Handles 'get' magic, but not 'set' magic. See <code class="inline"><span class="w">sv_catpv_mg</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_catpv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="w">ptr</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_catpvf"></a><b>sv_catpvf
</b>
<p>Processes its arguments like <code class="inline"><a class="l_k" href="functions/sprintf.html">sprintf</a></code> and appends the formatted
output to an SV. If the appended data contains "wide" characters
(including, but not limited to, SVs with a UTF-8 PV formatted with %s,
and characters >255 formatted with %c), the original SV might get
upgraded to UTF-8. Handles 'get' magic, but not 'set' magic. See
<code class="inline"><span class="w">sv_catpvf_mg</span></code>
. If the original SV was UTF-8, the pattern should be
valid UTF-8; if the original SV was bytes, the pattern should be too.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_catpvf</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">pat</span><span class="cm">,</span></li><li> ...<span class="s">)</span></li></ol></pre></li>
<li><a name="sv_catpvf_mg"></a><b>sv_catpvf_mg
</b>
<p>Like <code class="inline"><span class="w">sv_catpvf</span></code>
, but also handles 'set' magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_catpvf_mg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">pat</span><span class="cm">,</span> ...<span class="s">)</span></li></ol></pre></li>
<li><a name="sv_catpvn"></a><b>sv_catpvn
</b>
<p>Concatenates the string onto the end of the string which is in the SV. The
<code class="inline"><span class="w">len</span></code>
indicates number of bytes to copy. If the SV has the UTF-8
status set, then the bytes appended should be valid UTF-8.
Handles 'get' magic, but not 'set' magic. See <code class="inline"><span class="w">sv_catpvn_mg</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_catpvn</span><span class="s">(</span><span class="w">SV</span> *<span class="w">dsv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">sstr</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_catpvn_flags"></a><b>sv_catpvn_flags
</b>
<p>Concatenates the string onto the end of the string which is in the SV. The
<code class="inline"><span class="w">len</span></code>
indicates number of bytes to copy.</p>
<p>By default, the string appended is assumed to be valid UTF-8 if the SV has
the UTF-8 status set, and a string of bytes otherwise. One can force the
appended string to be interpreted as UTF-8 by supplying the <code class="inline"><span class="w">SV_CATUTF8</span></code>
flag, and as bytes by supplying the <code class="inline"><span class="w">SV_CATBYTES</span></code>
flag; the SV or the
string appended will be upgraded to UTF-8 if necessary.</p>
<p>If <code class="inline"><span class="w">flags</span></code>
has the <code class="inline"><span class="w">SV_SMAGIC</span></code>
bit set, will
<code class="inline"><span class="w">mg_set</span></code>
on <code class="inline"><span class="w">dsv</span></code>
afterwards if appropriate.
<code class="inline"><span class="w">sv_catpvn</span></code>
and <code class="inline"><span class="w">sv_catpvn_nomg</span></code>
are implemented
in terms of this function.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_catpvn_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">dstr</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">sstr</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_catpvs"></a><b>sv_catpvs
</b>
<p>Like <code class="inline"><span class="w">sv_catpvn</span></code>
, but takes a literal string instead of a string/length pair.</p>
<pre class="verbatim"><ol><li> void sv_catpvs(SV* sv, const char* s)</li></ol></pre></li>
<li><a name="sv_catpvs_flags"></a><b>sv_catpvs_flags
</b>
<p>Like <code class="inline"><span class="w">sv_catpvn_flags</span></code>
, but takes a literal <code class="inline"><span class="w">NUL</span></code>
-terminated string instead
of a string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_catpvs_flags</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="q">s,</span></li><li> <span class="q"> I32 flags)</span></li></ol></pre></li>
<li><a name="sv_catpvs_mg"></a><b>sv_catpvs_mg
</b>
<p>Like <code class="inline"><span class="w">sv_catpvn_mg</span></code>
, but takes a literal string instead of a
string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_catpvs_mg</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="q">s)</span></li></ol></pre></li>
<li><a name="sv_catpvs_nomg"></a><b>sv_catpvs_nomg
</b>
<p>Like <code class="inline"><span class="w">sv_catpvn_nomg</span></code>
, but takes a literal string instead of a
string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_catpvs_nomg</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="q">s)</span></li></ol></pre></li>
<li><a name="sv_catpv_flags"></a><b>sv_catpv_flags
</b>
<p>Concatenates the <code class="inline"><span class="w">NUL</span></code>
-terminated string onto the end of the string which is
in the SV.
If the SV has the UTF-8 status set, then the bytes appended should
be valid UTF-8. If <code class="inline"><span class="w">flags</span></code>
has the <code class="inline"><span class="w">SV_SMAGIC</span></code>
bit set, will <code class="inline"><span class="w">mg_set</span></code>
on the modified SV if appropriate.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_catpv_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">dstr</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">sstr</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_catpv_mg"></a><b>sv_catpv_mg
</b>
<p>Like <code class="inline"><span class="w">sv_catpv</span></code>
, but also handles 'set' magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_catpv_mg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">ptr</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_catsv"></a><b>sv_catsv
</b>
<p>Concatenates the string from SV <code class="inline"><span class="w">ssv</span></code>
onto the end of the string in SV
<code class="inline"><span class="w">dsv</span></code>
. If <code class="inline"><span class="w">ssv</span></code>
is null, does nothing; otherwise modifies only <code class="inline"><span class="w">dsv</span></code>
.
Handles 'get' magic on both SVs, but no 'set' magic. See <code class="inline"><span class="w">sv_catsv_mg</span></code>
and
<code class="inline"><span class="w">sv_catsv_nomg</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_catsv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">dstr</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">sstr</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_catsv_flags"></a><b>sv_catsv_flags
</b>
<p>Concatenates the string from SV <code class="inline"><span class="w">ssv</span></code>
onto the end of the string in SV
<code class="inline"><span class="w">dsv</span></code>
. If <code class="inline"><span class="w">ssv</span></code>
is null, does nothing; otherwise modifies only <code class="inline"><span class="w">dsv</span></code>
.
If <code class="inline"><span class="w">flags</span></code>
include <code class="inline"><span class="w">SV_GMAGIC</span></code>
bit set, will call <code class="inline"><span class="w">mg_get</span></code>
on both SVs if
appropriate. If <code class="inline"><span class="w">flags</span></code>
include <code class="inline"><span class="w">SV_SMAGIC</span></code>
, <code class="inline"><span class="w">mg_set</span></code>
will be called on
the modified SV afterward, if appropriate. <code class="inline"><span class="w">sv_catsv</span></code>
, <code class="inline"><span class="w">sv_catsv_nomg</span></code>
,
and <code class="inline"><span class="w">sv_catsv_mg</span></code>
are implemented in terms of this function.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_catsv_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">dsv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">const</span> <span class="w">ssv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_chop"></a><b>sv_chop
</b>
<p>Efficient removal of characters from the beginning of the string buffer.
SvPOK(sv), or at least SvPOKp(sv), must be true and the <code class="inline"><span class="w">ptr</span></code>
must be a
pointer to somewhere inside the string buffer. The <code class="inline"><span class="w">ptr</span></code>
becomes the first
character of the adjusted string. Uses the "OOK hack". On return, only
SvPOK(sv) and SvPOKp(sv) among the OK flags will be true.</p>
<p>Beware: after this function returns, <code class="inline"><span class="w">ptr</span></code>
and SvPVX_const(sv) may no longer
refer to the same chunk of data.</p>
<p>The unfortunate similarity of this function's name to that of Perl's <code class="inline"><a class="l_k" href="functions/chop.html">chop</a></code>
operator is strictly coincidental. This function works from the left;
<code class="inline"><a class="l_k" href="functions/chop.html">chop</a></code> works from the right.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_chop</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">ptr</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_clear"></a><b>sv_clear
</b>
<p>Clear an SV: call any destructors, free up any memory used by the body,
and free the body itself. The SV's head is <i>not</i> freed, although
its type is set to all 1's so that it won't inadvertently be assumed
to be live during global destruction etc.
This function should only be called when REFCNT is zero. Most of the time
you'll want to call <code class="inline"><span class="i">sv_free</span><span class="s">(</span><span class="s">)</span></code>
(or its macro wrapper <code class="inline"><span class="w">SvREFCNT_dec</span></code>
)
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_clear</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">orig_sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_cmp"></a><b>sv_cmp
</b>
<p>Compares the strings in two SVs. Returns -1, 0, or 1 indicating whether the
string in <code class="inline"><span class="w">sv1</span></code>
is less than, equal to, or greater than the string in
<code class="inline"><span class="w">sv2</span></code>
. Is UTF-8 and 'use bytes' aware, handles get magic, and will
coerce its args to strings if necessary. See also <code class="inline"><span class="w">sv_cmp_locale</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">sv_cmp</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv1</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">const</span> <span class="w">sv2</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_cmp_flags"></a><b>sv_cmp_flags
</b>
<p>Compares the strings in two SVs. Returns -1, 0, or 1 indicating whether the
string in <code class="inline"><span class="w">sv1</span></code>
is less than, equal to, or greater than the string in
<code class="inline"><span class="w">sv2</span></code>
. Is UTF-8 and 'use bytes' aware and will coerce its args to strings
if necessary. If the flags include SV_GMAGIC, it handles get magic. See
also <code class="inline"><span class="w">sv_cmp_locale_flags</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">sv_cmp_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv1</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">const</span> <span class="w">sv2</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_cmp_locale"></a><b>sv_cmp_locale
</b>
<p>Compares the strings in two SVs in a locale-aware manner. Is UTF-8 and
'use bytes' aware, handles get magic, and will coerce its args to strings
if necessary. See also <code class="inline"><span class="w">sv_cmp</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">sv_cmp_locale</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv1</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">const</span> <span class="w">sv2</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_cmp_locale_flags"></a><b>sv_cmp_locale_flags
</b>
<p>Compares the strings in two SVs in a locale-aware manner. Is UTF-8 and
'use bytes' aware and will coerce its args to strings if necessary. If the
flags contain SV_GMAGIC, it handles get magic. See also <code class="inline"><span class="w">sv_cmp_flags</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">sv_cmp_locale_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv1</span><span class="cm">,</span></li><li> <span class="w">SV</span> *<span class="w">const</span> <span class="w">sv2</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_collxfrm"></a><b>sv_collxfrm
</b>
<p>This calls <code class="inline"><span class="w">sv_collxfrm_flags</span></code>
with the SV_GMAGIC flag. See
<code class="inline"><span class="w">sv_collxfrm_flags</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_collxfrm</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> *<span class="w">const</span> <span class="w">nxp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_collxfrm_flags"></a><b>sv_collxfrm_flags
</b>
<p>Add Collate Transform magic to an SV if it doesn't already have it. If the
flags contain SV_GMAGIC, it handles get-magic.</p>
<p>Any scalar variable may carry PERL_MAGIC_collxfrm magic that contains the
scalar data of the variable, but transformed to such a format that a normal
memory comparison can be used to compare the data according to the locale
settings.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_collxfrm_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> *<span class="w">const</span> <span class="w">nxp</span><span class="cm">,</span></li><li> <span class="w">I32</span> <span class="w">const</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_copypv_flags"></a><b>sv_copypv_flags
</b>
<p>Implementation of sv_copypv and sv_copypv_nomg. Calls get magic iff flags
include SV_GMAGIC.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_copypv_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">dsv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">const</span> <span class="w">ssv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_copypv_nomg"></a><b>sv_copypv_nomg
</b>
<p>Like sv_copypv, but doesn't invoke get magic first.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_copypv_nomg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">dsv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">const</span> <span class="w">ssv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_dec"></a><b>sv_dec
</b>
<p>Auto-decrement of the value in the SV, doing string to numeric conversion
if necessary. Handles 'get' magic and operator overloading.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_dec</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_dec_nomg"></a><b>sv_dec_nomg
</b>
<p>Auto-decrement of the value in the SV, doing string to numeric conversion
if necessary. Handles operator overloading. Skips handling 'get' magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_dec_nomg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_eq"></a><b>sv_eq
</b>
<p>Returns a boolean indicating whether the strings in the two SVs are
identical. Is UTF-8 and 'use bytes' aware, handles get magic, and will
coerce its args to strings if necessary.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">sv_eq</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv1</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">sv2</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_eq_flags"></a><b>sv_eq_flags
</b>
<p>Returns a boolean indicating whether the strings in the two SVs are
identical. Is UTF-8 and 'use bytes' aware and coerces its args to strings
if necessary. If the flags include SV_GMAGIC, it handles get-magic, too.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">sv_eq_flags</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv1</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">sv2</span><span class="cm">,</span> <span class="w">const</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_force_normal_flags"></a><b>sv_force_normal_flags
</b>
<p>Undo various types of fakery on an SV, where fakery means
"more than" a string: if the PV is a shared string, make
a private copy; if we're a ref, stop refing; if we're a glob, downgrade to
an xpvmg; if we're a copy-on-write scalar, this is the on-write time when
we do the copy, and is also used locally; if this is a
vstring, drop the vstring magic. If <code class="inline"><span class="w">SV_COW_DROP_PV</span></code>
is set
then a copy-on-write scalar drops its PV buffer (if any) and becomes
SvPOK_off rather than making a copy. (Used where this
scalar is about to be set to some other value.) In addition,
the <code class="inline"><span class="w">flags</span></code>
parameter gets passed to <code class="inline"><span class="i">sv_unref_flags</span><span class="s">(</span><span class="s">)</span></code>
when unreffing. <code class="inline"><span class="w">sv_force_normal</span></code>
calls this function
with flags set to 0.</p>
<p>This function is expected to be used to signal to perl that this SV is
about to be written to, and any extra book-keeping needs to be taken care
of. Hence, it croaks on read-only values.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_force_normal_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_free"></a><b>sv_free
</b>
<p>Decrement an SV's reference count, and if it drops to zero, call
<code class="inline"><span class="w">sv_clear</span></code>
to invoke destructors and free up any memory used by
the body; finally, deallocate the SV's head itself.
Normally called via a wrapper macro <code class="inline"><span class="w">SvREFCNT_dec</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_free</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_gets"></a><b>sv_gets
</b>
<p>Get a line from the filehandle and store it into the SV, optionally
appending to the currently-stored string. If <code class="inline"><span class="w">append</span></code>
is not 0, the
line is appended to the SV instead of overwriting it. <code class="inline"><span class="w">append</span></code>
should
be set to the byte offset that the appended string should start at
in the SV (typically, <code class="inline"><span class="i">SvCUR</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span></code>
is a suitable choice).</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_gets</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">PerlIO</span> *<span class="w">const</span> <span class="w">fp</span><span class="cm">,</span></li><li> <span class="w">I32</span> <span class="w">append</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_get_backrefs"></a><b>sv_get_backrefs
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>If the sv is the target of a weak reference then it returns the back
references structure associated with the sv; otherwise return NULL.</p>
<p>When returning a non-null result the type of the return is relevant. If it
is an AV then the elements of the AV are the weak reference RVs which
point at this item. If it is any other type then the item itself is the
weak reference.</p>
<p>See also Perl_sv_add_backref(), Perl_sv_del_backref(),
Perl_sv_kill_backrefs()</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">sv_get_backrefs</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_grow"></a><b>sv_grow
</b>
<p>Expands the character buffer in the SV. If necessary, uses <code class="inline"><span class="w">sv_unref</span></code>
and
upgrades the SV to <code class="inline"><span class="w">SVt_PV</span></code>
. Returns a pointer to the character buffer.
Use the <code class="inline"><span class="w">SvGROW</span></code>
wrapper instead.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_grow</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">newlen</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_inc"></a><b>sv_inc
</b>
<p>Auto-increment of the value in the SV, doing string to numeric conversion
if necessary. Handles 'get' magic and operator overloading.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_inc</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_inc_nomg"></a><b>sv_inc_nomg
</b>
<p>Auto-increment of the value in the SV, doing string to numeric conversion
if necessary. Handles operator overloading. Skips handling 'get' magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_inc_nomg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_insert"></a><b>sv_insert
</b>
<p>Inserts a string at the specified offset/length within the SV. Similar to
the Perl substr() function. Handles get magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_insert</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">bigstr</span><span class="cm">,</span> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">offset</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">little</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">littlelen</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_insert_flags"></a><b>sv_insert_flags
</b>
<p>Same as <code class="inline"><span class="w">sv_insert</span></code>
, but the extra <code class="inline"><span class="w">flags</span></code>
are passed to the
<code class="inline"><span class="w">SvPV_force_flags</span></code>
that applies to <code class="inline"><span class="w">bigstr</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_insert_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">bigstr</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">offset</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">little</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">littlelen</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_isa"></a><b>sv_isa
</b>
<p>Returns a boolean indicating whether the SV is blessed into the specified
class. This does not check for subtypes; use <code class="inline"><span class="w">sv_derived_from</span></code>
to verify
an inheritance relationship.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">sv_isa</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">name</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_isobject"></a><b>sv_isobject
</b>
<p>Returns a boolean indicating whether the SV is an RV pointing to a blessed
object. If the SV is not an RV, or if the object is not blessed, then this
will return false.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">sv_isobject</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_len"></a><b>sv_len
</b>
<p>Returns the length of the string in the SV. Handles magic and type
coercion and sets the UTF8 flag appropriately. See also <code class="inline"><span class="w">SvCUR</span></code>
, which
gives raw access to the xpv_cur slot.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">sv_len</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_len_utf8"></a><b>sv_len_utf8
</b>
<p>Returns the number of characters in the string in an SV, counting wide
UTF-8 bytes as a single character. Handles magic and type coercion.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">sv_len_utf8</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_magic"></a><b>sv_magic
</b>
<p>Adds magic to an SV. First upgrades <code class="inline"><span class="w">sv</span></code>
to type <code class="inline"><span class="w">SVt_PVMG</span></code>
if
necessary, then adds a new magic item of type <code class="inline"><span class="w">how</span></code>
to the head of the
magic list.</p>
<p>See <code class="inline"><span class="w">sv_magicext</span></code>
(which <code class="inline"><span class="w">sv_magic</span></code>
now calls) for a description of the
handling of the <code class="inline"><span class="w">name</span></code>
and <code class="inline"><span class="w">namlen</span></code>
arguments.</p>
<p>You need to use <code class="inline"><span class="w">sv_magicext</span></code>
to add magic to SvREADONLY SVs and also
to add more than one instance of the same 'how'.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_magic</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">const</span> <span class="w">obj</span><span class="cm">,</span></li><li> <span class="w">const</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">how</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">name</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">I32</span> <span class="w">namlen</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_magicext"></a><b>sv_magicext
</b>
<p>Adds magic to an SV, upgrading it if necessary. Applies the
supplied vtable and returns a pointer to the magic added.</p>
<p>Note that <code class="inline"><span class="w">sv_magicext</span></code>
will allow things that <code class="inline"><span class="w">sv_magic</span></code>
will not.
In particular, you can add magic to SvREADONLY SVs, and add more than
one instance of the same 'how'.</p>
<p>If <code class="inline"><span class="w">namlen</span></code>
is greater than zero then a <code class="inline"><span class="w">savepvn</span></code>
<i>copy</i> of <code class="inline"><span class="w">name</span></code>
is
stored, if <code class="inline"><span class="w">namlen</span></code>
is zero then <code class="inline"><span class="w">name</span></code>
is stored as-is and - as another
special case - if <code class="inline"><span class="s">(</span><span class="w">name</span> && <span class="w">namlen</span> == <span class="w">HEf_SVKEY</span><span class="s">)</span></code>
then <code class="inline"><span class="w">name</span></code>
is assumed
to contain an <code class="inline"><span class="w">SV</span>*</code>
and is stored as-is with its REFCNT incremented.</p>
<p>(This is now used as a subroutine by <code class="inline"><span class="w">sv_magic</span></code>
.)</p>
<pre class="verbatim"><ol><li> <span class="w">MAGIC</span> * <span class="i">sv_magicext</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">const</span> <span class="w">obj</span><span class="cm">,</span></li><li> <span class="w">const</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">how</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">MGVTBL</span> *<span class="w">const</span> <span class="w">vtbl</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">name</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">I32</span> <span class="w">namlen</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_mortalcopy"></a><b>sv_mortalcopy
</b>
<p>Creates a new SV which is a copy of the original SV (using <code class="inline"><span class="w">sv_setsv</span></code>
).
The new SV is marked as mortal. It will be destroyed "soon", either by an
explicit call to FREETMPS, or by an implicit call at places such as
statement boundaries. See also <code class="inline"><span class="w">sv_newmortal</span></code>
and <code class="inline"><span class="w">sv_2mortal</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">sv_mortalcopy</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">oldsv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_newmortal"></a><b>sv_newmortal
</b>
<p>Creates a new null SV which is mortal. The reference count of the SV is
set to 1. It will be destroyed "soon", either by an explicit call to
FREETMPS, or by an implicit call at places such as statement boundaries.
See also <code class="inline"><span class="w">sv_mortalcopy</span></code>
and <code class="inline"><span class="w">sv_2mortal</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">sv_newmortal</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_newref"></a><b>sv_newref
</b>
<p>Increment an SV's reference count. Use the <code class="inline"><span class="i">SvREFCNT_inc</span><span class="s">(</span><span class="s">)</span></code>
wrapper
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">sv_newref</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_pos_b2u"></a><b>sv_pos_b2u
</b>
<p>Converts the value pointed to by offsetp from a count of bytes from the
start of the string, to a count of the equivalent number of UTF-8 chars.
Handles magic and type coercion.</p>
<p>Use <code class="inline"><span class="w">sv_pos_b2u_flags</span></code>
in preference, which correctly handles strings
longer than 2Gb.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_pos_b2u</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">I32</span> *<span class="w">const</span> <span class="w">offsetp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_pos_b2u_flags"></a><b>sv_pos_b2u_flags
</b>
<p>Converts the offset from a count of bytes from the start of the string, to
a count of the equivalent number of UTF-8 chars. Handles type coercion.
<i>flags</i> is passed to <code class="inline"><span class="w">SvPV_flags</span></code>
, and usually should be
<code class="inline"><span class="w">SV_GMAGIC</span>|<span class="w">SV_CONST_RETURN</span></code>
to handle magic.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">sv_pos_b2u_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">const</span> <span class="w">offset</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_pos_u2b"></a><b>sv_pos_u2b
</b>
<p>Converts the value pointed to by offsetp from a count of UTF-8 chars from
the start of the string, to a count of the equivalent number of bytes; if
lenp is non-zero, it does the same to lenp, but this time starting from
the offset, rather than from the start of the string. Handles magic and
type coercion.</p>
<p>Use <code class="inline"><span class="w">sv_pos_u2b_flags</span></code>
in preference, which correctly handles strings longer
than 2Gb.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_pos_u2b</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">I32</span> *<span class="w">const</span> <span class="w">offsetp</span><span class="cm">,</span></li><li> <span class="w">I32</span> *<span class="w">const</span> <span class="w">lenp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_pos_u2b_flags"></a><b>sv_pos_u2b_flags
</b>
<p>Converts the offset from a count of UTF-8 chars from
the start of the string, to a count of the equivalent number of bytes; if
lenp is non-zero, it does the same to lenp, but this time starting from
the offset, rather than from the start
of the string. Handles type coercion.
<i>flags</i> is passed to <code class="inline"><span class="w">SvPV_flags</span></code>
, and usually should be
<code class="inline"><span class="w">SV_GMAGIC</span>|<span class="w">SV_CONST_RETURN</span></code>
to handle magic.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">sv_pos_u2b_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">uoffset</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> *<span class="w">const</span> <span class="w">lenp</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_pvbyten_force"></a><b>sv_pvbyten_force
</b>
<p>The backend for the <code class="inline"><span class="w">SvPVbytex_force</span></code>
macro. Always use the macro
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_pvbyten_force</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> *<span class="w">const</span> <span class="w">lp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_pvn_force"></a><b>sv_pvn_force
</b>
<p>Get a sensible string out of the SV somehow.
A private implementation of the <code class="inline"><span class="w">SvPV_force</span></code>
macro for compilers which
can't cope with complex macro expressions. Always use the macro instead.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_pvn_force</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span>* <span class="w">lp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_pvn_force_flags"></a><b>sv_pvn_force_flags
</b>
<p>Get a sensible string out of the SV somehow.
If <code class="inline"><span class="w">flags</span></code>
has <code class="inline"><span class="w">SV_GMAGIC</span></code>
bit set, will <code class="inline"><span class="w">mg_get</span></code>
on <code class="inline"><span class="w">sv</span></code>
if
appropriate, else not. <code class="inline"><span class="w">sv_pvn_force</span></code>
and <code class="inline"><span class="w">sv_pvn_force_nomg</span></code>
are
implemented in terms of this function.
You normally want to use the various wrapper macros instead: see
<code class="inline"><span class="w">SvPV_force</span></code>
and <code class="inline"><span class="w">SvPV_force_nomg</span></code>
</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_pvn_force_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> *<span class="w">const</span> <span class="w">lp</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_pvutf8n_force"></a><b>sv_pvutf8n_force
</b>
<p>The backend for the <code class="inline"><span class="w">SvPVutf8x_force</span></code>
macro. Always use the macro
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_pvutf8n_force</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">STRLEN</span> *<span class="w">const</span> <span class="w">lp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_reftype"></a><b>sv_reftype
</b>
<p>Returns a string describing what the SV is a reference to.</p>
<pre class="verbatim"><ol><li> <span class="w">const</span> <span class="w">char</span>* <span class="i">sv_reftype</span><span class="s">(</span><span class="w">const</span> <span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">ob</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_replace"></a><b>sv_replace
</b>
<p>Make the first argument a copy of the second, then delete the original.
The target SV physically takes over ownership of the body of the source SV
and inherits its flags; however, the target keeps any magic it owns,
and any magic in the source is discarded.
Note that this is a rather specialist SV copying operation; most of the
time you'll want to use <code class="inline"><span class="w">sv_setsv</span></code>
or one of its many macro front-ends.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_replace</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">const</span> <span class="w">nsv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_reset"></a><b>sv_reset
</b>
<p>Underlying implementation for the <code class="inline"><a class="l_k" href="functions/reset.html">reset</a></code> Perl function.
Note that the perl-level function is vaguely deprecated.</p>
<pre class="verbatim"><ol><li> void sv_reset(const char* s, HV *const stash)</li></ol></pre></li>
<li><a name="sv_rvweaken"></a><b>sv_rvweaken
</b>
<p>Weaken a reference: set the <code class="inline"><span class="w">SvWEAKREF</span></code>
flag on this RV; give the
referred-to SV <code class="inline"><span class="w">PERL_MAGIC_backref</span></code>
magic if it hasn't already; and
push a back-reference to this RV onto the array of backreferences
associated with that magic. If the RV is magical, set magic will be
called after the RV is cleared.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">sv_rvweaken</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setiv"></a><b>sv_setiv
</b>
<p>Copies an integer into the given SV, upgrading first if necessary.
Does not handle 'set' magic. See also <code class="inline"><span class="w">sv_setiv_mg</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setiv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">IV</span> <span class="w">num</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setiv_mg"></a><b>sv_setiv_mg
</b>
<p>Like <code class="inline"><span class="w">sv_setiv</span></code>
, but also handles 'set' magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setiv_mg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">IV</span> <span class="w">i</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setnv"></a><b>sv_setnv
</b>
<p>Copies a double into the given SV, upgrading first if necessary.
Does not handle 'set' magic. See also <code class="inline"><span class="w">sv_setnv_mg</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setnv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">NV</span> <span class="w">num</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setnv_mg"></a><b>sv_setnv_mg
</b>
<p>Like <code class="inline"><span class="w">sv_setnv</span></code>
, but also handles 'set' magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setnv_mg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">NV</span> <span class="w">num</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setpv"></a><b>sv_setpv
</b>
<p>Copies a string into an SV. The string must be terminated with a <code class="inline"><span class="w">NUL</span></code>
character.
Does not handle 'set' magic. See <code class="inline"><span class="w">sv_setpv_mg</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setpv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">ptr</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setpvf"></a><b>sv_setpvf
</b>
<p>Works like <code class="inline"><span class="w">sv_catpvf</span></code>
but copies the text into the SV instead of
appending it. Does not handle 'set' magic. See <code class="inline"><span class="w">sv_setpvf_mg</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setpvf</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">pat</span><span class="cm">,</span></li><li> ...<span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setpvf_mg"></a><b>sv_setpvf_mg
</b>
<p>Like <code class="inline"><span class="w">sv_setpvf</span></code>
, but also handles 'set' magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setpvf_mg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">pat</span><span class="cm">,</span> ...<span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setpviv"></a><b>sv_setpviv
</b>
<p>Copies an integer into the given SV, also updating its string value.
Does not handle 'set' magic. See <code class="inline"><span class="w">sv_setpviv_mg</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setpviv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">IV</span> <span class="w">num</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setpviv_mg"></a><b>sv_setpviv_mg
</b>
<p>Like <code class="inline"><span class="w">sv_setpviv</span></code>
, but also handles 'set' magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setpviv_mg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">IV</span> <span class="w">iv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setpvn"></a><b>sv_setpvn
</b>
<p>Copies a string (possibly containing embedded <code class="inline"><span class="w">NUL</span></code>
characters) into an SV.
The <code class="inline"><span class="w">len</span></code>
parameter indicates the number of
bytes to be copied. If the <code class="inline"><span class="w">ptr</span></code>
argument is NULL the SV will become
undefined. Does not handle 'set' magic. See <code class="inline"><span class="w">sv_setpvn_mg</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setpvn</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">ptr</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setpvn_mg"></a><b>sv_setpvn_mg
</b>
<p>Like <code class="inline"><span class="w">sv_setpvn</span></code>
, but also handles 'set' magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setpvn_mg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">ptr</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setpvs"></a><b>sv_setpvs
</b>
<p>Like <code class="inline"><span class="w">sv_setpvn</span></code>
, but takes a literal string instead of a string/length pair.</p>
<pre class="verbatim"><ol><li> void sv_setpvs(SV* sv, const char* s)</li></ol></pre></li>
<li><a name="sv_setpvs_mg"></a><b>sv_setpvs_mg
</b>
<p>Like <code class="inline"><span class="w">sv_setpvn_mg</span></code>
, but takes a literal string instead of a
string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setpvs_mg</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span>* <span class="q">s)</span></li></ol></pre></li>
<li><a name="sv_setpv_mg"></a><b>sv_setpv_mg
</b>
<p>Like <code class="inline"><span class="w">sv_setpv</span></code>
, but also handles 'set' magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setpv_mg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">ptr</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setref_iv"></a><b>sv_setref_iv
</b>
<p>Copies an integer into a new SV, optionally blessing the SV. The <code class="inline"><span class="w">rv</span></code>
argument will be upgraded to an RV. That RV will be modified to point to
the new SV. The <code class="inline"><span class="w">classname</span></code>
argument indicates the package for the
blessing. Set <code class="inline"><span class="w">classname</span></code>
to <code class="inline"><span class="w">NULL</span></code>
to avoid the blessing. The new SV
will have a reference count of 1, and the RV will be returned.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">sv_setref_iv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">rv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">classname</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">IV</span> <span class="w">iv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setref_nv"></a><b>sv_setref_nv
</b>
<p>Copies a double into a new SV, optionally blessing the SV. The <code class="inline"><span class="w">rv</span></code>
argument will be upgraded to an RV. That RV will be modified to point to
the new SV. The <code class="inline"><span class="w">classname</span></code>
argument indicates the package for the
blessing. Set <code class="inline"><span class="w">classname</span></code>
to <code class="inline"><span class="w">NULL</span></code>
to avoid the blessing. The new SV
will have a reference count of 1, and the RV will be returned.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">sv_setref_nv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">rv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">classname</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">NV</span> <span class="w">nv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setref_pv"></a><b>sv_setref_pv
</b>
<p>Copies a pointer into a new SV, optionally blessing the SV. The <code class="inline"><span class="w">rv</span></code>
argument will be upgraded to an RV. That RV will be modified to point to
the new SV. If the <code class="inline"><span class="w">pv</span></code>
argument is NULL then <code class="inline"><span class="w">PL_sv_undef</span></code>
will be placed
into the SV. The <code class="inline"><span class="w">classname</span></code>
argument indicates the package for the
blessing. Set <code class="inline"><span class="w">classname</span></code>
to <code class="inline"><span class="w">NULL</span></code>
to avoid the blessing. The new SV
will have a reference count of 1, and the RV will be returned.</p>
<p>Do not use with other Perl types such as HV, AV, SV, CV, because those
objects will become corrupted by the pointer copy process.</p>
<p>Note that <code class="inline"><span class="w">sv_setref_pvn</span></code>
copies the string while this copies the pointer.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">sv_setref_pv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">rv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">classname</span><span class="cm">,</span></li><li> <span class="w">void</span> *<span class="w">const</span> <span class="w">pv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setref_pvn"></a><b>sv_setref_pvn
</b>
<p>Copies a string into a new SV, optionally blessing the SV. The length of the
string must be specified with <code class="inline"><span class="w">n</span></code>
. The <code class="inline"><span class="w">rv</span></code>
argument will be upgraded to
an RV. That RV will be modified to point to the new SV. The <code class="inline"><span class="w">classname</span></code>
argument indicates the package for the blessing. Set <code class="inline"><span class="w">classname</span></code>
to
<code class="inline"><span class="w">NULL</span></code>
to avoid the blessing. The new SV will have a reference count
of 1, and the RV will be returned.</p>
<p>Note that <code class="inline"><span class="w">sv_setref_pv</span></code>
copies the pointer while this copies the string.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">sv_setref_pvn</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">rv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">classname</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">pv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">n</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setref_pvs"></a><b>sv_setref_pvs
</b>
<p>Like <code class="inline"><span class="w">sv_setref_pvn</span></code>
, but takes a literal string instead of a
string/length pair.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> * <span class="i">sv_setref_pvs</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="q">s)</span></li></ol></pre></li>
<li><a name="sv_setref_uv"></a><b>sv_setref_uv
</b>
<p>Copies an unsigned integer into a new SV, optionally blessing the SV. The <code class="inline"><span class="w">rv</span></code>
argument will be upgraded to an RV. That RV will be modified to point to
the new SV. The <code class="inline"><span class="w">classname</span></code>
argument indicates the package for the
blessing. Set <code class="inline"><span class="w">classname</span></code>
to <code class="inline"><span class="w">NULL</span></code>
to avoid the blessing. The new SV
will have a reference count of 1, and the RV will be returned.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">sv_setref_uv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">rv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">classname</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">UV</span> <span class="w">uv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setsv"></a><b>sv_setsv
</b>
<p>Copies the contents of the source SV <code class="inline"><span class="w">ssv</span></code>
into the destination SV
<code class="inline"><span class="w">dsv</span></code>
. The source SV may be destroyed if it is mortal, so don't use this
function if the source SV needs to be reused. Does not handle 'set' magic on
destination SV. Calls 'get' magic on source SV. Loosely speaking, it
performs a copy-by-value, obliterating any previous content of the
destination.</p>
<p>You probably want to use one of the assortment of wrappers, such as
<code class="inline"><span class="w">SvSetSV</span></code>
, <code class="inline"><span class="w">SvSetSV_nosteal</span></code>
, <code class="inline"><span class="w">SvSetMagicSV</span></code>
and
<code class="inline"><span class="w">SvSetMagicSV_nosteal</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setsv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">dstr</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">sstr</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setsv_flags"></a><b>sv_setsv_flags
</b>
<p>Copies the contents of the source SV <code class="inline"><span class="w">ssv</span></code>
into the destination SV
<code class="inline"><span class="w">dsv</span></code>
. The source SV may be destroyed if it is mortal, so don't use this
function if the source SV needs to be reused. Does not handle 'set' magic.
Loosely speaking, it performs a copy-by-value, obliterating any previous
content of the destination.
If the <code class="inline"><span class="w">flags</span></code>
parameter has the <code class="inline"><span class="w">SV_GMAGIC</span></code>
bit set, will <code class="inline"><span class="w">mg_get</span></code>
on
<code class="inline"><span class="w">ssv</span></code>
if appropriate, else not. If the <code class="inline"><span class="w">flags</span></code>
parameter has the <code class="inline"><span class="w">SV_NOSTEAL</span></code>
bit set then the
buffers of temps will not be stolen. <sv_setsv>
and <code class="inline"><span class="w">sv_setsv_nomg</span></code>
are implemented in terms of this function.</p>
<p>You probably want to use one of the assortment of wrappers, such as
<code class="inline"><span class="w">SvSetSV</span></code>
, <code class="inline"><span class="w">SvSetSV_nosteal</span></code>
, <code class="inline"><span class="w">SvSetMagicSV</span></code>
and
<code class="inline"><span class="w">SvSetMagicSV_nosteal</span></code>
.</p>
<p>This is the primary function for copying scalars, and most other
copy-ish functions and macros use this underneath.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setsv_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">dstr</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">sstr</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setsv_mg"></a><b>sv_setsv_mg
</b>
<p>Like <code class="inline"><span class="w">sv_setsv</span></code>
, but also handles 'set' magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setsv_mg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">dstr</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">const</span> <span class="w">sstr</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setuv"></a><b>sv_setuv
</b>
<p>Copies an unsigned integer into the given SV, upgrading first if necessary.
Does not handle 'set' magic. See also <code class="inline"><span class="w">sv_setuv_mg</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setuv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">UV</span> <span class="w">num</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_setuv_mg"></a><b>sv_setuv_mg
</b>
<p>Like <code class="inline"><span class="w">sv_setuv</span></code>
, but also handles 'set' magic.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_setuv_mg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">UV</span> <span class="w">u</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_tainted"></a><b>sv_tainted
</b>
<p>Test an SV for taintedness. Use <code class="inline"><span class="w">SvTAINTED</span></code>
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">sv_tainted</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_true"></a><b>sv_true
</b>
<p>Returns true if the SV has a true value by Perl's rules.
Use the <code class="inline"><span class="w">SvTRUE</span></code>
macro instead, which may call <code class="inline"><span class="i">sv_true</span><span class="s">(</span><span class="s">)</span></code>
or may
instead use an in-line version.</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">sv_true</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_unmagic"></a><b>sv_unmagic
</b>
<p>Removes all magic of type <code class="inline"><span class="w">type</span></code>
from an SV.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">sv_unmagic</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_unmagicext"></a><b>sv_unmagicext
</b>
<p>Removes all magic of type <code class="inline"><span class="w">type</span></code>
with the specified <code class="inline"><span class="w">vtbl</span></code>
from an SV.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">sv_unmagicext</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">type</span><span class="cm">,</span></li><li> <span class="w">MGVTBL</span> *<span class="w">vtbl</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_unref_flags"></a><b>sv_unref_flags
</b>
<p>Unsets the RV status of the SV, and decrements the reference count of
whatever was being referenced by the RV. This can almost be thought of
as a reversal of <code class="inline"><span class="w">newSVrv</span></code>
. The <code class="inline"><span class="w">cflags</span></code>
argument can contain
<code class="inline"><span class="w">SV_IMMEDIATE_UNREF</span></code>
to force the reference count to be decremented
(otherwise the decrementing is conditional on the reference count being
different from one or the reference being a readonly SV).
See <code class="inline"><span class="w">SvROK_off</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_unref_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <a class="l_k" href="functions/ref.html">ref</a><span class="cm">,</span> <span class="w">const</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_untaint"></a><b>sv_untaint
</b>
<p>Untaint an SV. Use <code class="inline"><span class="w">SvTAINTED_off</span></code>
instead.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_untaint</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_upgrade"></a><b>sv_upgrade
</b>
<p>Upgrade an SV to a more complex form. Generally adds a new body type to the
SV, then copies across as much information as possible from the old body.
It croaks if the SV is already in a more complex form than requested. You
generally want to use the <code class="inline"><span class="w">SvUPGRADE</span></code>
macro wrapper, which checks the type
before calling <code class="inline"><span class="w">sv_upgrade</span></code>
, and hence does not croak. See also
<code class="inline"><span class="w">svtype</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_upgrade</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">svtype</span> <span class="w">new_type</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_usepvn_flags"></a><b>sv_usepvn_flags
</b>
<p>Tells an SV to use <code class="inline"><span class="w">ptr</span></code>
to find its string value. Normally the
string is stored inside the SV, but sv_usepvn allows the SV to use an
outside string. The <code class="inline"><span class="w">ptr</span></code>
should point to memory that was allocated
by <a href="perlclib.html#Memory-Management-and-String-Handling">Newx</a>. It must be
the start of a Newx-ed block of memory, and not a pointer to the
middle of it (beware of <a href="perlguts.html#Offsets">OOK</a> and copy-on-write),
and not be from a non-Newx memory allocator like <code class="inline"><span class="w">malloc</span></code>
. The
string length, <code class="inline"><span class="w">len</span></code>
, must be supplied. By default this function
will <code class="inline"><span class="w">Renew</span></code>
(i.e. realloc, move) the memory pointed to by <code class="inline"><span class="w">ptr</span></code>
,
so that pointer should not be freed or used by the programmer after
giving it to sv_usepvn, and neither should any pointers from "behind"
that pointer (e.g. ptr + 1) be used.</p>
<p>If <code class="inline"><span class="w">flags</span></code>
& SV_SMAGIC is true, will call SvSETMAGIC. If <code class="inline"><span class="w">flags</span></code>
&
SV_HAS_TRAILING_NUL is true, then <code class="inline"><span class="w">ptr</span><span class="s">[</span><span class="w">len</span><span class="s">]</span></code>
must be <code class="inline"><span class="w">NUL</span></code>
, and the realloc
will be skipped (i.e. the buffer is actually at least 1 byte longer than
<code class="inline"><span class="w">len</span></code>
, and already meets the requirements for storing in <code class="inline"><span class="w">SvPVX</span></code>
).</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_usepvn_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">char</span>* <span class="w">ptr</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_utf8_decode"></a><b>sv_utf8_decode
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>If the PV of the SV is an octet sequence in UTF-8
and contains a multiple-byte character, the <code class="inline"><span class="w">SvUTF8</span></code>
flag is turned on
so that it looks like a character. If the PV contains only single-byte
characters, the <code class="inline"><span class="w">SvUTF8</span></code>
flag stays off.
Scans PV for validity and returns false if the PV is invalid UTF-8.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">sv_utf8_decode</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_utf8_downgrade"></a><b>sv_utf8_downgrade
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Attempts to convert the PV of an SV from characters to bytes.
If the PV contains a character that cannot fit
in a byte, this conversion will fail;
in this case, either returns false or, if <code class="inline"><span class="w">fail_ok</span></code>
is not
true, croaks.</p>
<p>This is not a general purpose Unicode to byte encoding interface:
use the Encode extension for that.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">sv_utf8_downgrade</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">bool</span> <span class="w">fail_ok</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_utf8_encode"></a><b>sv_utf8_encode
</b>
<p>Converts the PV of an SV to UTF-8, but then turns the <code class="inline"><span class="w">SvUTF8</span></code>
flag off so that it looks like octets again.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_utf8_encode</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_utf8_upgrade"></a><b>sv_utf8_upgrade
</b>
<p>Converts the PV of an SV to its UTF-8-encoded form.
Forces the SV to string form if it is not already.
Will <code class="inline"><span class="w">mg_get</span></code>
on <code class="inline"><span class="w">sv</span></code>
if appropriate.
Always sets the SvUTF8 flag to avoid future validity checks even
if the whole string is the same in UTF-8 as not.
Returns the number of bytes in the converted string</p>
<p>This is not a general purpose byte encoding to Unicode interface:
use the Encode extension for that.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">sv_utf8_upgrade</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_utf8_upgrade_flags"></a><b>sv_utf8_upgrade_flags
</b>
<p>Converts the PV of an SV to its UTF-8-encoded form.
Forces the SV to string form if it is not already.
Always sets the SvUTF8 flag to avoid future validity checks even
if all the bytes are invariant in UTF-8.
If <code class="inline"><span class="w">flags</span></code>
has <code class="inline"><span class="w">SV_GMAGIC</span></code>
bit set,
will <code class="inline"><span class="w">mg_get</span></code>
on <code class="inline"><span class="w">sv</span></code>
if appropriate, else not.</p>
<p>If <code class="inline"><span class="w">flags</span></code>
has SV_FORCE_UTF8_UPGRADE set, this function assumes that the PV
will expand when converted to UTF-8, and skips the extra work of checking for
that. Typically this flag is used by a routine that has already parsed the
string and found such characters, and passes this information on so that the
work doesn't have to be repeated.</p>
<p>Returns the number of bytes in the converted string.</p>
<p>This is not a general purpose byte encoding to Unicode interface:
use the Encode extension for that.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">sv_utf8_upgrade_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">I32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_utf8_upgrade_flags_grow"></a><b>sv_utf8_upgrade_flags_grow
</b>
<p>Like sv_utf8_upgrade_flags, but has an additional parameter <code class="inline"><span class="w">extra</span></code>
, which is
the number of unused bytes the string of 'sv' is guaranteed to have free after
it upon return. This allows the caller to reserve extra space that it intends
to fill, to avoid extra grows.</p>
<p><code class="inline"><span class="w">sv_utf8_upgrade</span></code>
, <code class="inline"><span class="w">sv_utf8_upgrade_nomg</span></code>
, and <code class="inline"><span class="w">sv_utf8_upgrade_flags</span></code>
are implemented in terms of this function.</p>
<p>Returns the number of bytes in the converted string (not including the spares).</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">sv_utf8_upgrade_flags_grow</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">I32</span> <span class="w">flags</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">extra</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_utf8_upgrade_nomg"></a><b>sv_utf8_upgrade_nomg
</b>
<p>Like sv_utf8_upgrade, but doesn't do magic on <code class="inline"><span class="w">sv</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">sv_utf8_upgrade_nomg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_vcatpvf"></a><b>sv_vcatpvf
</b>
<p>Processes its arguments like <code class="inline"><span class="w">vsprintf</span></code>
and appends the formatted output
to an SV. Does not handle 'set' magic. See <code class="inline"><span class="w">sv_vcatpvf_mg</span></code>
.</p>
<p>Usually used via its frontend <code class="inline"><span class="w">sv_catpvf</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_vcatpvf</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">pat</span><span class="cm">,</span></li><li> <span class="w">va_list</span> *<span class="w">const</span> <span class="w">args</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_vcatpvfn"></a><b>sv_vcatpvfn
</b>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_vcatpvfn</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">pat</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">patlen</span><span class="cm">,</span></li><li> <span class="w">va_list</span> *<span class="w">const</span> <span class="w">args</span><span class="cm">,</span></li><li> <span class="w">SV</span> **<span class="w">const</span> <span class="w">svargs</span><span class="cm">,</span> <span class="w">const</span> <span class="w">I32</span> <span class="w">svmax</span><span class="cm">,</span></li><li> <span class="w">bool</span> *<span class="w">const</span> <span class="w">maybe_tainted</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_vcatpvfn_flags"></a><b>sv_vcatpvfn_flags
</b>
<p>Processes its arguments like <code class="inline"><span class="w">vsprintf</span></code>
and appends the formatted output
to an SV. Uses an array of SVs if the C style variable argument list is
missing (NULL). When running with taint checks enabled, indicates via
<code class="inline"><span class="w">maybe_tainted</span></code>
if results are untrustworthy (often due to the use of
locales).</p>
<p>If called as <code class="inline"><span class="w">sv_vcatpvfn</span></code>
or flags include <code class="inline"><span class="w">SV_GMAGIC</span></code>
, calls get magic.</p>
<p>Usually used via one of its frontends <code class="inline"><span class="w">sv_vcatpvf</span></code>
and <code class="inline"><span class="w">sv_vcatpvf_mg</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_vcatpvfn_flags</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">pat</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">patlen</span><span class="cm">,</span></li><li> <span class="w">va_list</span> *<span class="w">const</span> <span class="w">args</span><span class="cm">,</span></li><li> <span class="w">SV</span> **<span class="w">const</span> <span class="w">svargs</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">I32</span> <span class="w">svmax</span><span class="cm">,</span></li><li> <span class="w">bool</span> *<span class="w">const</span> <span class="w">maybe_tainted</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_vcatpvf_mg"></a><b>sv_vcatpvf_mg
</b>
<p>Like <code class="inline"><span class="w">sv_vcatpvf</span></code>
, but also handles 'set' magic.</p>
<p>Usually used via its frontend <code class="inline"><span class="w">sv_catpvf_mg</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_vcatpvf_mg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">pat</span><span class="cm">,</span></li><li> <span class="w">va_list</span> *<span class="w">const</span> <span class="w">args</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_vsetpvf"></a><b>sv_vsetpvf
</b>
<p>Works like <code class="inline"><span class="w">sv_vcatpvf</span></code>
but copies the text into the SV instead of
appending it. Does not handle 'set' magic. See <code class="inline"><span class="w">sv_vsetpvf_mg</span></code>
.</p>
<p>Usually used via its frontend <code class="inline"><span class="w">sv_setpvf</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_vsetpvf</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">pat</span><span class="cm">,</span></li><li> <span class="w">va_list</span> *<span class="w">const</span> <span class="w">args</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_vsetpvfn"></a><b>sv_vsetpvfn
</b>
<p>Works like <code class="inline"><span class="w">sv_vcatpvfn</span></code>
but copies the text into the SV instead of
appending it.</p>
<p>Usually used via one of its frontends <code class="inline"><span class="w">sv_vsetpvf</span></code>
and <code class="inline"><span class="w">sv_vsetpvf_mg</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_vsetpvfn</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">pat</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">STRLEN</span> <span class="w">patlen</span><span class="cm">,</span></li><li> <span class="w">va_list</span> *<span class="w">const</span> <span class="w">args</span><span class="cm">,</span></li><li> <span class="w">SV</span> **<span class="w">const</span> <span class="w">svargs</span><span class="cm">,</span> <span class="w">const</span> <span class="w">I32</span> <span class="w">svmax</span><span class="cm">,</span></li><li> <span class="w">bool</span> *<span class="w">const</span> <span class="w">maybe_tainted</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_vsetpvf_mg"></a><b>sv_vsetpvf_mg
</b>
<p>Like <code class="inline"><span class="w">sv_vsetpvf</span></code>
, but also handles 'set' magic.</p>
<p>Usually used via its frontend <code class="inline"><span class="w">sv_setpvf_mg</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">sv_vsetpvf_mg</span><span class="s">(</span><span class="w">SV</span> *<span class="w">const</span> <span class="w">sv</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">const</span> <span class="w">pat</span><span class="cm">,</span></li><li> <span class="w">va_list</span> *<span class="w">const</span> <span class="w">args</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Unicode-Support"></a><h1>Unicode Support</h1>
<p><a href="perlguts.html#Unicode-Support">Unicode Support in perlguts</a> has an introduction to this API.</p>
<p>See also <a href="#Character-classification">Character classification</a>,
and <a href="#Character-case-changing">Character case changing</a>.
Various functions outside this section also work specially with Unicode.
Search for the string "utf8" in this document.</p>
<ul>
<li><a name="bytes_cmp_utf8"></a><b>bytes_cmp_utf8
</b>
<p>Compares the sequence of characters (stored as octets) in <code class="inline"><span class="w">b</span></code>
, <code class="inline"><span class="w">blen</span></code>
with the
sequence of characters (stored as UTF-8)
in <code class="inline"><span class="w">u</span></code>
, <code class="inline"><span class="w">ulen</span></code>
. Returns 0 if they are
equal, -1 or -2 if the first string is less than the second string, +1 or +2
if the first string is greater than the second string.</p>
<p>-1 or +1 is returned if the shorter string was identical to the start of the
longer string. -2 or +2 is returned if
there was a difference between characters
within the strings.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">bytes_cmp_utf8</span><span class="s">(</span><span class="w">const</span> <span class="w">U8</span> *<span class="w">b</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">blen</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">U8</span> *<span class="w">u</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">ulen</span><span class="s">)</span></li></ol></pre></li>
<li><a name="bytes_from_utf8"></a><b>bytes_from_utf8
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Converts a string <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> of length <code class="inline"><span class="w">len</span></code>
from UTF-8 into native byte encoding.
Unlike <a href="#utf8_to_bytes">utf8_to_bytes</a> but like <a href="#bytes_to_utf8">bytes_to_utf8</a>, returns a pointer to
the newly-created string, and updates <code class="inline"><span class="w">len</span></code>
to contain the new
length. Returns the original string if no conversion occurs, <code class="inline"><span class="w">len</span></code>
is unchanged. Do nothing if <code class="inline"><span class="w">is_utf8</span></code>
points to 0. Sets <code class="inline"><span class="w">is_utf8</span></code>
to
0 if <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> is converted or consisted entirely of characters that are invariant
in utf8 (i.e., US-ASCII on non-EBCDIC machines).</p>
<pre class="verbatim"><ol><li> <span class="w">U8</span>* <span class="i">bytes_from_utf8</span><span class="s">(</span><span class="w">const</span> <span class="w">U8</span> *<span class="q">s, STRLEN *len,</span></li><li> <span class="q"> bool *is_utf8)</span></li></ol></pre></li>
<li><a name="bytes_to_utf8"></a><b>bytes_to_utf8
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Converts a string <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> of length <code class="inline"><span class="w">len</span></code>
bytes from the native encoding into
UTF-8.
Returns a pointer to the newly-created string, and sets <code class="inline"><span class="w">len</span></code>
to
reflect the new length in bytes.</p>
<p>A <code class="inline"><span class="w">NUL</span></code>
character will be written after the end of the string.</p>
<p>If you want to convert to UTF-8 from encodings other than
the native (Latin1 or EBCDIC),
see <a href="#sv_recode_to_utf8">sv_recode_to_utf8</a>().</p>
<pre class="verbatim"><ol><li> U8* bytes_to_utf8(const U8 *s, STRLEN *len)</li></ol></pre></li>
<li><a name="DO_UTF8"></a><b>DO_UTF8
</b>
<p>Returns a bool giving whether or not the PV in <code class="inline"><span class="w">sv</span></code>
is to be treated as being
encoded in UTF-8.</p>
<p>You should use this <i>after</i> a call to <code class="inline"><span class="i">SvPV</span><span class="s">(</span><span class="s">)</span></code>
or one of its variants, in
case any call to string overloading updates the internal UTF-8 encoding flag.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">DO_UTF8</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="foldEQ_utf8"></a><b>foldEQ_utf8
</b>
<p>Returns true if the leading portions of the strings <code class="inline"><span class="w">s1</span></code>
and <code class="inline"><span class="w">s2</span></code>
(either or both
of which may be in UTF-8) are the same case-insensitively; false otherwise.
How far into the strings to compare is determined by other input parameters.</p>
<p>If <code class="inline"><span class="w">u1</span></code>
is true, the string <code class="inline"><span class="w">s1</span></code>
is assumed to be in UTF-8-encoded Unicode;
otherwise it is assumed to be in native 8-bit encoding. Correspondingly for <code class="inline"><span class="w">u2</span></code>
with respect to <code class="inline"><span class="w">s2</span></code>
.</p>
<p>If the byte length <code class="inline"><span class="w">l1</span></code>
is non-zero, it says how far into <code class="inline"><span class="w">s1</span></code>
to check for fold
equality. In other words, <code class="inline"><span class="w">s1</span></code>
+<code class="inline"><span class="w">l1</span></code>
will be used as a goal to reach. The
scan will not be considered to be a match unless the goal is reached, and
scanning won't continue past that goal. Correspondingly for <code class="inline"><span class="w">l2</span></code>
with respect to
<code class="inline"><span class="w">s2</span></code>
.</p>
<p>If <code class="inline"><span class="w">pe1</span></code>
is non-NULL and the pointer it points to is not NULL, that pointer is
considered an end pointer to the position 1 byte past the maximum point
in <code class="inline"><span class="w">s1</span></code>
beyond which scanning will not continue under any circumstances.
(This routine assumes that UTF-8 encoded input strings are not malformed;
malformed input can cause it to read past <code class="inline"><span class="w">pe1</span></code>
).
This means that if both <code class="inline"><span class="w">l1</span></code>
and <code class="inline"><span class="w">pe1</span></code>
are specified, and <code class="inline"><span class="w">pe1</span></code>
is less than <code class="inline"><span class="w">s1</span></code>
+<code class="inline"><span class="w">l1</span></code>
, the match will never be successful because it can
never
get as far as its goal (and in fact is asserted against). Correspondingly for
<code class="inline"><span class="w">pe2</span></code>
with respect to <code class="inline"><span class="w">s2</span></code>
.</p>
<p>At least one of <code class="inline"><span class="w">s1</span></code>
and <code class="inline"><span class="w">s2</span></code>
must have a goal (at least one of <code class="inline"><span class="w">l1</span></code>
and
<code class="inline"><span class="w">l2</span></code>
must be non-zero), and if both do, both have to be
reached for a successful match. Also, if the fold of a character is multiple
characters, all of them must be matched (see tr21 reference below for
'folding').</p>
<p>Upon a successful match, if <code class="inline"><span class="w">pe1</span></code>
is non-NULL,
it will be set to point to the beginning of the <i>next</i> character of <code class="inline"><span class="w">s1</span></code>
beyond what was matched. Correspondingly for <code class="inline"><span class="w">pe2</span></code>
and <code class="inline"><span class="w">s2</span></code>
.</p>
<p>For case-insensitiveness, the "casefolding" of Unicode is used
instead of upper/lowercasing both the characters, see
<a href="http://www.unicode.org/unicode/reports/tr21/">http://www.unicode.org/unicode/reports/tr21/</a> (Case Mappings).</p>
<pre class="verbatim"><ol><li> <span class="w">I32</span> <span class="i">foldEQ_utf8</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">s1</span><span class="cm">,</span> <span class="w">char</span> **<span class="w">pe1</span><span class="cm">,</span> <span class="w">UV</span> <span class="w">l1</span><span class="cm">,</span></li><li> <span class="w">bool</span> <span class="w">u1</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">s2</span><span class="cm">,</span> <span class="w">char</span> **<span class="w">pe2</span><span class="cm">,</span></li><li> <span class="w">UV</span> <span class="w">l2</span><span class="cm">,</span> <span class="w">bool</span> <span class="w">u2</span><span class="s">)</span></li></ol></pre></li>
<li><a name="isUTF8_CHAR"></a><b>isUTF8_CHAR
</b>
<p>Returns the number of bytes beginning at <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> which form a legal UTF-8 (or
UTF-EBCDIC) encoded character, looking no further than <code class="inline"><span class="w">e</span> - <span class="q">s</span></code>
bytes into
<code class="inline"><a class="l_k" href="functions/s.html">s</a></code>. Returns 0 if the sequence starting at <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> through <code class="inline"><span class="w">e</span> - <span class="n">1</span></code>
is not
well-formed UTF-8</p>
<p>Note that an INVARIANT character (i.e. ASCII on non-EBCDIC
machines) is a valid UTF-8 character.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">isUTF8_CHAR</span><span class="s">(</span><span class="w">const</span> <span class="w">U8</span> *<span class="q">s, const U8 *e)</span></li></ol></pre></li>
<li><a name="is_ascii_string"></a><b>is_ascii_string
</b>
<p>This is a misleadingly-named synonym for <a href="#is_invariant_string">is_invariant_string</a>.
On ASCII-ish platforms, the name isn't misleading: the ASCII-range characters
are exactly the UTF-8 invariants. But EBCDIC machines have more invariants
than just the ASCII characters, so <code class="inline"><span class="w">is_invariant_string</span></code>
is preferred.</p>
<pre class="verbatim"><ol><li> bool is_ascii_string(const U8 *s, STRLEN len)</li></ol></pre></li>
<li><a name="is_invariant_string"></a><b>is_invariant_string
</b>
<p>Returns true iff the first <code class="inline"><span class="w">len</span></code>
bytes of the string <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> are the same
regardless of the UTF-8 encoding of the string (or UTF-EBCDIC encoding on
EBCDIC machines). That is, if they are UTF-8 invariant. On ASCII-ish
machines, all the ASCII characters and only the ASCII characters fit this
definition. On EBCDIC machines, the ASCII-range characters are invariant, but
so also are the C1 controls and <code class="inline">\<span class="w">c</span>?</code>
(which isn't in the ASCII range on
EBCDIC).</p>
<p>If <code class="inline"><span class="w">len</span></code>
is 0, it will be calculated using <code class="inline"><span class="i">strlen</span><span class="s">(</span><span class="q">s)</span></code>
, (which means if you
use this option, that <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> can't have embedded <code class="inline"><span class="w">NUL</span></code>
characters and has to
have a terminating <code class="inline"><span class="w">NUL</span></code>
byte).</p>
<p>See also <a href="#is_utf8_string">is_utf8_string</a>(), <a href="#is_utf8_string_loclen">is_utf8_string_loclen</a>(), and <a href="#is_utf8_string_loc">is_utf8_string_loc</a>().</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">is_invariant_string</span><span class="s">(</span><span class="w">const</span> <span class="w">U8</span> *<span class="q">s, STRLEN len)</span></li></ol></pre></li>
<li><a name="is_utf8_string"></a><b>is_utf8_string
</b>
<p>Returns true if the first <code class="inline"><span class="w">len</span></code>
bytes of string <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> form a valid
UTF-8 string, false otherwise. If <code class="inline"><span class="w">len</span></code>
is 0, it will be calculated
using <code class="inline"><span class="i">strlen</span><span class="s">(</span><span class="q">s)</span></code>
(which means if you use this option, that <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> can't have
embedded <code class="inline"><span class="w">NUL</span></code>
characters and has to have a terminating <code class="inline"><span class="w">NUL</span></code>
byte). Note
that all characters being ASCII constitute 'a valid UTF-8 string'.</p>
<p>See also <a href="#is_invariant_string">is_invariant_string</a>(), <a href="#is_utf8_string_loclen">is_utf8_string_loclen</a>(), and <a href="#is_utf8_string_loc">is_utf8_string_loc</a>().</p>
<pre class="verbatim"><ol><li> bool is_utf8_string(const U8 *s, STRLEN len)</li></ol></pre></li>
<li><a name="is_utf8_string_loc"></a><b>is_utf8_string_loc
</b>
<p>Like <a href="#is_utf8_string">is_utf8_string</a> but stores the location of the failure (in the
case of "utf8ness failure") or the location <code class="inline"><a class="l_k" href="functions/s.html">s</a></code>+<code class="inline"><span class="w">len</span></code>
(in the case of
"utf8ness success") in the <code class="inline"><span class="w">ep</span></code>
.</p>
<p>See also <a href="#is_utf8_string_loclen">is_utf8_string_loclen</a>() and <a href="#is_utf8_string">is_utf8_string</a>().</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">is_utf8_string_loc</span><span class="s">(</span><span class="w">const</span> <span class="w">U8</span> *<span class="q">s, STRLEN len,</span></li><li> <span class="q"> const U8 **ep)</span></li></ol></pre></li>
<li><a name="is_utf8_string_loclen"></a><b>is_utf8_string_loclen
</b>
<p>Like <a href="#is_utf8_string">is_utf8_string</a>() but stores the location of the failure (in the
case of "utf8ness failure") or the location <code class="inline"><a class="l_k" href="functions/s.html">s</a></code>+<code class="inline"><span class="w">len</span></code>
(in the case of
"utf8ness success") in the <code class="inline"><span class="w">ep</span></code>
, and the number of UTF-8
encoded characters in the <code class="inline"><span class="w">el</span></code>
.</p>
<p>See also <a href="#is_utf8_string_loc">is_utf8_string_loc</a>() and <a href="#is_utf8_string">is_utf8_string</a>().</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">is_utf8_string_loclen</span><span class="s">(</span><span class="w">const</span> <span class="w">U8</span> *<span class="q">s, STRLEN len,</span></li><li> <span class="q"> const U8 **ep,</span> <span class="w">STRLEN</span> *<span class="w">el</span><span class="s">)</span></li></ol></pre></li>
<li><a name="pv_uni_display"></a><b>pv_uni_display
</b>
<p>Build to the scalar <code class="inline"><span class="w">dsv</span></code>
a displayable version of the string <code class="inline"><span class="w">spv</span></code>
,
length <code class="inline"><span class="w">len</span></code>
, the displayable version being at most <code class="inline"><span class="w">pvlim</span></code>
bytes long
(if longer, the rest is truncated and "..." will be appended).</p>
<p>The <code class="inline"><span class="w">flags</span></code>
argument can have UNI_DISPLAY_ISPRINT set to display
isPRINT()able characters as themselves, UNI_DISPLAY_BACKSLASH
to display the \\[nrfta\\] as the backslashed versions (like '\n')
(UNI_DISPLAY_BACKSLASH is preferred over UNI_DISPLAY_ISPRINT for \\).
UNI_DISPLAY_QQ (and its alias UNI_DISPLAY_REGEX) have both
UNI_DISPLAY_BACKSLASH and UNI_DISPLAY_ISPRINT turned on.</p>
<p>The pointer to the PV of the <code class="inline"><span class="w">dsv</span></code>
is returned.</p>
<p>See also <a href="#sv_uni_display">sv_uni_display</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">pv_uni_display</span><span class="s">(</span><span class="w">SV</span> *<span class="w">dsv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">U8</span> *<span class="w">spv</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">pvlim</span><span class="cm">,</span></li><li> <span class="w">UV</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_cat_decode"></a><b>sv_cat_decode
</b>
<p>The encoding is assumed to be an Encode object, the PV of the ssv is
assumed to be octets in that encoding and decoding the input starts
from the position which (PV + *offset) pointed to. The dsv will be
concatenated the decoded UTF-8 string from ssv. Decoding will terminate
when the string tstr appears in decoding output or the input ends on
the PV of the ssv. The value which the offset points will be modified
to the last input position on the ssv.</p>
<p>Returns TRUE if the terminator was found, else returns FALSE.</p>
<pre class="verbatim"><ol><li> <span class="w">bool</span> <span class="i">sv_cat_decode</span><span class="s">(</span><span class="w">SV</span>* <span class="w">dsv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">encoding</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">ssv</span><span class="cm">,</span></li><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">*offset</span><span class="cm">,</span> <span class="w">char</span>* <span class="w">tstr</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">tlen</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_recode_to_utf8"></a><b>sv_recode_to_utf8
</b>
<p>The encoding is assumed to be an Encode object, on entry the PV
of the sv is assumed to be octets in that encoding, and the sv
will be converted into Unicode (and UTF-8).</p>
<p>If the sv already is UTF-8 (or if it is not POK), or if the encoding
is not a reference, nothing is done to the sv. If the encoding is not
an <code class="inline"><span class="w">Encode::XS</span></code>
Encoding object, bad things will happen.
(See <i>lib/encoding.pm</i> and <a href="Encode.html">Encode</a>.)</p>
<p>The PV of the sv is returned.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_recode_to_utf8</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">encoding</span><span class="s">)</span></li></ol></pre></li>
<li><a name="sv_uni_display"></a><b>sv_uni_display
</b>
<p>Build to the scalar <code class="inline"><span class="w">dsv</span></code>
a displayable version of the scalar <code class="inline"><span class="w">sv</span></code>
,
the displayable version being at most <code class="inline"><span class="w">pvlim</span></code>
bytes long
(if longer, the rest is truncated and "..." will be appended).</p>
<p>The <code class="inline"><span class="w">flags</span></code>
argument is as in <a href="#pv_uni_display">pv_uni_display</a>().</p>
<p>The pointer to the PV of the <code class="inline"><span class="w">dsv</span></code>
is returned.</p>
<pre class="verbatim"><ol><li> <span class="w">char</span>* <span class="i">sv_uni_display</span><span class="s">(</span><span class="w">SV</span> *<span class="w">dsv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">ssv</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">pvlim</span><span class="cm">,</span></li><li> <span class="w">UV</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="to_utf8_case"></a><b>to_utf8_case
</b>
<p><code class="inline"><span class="w">p</span></code>
contains the pointer to the UTF-8 string encoding
the character that is being converted. This routine assumes that the character
at <code class="inline"><span class="w">p</span></code>
is well-formed.</p>
<p><code class="inline"><span class="w">ustrp</span></code>
is a pointer to the character buffer to put the
conversion result to. <code class="inline"><span class="w">lenp</span></code>
is a pointer to the length
of the result.</p>
<p><code class="inline"><span class="w">swashp</span></code>
is a pointer to the swash to use.</p>
<p>Both the special and normal mappings are stored in <i>lib/unicore/To/Foo.pl</i>,
and loaded by SWASHNEW, using <i>lib/utf8_heavy.pl</i>. <code class="inline"><span class="w">special</span></code>
(usually,
but not always, a multicharacter mapping), is tried first.</p>
<p><code class="inline"><span class="w">special</span></code>
is a string, normally <code class="inline"><span class="w">NULL</span></code>
or <code class="inline"><span class="q">""</span></code>
. <code class="inline"><span class="w">NULL</span></code>
means to not use
any special mappings; <code class="inline"><span class="q">""</span></code>
means to use the special mappings. Values other
than these two are treated as the name of the hash containing the special
mappings, like <code class="inline"><span class="q">"utf8::ToSpecLower"</span></code>
.</p>
<p><code class="inline"><span class="w">normal</span></code>
is a string like "ToLower" which means the swash
%utf8::ToLower.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">to_utf8_case</span><span class="s">(</span><span class="w">const</span> <span class="w">U8</span> *<span class="w">p</span><span class="cm">,</span> <span class="w">U8</span>* <span class="w">ustrp</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> *<span class="w">lenp</span><span class="cm">,</span> <span class="w">SV</span> **<span class="w">swashp</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">normal</span><span class="cm">,</span></li><li> <span class="w">const</span> <span class="w">char</span> *<span class="w">special</span><span class="s">)</span></li></ol></pre></li>
<li><a name="to_utf8_fold"></a><b>to_utf8_fold
</b>
<p>Instead use <a href="#toFOLD_utf8">toFOLD_utf8</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">to_utf8_fold</span><span class="s">(</span><span class="w">const</span> <span class="w">U8</span> *<span class="w">p</span><span class="cm">,</span> <span class="w">U8</span>* <span class="w">ustrp</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> *<span class="w">lenp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="to_utf8_lower"></a><b>to_utf8_lower
</b>
<p>Instead use <a href="#toLOWER_utf8">toLOWER_utf8</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">to_utf8_lower</span><span class="s">(</span><span class="w">const</span> <span class="w">U8</span> *<span class="w">p</span><span class="cm">,</span> <span class="w">U8</span>* <span class="w">ustrp</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> *<span class="w">lenp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="to_utf8_title"></a><b>to_utf8_title
</b>
<p>Instead use <a href="#toTITLE_utf8">toTITLE_utf8</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">to_utf8_title</span><span class="s">(</span><span class="w">const</span> <span class="w">U8</span> *<span class="w">p</span><span class="cm">,</span> <span class="w">U8</span>* <span class="w">ustrp</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> *<span class="w">lenp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="to_utf8_upper"></a><b>to_utf8_upper
</b>
<p>Instead use <a href="#toUPPER_utf8">toUPPER_utf8</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">to_utf8_upper</span><span class="s">(</span><span class="w">const</span> <span class="w">U8</span> *<span class="w">p</span><span class="cm">,</span> <span class="w">U8</span>* <span class="w">ustrp</span><span class="cm">,</span></li><li> <span class="w">STRLEN</span> *<span class="w">lenp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="utf8n_to_uvchr"></a><b>utf8n_to_uvchr
</b>
<p>THIS FUNCTION SHOULD BE USED IN ONLY VERY SPECIALIZED CIRCUMSTANCES.
Most code should use <a href="#utf8_to_uvchr_buf">utf8_to_uvchr_buf</a>() rather than call this directly.</p>
<p>Bottom level UTF-8 decode routine.
Returns the native code point value of the first character in the string <code class="inline"><a class="l_k" href="functions/s.html">s</a></code>,
which is assumed to be in UTF-8 (or UTF-EBCDIC) encoding, and no longer than
<code class="inline"><span class="w">curlen</span></code>
bytes; <code class="inline"><span class="i">*retlen</span></code>
(if <code class="inline"><span class="w">retlen</span></code>
isn't NULL) will be set to
the length, in bytes, of that character.</p>
<p>The value of <code class="inline"><span class="w">flags</span></code>
determines the behavior when <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> does not point to a
well-formed UTF-8 character. If <code class="inline"><span class="w">flags</span></code>
is 0, when a malformation is found,
zero is returned and <code class="inline"><span class="i">*retlen</span></code>
is set so that (<code class="inline"><a class="l_k" href="functions/s.html">s</a></code> + <code class="inline"><span class="i">*retlen</span></code>
) is the
next possible position in <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> that could begin a non-malformed character.
Also, if UTF-8 warnings haven't been lexically disabled, a warning is raised.</p>
<p>Various ALLOW flags can be set in <code class="inline"><span class="w">flags</span></code>
to allow (and not warn on)
individual types of malformations, such as the sequence being overlong (that
is, when there is a shorter sequence that can express the same code point;
overlong sequences are expressly forbidden in the UTF-8 standard due to
potential security issues). Another malformation example is the first byte of
a character not being a legal first byte. See <i>utf8.h</i> for the list of such
flags. For allowed 0 length strings, this function returns 0; for allowed
overlong sequences, the computed code point is returned; for all other allowed
malformations, the Unicode REPLACEMENT CHARACTER is returned, as these have no
determinable reasonable value.</p>
<p>The UTF8_CHECK_ONLY flag overrides the behavior when a non-allowed (by other
flags) malformation is found. If this flag is set, the routine assumes that
the caller will raise a warning, and this function will silently just set
<code class="inline"><span class="w">retlen</span></code>
to <code class="inline"><span class="n">-1</span></code>
(cast to <code class="inline"><span class="w">STRLEN</span></code>
) and return zero.</p>
<p>Note that this API requires disambiguation between successful decoding a <code class="inline"><span class="w">NUL</span></code>
character, and an error return (unless the UTF8_CHECK_ONLY flag is set), as
in both cases, 0 is returned. To disambiguate, upon a zero return, see if the
first byte of <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> is 0 as well. If so, the input was a <code class="inline"><span class="w">NUL</span></code>
; if not, the
input had an error.</p>
<p>Certain code points are considered problematic. These are Unicode surrogates,
Unicode non-characters, and code points above the Unicode maximum of 0x10FFFF.
By default these are considered regular code points, but certain situations
warrant special handling for them. If <code class="inline"><span class="w">flags</span></code>
contains
UTF8_DISALLOW_ILLEGAL_INTERCHANGE, all three classes are treated as
malformations and handled as such. The flags UTF8_DISALLOW_SURROGATE,
UTF8_DISALLOW_NONCHAR, and UTF8_DISALLOW_SUPER (meaning above the legal Unicode
maximum) can be set to disallow these categories individually.</p>
<p>The flags UTF8_WARN_ILLEGAL_INTERCHANGE, UTF8_WARN_SURROGATE,
UTF8_WARN_NONCHAR, and UTF8_WARN_SUPER will cause warning messages to be raised
for their respective categories, but otherwise the code points are considered
valid (not malformations). To get a category to both be treated as a
malformation and raise a warning, specify both the WARN and DISALLOW flags.
(But note that warnings are not raised if lexically disabled nor if
UTF8_CHECK_ONLY is also specified.)</p>
<p>Very large code points (above 0x7FFF_FFFF) are considered more problematic than
the others that are above the Unicode legal maximum. There are several
reasons: they requre at least 32 bits to represent them on ASCII platforms, are
not representable at all on EBCDIC platforms, and the original UTF-8
specification never went above this number (the current 0x10FFFF limit was
imposed later). (The smaller ones, those that fit into 32 bits, are
representable by a UV on ASCII platforms, but not by an IV, which means that
the number of operations that can be performed on them is quite restricted.)
The UTF-8 encoding on ASCII platforms for these large code points begins with a
byte containing 0xFE or 0xFF. The UTF8_DISALLOW_FE_FF flag will cause them to
be treated as malformations, while allowing smaller above-Unicode code points.
(Of course UTF8_DISALLOW_SUPER will treat all above-Unicode code points,
including these, as malformations.)
Similarly, UTF8_WARN_FE_FF acts just like
the other WARN flags, but applies just to these code points.</p>
<p>All other code points corresponding to Unicode characters, including private
use and those yet to be assigned, are never considered malformed and never
warn.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">utf8n_to_uvchr</span><span class="s">(</span><span class="w">const</span> <span class="w">U8</span> *<span class="q">s, STRLEN curlen,</span></li><li> <span class="q"> STRLEN *retlen,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="utf8n_to_uvuni"></a><b>utf8n_to_uvuni
</b>
<p>Instead use <a href="#utf8_to_uvchr_buf">utf8_to_uvchr_buf</a>, or rarely, <a href="#utf8n_to_uvchr">utf8n_to_uvchr</a>.</p>
<p>This function was useful for code that wanted to handle both EBCDIC and
ASCII platforms with Unicode properties, but starting in Perl v5.20, the
distinctions between the platforms have mostly been made invisible to most
code, so this function is quite unlikely to be what you want. If you do need
this precise functionality, use instead
<code class="inline"><a href="#utf8_to_uvchr_buf">NATIVE_TO_UNI(utf8_to_uvchr_buf(...))</a></code>
or <code class="inline"><a href="#utf8n_to_uvchr">NATIVE_TO_UNI(utf8n_to_uvchr(...))</a></code>.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">utf8n_to_uvuni</span><span class="s">(</span><span class="w">const</span> <span class="w">U8</span> *<span class="q">s, STRLEN curlen,</span></li><li> <span class="q"> STRLEN *retlen,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="UTF8SKIP"></a><b>UTF8SKIP
</b>
<p>returns the number of bytes in the UTF-8 encoded character whose first (perhaps
only) byte is pointed to by <code class="inline"><a class="l_k" href="functions/s.html">s</a></code>.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">UTF8SKIP</span><span class="s">(</span><span class="w">char</span>* <span class="q">s)</span></li></ol></pre></li>
<li><a name="utf8_distance"></a><b>utf8_distance
</b>
<p>Returns the number of UTF-8 characters between the UTF-8 pointers <code class="inline"><span class="w">a</span></code>
and <code class="inline"><span class="w">b</span></code>
.</p>
<p>WARNING: use only if you *know* that the pointers point inside the
same UTF-8 buffer.</p>
<pre class="verbatim"><ol><li> <span class="w">IV</span> <span class="i">utf8_distance</span><span class="s">(</span><span class="w">const</span> <span class="w">U8</span> *<span class="w">a</span><span class="cm">,</span> <span class="w">const</span> <span class="w">U8</span> *<span class="w">b</span><span class="s">)</span></li></ol></pre></li>
<li><a name="utf8_hop"></a><b>utf8_hop
</b>
<p>Return the UTF-8 pointer <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> displaced by <code class="inline"><span class="w">off</span></code>
characters, either
forward or backward.</p>
<p>WARNING: do not use the following unless you *know* <code class="inline"><span class="w">off</span></code>
is within
the UTF-8 data pointed to by <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> *and* that on entry <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> is aligned
on the first byte of character or just after the last byte of a character.</p>
<pre class="verbatim"><ol><li> U8* utf8_hop(const U8 *s, I32 off)</li></ol></pre></li>
<li><a name="utf8_length"></a><b>utf8_length
</b>
<p>Return the length of the UTF-8 char encoded string <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> in characters.
Stops at <code class="inline"><span class="w">e</span></code>
(inclusive). If <code class="inline">e < s</code> or if the scan would end
up past <code class="inline"><span class="w">e</span></code>
, croaks.</p>
<pre class="verbatim"><ol><li> STRLEN utf8_length(const U8* s, const U8 *e)</li></ol></pre></li>
<li><a name="utf8_to_bytes"></a><b>utf8_to_bytes
</b>
<p>NOTE: this function is experimental and may change or be
removed without notice.</p>
<p>Converts a string <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> of length <code class="inline"><span class="w">len</span></code>
from UTF-8 into native byte encoding.
Unlike <a href="#bytes_to_utf8">bytes_to_utf8</a>, this over-writes the original string, and
updates <code class="inline"><span class="w">len</span></code>
to contain the new length.
Returns zero on failure, setting <code class="inline"><span class="w">len</span></code>
to -1.</p>
<p>If you need a copy of the string, see <a href="#bytes_from_utf8">bytes_from_utf8</a>.</p>
<pre class="verbatim"><ol><li> U8* utf8_to_bytes(U8 *s, STRLEN *len)</li></ol></pre></li>
<li><a name="utf8_to_uvchr_buf"></a><b>utf8_to_uvchr_buf
</b>
<p>Returns the native code point of the first character in the string <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> which
is assumed to be in UTF-8 encoding; <code class="inline"><a class="l_k" href="functions/send.html">send</a></code> points to 1 beyond the end of <code class="inline"><a class="l_k" href="functions/s.html">s</a></code>.
<code class="inline"><span class="i">*retlen</span></code>
will be set to the length, in bytes, of that character.</p>
<p>If <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> does not point to a well-formed UTF-8 character and UTF8 warnings are
enabled, zero is returned and <code class="inline"><span class="i">*retlen</span></code>
is set (if <code class="inline"><span class="w">retlen</span></code>
isn't
NULL) to -1. If those warnings are off, the computed value, if well-defined
(or the Unicode REPLACEMENT CHARACTER if not), is silently returned, and
<code class="inline"><span class="i">*retlen</span></code>
is set (if <code class="inline"><span class="w">retlen</span></code>
isn't NULL) so that (<code class="inline"><a class="l_k" href="functions/s.html">s</a></code> + <code class="inline"><span class="i">*retlen</span></code>
) is
the next possible position in <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> that could begin a non-malformed character.
See <a href="#utf8n_to_uvchr">utf8n_to_uvchr</a> for details on when the REPLACEMENT CHARACTER is
returned.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">utf8_to_uvchr_buf</span><span class="s">(</span><span class="w">const</span> <span class="w">U8</span> *<span class="q">s, const U8 *send,</span></li><li> <span class="q"> STRLEN *retlen)</span></li></ol></pre></li>
<li><a name="utf8_to_uvuni_buf"></a><b>utf8_to_uvuni_buf
</b>
<p>DEPRECATED! It is planned to remove this function from a
future release of Perl. Do not use it for new code; remove it from
existing code.</p>
<p>Only in very rare circumstances should code need to be dealing in Unicode
(as opposed to native) code points. In those few cases, use
<code class="inline"><a href="#utf8_to_uvchr_buf">NATIVE_TO_UNI(utf8_to_uvchr_buf(...))</a></code> instead.</p>
<p>Returns the Unicode (not-native) code point of the first character in the
string <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> which
is assumed to be in UTF-8 encoding; <code class="inline"><a class="l_k" href="functions/send.html">send</a></code> points to 1 beyond the end of <code class="inline"><a class="l_k" href="functions/s.html">s</a></code>.
<code class="inline"><span class="w">retlen</span></code>
will be set to the length, in bytes, of that character.</p>
<p>If <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> does not point to a well-formed UTF-8 character and UTF8 warnings are
enabled, zero is returned and <code class="inline"><span class="i">*retlen</span></code>
is set (if <code class="inline"><span class="w">retlen</span></code>
isn't
NULL) to -1. If those warnings are off, the computed value if well-defined (or
the Unicode REPLACEMENT CHARACTER, if not) is silently returned, and <code class="inline"><span class="i">*retlen</span></code>
is set (if <code class="inline"><span class="w">retlen</span></code>
isn't NULL) so that (<code class="inline"><a class="l_k" href="functions/s.html">s</a></code> + <code class="inline"><span class="i">*retlen</span></code>
) is the
next possible position in <code class="inline"><a class="l_k" href="functions/s.html">s</a></code> that could begin a non-malformed character.
See <a href="#utf8n_to_uvchr">utf8n_to_uvchr</a> for details on when the REPLACEMENT CHARACTER is returned.</p>
<pre class="verbatim"><ol><li> <span class="w">UV</span> <span class="i">utf8_to_uvuni_buf</span><span class="s">(</span><span class="w">const</span> <span class="w">U8</span> *<span class="q">s, const U8 *send,</span></li><li> <span class="q"> STRLEN *retlen)</span></li></ol></pre></li>
<li><a name="UVCHR_SKIP"></a><b>UVCHR_SKIP
</b>
<p>returns the number of bytes required to represent the code point <code class="inline"><span class="w">cp</span></code>
when
encoded as UTF-8. <code class="inline"><span class="w">cp</span></code>
is a native (ASCII or EBCDIC) code point if less than
255; a Unicode code point otherwise.</p>
<pre class="verbatim"><ol><li> <span class="w">STRLEN</span> <span class="i">UVCHR_SKIP</span><span class="s">(</span><span class="w">UV</span> <span class="w">cp</span><span class="s">)</span></li></ol></pre></li>
<li><a name="uvchr_to_utf8"></a><b>uvchr_to_utf8
</b>
<p>Adds the UTF-8 representation of the native code point <code class="inline"><span class="w">uv</span></code>
to the end
of the string <code class="inline"><span class="w">d</span></code>
; <code class="inline"><span class="w">d</span></code>
should have at least <code class="inline"><span class="i">UVCHR_SKIP</span><span class="s">(</span><span class="w">uv</span><span class="s">)</span>+<span class="n">1</span></code>
(up to
<code class="inline"><span class="w">UTF8_MAXBYTES</span>+<span class="n">1</span></code>
) free bytes available. The return value is the pointer to
the byte after the end of the new character. In other words,</p>
<pre class="verbatim"><ol><li> <span class="w">d</span> = <span class="i">uvchr_to_utf8</span><span class="s">(</span><span class="w">d</span><span class="cm">,</span> <span class="w">uv</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>is the recommended wide native character-aware way of saying</p>
<pre class="verbatim"><ol><li> *(d++) = uv;</li></ol></pre><p>This function accepts any UV as input. To forbid or warn on non-Unicode code
points, or those that may be problematic, see <a href="#uvchr_to_utf8_flags">uvchr_to_utf8_flags</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">U8</span>* <span class="i">uvchr_to_utf8</span><span class="s">(</span><span class="w">U8</span> *<span class="w">d</span><span class="cm">,</span> <span class="w">UV</span> <span class="w">uv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="uvchr_to_utf8_flags"></a><b>uvchr_to_utf8_flags
</b>
<p>Adds the UTF-8 representation of the native code point <code class="inline"><span class="w">uv</span></code>
to the end
of the string <code class="inline"><span class="w">d</span></code>
; <code class="inline"><span class="w">d</span></code>
should have at least <code class="inline"><span class="i">UVCHR_SKIP</span><span class="s">(</span><span class="w">uv</span><span class="s">)</span>+<span class="n">1</span></code>
(up to
<code class="inline"><span class="w">UTF8_MAXBYTES</span>+<span class="n">1</span></code>
) free bytes available. The return value is the pointer to
the byte after the end of the new character. In other words,</p>
<pre class="verbatim"><ol><li> <span class="w">d</span> = <span class="i">uvchr_to_utf8_flags</span><span class="s">(</span><span class="w">d</span><span class="cm">,</span> <span class="w">uv</span><span class="cm">,</span> <span class="w">flags</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>or, in most cases,</p>
<pre class="verbatim"><ol><li> <span class="w">d</span> = <span class="i">uvchr_to_utf8_flags</span><span class="s">(</span><span class="w">d</span><span class="cm">,</span> <span class="w">uv</span><span class="cm">,</span> <span class="n">0</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>This is the Unicode-aware way of saying</p>
<pre class="verbatim"><ol><li> *(d++) = uv;</li></ol></pre><p>This function will convert to UTF-8 (and not warn) even code points that aren't
legal Unicode or are problematic, unless <code class="inline"><span class="w">flags</span></code>
contains one or more of the
following flags:</p>
<p>If <code class="inline"><span class="w">uv</span></code>
is a Unicode surrogate code point and UNICODE_WARN_SURROGATE is set,
the function will raise a warning, provided UTF8 warnings are enabled. If instead
UNICODE_DISALLOW_SURROGATE is set, the function will fail and return NULL.
If both flags are set, the function will both warn and return NULL.</p>
<p>The UNICODE_WARN_NONCHAR and UNICODE_DISALLOW_NONCHAR flags
affect how the function handles a Unicode non-character. And likewise, the
UNICODE_WARN_SUPER and UNICODE_DISALLOW_SUPER flags affect the handling of
code points that are
above the Unicode maximum of 0x10FFFF. Code points above 0x7FFF_FFFF (which are
even less portable) can be warned and/or disallowed even if other above-Unicode
code points are accepted, by the UNICODE_WARN_FE_FF and UNICODE_DISALLOW_FE_FF
flags.</p>
<p>And finally, the flag UNICODE_WARN_ILLEGAL_INTERCHANGE selects all four of the
above WARN flags; and UNICODE_DISALLOW_ILLEGAL_INTERCHANGE selects all four
DISALLOW flags.</p>
<pre class="verbatim"><ol><li> <span class="w">U8</span>* <span class="i">uvchr_to_utf8_flags</span><span class="s">(</span><span class="w">U8</span> *<span class="w">d</span><span class="cm">,</span> <span class="w">UV</span> <span class="w">uv</span><span class="cm">,</span> <span class="w">UV</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="uvoffuni_to_utf8_flags"></a><b>uvoffuni_to_utf8_flags
</b>
<p>THIS FUNCTION SHOULD BE USED IN ONLY VERY SPECIALIZED CIRCUMSTANCES.
Instead, <b>Almost all code should use <a href="#uvchr_to_utf8">uvchr_to_utf8</a> or
<a href="#uvchr_to_utf8_flags">uvchr_to_utf8_flags</a></b>.</p>
<p>This function is like them, but the input is a strict Unicode
(as opposed to native) code point. Only in very rare circumstances should code
not be using the native code point.</p>
<p>For details, see the description for <a href="#uvchr_to_utf8_flags">uvchr_to_utf8_flags</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">U8</span>* <span class="i">uvoffuni_to_utf8_flags</span><span class="s">(</span><span class="w">U8</span> *<span class="w">d</span><span class="cm">,</span> <span class="w">UV</span> <span class="w">uv</span><span class="cm">,</span> <span class="w">UV</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
<li><a name="uvuni_to_utf8_flags"></a><b>uvuni_to_utf8_flags
</b>
<p>Instead you almost certainly want to use <a href="#uvchr_to_utf8">uvchr_to_utf8</a> or
<a href="#uvchr_to_utf8_flags">uvchr_to_utf8_flags</a>.</p>
<p>This function is a deprecated synonym for <a href="#uvoffuni_to_utf8_flags">uvoffuni_to_utf8_flags</a>,
which itself, while not deprecated, should be used only in isolated
circumstances. These functions were useful for code that wanted to handle
both EBCDIC and ASCII platforms with Unicode properties, but starting in Perl
v5.20, the distinctions between the platforms have mostly been made invisible
to most code, so this function is quite unlikely to be what you want.</p>
<pre class="verbatim"><ol><li> <span class="w">U8</span>* <span class="i">uvuni_to_utf8_flags</span><span class="s">(</span><span class="w">U8</span> *<span class="w">d</span><span class="cm">,</span> <span class="w">UV</span> <span class="w">uv</span><span class="cm">,</span> <span class="w">UV</span> <span class="w">flags</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Variables-created-by-xsubpp-and-xsubpp-internal-functions"></a><h1>Variables created by <code class="inline"><span class="w">xsubpp</span></code>
and <code class="inline"><span class="w">xsubpp</span></code>
internal functions</h1>
<ul>
<li><a name="newXSproto"></a><b>newXSproto
</b>
<p>Used by <code class="inline"><span class="w">xsubpp</span></code>
to hook up XSUBs as Perl subs. Adds Perl prototypes to
the subs.</p>
</li>
<li><a name="XS_APIVERSION_BOOTCHECK"></a><b>XS_APIVERSION_BOOTCHECK
</b>
<p>Macro to verify that the perl api version an XS module has been compiled against
matches the api version of the perl interpreter it's being loaded into.</p>
<pre class="verbatim"><ol><li> <span class="w">XS_APIVERSION_BOOTCHECK</span><span class="sc">;</span></li></ol></pre></li>
<li><a name="XS_VERSION"></a><b>XS_VERSION
</b>
<p>The version identifier for an XS module. This is usually
handled automatically by <code class="inline"><span class="w">ExtUtils::MakeMaker</span></code>
. See <code class="inline"><span class="w">XS_VERSION_BOOTCHECK</span></code>
.</p>
</li>
<li><a name="XS_VERSION_BOOTCHECK"></a><b>XS_VERSION_BOOTCHECK
</b>
<p>Macro to verify that a PM module's $VERSION variable matches the XS
module's <code class="inline"><span class="w">XS_VERSION</span></code>
variable. This is usually handled automatically by
<code class="inline"><span class="w">xsubpp</span></code>
. See <a href="perlxs.html#The-VERSIONCHECK%3a-Keyword">The VERSIONCHECK: Keyword in perlxs</a>.</p>
<pre class="verbatim"><ol><li> <span class="w">XS_VERSION_BOOTCHECK</span><span class="sc">;</span></li></ol></pre></li>
</ul>
<a name="Versioning"></a><h1>Versioning</h1>
<ul>
<li><a name="new_version"></a><b>new_version
</b>
<p>Returns a new version object based on the passed in SV:</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> *<span class="w">sv</span> = <span class="i">new_version</span><span class="s">(</span><span class="w">SV</span> *<span class="w">ver</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>Does not alter the passed in ver SV. See "upg_version" if you
want to upgrade the SV.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">new_version</span><span class="s">(</span><span class="w">SV</span> *<span class="w">ver</span><span class="s">)</span></li></ol></pre></li>
<li><a name="prescan_version"></a><b>prescan_version
</b>
<p>Validate that a given string can be parsed as a version object, but doesn't
actually perform the parsing. Can use either strict or lax validation rules.
Can optionally set a number of hint variables to save the parsing code
some time when tokenizing.</p>
<pre class="verbatim"><ol><li> <span class="w">const</span> <span class="w">char</span>* <span class="i">prescan_version</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="q">s, bool strict,</span></li><li> <span class="q"> const char** errstr,</span></li><li> <span class="w">bool</span> *<span class="w">sqv</span><span class="cm">,</span></li><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">*ssaw_decimal</span><span class="cm">,</span></li><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">*swidth</span><span class="cm">,</span> <span class="w">bool</span> *<span class="w">salpha</span><span class="s">)</span></li></ol></pre></li>
<li><a name="scan_version"></a><b>scan_version
</b>
<p>Returns a pointer to the next character after the parsed
version string, as well as upgrading the passed in SV to
an RV.</p>
<p>Function must be called with an already existing SV like</p>
<pre class="verbatim"><ol><li> sv = newSV(0);</li><li> s = scan_version(s, SV *sv, bool qv);</li></ol></pre><p>Performs some preprocessing to the string to ensure that
it has the correct characteristics of a version. Flags the
object if it contains an underscore (which denotes this
is an alpha version). The boolean qv denotes that the version
should be interpreted as if it had multiple decimals, even if
it doesn't.</p>
<pre class="verbatim"><ol><li> <span class="w">const</span> <span class="w">char</span>* <span class="i">scan_version</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="q">s, SV *rv, bool qv)</span></li></ol></pre></li>
<li><a name="upg_version"></a><b>upg_version
</b>
<p>In-place upgrade of the supplied SV to a version object.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> *<span class="w">sv</span> = <span class="i">upg_version</span><span class="s">(</span><span class="w">SV</span> *<span class="w">sv</span><span class="cm">,</span> <span class="w">bool</span> <span class="w">qv</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>Returns a pointer to the upgraded SV. Set the boolean qv if you want
to force this SV to be interpreted as an "extended" version.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">upg_version</span><span class="s">(</span><span class="w">SV</span> *<span class="w">ver</span><span class="cm">,</span> <span class="w">bool</span> <span class="w">qv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="vcmp"></a><b>vcmp
</b>
<p>Version object aware cmp. Both operands must already have been
converted into version objects.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/int.html">int</a> <span class="i">vcmp</span><span class="s">(</span><span class="w">SV</span> *<span class="w">lhv</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">rhv</span><span class="s">)</span></li></ol></pre></li>
<li><a name="vnormal"></a><b>vnormal
</b>
<p>Accepts a version object and returns the normalized string
representation. Call like:</p>
<pre class="verbatim"><ol><li> <span class="w">sv</span> = <span class="i">vnormal</span><span class="s">(</span><span class="w">rv</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>NOTE: you can pass either the object directly or the SV
contained within the RV.</p>
<p>The SV returned has a refcount of 1.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">vnormal</span><span class="s">(</span><span class="w">SV</span> *<span class="w">vs</span><span class="s">)</span></li></ol></pre></li>
<li><a name="vnumify"></a><b>vnumify
</b>
<p>Accepts a version object and returns the normalized floating
point representation. Call like:</p>
<pre class="verbatim"><ol><li> <span class="w">sv</span> = <span class="i">vnumify</span><span class="s">(</span><span class="w">rv</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>NOTE: you can pass either the object directly or the SV
contained within the RV.</p>
<p>The SV returned has a refcount of 1.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">vnumify</span><span class="s">(</span><span class="w">SV</span> *<span class="w">vs</span><span class="s">)</span></li></ol></pre></li>
<li><a name="vstringify"></a><b>vstringify
</b>
<p>In order to maintain maximum compatibility with earlier versions
of Perl, this function will return either the floating point
notation or the multiple dotted notation, depending on whether
the original version contained 1 or more dots, respectively.</p>
<p>The SV returned has a refcount of 1.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">vstringify</span><span class="s">(</span><span class="w">SV</span> *<span class="w">vs</span><span class="s">)</span></li></ol></pre></li>
<li><a name="vverify"></a><b>vverify
</b>
<p>Validates that the SV contains valid internal structure for a version object.
It may be passed either the version object (RV) or the hash itself (HV). If
the structure is valid, it returns the HV. If the structure is invalid,
it returns NULL.</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span> *<span class="w">hv</span> = <span class="i">vverify</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>Note that it only confirms the bare minimum structure (so as not to get
confused by derived classes which may contain additional hash entries):</p>
<pre class="verbatim"><ol><li> <span class="w">SV</span>* <span class="i">vverify</span><span class="s">(</span><span class="w">SV</span> *<span class="w">vs</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Warning-and-Dieing"></a><h1>Warning and Dieing</h1>
<ul>
<li><a name="croak"></a><b>croak
</b>
<p>This is an XS interface to Perl's <code class="inline"><a class="l_k" href="functions/die.html">die</a></code> function.</p>
<p>Take a sprintf-style format pattern and argument list. These are used to
generate a string message. If the message does not end with a newline,
then it will be extended with some indication of the current location
in the code, as described for <a href="#mess_sv">mess_sv</a>.</p>
<p>The error message will be used as an exception, by default
returning control to the nearest enclosing <code class="inline"><a class="l_k" href="functions/eval.html">eval</a></code>, but subject to
modification by a <code class="inline"><span class="i">$SIG</span>{<span class="w">__DIE__</span>}</code>
handler. In any case, the <code class="inline"><span class="w">croak</span></code>
function never returns normally.</p>
<p>For historical reasons, if <code class="inline"><span class="w">pat</span></code>
is null then the contents of <code class="inline"><span class="w">ERRSV</span></code>
(<code class="inline"><span class="i">$@</span></code>
) will be used as an error message or object instead of building an
error message from arguments. If you want to throw a non-string object,
or build an error message in an SV yourself, it is preferable to use
the <a href="#croak_sv">croak_sv</a> function, which does not involve clobbering <code class="inline"><span class="w">ERRSV</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">croak</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">pat</span><span class="cm">,</span> ...<span class="s">)</span></li></ol></pre></li>
<li><a name="croak_no_modify"></a><b>croak_no_modify
</b>
<p>Exactly equivalent to <code class="inline"><span class="i">Perl_croak</span><span class="s">(</span><span class="w">aTHX_</span> <span class="q">"%s"</span><span class="cm">,</span> <span class="w">PL_no_modify</span><span class="s">)</span></code>
, but generates
terser object code than using <code class="inline"><span class="w">Perl_croak</span></code>
. Less code used on exception code
paths reduces CPU cache pressure.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">croak_no_modify</span><span class="s">(</span><span class="s">)</span></li></ol></pre></li>
<li><a name="croak_sv"></a><b>croak_sv
</b>
<p>This is an XS interface to Perl's <code class="inline"><a class="l_k" href="functions/die.html">die</a></code> function.</p>
<p><code class="inline"><span class="w">baseex</span></code>
is the error message or object. If it is a reference, it
will be used as-is. Otherwise it is used as a string, and if it does
not end with a newline then it will be extended with some indication of
the current location in the code, as described for <a href="#mess_sv">mess_sv</a>.</p>
<p>The error message or object will be used as an exception, by default
returning control to the nearest enclosing <code class="inline"><a class="l_k" href="functions/eval.html">eval</a></code>, but subject to
modification by a <code class="inline"><span class="i">$SIG</span>{<span class="w">__DIE__</span>}</code>
handler. In any case, the <code class="inline"><span class="w">croak_sv</span></code>
function never returns normally.</p>
<p>To die with a simple string message, the <a href="#croak">croak</a> function may be
more convenient.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">croak_sv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">baseex</span><span class="s">)</span></li></ol></pre></li>
<li><a name="die"></a><b>die
</b>
<p>Behaves the same as <a href="#croak">croak</a>, except for the return type.
It should be used only where the <code class="inline"><span class="w">OP</span> *</code>
return type is required.
The function never actually returns.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <a class="l_k" href="functions/die.html">die</a><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">pat</span><span class="cm">,</span> ...<span class="s">)</span></li></ol></pre></li>
<li><a name="die_sv"></a><b>die_sv
</b>
<p>Behaves the same as <a href="#croak_sv">croak_sv</a>, except for the return type.
It should be used only where the <code class="inline"><span class="w">OP</span> *</code>
return type is required.
The function never actually returns.</p>
<pre class="verbatim"><ol><li> <span class="w">OP</span> * <span class="i">die_sv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">baseex</span><span class="s">)</span></li></ol></pre></li>
<li><a name="vcroak"></a><b>vcroak
</b>
<p>This is an XS interface to Perl's <code class="inline"><a class="l_k" href="functions/die.html">die</a></code> function.</p>
<p><code class="inline"><span class="w">pat</span></code>
and <code class="inline"><span class="w">args</span></code>
are a sprintf-style format pattern and encapsulated
argument list. These are used to generate a string message. If the
message does not end with a newline, then it will be extended with
some indication of the current location in the code, as described for
<a href="#mess_sv">mess_sv</a>.</p>
<p>The error message will be used as an exception, by default
returning control to the nearest enclosing <code class="inline"><a class="l_k" href="functions/eval.html">eval</a></code>, but subject to
modification by a <code class="inline"><span class="i">$SIG</span>{<span class="w">__DIE__</span>}</code>
handler. In any case, the <code class="inline"><span class="w">croak</span></code>
function never returns normally.</p>
<p>For historical reasons, if <code class="inline"><span class="w">pat</span></code>
is null then the contents of <code class="inline"><span class="w">ERRSV</span></code>
(<code class="inline"><span class="i">$@</span></code>
) will be used as an error message or object instead of building an
error message from arguments. If you want to throw a non-string object,
or build an error message in an SV yourself, it is preferable to use
the <a href="#croak_sv">croak_sv</a> function, which does not involve clobbering <code class="inline"><span class="w">ERRSV</span></code>
.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">vcroak</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">pat</span><span class="cm">,</span> <span class="w">va_list</span> *<span class="w">args</span><span class="s">)</span></li></ol></pre></li>
<li><a name="vwarn"></a><b>vwarn
</b>
<p>This is an XS interface to Perl's <code class="inline"><a class="l_k" href="functions/warn.html">warn</a></code> function.</p>
<p><code class="inline"><span class="w">pat</span></code>
and <code class="inline"><span class="w">args</span></code>
are a sprintf-style format pattern and encapsulated
argument list. These are used to generate a string message. If the
message does not end with a newline, then it will be extended with
some indication of the current location in the code, as described for
<a href="#mess_sv">mess_sv</a>.</p>
<p>The error message or object will by default be written to standard error,
but this is subject to modification by a <code class="inline"><span class="i">$SIG</span>{<span class="w">__WARN__</span>}</code>
handler.</p>
<p>Unlike with <a href="#vcroak">vcroak</a>, <code class="inline"><span class="w">pat</span></code>
is not permitted to be null.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">vwarn</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">pat</span><span class="cm">,</span> <span class="w">va_list</span> *<span class="w">args</span><span class="s">)</span></li></ol></pre></li>
<li><a name="warn"></a><b>warn
</b>
<p>This is an XS interface to Perl's <code class="inline"><a class="l_k" href="functions/warn.html">warn</a></code> function.</p>
<p>Take a sprintf-style format pattern and argument list. These are used to
generate a string message. If the message does not end with a newline,
then it will be extended with some indication of the current location
in the code, as described for <a href="#mess_sv">mess_sv</a>.</p>
<p>The error message or object will by default be written to standard error,
but this is subject to modification by a <code class="inline"><span class="i">$SIG</span>{<span class="w">__WARN__</span>}</code>
handler.</p>
<p>Unlike with <a href="#croak">croak</a>, <code class="inline"><span class="w">pat</span></code>
is not permitted to be null.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <a class="l_k" href="functions/warn.html">warn</a><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">pat</span><span class="cm">,</span> ...<span class="s">)</span></li></ol></pre></li>
<li><a name="warn_sv"></a><b>warn_sv
</b>
<p>This is an XS interface to Perl's <code class="inline"><a class="l_k" href="functions/warn.html">warn</a></code> function.</p>
<p><code class="inline"><span class="w">baseex</span></code>
is the error message or object. If it is a reference, it
will be used as-is. Otherwise it is used as a string, and if it does
not end with a newline then it will be extended with some indication of
the current location in the code, as described for <a href="#mess_sv">mess_sv</a>.</p>
<p>The error message or object will by default be written to standard error,
but this is subject to modification by a <code class="inline"><span class="i">$SIG</span>{<span class="w">__WARN__</span>}</code>
handler.</p>
<p>To warn with a simple string message, the <a href="#warn">warn</a> function may be
more convenient.</p>
<pre class="verbatim"><ol><li> <span class="w">void</span> <span class="i">warn_sv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">baseex</span><span class="s">)</span></li></ol></pre></li>
</ul>
<a name="Undocumented-functions"></a><h1>Undocumented functions</h1>
<p>The following functions have been flagged as part of the public API,
but are currently undocumented. Use them at your own risk, as the
interfaces are subject to change. Functions that are not listed in this
document are not intended for public use, and should NOT be used under any
circumstances.</p>
<p>If you use one of the undocumented functions below, you may wish to consider
creating and submitting documentation
for it. If your patch is accepted, this
will indicate that the interface is stable (unless it is explicitly marked
otherwise).</p>
<ul>
<li><a name="GetVars"></a><b>GetVars
</b>
</li>
<li><a name="Gv_AMupdate"></a><b>Gv_AMupdate
</b>
</li>
<li><a name="PerlIO_clearerr"></a><b>PerlIO_clearerr
</b>
</li>
<li><a name="PerlIO_close"></a><b>PerlIO_close
</b>
</li>
<li><a name="PerlIO_context_layers"></a><b>PerlIO_context_layers
</b>
</li>
<li><a name="PerlIO_eof"></a><b>PerlIO_eof
</b>
</li>
<li><a name="PerlIO_error"></a><b>PerlIO_error
</b>
</li>
<li><a name="PerlIO_fileno"></a><b>PerlIO_fileno
</b>
</li>
<li><a name="PerlIO_fill"></a><b>PerlIO_fill
</b>
</li>
<li><a name="PerlIO_flush"></a><b>PerlIO_flush
</b>
</li>
<li><a name="PerlIO_get_base"></a><b>PerlIO_get_base
</b>
</li>
<li><a name="PerlIO_get_bufsiz"></a><b>PerlIO_get_bufsiz
</b>
</li>
<li><a name="PerlIO_get_cnt"></a><b>PerlIO_get_cnt
</b>
</li>
<li><a name="PerlIO_get_ptr"></a><b>PerlIO_get_ptr
</b>
</li>
<li><a name="PerlIO_read"></a><b>PerlIO_read
</b>
</li>
<li><a name="PerlIO_seek"></a><b>PerlIO_seek
</b>
</li>
<li><a name="PerlIO_set_cnt"></a><b>PerlIO_set_cnt
</b>
</li>
<li><a name="PerlIO_set_ptrcnt"></a><b>PerlIO_set_ptrcnt
</b>
</li>
<li><a name="PerlIO_setlinebuf"></a><b>PerlIO_setlinebuf
</b>
</li>
<li><a name="PerlIO_stderr"></a><b>PerlIO_stderr
</b>
</li>
<li><a name="PerlIO_stdin"></a><b>PerlIO_stdin
</b>
</li>
<li><a name="PerlIO_stdout"></a><b>PerlIO_stdout
</b>
</li>
<li><a name="PerlIO_tell"></a><b>PerlIO_tell
</b>
</li>
<li><a name="PerlIO_unread"></a><b>PerlIO_unread
</b>
</li>
<li><a name="PerlIO_write"></a><b>PerlIO_write
</b>
</li>
<li><a name="amagic_call"></a><b>amagic_call
</b>
</li>
<li><a name="amagic_deref_call"></a><b>amagic_deref_call
</b>
</li>
<li><a name="any_dup"></a><b>any_dup
</b>
</li>
<li><a name="atfork_lock"></a><b>atfork_lock
</b>
</li>
<li><a name="atfork_unlock"></a><b>atfork_unlock
</b>
</li>
<li><a name="av_arylen_p"></a><b>av_arylen_p
</b>
</li>
<li><a name="av_iter_p"></a><b>av_iter_p
</b>
</li>
<li><a name="block_gimme"></a><b>block_gimme
</b>
</li>
<li><a name="call_atexit"></a><b>call_atexit
</b>
</li>
<li><a name="call_list"></a><b>call_list
</b>
</li>
<li><a name="calloc"></a><b>calloc
</b>
</li>
<li><a name="cast_i32"></a><b>cast_i32
</b>
</li>
<li><a name="cast_iv"></a><b>cast_iv
</b>
</li>
<li><a name="cast_ulong"></a><b>cast_ulong
</b>
</li>
<li><a name="cast_uv"></a><b>cast_uv
</b>
</li>
<li><a name="ck_warner"></a><b>ck_warner
</b>
</li>
<li><a name="ck_warner_d"></a><b>ck_warner_d
</b>
</li>
<li><a name="ckwarn"></a><b>ckwarn
</b>
</li>
<li><a name="ckwarn_d"></a><b>ckwarn_d
</b>
</li>
<li><a name="clone_params_del"></a><b>clone_params_del
</b>
</li>
<li><a name="clone_params_new"></a><b>clone_params_new
</b>
</li>
<li><a name="croak_memory_wrap"></a><b>croak_memory_wrap
</b>
</li>
<li><a name="croak_nocontext"></a><b>croak_nocontext
</b>
</li>
<li><a name="csighandler"></a><b>csighandler
</b>
</li>
<li><a name="cx_dump"></a><b>cx_dump
</b>
</li>
<li><a name="cx_dup"></a><b>cx_dup
</b>
</li>
<li><a name="cxinc"></a><b>cxinc
</b>
</li>
<li><a name="deb"></a><b>deb
</b>
</li>
<li><a name="deb_nocontext"></a><b>deb_nocontext
</b>
</li>
<li><a name="debop"></a><b>debop
</b>
</li>
<li><a name="debprofdump"></a><b>debprofdump
</b>
</li>
<li><a name="debstack"></a><b>debstack
</b>
</li>
<li><a name="debstackptrs"></a><b>debstackptrs
</b>
</li>
<li><a name="delimcpy"></a><b>delimcpy
</b>
</li>
<li><a name="despatch_signals"></a><b>despatch_signals
</b>
</li>
<li><a name="die_nocontext"></a><b>die_nocontext
</b>
</li>
<li><a name="dirp_dup"></a><b>dirp_dup
</b>
</li>
<li><a name="do_aspawn"></a><b>do_aspawn
</b>
</li>
<li><a name="do_binmode"></a><b>do_binmode
</b>
</li>
<li><a name="do_close"></a><b>do_close
</b>
</li>
<li><a name="do_gv_dump"></a><b>do_gv_dump
</b>
</li>
<li><a name="do_gvgv_dump"></a><b>do_gvgv_dump
</b>
</li>
<li><a name="do_hv_dump"></a><b>do_hv_dump
</b>
</li>
<li><a name="do_join"></a><b>do_join
</b>
</li>
<li><a name="do_magic_dump"></a><b>do_magic_dump
</b>
</li>
<li><a name="do_op_dump"></a><b>do_op_dump
</b>
</li>
<li><a name="do_open"></a><b>do_open
</b>
</li>
<li><a name="do_open9"></a><b>do_open9
</b>
</li>
<li><a name="do_openn"></a><b>do_openn
</b>
</li>
<li><a name="do_pmop_dump"></a><b>do_pmop_dump
</b>
</li>
<li><a name="do_spawn"></a><b>do_spawn
</b>
</li>
<li><a name="do_spawn_nowait"></a><b>do_spawn_nowait
</b>
</li>
<li><a name="do_sprintf"></a><b>do_sprintf
</b>
</li>
<li><a name="do_sv_dump"></a><b>do_sv_dump
</b>
</li>
<li><a name="doing_taint"></a><b>doing_taint
</b>
</li>
<li><a name="doref"></a><b>doref
</b>
</li>
<li><a name="dounwind"></a><b>dounwind
</b>
</li>
<li><a name="dowantarray"></a><b>dowantarray
</b>
</li>
<li><a name="dump_eval"></a><b>dump_eval
</b>
</li>
<li><a name="dump_form"></a><b>dump_form
</b>
</li>
<li><a name="dump_indent"></a><b>dump_indent
</b>
</li>
<li><a name="dump_mstats"></a><b>dump_mstats
</b>
</li>
<li><a name="dump_sub"></a><b>dump_sub
</b>
</li>
<li><a name="dump_vindent"></a><b>dump_vindent
</b>
</li>
<li><a name="filter_add"></a><b>filter_add
</b>
</li>
<li><a name="filter_del"></a><b>filter_del
</b>
</li>
<li><a name="filter_read"></a><b>filter_read
</b>
</li>
<li><a name="foldEQ_latin1"></a><b>foldEQ_latin1
</b>
</li>
<li><a name="form_nocontext"></a><b>form_nocontext
</b>
</li>
<li><a name="fp_dup"></a><b>fp_dup
</b>
</li>
<li><a name="fprintf_nocontext"></a><b>fprintf_nocontext
</b>
</li>
<li><a name="free_global_struct"></a><b>free_global_struct
</b>
</li>
<li><a name="free_tmps"></a><b>free_tmps
</b>
</li>
<li><a name="get_context"></a><b>get_context
</b>
</li>
<li><a name="get_mstats"></a><b>get_mstats
</b>
</li>
<li><a name="get_op_descs"></a><b>get_op_descs
</b>
</li>
<li><a name="get_op_names"></a><b>get_op_names
</b>
</li>
<li><a name="get_ppaddr"></a><b>get_ppaddr
</b>
</li>
<li><a name="get_vtbl"></a><b>get_vtbl
</b>
</li>
<li><a name="gp_dup"></a><b>gp_dup
</b>
</li>
<li><a name="gp_free"></a><b>gp_free
</b>
</li>
<li><a name="gp_ref"></a><b>gp_ref
</b>
</li>
<li><a name="gv_AVadd"></a><b>gv_AVadd
</b>
</li>
<li><a name="gv_HVadd"></a><b>gv_HVadd
</b>
</li>
<li><a name="gv_IOadd"></a><b>gv_IOadd
</b>
</li>
<li><a name="gv_SVadd"></a><b>gv_SVadd
</b>
</li>
<li><a name="gv_add_by_type"></a><b>gv_add_by_type
</b>
</li>
<li><a name="gv_autoload4"></a><b>gv_autoload4
</b>
</li>
<li><a name="gv_autoload_pv"></a><b>gv_autoload_pv
</b>
</li>
<li><a name="gv_autoload_pvn"></a><b>gv_autoload_pvn
</b>
</li>
<li><a name="gv_autoload_sv"></a><b>gv_autoload_sv
</b>
</li>
<li><a name="gv_check"></a><b>gv_check
</b>
</li>
<li><a name="gv_dump"></a><b>gv_dump
</b>
</li>
<li><a name="gv_efullname"></a><b>gv_efullname
</b>
</li>
<li><a name="gv_efullname3"></a><b>gv_efullname3
</b>
</li>
<li><a name="gv_efullname4"></a><b>gv_efullname4
</b>
</li>
<li><a name="gv_fetchfile"></a><b>gv_fetchfile
</b>
</li>
<li><a name="gv_fetchfile_flags"></a><b>gv_fetchfile_flags
</b>
</li>
<li><a name="gv_fetchpv"></a><b>gv_fetchpv
</b>
</li>
<li><a name="gv_fetchpvn_flags"></a><b>gv_fetchpvn_flags
</b>
</li>
<li><a name="gv_fetchsv"></a><b>gv_fetchsv
</b>
</li>
<li><a name="gv_fullname"></a><b>gv_fullname
</b>
</li>
<li><a name="gv_fullname3"></a><b>gv_fullname3
</b>
</li>
<li><a name="gv_fullname4"></a><b>gv_fullname4
</b>
</li>
<li><a name="gv_handler"></a><b>gv_handler
</b>
</li>
<li><a name="gv_name_set"></a><b>gv_name_set
</b>
</li>
<li><a name="he_dup"></a><b>he_dup
</b>
</li>
<li><a name="hek_dup"></a><b>hek_dup
</b>
</li>
<li><a name="hv_common"></a><b>hv_common
</b>
</li>
<li><a name="hv_common_key_len"></a><b>hv_common_key_len
</b>
</li>
<li><a name="hv_delayfree_ent"></a><b>hv_delayfree_ent
</b>
</li>
<li><a name="hv_eiter_p"></a><b>hv_eiter_p
</b>
</li>
<li><a name="hv_eiter_set"></a><b>hv_eiter_set
</b>
</li>
<li><a name="hv_free_ent"></a><b>hv_free_ent
</b>
</li>
<li><a name="hv_ksplit"></a><b>hv_ksplit
</b>
</li>
<li><a name="hv_name_set"></a><b>hv_name_set
</b>
</li>
<li><a name="hv_placeholders_get"></a><b>hv_placeholders_get
</b>
</li>
<li><a name="hv_placeholders_set"></a><b>hv_placeholders_set
</b>
</li>
<li><a name="hv_rand_set"></a><b>hv_rand_set
</b>
</li>
<li><a name="hv_riter_p"></a><b>hv_riter_p
</b>
</li>
<li><a name="hv_riter_set"></a><b>hv_riter_set
</b>
</li>
<li><a name="ibcmp_utf8"></a><b>ibcmp_utf8
</b>
</li>
<li><a name="init_global_struct"></a><b>init_global_struct
</b>
</li>
<li><a name="init_stacks"></a><b>init_stacks
</b>
</li>
<li><a name="init_tm"></a><b>init_tm
</b>
</li>
<li><a name="instr"></a><b>instr
</b>
</li>
<li><a name="is_lvalue_sub"></a><b>is_lvalue_sub
</b>
</li>
<li><a name="leave_scope"></a><b>leave_scope
</b>
</li>
<li><a name="load_module_nocontext"></a><b>load_module_nocontext
</b>
</li>
<li><a name="magic_dump"></a><b>magic_dump
</b>
</li>
<li><a name="malloc"></a><b>malloc
</b>
</li>
<li><a name="markstack_grow"></a><b>markstack_grow
</b>
</li>
<li><a name="mess_nocontext"></a><b>mess_nocontext
</b>
</li>
<li><a name="mfree"></a><b>mfree
</b>
</li>
<li><a name="mg_dup"></a><b>mg_dup
</b>
</li>
<li><a name="mg_size"></a><b>mg_size
</b>
</li>
<li><a name="mini_mktime"></a><b>mini_mktime
</b>
</li>
<li><a name="moreswitches"></a><b>moreswitches
</b>
</li>
<li><a name="mro_get_from_name"></a><b>mro_get_from_name
</b>
</li>
<li><a name="mro_get_private_data"></a><b>mro_get_private_data
</b>
</li>
<li><a name="mro_set_mro"></a><b>mro_set_mro
</b>
</li>
<li><a name="mro_set_private_data"></a><b>mro_set_private_data
</b>
</li>
<li><a name="my_atof"></a><b>my_atof
</b>
</li>
<li><a name="my_atof2"></a><b>my_atof2
</b>
</li>
<li><a name="my_bcopy"></a><b>my_bcopy
</b>
</li>
<li><a name="my_bzero"></a><b>my_bzero
</b>
</li>
<li><a name="my_chsize"></a><b>my_chsize
</b>
</li>
<li><a name="my_cxt_index"></a><b>my_cxt_index
</b>
</li>
<li><a name="my_cxt_init"></a><b>my_cxt_init
</b>
</li>
<li><a name="my_dirfd"></a><b>my_dirfd
</b>
</li>
<li><a name="my_exit"></a><b>my_exit
</b>
</li>
<li><a name="my_failure_exit"></a><b>my_failure_exit
</b>
</li>
<li><a name="my_fflush_all"></a><b>my_fflush_all
</b>
</li>
<li><a name="my_fork"></a><b>my_fork
</b>
</li>
<li><a name="my_lstat"></a><b>my_lstat
</b>
</li>
<li><a name="my_memcmp"></a><b>my_memcmp
</b>
</li>
<li><a name="my_memset"></a><b>my_memset
</b>
</li>
<li><a name="my_pclose"></a><b>my_pclose
</b>
</li>
<li><a name="my_popen"></a><b>my_popen
</b>
</li>
<li><a name="my_popen_list"></a><b>my_popen_list
</b>
</li>
<li><a name="my_setenv"></a><b>my_setenv
</b>
</li>
<li><a name="my_socketpair"></a><b>my_socketpair
</b>
</li>
<li><a name="my_stat"></a><b>my_stat
</b>
</li>
<li><a name="my_strftime"></a><b>my_strftime
</b>
</li>
<li><a name="newANONATTRSUB"></a><b>newANONATTRSUB
</b>
</li>
<li><a name="newANONHASH"></a><b>newANONHASH
</b>
</li>
<li><a name="newANONLIST"></a><b>newANONLIST
</b>
</li>
<li><a name="newANONSUB"></a><b>newANONSUB
</b>
</li>
<li><a name="newATTRSUB"></a><b>newATTRSUB
</b>
</li>
<li><a name="newAVREF"></a><b>newAVREF
</b>
</li>
<li><a name="newCVREF"></a><b>newCVREF
</b>
</li>
<li><a name="newFORM"></a><b>newFORM
</b>
</li>
<li><a name="newGVREF"></a><b>newGVREF
</b>
</li>
<li><a name="newGVgen"></a><b>newGVgen
</b>
</li>
<li><a name="newGVgen_flags"></a><b>newGVgen_flags
</b>
</li>
<li><a name="newHVREF"></a><b>newHVREF
</b>
</li>
<li><a name="newHVhv"></a><b>newHVhv
</b>
</li>
<li><a name="newIO"></a><b>newIO
</b>
</li>
<li><a name="newMYSUB"></a><b>newMYSUB
</b>
</li>
<li><a name="newPROG"></a><b>newPROG
</b>
</li>
<li><a name="newRV"></a><b>newRV
</b>
</li>
<li><a name="newSUB"></a><b>newSUB
</b>
</li>
<li><a name="newSVREF"></a><b>newSVREF
</b>
</li>
<li><a name="newSVpvf_nocontext"></a><b>newSVpvf_nocontext
</b>
</li>
<li><a name="new_stackinfo"></a><b>new_stackinfo
</b>
</li>
<li><a name="ninstr"></a><b>ninstr
</b>
</li>
<li><a name="op_refcnt_lock"></a><b>op_refcnt_lock
</b>
</li>
<li><a name="op_refcnt_unlock"></a><b>op_refcnt_unlock
</b>
</li>
<li><a name="parser_dup"></a><b>parser_dup
</b>
</li>
<li><a name="perl_alloc_using"></a><b>perl_alloc_using
</b>
</li>
<li><a name="perl_clone_using"></a><b>perl_clone_using
</b>
</li>
<li><a name="pmop_dump"></a><b>pmop_dump
</b>
</li>
<li><a name="pop_scope"></a><b>pop_scope
</b>
</li>
<li><a name="pregcomp"></a><b>pregcomp
</b>
</li>
<li><a name="pregexec"></a><b>pregexec
</b>
</li>
<li><a name="pregfree"></a><b>pregfree
</b>
</li>
<li><a name="pregfree2"></a><b>pregfree2
</b>
</li>
<li><a name="printf_nocontext"></a><b>printf_nocontext
</b>
</li>
<li><a name="ptr_table_fetch"></a><b>ptr_table_fetch
</b>
</li>
<li><a name="ptr_table_free"></a><b>ptr_table_free
</b>
</li>
<li><a name="ptr_table_new"></a><b>ptr_table_new
</b>
</li>
<li><a name="ptr_table_split"></a><b>ptr_table_split
</b>
</li>
<li><a name="ptr_table_store"></a><b>ptr_table_store
</b>
</li>
<li><a name="push_scope"></a><b>push_scope
</b>
</li>
<li><a name="re_compile"></a><b>re_compile
</b>
</li>
<li><a name="re_dup_guts"></a><b>re_dup_guts
</b>
</li>
<li><a name="re_intuit_start"></a><b>re_intuit_start
</b>
</li>
<li><a name="re_intuit_string"></a><b>re_intuit_string
</b>
</li>
<li><a name="realloc"></a><b>realloc
</b>
</li>
<li><a name="reentrant_free"></a><b>reentrant_free
</b>
</li>
<li><a name="reentrant_init"></a><b>reentrant_init
</b>
</li>
<li><a name="reentrant_retry"></a><b>reentrant_retry
</b>
</li>
<li><a name="reentrant_size"></a><b>reentrant_size
</b>
</li>
<li><a name="ref"></a><b>ref
</b>
</li>
<li><a name="reg_named_buff_all"></a><b>reg_named_buff_all
</b>
</li>
<li><a name="reg_named_buff_exists"></a><b>reg_named_buff_exists
</b>
</li>
<li><a name="reg_named_buff_fetch"></a><b>reg_named_buff_fetch
</b>
</li>
<li><a name="reg_named_buff_firstkey"></a><b>reg_named_buff_firstkey
</b>
</li>
<li><a name="reg_named_buff_nextkey"></a><b>reg_named_buff_nextkey
</b>
</li>
<li><a name="reg_named_buff_scalar"></a><b>reg_named_buff_scalar
</b>
</li>
<li><a name="regclass_swash"></a><b>regclass_swash
</b>
</li>
<li><a name="regdump"></a><b>regdump
</b>
</li>
<li><a name="regdupe_internal"></a><b>regdupe_internal
</b>
</li>
<li><a name="regexec_flags"></a><b>regexec_flags
</b>
</li>
<li><a name="regfree_internal"></a><b>regfree_internal
</b>
</li>
<li><a name="reginitcolors"></a><b>reginitcolors
</b>
</li>
<li><a name="regnext"></a><b>regnext
</b>
</li>
<li><a name="repeatcpy"></a><b>repeatcpy
</b>
</li>
<li><a name="rninstr"></a><b>rninstr
</b>
</li>
<li><a name="rsignal"></a><b>rsignal
</b>
</li>
<li><a name="rsignal_state"></a><b>rsignal_state
</b>
</li>
<li><a name="runops_debug"></a><b>runops_debug
</b>
</li>
<li><a name="runops_standard"></a><b>runops_standard
</b>
</li>
<li><a name="rvpv_dup"></a><b>rvpv_dup
</b>
</li>
<li><a name="safesyscalloc"></a><b>safesyscalloc
</b>
</li>
<li><a name="safesysfree"></a><b>safesysfree
</b>
</li>
<li><a name="safesysmalloc"></a><b>safesysmalloc
</b>
</li>
<li><a name="safesysrealloc"></a><b>safesysrealloc
</b>
</li>
<li><a name="save_I16"></a><b>save_I16
</b>
</li>
<li><a name="save_I32"></a><b>save_I32
</b>
</li>
<li><a name="save_I8"></a><b>save_I8
</b>
</li>
<li><a name="save_adelete"></a><b>save_adelete
</b>
</li>
<li><a name="save_aelem"></a><b>save_aelem
</b>
</li>
<li><a name="save_aelem_flags"></a><b>save_aelem_flags
</b>
</li>
<li><a name="save_alloc"></a><b>save_alloc
</b>
</li>
<li><a name="save_aptr"></a><b>save_aptr
</b>
</li>
<li><a name="save_ary"></a><b>save_ary
</b>
</li>
<li><a name="save_bool"></a><b>save_bool
</b>
</li>
<li><a name="save_clearsv"></a><b>save_clearsv
</b>
</li>
<li><a name="save_delete"></a><b>save_delete
</b>
</li>
<li><a name="save_destructor"></a><b>save_destructor
</b>
</li>
<li><a name="save_destructor_x"></a><b>save_destructor_x
</b>
</li>
<li><a name="save_freeop"></a><b>save_freeop
</b>
</li>
<li><a name="save_freepv"></a><b>save_freepv
</b>
</li>
<li><a name="save_freesv"></a><b>save_freesv
</b>
</li>
<li><a name="save_generic_pvref"></a><b>save_generic_pvref
</b>
</li>
<li><a name="save_generic_svref"></a><b>save_generic_svref
</b>
</li>
<li><a name="save_gp"></a><b>save_gp
</b>
</li>
<li><a name="save_hash"></a><b>save_hash
</b>
</li>
<li><a name="save_hdelete"></a><b>save_hdelete
</b>
</li>
<li><a name="save_helem"></a><b>save_helem
</b>
</li>
<li><a name="save_helem_flags"></a><b>save_helem_flags
</b>
</li>
<li><a name="save_hints"></a><b>save_hints
</b>
</li>
<li><a name="save_hptr"></a><b>save_hptr
</b>
</li>
<li><a name="save_int"></a><b>save_int
</b>
</li>
<li><a name="save_item"></a><b>save_item
</b>
</li>
<li><a name="save_iv"></a><b>save_iv
</b>
</li>
<li><a name="save_list"></a><b>save_list
</b>
</li>
<li><a name="save_long"></a><b>save_long
</b>
</li>
<li><a name="save_mortalizesv"></a><b>save_mortalizesv
</b>
</li>
<li><a name="save_nogv"></a><b>save_nogv
</b>
</li>
<li><a name="save_op"></a><b>save_op
</b>
</li>
<li><a name="save_padsv_and_mortalize"></a><b>save_padsv_and_mortalize
</b>
</li>
<li><a name="save_pptr"></a><b>save_pptr
</b>
</li>
<li><a name="save_pushi32ptr"></a><b>save_pushi32ptr
</b>
</li>
<li><a name="save_pushptr"></a><b>save_pushptr
</b>
</li>
<li><a name="save_pushptrptr"></a><b>save_pushptrptr
</b>
</li>
<li><a name="save_re_context"></a><b>save_re_context
</b>
</li>
<li><a name="save_scalar"></a><b>save_scalar
</b>
</li>
<li><a name="save_set_svflags"></a><b>save_set_svflags
</b>
</li>
<li><a name="save_shared_pvref"></a><b>save_shared_pvref
</b>
</li>
<li><a name="save_sptr"></a><b>save_sptr
</b>
</li>
<li><a name="save_svref"></a><b>save_svref
</b>
</li>
<li><a name="save_vptr"></a><b>save_vptr
</b>
</li>
<li><a name="savestack_grow"></a><b>savestack_grow
</b>
</li>
<li><a name="savestack_grow_cnt"></a><b>savestack_grow_cnt
</b>
</li>
<li><a name="scan_num"></a><b>scan_num
</b>
</li>
<li><a name="scan_vstring"></a><b>scan_vstring
</b>
</li>
<li><a name="seed"></a><b>seed
</b>
</li>
<li><a name="set_context"></a><b>set_context
</b>
</li>
<li><a name="set_numeric_local"></a><b>set_numeric_local
</b>
</li>
<li><a name="set_numeric_radix"></a><b>set_numeric_radix
</b>
</li>
<li><a name="set_numeric_standard"></a><b>set_numeric_standard
</b>
</li>
<li><a name="share_hek"></a><b>share_hek
</b>
</li>
<li><a name="si_dup"></a><b>si_dup
</b>
</li>
<li><a name="ss_dup"></a><b>ss_dup
</b>
</li>
<li><a name="stack_grow"></a><b>stack_grow
</b>
</li>
<li><a name="start_subparse"></a><b>start_subparse
</b>
</li>
<li><a name="str_to_version"></a><b>str_to_version
</b>
</li>
<li><a name="sv_2iv"></a><b>sv_2iv
</b>
</li>
<li><a name="sv_2pv"></a><b>sv_2pv
</b>
</li>
<li><a name="sv_2uv"></a><b>sv_2uv
</b>
</li>
<li><a name="sv_catpvf_mg_nocontext"></a><b>sv_catpvf_mg_nocontext
</b>
</li>
<li><a name="sv_catpvf_nocontext"></a><b>sv_catpvf_nocontext
</b>
</li>
<li><a name="sv_dup"></a><b>sv_dup
</b>
</li>
<li><a name="sv_dup_inc"></a><b>sv_dup_inc
</b>
</li>
<li><a name="sv_peek"></a><b>sv_peek
</b>
</li>
<li><a name="sv_pvn_nomg"></a><b>sv_pvn_nomg
</b>
</li>
<li><a name="sv_setpvf_mg_nocontext"></a><b>sv_setpvf_mg_nocontext
</b>
</li>
<li><a name="sv_setpvf_nocontext"></a><b>sv_setpvf_nocontext
</b>
</li>
<li><a name="swash_fetch"></a><b>swash_fetch
</b>
</li>
<li><a name="swash_init"></a><b>swash_init
</b>
</li>
<li><a name="sys_init"></a><b>sys_init
</b>
</li>
<li><a name="sys_init3"></a><b>sys_init3
</b>
</li>
<li><a name="sys_intern_clear"></a><b>sys_intern_clear
</b>
</li>
<li><a name="sys_intern_dup"></a><b>sys_intern_dup
</b>
</li>
<li><a name="sys_intern_init"></a><b>sys_intern_init
</b>
</li>
<li><a name="sys_term"></a><b>sys_term
</b>
</li>
<li><a name="taint_env"></a><b>taint_env
</b>
</li>
<li><a name="taint_proper"></a><b>taint_proper
</b>
</li>
<li><a name="unlnk"></a><b>unlnk
</b>
</li>
<li><a name="unsharepvn"></a><b>unsharepvn
</b>
</li>
<li><a name="utf16_to_utf8"></a><b>utf16_to_utf8
</b>
</li>
<li><a name="utf16_to_utf8_reversed"></a><b>utf16_to_utf8_reversed
</b>
</li>
<li><a name="uvuni_to_utf8"></a><b>uvuni_to_utf8
</b>
</li>
<li><a name="vdeb"></a><b>vdeb
</b>
</li>
<li><a name="vform"></a><b>vform
</b>
</li>
<li><a name="vload_module"></a><b>vload_module
</b>
</li>
<li><a name="vnewSVpvf"></a><b>vnewSVpvf
</b>
</li>
<li><a name="vwarner"></a><b>vwarner
</b>
</li>
<li><a name="warn_nocontext"></a><b>warn_nocontext
</b>
</li>
<li><a name="warner"></a><b>warner
</b>
</li>
<li><a name="warner_nocontext"></a><b>warner_nocontext
</b>
</li>
<li><a name="whichsig"></a><b>whichsig
</b>
</li>
<li><a name="whichsig_pv"></a><b>whichsig_pv
</b>
</li>
<li><a name="whichsig_pvn"></a><b>whichsig_pvn
</b>
</li>
<li><a name="whichsig_sv"></a><b>whichsig_sv
</b>
</li>
</ul>
<a name="AUTHORS"></a><h1>AUTHORS</h1>
<p>Until May 1997, this document was maintained by Jeff Okamoto
<okamoto@corp.hp.com>. It is now maintained as part of Perl itself.</p>
<p>With lots of help and suggestions from Dean Roehrich, Malcolm Beattie,
Andreas Koenig, Paul Hudson, Ilya Zakharevich, Paul Marquess, Neil
Bowers, Matthew Green, Tim Bunce, Spider Boardman, Ulrich Pfeifer,
Stephen McCamant, and Gurusamy Sarathy.</p>
<p>API Listing originally by Dean Roehrich <roehrich@cray.com>.</p>
<p>Updated to be autogenerated from comments in the source by Benjamin Stuhl.</p>
<a name="SEE-ALSO"></a><h1>SEE ALSO</h1>
<p><a href="perlguts.html">perlguts</a>, <a href="perlxs.html">perlxs</a>, <a href="perlxstut.html">perlxstut</a>, <a href="perlintern.html">perlintern</a></p>
<div id="page_index" class="hud_container">
<div id="page_index_header" class="hud_header">
<div id="page_index_close" class="hud_close"><a href="#" onClick="pageIndex.hide();return false;"></a></div>
<div id="page_index_title" class="hud_title"><span class="hud_span_top">Page index</span></div>
<div id="page_index_topright" class="hud_topright"></div>
</div>
<div id="page_index_content" class="hud_content">
<ul><li><a href="#NAME">NAME</a><li><a href="#DESCRIPTION">DESCRIPTION
</a><li><a href="#%22Gimme%22-Values">"Gimme" Values</a><li><a href="#Array-Manipulation-Functions">Array Manipulation Functions</a><li><a href="#xsubpp-variables-and-internal-functions">xsubpp variables and internal functions</a><li><a href="#Callback-Functions">Callback Functions</a><li><a href="#Character-case-changing">Character case changing</a><li><a href="#Character-classification">Character classification</a><li><a href="#Cloning-an-interpreter">Cloning an interpreter</a><li><a href="#Compile-time-scope-hooks">Compile-time scope hooks</a><li><a href="#COP-Hint-Hashes">COP Hint Hashes</a><li><a href="#COP-Hint-Reading">COP Hint Reading</a><li><a href="#Custom-Operators">Custom Operators</a><li><a href="#CV-Manipulation-Functions">CV Manipulation Functions</a><li><a href="#Debugging-Utilities">Debugging Utilities</a><li><a href="#Display-and-Dump-functions">Display and Dump functions</a><li><a href="#Embedding-Functions">Embedding Functions</a><li><a href="#Exception-Handling-(simple)-Macros">Exception Handling (simple) Macros</a><li><a href="#Global-Variables">Global Variables</a><li><a href="#GV-Functions">GV Functions</a><li><a href="#Handy-Values">Handy Values</a><li><a href="#Hash-Manipulation-Functions">Hash Manipulation Functions</a><li><a href="#Hook-manipulation">Hook manipulation</a><li><a href="#Lexer-interface">Lexer interface</a><li><a href="#Locale-related-functions-and-macros">Locale-related functions and macros</a><li><a href="#Magical-Functions">Magical Functions</a><li><a href="#Memory-Management">Memory Management</a><li><a href="#Miscellaneous-Functions">Miscellaneous Functions</a><li><a href="#MRO-Functions">MRO Functions</a><li><a href="#Multicall-Functions">Multicall Functions</a><li><a href="#Numeric-functions">Numeric functions</a><li><a href="#Obsolete-backwards-compatibility-functions">Obsolete backwards compatibility functions</a><li><a href="#Optree-construction">Optree construction</a><li><a href="#Optree-Manipulation-Functions">Optree Manipulation Functions</a><li><a href="#Pack-and-Unpack">Pack and Unpack</a><li><a href="#Pad-Data-Structures">Pad Data Structures</a><li><a href="#Per-Interpreter-Variables">Per-Interpreter Variables</a><li><a href="#REGEXP-Functions">REGEXP Functions</a><li><a href="#Stack-Manipulation-Macros">Stack Manipulation Macros</a><li><a href="#SV-Flags">SV Flags</a><li><a href="#SV-Manipulation-Functions">SV Manipulation Functions</a><li><a href="#SV-Body-Allocation">SV-Body Allocation</a><li><a href="#Unicode-Support">Unicode Support</a><li><a href="#Variables-created-by-xsubpp-and-xsubpp-internal-functions">Variables created by xsubpp and xsubpp internal functions</a><li><a href="#Versioning">Versioning</a><li><a href="#Warning-and-Dieing">Warning and Dieing</a><li><a href="#Undocumented-functions">Undocumented functions</a><li><a href="#AUTHORS">AUTHORS</a><li><a href="#SEE-ALSO">SEE ALSO</a></ul>
</div>
<div id="page_index_footer" class="hud_footer">
<div id="page_index_bottomleft" class="hud_bottomleft"></div>
<div id="page_index_bottom" class="hud_bottom"><span class="hud_span_bottom"></span></div>
<div id="page_index_resize" class="hud_resize"></div>
</div>
</div>
</div>
<div id="content_footer">
</div>
</div>
<div class="clear"></div>
</div>
<div id="footer">
<div id="footer_content">
<div id="footer_strapline">
perldoc.perl.org - Official documentation for the Perl programming language
</div>
<div id="footer_links">
<div id="address">
<p class="name">Contact details</p>
<p class="address">
Site maintained by <a href="mailto:jj@jonallen.info">Jon Allen (JJ)</a><br>
</p>
<p class="contact">
Documentation maintained by the <a href="http://lists.cpan.org/showlist.cgi?name=perl5-porters">Perl 5 Porters</a>
</p>
</div>
<ul class="f1">
<li>Manual
<ul class="f2">
<li><a href="index-overview.html">Overview</a>
<li><a href="index-tutorials.html">Tutorials</a>
<li><a href="index-faq.html">FAQs</a>
<li><a href="index-history.html">Changes</a>
</ul>
<li>Reference
<ul class="f2">
<li><a href="index-language.html">Language</a>
<li><a href="index-functions.html">Functions</a>
<li><a href="perlop.html">Operators</a>
<li><a href="perlvar.html">Variables</a>
</ul>
<li>Modules
<ul class="f2">
<li><a href="index-modules-A.html">Modules</a>
<li><a href="index-pragmas.html">Pragmas</a>
<li><a href="index-utilities.html">Utilities</a>
</ul>
<li>Misc
<ul class="f2">
<li><a href="index-licence.html">License</a>
<li><a href="index-internals.html">Internals</a>
<li><a href="index-platforms.html">Platforms</a>
</ul> </ul>
<div class="clear"></div>
</div>
</div>
<div id="footer_end">
</div>
</div>
</div>
<script language="JavaScript" type="text/javascript" src="static/exploreperl.js"></script>
<script language="JavaScript" src="static/combined-20100403.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
perldoc.setPath(0);
perldoc.pageName = 'perlapi';
perldoc.pageAddress = 'perlapi.html';
perldoc.contentPage = 1;
explorePerl.render();
explorePerl.addEvents('explore_anchor');
</script>
</body>
</html>
|