       0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0
  N   ˆl–Ãa¾”J_)â€~à[¸ÔÅ£‘äÇò 8àIR‘ÙFË_ÏÎƒh¹Ía–Ãa¾”J_)â€~à[¸ÔÅ£Ë             0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0
  6   ˆl–Ým_J22Ž¥	@³p¸ ©‹Fÿ�þ^eå›‘Â§Zp!hÏÐƒ@×ÏÎ¿Ì 8    # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package ModPerl::ParseSource;

use strict;
use Config ();
use Apache2::ParseSource ();

our @ISA = qw(Apache2::ParseSource);
our $VERSION = '0.01';

sub includes {
    my $self = shift;
    my $dirs = $self->SUPER::includes;
    return [
            '.', qw(xs src/modules/perl),
            @$dirs,
            "$Config::Config{archlibexp}/CORE",
           ];
}

sub include_dirs { '.' }

sub find_includes {
    my $self = shift;
    my $includes = $self->SUPER::find_includes;
    #filter/sort
    my @wanted  = grep { /mod_perl\.h/ } @$includes;
    push @wanted, grep { m:xs/modperl_xs_: } @$includes;
    push @wanted, grep { m:xs/[AM]: } @$includes;
    \@wanted;
}

my $prefixes = join '|', qw(modperl mpxs mp_xs);
my $prefix_re = qr{^($prefixes)_};
sub wanted_functions { $prefix_re }

sub write_functions_pm {
    my $self = shift;
    my $file = shift || 'FunctionTable.pm';
    my $name = shift || 'ModPerl::FunctionTable';
    $self->SUPER::write_functions_pm($file, $name);
}

for my $method (qw(get_constants get_structs write_structs_pm get_structs)) {
    no strict 'refs';
    *$method = sub { die __PACKAGE__ . "->$method not implemented" };
}

1;
__END__
     !ˆÄÃÏ495Â¿Ì ï    !‹      Å”]o›0†ïû+<_ìN¾Õµ†©‘)M¢”ªš¦i2Ø€5c#ÛY’ýú9!Q³©Ñ>.¶+Œy8~Î6y•,Æé‡å½Oïghùøn6# <õÇ Iš´a§0™c„+çš€Ífnú¡6%¤+¨\-`�¹™c8¾"û¹ø
‘ŠSæ¯ˆ8á$�§Šñ-Ò½vV0î+7ëLŠü4L×,W¬’‡Œ×:¬l˜kÝø…˜Îm`­<Ñ�"ƒíõèóhH¡ÖÛ Tkh¸‘C†ýLT®}Õô‰@«à¥àhE2Ív{Ùîÿóë"¢ÙÁo?41qúJ¥(U„�npLD]"kòƒÈµ²�Iª¾„¥(0¢ÒEøãt¼øä9pÕþí˜PT^Døí8šß.¢ÇsZsôeæÞ3w8žQëP­™(gá‡~ß.LZ&á67¢qB«g|‹ç­æZÚ†ú^‡¾ƒÊœS-Â~•Ícy·šÌÓdºj#aûÏvÿú3ãxIW%ÂðÜi³;FÑz½V™mnO·èØ¨eåpŒP€^$ÿ �BKÆÍy>—’yTÂî¬>Î=ëuzý ó&è]£îð¦ÛEè¯:øÍ¿ ŽûƒÀaÛhÏ˜ï~K–9Æ       #ˆË�þK$«7(ŠPŒŽ•Ö�üÿÐƒeà;Ï¿Ì ß    ##-*- R -*-

## Script from Fourth Edition of `Modern Applied Statistics with S'

# Chapter 3   S Language

library(MASS)
options(width=65, digits=5, height=9999)

# from Chapter 2

powers.of.pi <- pi^(-2:2)
names(powers.of.pi) <- -2:2
mymat <- matrix(1:30, 3, 10)
myarr <- mymat
dim(myarr) <- c(3, 5, 2)
dimnames(myarr) <- list(letters[1:3], NULL, c("(i)", "(ii)"))


# 3.1  Language layout

1 - pi + exp(1.7)

a <- 6

b <- a <- 6

(z <- 1 - pi + exp(1.7))

search()

objects()

objects(2)

find("objects")

get("[<-.data.frame", pos = 2)

# hills <- hills  # only needed in S-PLUS
hills$ispeed <- hills$time/hills$dist


# 3.2  More on S objects

length(letters)

Empl <- list(employee = "Anna", spouse = "Fred", children = 3,
            child.ages = c(4, 7, 9))

Empl$employee
Empl$child.ages[2]

x <- "spouse"; Empl[[x]]

unlist(Empl)
unlist(Empl, use.names = F)

attributes(myarr)
attr(myarr, "dim")

Empl <- c(Empl, service = 8)

c(list(x