Changeset 685749035beb…
Parent 1fb99fb51c4d…
by Benjamin Pollack
Changes to 13 files · Browse files at 685749035beb Showing diff from parent 1fb99fb51c4d Diff from another changeset...
@@ -17,12 +17,10 @@ #
# DEBUG=-DDEBUG
-TCLVERSION=8.3
-TCLINCLUDE=-I/usr/include/tcl$(TCLVERSION)
CFLAGS=-g -Wall
-all: megahal tcllib pythonmodule perlmodule
+all: megahal pythonmodule
megahal: main.o megahal.o megahal.h backup
gcc $(CFLAGS) -o megahal-bin megahal.o main.o -lm $(DEBUG)
@@ -34,24 +32,12 @@main.o: main.c megahal.h
gcc $(CFLAGS) -c main.c
-tcl-interface.o: tcl-interface.c
- gcc -fPIC $(CFLAGS) $(TCLINCLUDE) -c tcl-interface.c
-
-tcllib: megahal.o tcl-interface.o
- gcc -fPIC -shared -Wl,-soname,libmh_tcl.so -o libmh_tcl.so megahal.o tcl-interface.o
-
pythonmodule: python-interface.c megahal.c
python setup.py build
pythonmodule-install:
python setup.py install --root=$(DESTDIR)
-perlmodule: megahal.c megahal.h
- cd Megahal && perl Makefile.PL INSTALLDIRS=vendor && make
-
-perlmodule-install:
- cd Megahal && make install DESTDIR=$(DESTDIR)
-
version:
./cvsversion.tcl
|
|
@@ -1,6 +0,0 @@ - Revision history for Perl extension Megahal.
-
-0.01 Tue Aug 19 19:52:35 2003
- - original version; created by h2xs 1.22 with options
- -Oan Megahal megahal.h
-
|
|
@@ -1,23 +0,0 @@ - Changes
-Makefile
-Makefile.old
-Makefile.PL
-MANIFEST
-megahal.brn
-Megahal.bs
-Megahal.c
-megahal.c
-megahal.dic
-megahal.h
-megahal.log
-Megahal.o
-megahal.o
-Megahal.pm
-megahal.txt
-Megahal.xs
-pm_to_blib
-ppport.h
-README
-t/1.t
-fallback/const-c.inc
-fallback/const-xs.inc
|
|
@@ -1,39 +0,0 @@ - use 5.008;
-use ExtUtils::MakeMaker;
-# See lib/ExtUtils/MakeMaker.pm for details of how to influence
-# the contents of the Makefile that is written.
-WriteMakefile(
- 'NAME' => 'Megahal',
- 'VERSION_FROM' => 'Megahal.pm', # finds $VERSION
- 'PREREQ_PM' => {}, # e.g., Module::Name => 1.1
- ($] >= 5.005 ? ## Add these new keywords supported since 5.005
- (ABSTRACT_FROM => 'Megahal.pm', # retrieve abstract from module
- AUTHOR => 'Laurent Fousse <laurent@internal.cyberhqz.com>') : ()),
- 'LIBS' => [''], # e.g., '-lm'
- 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING'
- 'INC' => '-I.', # e.g., '-I. -I/usr/include/other'
- 'OBJECT' => '$(O_FILES)', # link all the C files too
-);
-if (eval {require ExtUtils::Constant; 1}) {
- # If you edit these definitions to change the constants used by this module,
- # you will need to use the generated const-c.inc and const-xs.inc
- # files to replace their "fallback" counterparts before distributing your
- # changes.
- my @names = (qw(MEGAHAL_H));
- ExtUtils::Constant::WriteConstants(
- NAME => 'Megahal',
- NAMES => \@names,
- DEFAULT_TYPE => 'IV',
- C_FILE => 'const-c.inc',
- XS_FILE => 'const-xs.inc',
- );
-
-}
-else {
- use File::Copy;
- use File::Spec;
- foreach my $file ('const-c.inc', 'const-xs.inc') {
- my $fallback = File::Spec->catfile('fallback', $file);
- copy ($fallback, $file) or die "Can't copy $fallback to $file: $!";
- }
-}
|
|
|
@@ -1,857 +0,0 @@ - # This Makefile is for the Megahal extension to perl.
-#
-# It was generated automatically by MakeMaker version
-# 6.17 (Revision: 1.133) from the contents of
-# Makefile.PL. Don't edit this file, edit Makefile.PL instead.
-#
-# ANY CHANGES MADE HERE WILL BE LOST!
-#
-# MakeMaker ARGV: (q[INSTALLDIRS=vendor])
-#
-# MakeMaker Parameters:
-
-# ABSTRACT_FROM => q[Megahal.pm]
-# AUTHOR => q[Laurent Fousse <laurent@internal.cyberhqz.com>]
-# DEFINE => q[]
-# INC => q[-I.]
-# LIBS => [q[]]
-# NAME => q[Megahal]
-# OBJECT => q[$(O_FILES)]
-# PREREQ_PM => { }
-# VERSION_FROM => q[Megahal.pm]
-
-# --- MakeMaker post_initialize section:
-
-
-# --- MakeMaker const_config section:
-
-# These definitions are from config.sh (via /usr/lib/perl/5.8/Config.pm)
-
-# They may have been overridden via Makefile.PL or on the command line
-AR = ar
-CC = cc
-CCCDLFLAGS = -fPIC
-CCDLFLAGS = -rdynamic
-DLEXT = so
-DLSRC = dl_dlopen.xs
-LD = cc
-LDDLFLAGS = -shared -L/usr/local/lib
-LDFLAGS = -L/usr/local/lib
-LIBC = /lib/libc-2.3.2.so
-LIB_EXT = .a
-OBJ_EXT = .o
-OSNAME = linux
-OSVERS = 2.4.22-xfs+ti1211
-RANLIB = :
-SITELIBEXP = /usr/local/share/perl/5.8.3
-SITEARCHEXP = /usr/local/lib/perl/5.8.3
-SO = so
-EXE_EXT =
-FULL_AR = /usr/bin/ar
-VENDORARCHEXP = /usr/lib/perl5
-VENDORLIBEXP = /usr/share/perl5
-
-
-# --- MakeMaker constants section:
-AR_STATIC_ARGS = cr
-DIRFILESEP = /
-NAME = Megahal
-NAME_SYM = Megahal
-VERSION = 0.01
-VERSION_MACRO = VERSION
-VERSION_SYM = 0_01
-DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\"
-XS_VERSION = 0.01
-XS_VERSION_MACRO = XS_VERSION
-XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"
-INST_ARCHLIB = blib/arch
-INST_SCRIPT = blib/script
-INST_BIN = blib/bin
-INST_LIB = blib/lib
-INST_MAN1DIR = blib/man1
-INST_MAN3DIR = blib/man3
-MAN1EXT = 1p
-MAN3EXT = 3pm
-INSTALLDIRS = vendor
-DESTDIR =
-PREFIX = /usr
-PERLPREFIX = $(PREFIX)
-SITEPREFIX = $(PREFIX)/local
-VENDORPREFIX = $(PREFIX)
-INSTALLPRIVLIB = $(PERLPREFIX)/share/perl/5.8
-DESTINSTALLPRIVLIB = $(DESTDIR)$(INSTALLPRIVLIB)
-INSTALLSITELIB = $(SITEPREFIX)/share/perl/5.8.3
-DESTINSTALLSITELIB = $(DESTDIR)$(INSTALLSITELIB)
-INSTALLVENDORLIB = $(VENDORPREFIX)/share/perl5
-DESTINSTALLVENDORLIB = $(DESTDIR)$(INSTALLVENDORLIB)
-INSTALLARCHLIB = $(PERLPREFIX)/lib/perl/5.8
-DESTINSTALLARCHLIB = $(DESTDIR)$(INSTALLARCHLIB)
-INSTALLSITEARCH = $(SITEPREFIX)/lib/perl/5.8.3
-DESTINSTALLSITEARCH = $(DESTDIR)$(INSTALLSITEARCH)
-INSTALLVENDORARCH = $(VENDORPREFIX)/lib/perl5
-DESTINSTALLVENDORARCH = $(DESTDIR)$(INSTALLVENDORARCH)
-INSTALLBIN = $(PERLPREFIX)/bin
-DESTINSTALLBIN = $(DESTDIR)$(INSTALLBIN)
-INSTALLSITEBIN = $(SITEPREFIX)/bin
-DESTINSTALLSITEBIN = $(DESTDIR)$(INSTALLSITEBIN)
-INSTALLVENDORBIN = $(VENDORPREFIX)/bin
-DESTINSTALLVENDORBIN = $(DESTDIR)$(INSTALLVENDORBIN)
-INSTALLSCRIPT = $(PERLPREFIX)/bin
-DESTINSTALLSCRIPT = $(DESTDIR)$(INSTALLSCRIPT)
-INSTALLMAN1DIR = $(PERLPREFIX)/share/man/man1
-DESTINSTALLMAN1DIR = $(DESTDIR)$(INSTALLMAN1DIR)
-INSTALLSITEMAN1DIR = $(SITEPREFIX)/man/man1
-DESTINSTALLSITEMAN1DIR = $(DESTDIR)$(INSTALLSITEMAN1DIR)
-INSTALLVENDORMAN1DIR = $(VENDORPREFIX)/share/man/man1
-DESTINSTALLVENDORMAN1DIR = $(DESTDIR)$(INSTALLVENDORMAN1DIR)
-INSTALLMAN3DIR = $(PERLPREFIX)/share/man/man3
-DESTINSTALLMAN3DIR = $(DESTDIR)$(INSTALLMAN3DIR)
-INSTALLSITEMAN3DIR = $(SITEPREFIX)/man/man3
-DESTINSTALLSITEMAN3DIR = $(DESTDIR)$(INSTALLSITEMAN3DIR)
-INSTALLVENDORMAN3DIR = $(VENDORPREFIX)/share/man/man3
-DESTINSTALLVENDORMAN3DIR = $(DESTDIR)$(INSTALLVENDORMAN3DIR)
-PERL_LIB = /usr/share/perl/5.8
-PERL_ARCHLIB = /usr/lib/perl/5.8
-LIBPERL_A = libperl.a
-FIRST_MAKEFILE = Makefile
-MAKEFILE_OLD = $(FIRST_MAKEFILE).old
-MAKE_APERL_FILE = $(FIRST_MAKEFILE).aperl
-PERLMAINCC = $(CC)
-PERL_INC = /usr/lib/perl/5.8/CORE
-PERL = /usr/bin/perl
-FULLPERL = /usr/bin/perl
-ABSPERL = $(PERL)
-PERLRUN = $(PERL)
-FULLPERLRUN = $(FULLPERL)
-ABSPERLRUN = $(ABSPERL)
-PERLRUNINST = $(PERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"
-FULLPERLRUNINST = $(FULLPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"
-ABSPERLRUNINST = $(ABSPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"
-PERL_CORE = 0
-PERM_RW = 644
-PERM_RWX = 755
-
-MAKEMAKER = /usr/share/perl/5.8/ExtUtils/MakeMaker.pm
-MM_VERSION = 6.17
-MM_REVISION = 1.133
-
-# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
-# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
-# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
-# DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
-FULLEXT = Megahal
-BASEEXT = Megahal
-PARENT_NAME =
-DLBASE = $(BASEEXT)
-VERSION_FROM = Megahal.pm
-INC = -I.
-DEFINE =
-OBJECT = $(O_FILES)
-LDFROM = $(OBJECT)
-LINKTYPE = dynamic
-
-# Handy lists of source code files:
-XS_FILES = Megahal.xs
-C_FILES = Megahal.c \
- megahal.c
-O_FILES = Megahal.o \
- megahal.o
-H_FILES = megahal.h \
- ppport.h
-MAN1PODS =
-MAN3PODS = Megahal.pm
-
-# Where is the Config information that we are using/depend on
-CONFIGDEP = $(PERL_ARCHLIB)$(DIRFILESEP)Config.pm $(PERL_INC)$(DIRFILESEP)config.h
-
-# Where to build things
-INST_LIBDIR = $(INST_LIB)
-INST_ARCHLIBDIR = $(INST_ARCHLIB)
-
-INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT)
-INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT)
-
-INST_STATIC = $(INST_ARCHAUTODIR)/$(BASEEXT)$(LIB_EXT)
-INST_DYNAMIC = $(INST_ARCHAUTODIR)/$(DLBASE).$(DLEXT)
-INST_BOOT = $(INST_ARCHAUTODIR)/$(BASEEXT).bs
-
-# Extra linker info
-EXPORT_LIST =
-PERL_ARCHIVE =
-PERL_ARCHIVE_AFTER =
-
-
-TO_INST_PM = Megahal.pm
-
-PM_TO_BLIB = Megahal.pm \
- $(INST_LIB)/Megahal.pm
-
-
-# --- MakeMaker platform_constants section:
-MM_Unix_VERSION = 1.42
-PERL_MALLOC_DEF = -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc
-
-
-# --- MakeMaker tool_autosplit section:
-# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
-AUTOSPLITFILE = $(PERLRUN) -e 'use AutoSplit; autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1)'
-
-
-
-# --- MakeMaker tool_xsubpp section:
-
-XSUBPPDIR = /usr/share/perl/5.8/ExtUtils
-XSUBPP = $(XSUBPPDIR)/xsubpp
-XSPROTOARG =
-XSUBPPDEPS = /usr/share/perl/5.8/ExtUtils/typemap $(XSUBPP)
-XSUBPPARGS = -typemap /usr/share/perl/5.8/ExtUtils/typemap
-XSUBPP_EXTRA_ARGS =
-
-
-# --- MakeMaker tools_other section:
-SHELL = /bin/sh
-CHMOD = chmod
-CP = cp
-MV = mv
-NOOP = $(SHELL) -c true
-NOECHO = @
-RM_F = rm -f
-RM_RF = rm -rf
-TEST_F = test -f
-TOUCH = touch
-UMASK_NULL = umask 0
-DEV_NULL = > /dev/null 2>&1
-MKPATH = $(PERLRUN) "-MExtUtils::Command" -e mkpath
-EQUALIZE_TIMESTAMP = $(PERLRUN) "-MExtUtils::Command" -e eqtime
-ECHO = echo
-ECHO_N = echo -n
-UNINST = 0
-VERBINST = 0
-MOD_INSTALL = $(PERLRUN) -MExtUtils::Install -e 'install({@ARGV}, '\''$(VERBINST)'\'', 0, '\''$(UNINST)'\'');'
-DOC_INSTALL = $(PERLRUN) "-MExtUtils::Command::MM" -e perllocal_install
-UNINSTALL = $(PERLRUN) "-MExtUtils::Command::MM" -e uninstall
-WARN_IF_OLD_PACKLIST = $(PERLRUN) "-MExtUtils::Command::MM" -e warn_if_old_packlist
-
-
-# --- MakeMaker makemakerdflt section:
-makemakerdflt: all
- $(NOECHO) $(NOOP)
-
-
-# --- MakeMaker dist section:
-TAR = tar
-TARFLAGS = cvf
-ZIP = zip
-ZIPFLAGS = -r
-COMPRESS = gzip --best
-SUFFIX = .gz
-SHAR = shar
-PREOP = $(NOECHO) $(NOOP)
-POSTOP = $(NOECHO) $(NOOP)
-TO_UNIX = $(NOECHO) $(NOOP)
-CI = ci -u
-RCS_LABEL = rcs -Nv$(VERSION_SYM): -q
-DIST_CP = best
-DIST_DEFAULT = tardist
-DISTNAME = Megahal
-DISTVNAME = Megahal-0.01
-
-
-# --- MakeMaker macro section:
-
-
-# --- MakeMaker depend section:
-
-
-# --- MakeMaker cflags section:
-
-CCFLAGS = -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-OPTIMIZE = -O3
-PERLTYPE =
-MPOLLUTE =
-
-
-# --- MakeMaker const_loadlibs section:
-
-# Megahal might depend on some other libraries:
-# See ExtUtils::Liblist for details
-#
-LD_RUN_PATH =
-
-
-# --- MakeMaker const_cccmd section:
-CCCMD = $(CC) -c $(PASTHRU_INC) $(INC) \
- $(CCFLAGS) $(OPTIMIZE) \
- $(PERLTYPE) $(MPOLLUTE) $(DEFINE_VERSION) \
- $(XS_DEFINE_VERSION)
-
-# --- MakeMaker post_constants section:
-
-
-# --- MakeMaker pasthru section:
-
-PASTHRU = LIB="$(LIB)"\
- LIBPERL_A="$(LIBPERL_A)"\
- LINKTYPE="$(LINKTYPE)"\
- PREFIX="$(PREFIX)"\
- OPTIMIZE="$(OPTIMIZE)"\
- PASTHRU_DEFINE="$(PASTHRU_DEFINE)"\
- PASTHRU_INC="$(PASTHRU_INC)"
-
-
-# --- MakeMaker special_targets section:
-.SUFFIXES: .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT)
-
-.PHONY: all config static dynamic test linkext manifest
-
-
-
-# --- MakeMaker c_o section:
-
-.c.i:
- cc -E -c $(PASTHRU_INC) $(INC) \
- $(CCFLAGS) $(OPTIMIZE) \
- $(PERLTYPE) $(MPOLLUTE) $(DEFINE_VERSION) \
- $(XS_DEFINE_VERSION) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c > $*.i
-
-.c.s:
- $(CCCMD) -S $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c
-
-.c$(OBJ_EXT):
- $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c
-
-.C$(OBJ_EXT):
- $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.C
-
-.cpp$(OBJ_EXT):
- $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cpp
-
-.cxx$(OBJ_EXT):
- $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cxx
-
-.cc$(OBJ_EXT):
- $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cc
-
-
-# --- MakeMaker xs_c section:
-
-.xs.c:
- $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(XSUBPP_EXTRA_ARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c
-
-
-# --- MakeMaker xs_o section:
-
-.xs$(OBJ_EXT):
- $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c
- $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c
-
-
-# --- MakeMaker top_targets section:
-all :: pure_all manifypods
- $(NOECHO) $(NOOP)
-
-
-pure_all :: config pm_to_blib subdirs linkext
- $(NOECHO) $(NOOP)
-
-subdirs :: $(MYEXTLIB)
- $(NOECHO) $(NOOP)
-
-config :: $(FIRST_MAKEFILE) $(INST_LIBDIR)$(DIRFILESEP).exists
- $(NOECHO) $(NOOP)
-
-config :: $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
- $(NOECHO) $(NOOP)
-
-config :: $(INST_AUTODIR)$(DIRFILESEP).exists
- $(NOECHO) $(NOOP)
-
-$(INST_AUTODIR)/.exists :: /usr/lib/perl/5.8/CORE/perl.h
- $(NOECHO) $(MKPATH) $(INST_AUTODIR)
- $(NOECHO) $(EQUALIZE_TIMESTAMP) /usr/lib/perl/5.8/CORE/perl.h $(INST_AUTODIR)/.exists
-
- -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_AUTODIR)
-
-$(INST_LIBDIR)/.exists :: /usr/lib/perl/5.8/CORE/perl.h
- $(NOECHO) $(MKPATH) $(INST_LIBDIR)
- $(NOECHO) $(EQUALIZE_TIMESTAMP) /usr/lib/perl/5.8/CORE/perl.h $(INST_LIBDIR)/.exists
-
- -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_LIBDIR)
-
-$(INST_ARCHAUTODIR)/.exists :: /usr/lib/perl/5.8/CORE/perl.h
- $(NOECHO) $(MKPATH) $(INST_ARCHAUTODIR)
- $(NOECHO) $(EQUALIZE_TIMESTAMP) /usr/lib/perl/5.8/CORE/perl.h $(INST_ARCHAUTODIR)/.exists
-
- -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_ARCHAUTODIR)
-
-config :: $(INST_MAN3DIR)$(DIRFILESEP).exists
- $(NOECHO) $(NOOP)
-
-
-$(INST_MAN3DIR)/.exists :: /usr/lib/perl/5.8/CORE/perl.h
- $(NOECHO) $(MKPATH) $(INST_MAN3DIR)
- $(NOECHO) $(EQUALIZE_TIMESTAMP) /usr/lib/perl/5.8/CORE/perl.h $(INST_MAN3DIR)/.exists
-
- -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_MAN3DIR)
-
-$(O_FILES): $(H_FILES)
-
-help:
- perldoc ExtUtils::MakeMaker
-
-
-# --- MakeMaker linkext section:
-
-linkext :: $(LINKTYPE)
- $(NOECHO) $(NOOP)
-
-
-# --- MakeMaker dlsyms section:
-
-
-# --- MakeMaker dynamic section:
-
-dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT)
- $(NOECHO) $(NOOP)
-
-
-# --- MakeMaker dynamic_bs section:
-BOOTSTRAP = $(BASEEXT).bs
-
-# As Mkbootstrap might not write a file (if none is required)
-# we use touch to prevent make continually trying to remake it.
-# The DynaLoader only reads a non-empty file.
-$(BOOTSTRAP): $(FIRST_MAKEFILE) $(BOOTDEP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
- $(NOECHO) $(ECHO) "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
- $(NOECHO) $(PERLRUN) \
- "-MExtUtils::Mkbootstrap" \
- -e "Mkbootstrap('$(BASEEXT)','$(BSLOADLIBS)');"
- $(NOECHO) $(TOUCH) $(BOOTSTRAP)
- $(CHMOD) $(PERM_RW) $@
-
-$(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
- $(NOECHO) $(RM_RF) $(INST_BOOT)
- -$(CP) $(BOOTSTRAP) $(INST_BOOT)
- $(CHMOD) $(PERM_RW) $@
-
-
-# --- MakeMaker dynamic_lib section:
-
-# This section creates the dynamically loadable $(INST_DYNAMIC)
-# from $(OBJECT) and possibly $(MYEXTLIB).
-ARMAYBE = :
-OTHERLDFLAGS =
-INST_DYNAMIC_DEP =
-INST_DYNAMIC_FIX =
-
-$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)
- $(RM_F) $@
- LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) $(LDDLFLAGS) $(LDFROM) $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST) $(INST_DYNAMIC_FIX)
- $(CHMOD) $(PERM_RWX) $@
-
-
-# --- MakeMaker static section:
-
-## $(INST_PM) has been moved to the all: target.
-## It remains here for awhile to allow for old usage: "make static"
-static :: $(FIRST_MAKEFILE) $(INST_STATIC)
- $(NOECHO) $(NOOP)
-
-
-# --- MakeMaker static_lib section:
-
-$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
- $(RM_RF) $@
- $(FULL_AR) $(AR_STATIC_ARGS) $@ $(OBJECT) && $(RANLIB) $@
- $(CHMOD) $(PERM_RWX) $@
- $(NOECHO) $(ECHO) "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld
-
-
-
-# --- MakeMaker manifypods section:
-
-POD2MAN_EXE = $(PERLRUN) "-MExtUtils::Command::MM" -e pod2man "--"
-POD2MAN = $(POD2MAN_EXE)
-
-
-manifypods : pure_all \
- Megahal.pm \
- Megahal.pm
- $(NOECHO) $(POD2MAN) --section=3 --perm_rw=$(PERM_RW)\
- Megahal.pm $(INST_MAN3DIR)/Megahal.$(MAN3EXT)
-
-
-
-
-# --- MakeMaker processPL section:
-
-
-# --- MakeMaker installbin section:
-
-
-# --- MakeMaker subdirs section:
-
-# none
-
-# --- MakeMaker clean_subdirs section:
-clean_subdirs :
- $(NOECHO) $(NOOP)
-
-
-# --- MakeMaker clean section:
-
-# Delete temporary files but do not touch installed files. We don't delete
-# the Makefile here so a later make realclean still has a makefile to use.
-
-clean :: clean_subdirs
- -$(RM_RF) Megahal.c ./blib $(MAKE_APERL_FILE) $(INST_ARCHAUTODIR)/extralibs.all $(INST_ARCHAUTODIR)/extralibs.ld perlmain.c tmon.out mon.out so_locations pm_to_blib *$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT) $(BOOTSTRAP) $(BASEEXT).bso $(BASEEXT).def lib$(BASEEXT).def $(BASEEXT).exp $(BASEEXT).x core core.*perl.*.? *perl.core core.[0-9] core.[0-9][0-9] core.[0-9][0-9][0-9] core.[0-9][0-9][0-9][0-9] core.[0-9][0-9][0-9][0-9][0-9]
- -$(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) $(DEV_NULL)
-
-
-# --- MakeMaker realclean_subdirs section:
-realclean_subdirs :
- $(NOECHO) $(NOOP)
-
-
-# --- MakeMaker realclean section:
-
-# Delete temporary files (via clean) and also delete installed files
-realclean purge :: clean realclean_subdirs
- $(RM_RF) $(INST_AUTODIR) $(INST_ARCHAUTODIR)
- $(RM_RF) $(DISTVNAME)
- $(RM_F) $(INST_DYNAMIC) $(INST_BOOT)
- $(RM_F) $(INST_STATIC)
- $(RM_F) $(MAKEFILE_OLD) $(FIRST_MAKEFILE) $(INST_LIB)/Megahal.pm
-
-
-# --- MakeMaker metafile section:
-metafile :
- $(NOECHO) $(ECHO) '# http://module-build.sourceforge.net/META-spec.html' > META.yml
- $(NOECHO) $(ECHO) '#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#' >> META.yml
- $(NOECHO) $(ECHO) 'name: Megahal' >> META.yml
- $(NOECHO) $(ECHO) 'version: 0.01' >> META.yml
- $(NOECHO) $(ECHO) 'version_from: Megahal.pm' >> META.yml
- $(NOECHO) $(ECHO) 'installdirs: vendor' >> META.yml
- $(NOECHO) $(ECHO) 'requires:' >> META.yml
- $(NOECHO) $(ECHO) '' >> META.yml
- $(NOECHO) $(ECHO) 'distribution_type: module' >> META.yml
- $(NOECHO) $(ECHO) 'generated_by: ExtUtils::MakeMaker version 6.17' >> META.yml
-
-
-# --- MakeMaker metafile_addtomanifest section:
-metafile_addtomanifest:
- $(NOECHO) $(PERLRUN) -MExtUtils::Manifest=maniadd -e 'eval { maniadd({q{META.yml} => q{Module meta-data (added by MakeMaker)}}) } ' \
- -e ' or print "Could not add META.yml to MANIFEST: $${'\''@'\''}\n"'
-
-
-# --- MakeMaker dist_basics section:
-distclean :: realclean distcheck
- $(NOECHO) $(NOOP)
-
-distcheck :
- $(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck
-
-skipcheck :
- $(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck
-
-manifest :
- $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest
-
-veryclean : realclean
- $(RM_F) *~ *.orig */*~ */*.orig
-
-
-
-# --- MakeMaker dist_core section:
-
-dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE)
- $(NOECHO) $(PERLRUN) -l -e 'print '\''Warning: Makefile possibly out of date with $(VERSION_FROM)'\''' \
- -e ' if -e '\''$(VERSION_FROM)'\'' and -M '\''$(VERSION_FROM)'\'' < -M '\''$(FIRST_MAKEFILE)'\'';'
-
-tardist : $(DISTVNAME).tar$(SUFFIX)
- $(NOECHO) $(NOOP)
-
-uutardist : $(DISTVNAME).tar$(SUFFIX)
- uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uu
-
-$(DISTVNAME).tar$(SUFFIX) : distdir
- $(PREOP)
- $(TO_UNIX)
- $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
- $(RM_RF) $(DISTVNAME)
- $(COMPRESS) $(DISTVNAME).tar
- $(POSTOP)
-
-zipdist : $(DISTVNAME).zip
- $(NOECHO) $(NOOP)
-
-$(DISTVNAME).zip : distdir
- $(PREOP)
- $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
- $(RM_RF) $(DISTVNAME)
- $(POSTOP)
-
-shdist : distdir
- $(PREOP)
- $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
- $(RM_RF) $(DISTVNAME)
- $(POSTOP)
-
-
-# --- MakeMaker distdir section:
-distdir : metafile metafile_addtomanifest
- $(RM_RF) $(DISTVNAME)
- $(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \
- -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
-
-
-
-# --- MakeMaker dist_test section:
-
-disttest : distdir
- cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL
- cd $(DISTVNAME) && $(MAKE) $(PASTHRU)
- cd $(DISTVNAME) && $(MAKE) test $(PASTHRU)
-
-
-# --- MakeMaker dist_ci section:
-
-ci :
- $(PERLRUN) "-MExtUtils::Manifest=maniread" \
- -e "@all = keys %{ maniread() };" \
- -e "print(qq{Executing $(CI) @all\n}); system(qq{$(CI) @all});" \
- -e "print(qq{Executing $(RCS_LABEL) ...\n}); system(qq{$(RCS_LABEL) @all});"
-
-
-# --- MakeMaker install section:
-
-install :: all pure_install doc_install
-
-install_perl :: all pure_perl_install doc_perl_install
-
-install_site :: all pure_site_install doc_site_install
-
-install_vendor :: all pure_vendor_install doc_vendor_install
-
-pure_install :: pure_$(INSTALLDIRS)_install
-
-doc_install :: doc_$(INSTALLDIRS)_install
-
-pure__install : pure_site_install
- $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
-
-doc__install : doc_site_install
- $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
-
-pure_perl_install ::
- $(NOECHO) umask 022; $(MOD_INSTALL) \
- $(INST_LIB) $(DESTINSTALLPRIVLIB) \
- $(INST_ARCHLIB) $(DESTINSTALLARCHLIB) \
- $(INST_BIN) $(DESTINSTALLBIN) \
- $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
- $(INST_MAN1DIR) $(DESTINSTALLMAN1DIR) \
- $(INST_MAN3DIR) $(DESTINSTALLMAN3DIR)
- $(NOECHO) $(WARN_IF_OLD_PACKLIST) \
- $(SITEARCHEXP)/auto/$(FULLEXT)
-
-
-pure_site_install ::
- $(NOECHO) umask 02; $(MOD_INSTALL) \
- read $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist \
- write $(DESTINSTALLSITEARCH)/auto/$(FULLEXT)/.packlist \
- $(INST_LIB) $(DESTINSTALLSITELIB) \
- $(INST_ARCHLIB) $(DESTINSTALLSITEARCH) \
- $(INST_BIN) $(DESTINSTALLSITEBIN) \
- $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
- $(INST_MAN1DIR) $(DESTINSTALLSITEMAN1DIR) \
- $(INST_MAN3DIR) $(DESTINSTALLSITEMAN3DIR)
- $(NOECHO) $(WARN_IF_OLD_PACKLIST) \
- $(PERL_ARCHLIB)/auto/$(FULLEXT)
-
-pure_vendor_install ::
- $(NOECHO) umask 022; $(MOD_INSTALL) \
- $(INST_LIB) $(DESTINSTALLVENDORLIB) \
- $(INST_ARCHLIB) $(DESTINSTALLVENDORARCH) \
- $(INST_BIN) $(DESTINSTALLVENDORBIN) \
- $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
- $(INST_MAN1DIR) $(DESTINSTALLVENDORMAN1DIR) \
- $(INST_MAN3DIR) $(DESTINSTALLVENDORMAN3DIR)
-
-doc_perl_install ::
-
-doc_site_install ::
- $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLSITEARCH)/perllocal.pod
- -$(NOECHO) umask 02; $(MKPATH) $(DESTINSTALLARCHLIB)
- -$(NOECHO) umask 02; $(DOC_INSTALL) \
- "Module" "$(NAME)" \
- "installed into" "$(INSTALLSITELIB)" \
- LINKTYPE "$(LINKTYPE)" \
- VERSION "$(VERSION)" \
- EXE_FILES "$(EXE_FILES)" \
- >> $(DESTINSTALLSITEARCH)/perllocal.pod
-
-doc_vendor_install ::
-
-
-uninstall :: uninstall_from_$(INSTALLDIRS)dirs
-
-uninstall_from_perldirs ::
- $(NOECHO) $(UNINSTALL) $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist
-
-uninstall_from_sitedirs ::
- $(NOECHO) $(UNINSTALL) $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist
-
-uninstall_from_vendordirs ::
- $(NOECHO) $(UNINSTALL) $(VENDORARCHEXP)/auto/$(FULLEXT)/.packlist
-
-
-# --- MakeMaker force section:
-# Phony target to force checking subdirectories.
-FORCE:
- $(NOECHO) $(NOOP)
-
-
-# --- MakeMaker perldepend section:
-
-PERL_HDRS = \
- $(PERL_INC)/EXTERN.h \
- $(PERL_INC)/INTERN.h \
- $(PERL_INC)/XSUB.h \
- $(PERL_INC)/av.h \
- $(PERL_INC)/cc_runtime.h \
- $(PERL_INC)/config.h \
- $(PERL_INC)/cop.h \
- $(PERL_INC)/cv.h \
- $(PERL_INC)/dosish.h \
- $(PERL_INC)/embed.h \
- $(PERL_INC)/embedvar.h \
- $(PERL_INC)/fakethr.h \
- $(PERL_INC)/form.h \
- $(PERL_INC)/gv.h \
- $(PERL_INC)/handy.h \
- $(PERL_INC)/hv.h \
- $(PERL_INC)/intrpvar.h \
- $(PERL_INC)/iperlsys.h \
- $(PERL_INC)/keywords.h \
- $(PERL_INC)/mg.h \
- $(PERL_INC)/nostdio.h \
- $(PERL_INC)/op.h \
- $(PERL_INC)/opcode.h \
- $(PERL_INC)/patchlevel.h \
- $(PERL_INC)/perl.h \
- $(PERL_INC)/perlio.h \
- $(PERL_INC)/perlsdio.h \
- $(PERL_INC)/perlsfio.h \
- $(PERL_INC)/perlvars.h \
- $(PERL_INC)/perly.h \
- $(PERL_INC)/pp.h \
- $(PERL_INC)/pp_proto.h \
- $(PERL_INC)/proto.h \
- $(PERL_INC)/regcomp.h \
- $(PERL_INC)/regexp.h \
- $(PERL_INC)/regnodes.h \
- $(PERL_INC)/scope.h \
- $(PERL_INC)/sv.h \
- $(PERL_INC)/thrdvar.h \
- $(PERL_INC)/thread.h \
- $(PERL_INC)/unixish.h \
- $(PERL_INC)/util.h
-
-$(OBJECT) : $(PERL_HDRS)
-
-Megahal.c : $(XSUBPPDEPS)
-
-
-# --- MakeMaker makefile section:
-
-$(OBJECT) : $(FIRST_MAKEFILE)
-
-# We take a very conservative approach here, but it's worth it.
-# We move Makefile to Makefile.old here to avoid gnu make looping.
-$(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP)
- $(NOECHO) $(ECHO) "Makefile out-of-date with respect to $?"
- $(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..."
- $(NOECHO) $(RM_F) $(MAKEFILE_OLD)
- $(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD)
- -$(MAKE) -f $(MAKEFILE_OLD) clean $(DEV_NULL) || $(NOOP)
- $(PERLRUN) Makefile.PL "INSTALLDIRS=vendor"
- $(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <=="
- $(NOECHO) $(ECHO) "==> Please rerun the make command. <=="
- false
-
-
-
-# --- MakeMaker staticmake section:
-
-# --- MakeMaker makeaperl section ---
-MAP_TARGET = perl
-FULLPERL = /usr/bin/perl
-
-$(MAP_TARGET) :: static $(MAKE_APERL_FILE)
- $(MAKE) -f $(MAKE_APERL_FILE) $@
-
-$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
- $(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
- $(NOECHO) $(PERLRUNINST) \
- Makefile.PL DIR= \
- MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
- MAKEAPERL=1 NORECURS=1 CCCDLFLAGS= \
- INSTALLDIRS=vendor
-
-
-# --- MakeMaker test section:
-
-TEST_VERBOSE=0
-TEST_TYPE=test_$(LINKTYPE)
-TEST_FILE = test.pl
-TEST_FILES =
-TESTDB_SW = -d
-
-testdb :: testdb_$(LINKTYPE)
-
-test :: $(TEST_TYPE)
- $(NOECHO) $(ECHO) 'No tests defined for $(NAME) extension.'
-
-test_dynamic :: pure_all
-
-testdb_dynamic :: pure_all
- PERL_DL_NONLAZY=1 $(FULLPERLRUN) $(TESTDB_SW) "-I$(INST_LIB)" "-I$(INST_ARCHLIB)" $(TEST_FILE)
-
-test_ : test_dynamic
-
-test_static :: pure_all $(MAP_TARGET)
-
-testdb_static :: pure_all $(MAP_TARGET)
- PERL_DL_NONLAZY=1 ./$(MAP_TARGET) $(TESTDB_SW) "-I$(INST_LIB)" "-I$(INST_ARCHLIB)" $(TEST_FILE)
-
-
-
-# --- MakeMaker ppd section:
-# Creates a PPD (Perl Package Description) for a binary distribution.
-ppd:
- $(NOECHO) $(ECHO) '<SOFTPKG NAME="$(DISTNAME)" VERSION="0,01,0,0">' > $(DISTNAME).ppd
- $(NOECHO) $(ECHO) ' <TITLE>$(DISTNAME)</TITLE>' >> $(DISTNAME).ppd
- $(NOECHO) $(ECHO) ' <ABSTRACT>Perl extension for the Megahal conversation simulator library.</ABSTRACT>' >> $(DISTNAME).ppd
- $(NOECHO) $(ECHO) ' <AUTHOR>Laurent Fousse <laurent@internal.cyberhqz.com></AUTHOR>' >> $(DISTNAME).ppd
- $(NOECHO) $(ECHO) ' <IMPLEMENTATION>' >> $(DISTNAME).ppd
- $(NOECHO) $(ECHO) ' <OS NAME="$(OSNAME)" />' >> $(DISTNAME).ppd
- $(NOECHO) $(ECHO) ' <ARCHITECTURE NAME="i386-linux-thread-multi" />' >> $(DISTNAME).ppd
- $(NOECHO) $(ECHO) ' <CODEBASE HREF="" />' >> $(DISTNAME).ppd
- $(NOECHO) $(ECHO) ' </IMPLEMENTATION>' >> $(DISTNAME).ppd
- $(NOECHO) $(ECHO) '</SOFTPKG>' >> $(DISTNAME).ppd
-
-
-# --- MakeMaker pm_to_blib section:
-
-pm_to_blib: $(TO_INST_PM)
- $(NOECHO) $(PERLRUN) -MExtUtils::Install -e 'pm_to_blib({@ARGV}, '\''$(INST_LIB)/auto'\'', '\''$(PM_FILTER)'\'')'\
- Megahal.pm $(INST_LIB)/Megahal.pm
- $(NOECHO) $(TOUCH) $@
-
-# --- MakeMaker selfdocument section:
-
-
-# --- MakeMaker postamble section:
-
-
-# End.
|
|
|
@@ -1,153 +0,0 @@ - package Megahal;
-
-use 5.008;
-use strict;
-use warnings;
-use Carp;
-
-require Exporter;
-use AutoLoader;
-
-our @ISA = qw(Exporter);
-
-# Items to export into callers namespace by default. Note: do not export
-# names by default without a very good reason. Use EXPORT_OK instead.
-# Do not simply export all your public functions/methods/constants.
-
-# This allows declaration use Megahal ':all';
-# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
-# will save memory.
-our %EXPORT_TAGS = ( 'all' => [ qw(
- MEGAHAL_H
-) ] );
-
-our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
-
-our @EXPORT = qw(
- MEGAHAL_H
-);
-
-our $VERSION = '0.01';
-
-sub AUTOLOAD {
- # This AUTOLOAD is used to 'autoload' constants from the constant()
- # XS function.
-
- my $constname;
- our $AUTOLOAD;
- ($constname = $AUTOLOAD) =~ s/.*:://;
- croak "&Megahal::constant not defined" if $constname eq 'constant';
- my ($error, $val) = constant($constname);
- if ($error) { croak $error; }
- {
- no strict 'refs';
- # Fixed between 5.005_53 and 5.005_61
-#XXX if ($] >= 5.00561) {
-#XXX *$AUTOLOAD = sub () { $val };
-#XXX }
-#XXX else {
- *$AUTOLOAD = sub { $val };
-#XXX }
- }
- goto &$AUTOLOAD;
-}
-
-require XSLoader;
-XSLoader::load('Megahal', $VERSION);
-
-# Preloaded methods go here.
-
-# Autoload methods go after =cut, and are processed by the autosplit program.
-
-1;
-__END__
-# Below is stub documentation for your module. You'd better edit it!
-
-=head1 NAME
-
-Megahal - Perl extension for the Megahal conversation simulator library.
-
-=head1 SYNOPSIS
-
- use Megahal;
-
- Megahal::megahal_initialize();
- Megahal::megahal_do_reply(texte, log);
- Megahal::megahal_learn_no_reply(texte, log);
- Megahal::megahal_cleanup();
-
-=head1 ABSTRACT
-
- Megahal is a conversation simulator that learns as you talk to it.
- It uses a Markov Model to learn how to hold a conversation. It is
- possible to teach Meagahal to talk about new topics, and in
- different languages.
-
-=head1 DESCRIPTION
-
-=over
-
-=item megahal_initialize()
-
-Initialize megahal brain. Required before other functions are called.
-
-=item megahal_do_reply(text, log)
-
-Update the brain by feeding him the input B<text>. Logging is controlled via
-the B<log> boolean. Returns the answer of the bot.
-
-=item megahal_learn_no_reply()
-
-Same as above but without making a reply. Much faster and typically used in
-scripts for quick learning.
-
-=item megahal_cleanup()
-
-You need to call this function to save the brain, and finish Megahal.
-
-=back
-
-=head1 FILES
-
-Megahal looks for the following files in the current directory:
-
-=over
-
-=item megahal.brn
-
-Megahal brain.
-
-=item megahal.ban
-
-List of words which cannot be used as keywords.
-
-=item megahal.log
-
-Log file for errors.
-
-=item megahal.txt
-
-Log file for the conversation.
-
-=item megahal.swp
-
-Keyword translation for Megahal. If Megahal choose "why" as keyword and find a
-line containing "why because" in a line of this file then "why" gets translated
-in "because" in the reply.
-
-=head1 SEE ALSO
-
-http://megahal.sourceforge.net/
-
-=head1 AUTHOR
-
-This page was written by Laurent Fousse, E<lt>laurent@komite.netE<gt>.
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2003 by Jason Hutchens, David N. Welton and others.
-
-This library is free software; you can redistribute it and/or modify
-it under the GNU General Public Licence.
-
-=cut
|
|
@@ -1,33 +0,0 @@ - #include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
-
-#include "ppport.h"
-
-#include <megahal.h>
-
-#include "const-c.inc"
-
-MODULE = Megahal PACKAGE = Megahal
-
-INCLUDE: const-xs.inc
-
-void
-megahal_learn_no_reply(x, h)
- char *x
- int h
- PROTOTYPE: $$
-
-void
-megahal_initialize();
- PROTOTYPE:
-
-void
-megahal_cleanup();
- PROTOTYPE:
-
-char *
-megahal_do_reply(x, h)
- char *x
- int h
- PROTOTYPE: $$
|
|
@@ -1,38 +0,0 @@ - Megahal version 0.01
-====================
-
-The README is used to introduce the module and provide instructions on
-how to install the module, any machine dependencies it may have (for
-example C compilers and installed libraries) and any other information
-that should be provided before the module is installed.
-
-A README file is required for CPAN modules since CPAN extracts the
-README file from a module distribution so that people browsing the
-archive can use it get an idea of the modules uses. It is usually a
-good idea to provide version information here so that people can
-decide whether fixes for the module are worth downloading.
-
-INSTALLATION
-
-To install this module type the following:
-
- perl Makefile.PL
- make
- make test
- make install
-
-DEPENDENCIES
-
-This module requires these other modules and libraries:
-
- blah blah blah
-
-COPYRIGHT AND LICENCE
-
-Put the correct copyright and licence information here.
-
-Copyright (C) 2003 Laurent Fousse
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
|
|
@@ -1,65 +0,0 @@ - #define PERL_constant_NOTFOUND 1
-#define PERL_constant_NOTDEF 2
-#define PERL_constant_ISIV 3
-#define PERL_constant_ISNO 4
-#define PERL_constant_ISNV 5
-#define PERL_constant_ISPV 6
-#define PERL_constant_ISPVN 7
-#define PERL_constant_ISSV 8
-#define PERL_constant_ISUNDEF 9
-#define PERL_constant_ISUV 10
-#define PERL_constant_ISYES 11
-
-#ifndef NVTYPE
-typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */
-#endif
-#ifndef aTHX_
-#define aTHX_ /* 5.6 or later define this for threading support. */
-#endif
-#ifndef pTHX_
-#define pTHX_ /* 5.6 or later define this for threading support. */
-#endif
-
-static int
-constant (pTHX_ const char *name, STRLEN len, IV *iv_return) {
- /* Initially switch on the length of the name. */
- /* When generated this function returned values for the list of names given
- in this section of perl code. Rather than manually editing these functions
- to add or remove constants, which would result in this comment and section
- of code becoming inaccurate, we recommend that you edit this section of
- code, and use it to regenerate a new set of constant functions which you
- then use to replace the originals.
-
- Regenerate these constant functions by feeding this entire source file to
- perl -x
-
-#!/usr/bin/perl -w
-use ExtUtils::Constant qw (constant_types C_constant XS_constant);
-
-my $types = {map {($_, 1)} qw(IV)};
-my @names = (qw(MEGAHAL_H));
-
-print constant_types(); # macro defs
-foreach (C_constant ("Megahal", 'constant', 'IV', $types, undef, 3, @names) ) {
- print $_, "\n"; # C constant subs
-}
-print "#### XS Section:\n";
-print XS_constant ("Megahal", $types);
-__END__
- */
-
- switch (len) {
- case 9:
- if (memEQ(name, "MEGAHAL_H", 9)) {
-#ifdef MEGAHAL_H
- *iv_return = MEGAHAL_H;
- return PERL_constant_ISIV;
-#else
- return PERL_constant_NOTDEF;
-#endif
- }
- break;
- }
- return PERL_constant_NOTFOUND;
-}
-
|
|
@@ -1,88 +0,0 @@ - void
-constant(sv)
- PREINIT:
-#ifdef dXSTARG
- dXSTARG; /* Faster if we have it. */
-#else
- dTARGET;
-#endif
- STRLEN len;
- int type;
- IV iv;
- /* NV nv; Uncomment this if you need to return NVs */
- /* const char *pv; Uncomment this if you need to return PVs */
- INPUT:
- SV * sv;
- const char * s = SvPV(sv, len);
- PPCODE:
- /* Change this to constant(aTHX_ s, len, &iv, &nv);
- if you need to return both NVs and IVs */
- type = constant(aTHX_ s, len, &iv);
- /* Return 1 or 2 items. First is error message, or undef if no error.
- Second, if present, is found value */
- switch (type) {
- case PERL_constant_NOTFOUND:
- sv = sv_2mortal(newSVpvf("%s is not a valid Megahal macro", s));
- PUSHs(sv);
- break;
- case PERL_constant_NOTDEF:
- sv = sv_2mortal(newSVpvf(
- "Your vendor has not defined Megahal macro %s, used", s));
- PUSHs(sv);
- break;
- case PERL_constant_ISIV:
- EXTEND(SP, 1);
- PUSHs(&PL_sv_undef);
- PUSHi(iv);
- break;
- /* Uncomment this if you need to return NOs
- case PERL_constant_ISNO:
- EXTEND(SP, 1);
- PUSHs(&PL_sv_undef);
- PUSHs(&PL_sv_no);
- break; */
- /* Uncomment this if you need to return NVs
- case PERL_constant_ISNV:
- EXTEND(SP, 1);
- PUSHs(&PL_sv_undef);
- PUSHn(nv);
- break; */
- /* Uncomment this if you need to return PVs
- case PERL_constant_ISPV:
- EXTEND(SP, 1);
- PUSHs(&PL_sv_undef);
- PUSHp(pv, strlen(pv));
- break; */
- /* Uncomment this if you need to return PVNs
- case PERL_constant_ISPVN:
- EXTEND(SP, 1);
- PUSHs(&PL_sv_undef);
- PUSHp(pv, iv);
- break; */
- /* Uncomment this if you need to return SVs
- case PERL_constant_ISSV:
- EXTEND(SP, 1);
- PUSHs(&PL_sv_undef);
- PUSHs(sv);
- break; */
- /* Uncomment this if you need to return UNDEFs
- case PERL_constant_ISUNDEF:
- break; */
- /* Uncomment this if you need to return UVs
- case PERL_constant_ISUV:
- EXTEND(SP, 1);
- PUSHs(&PL_sv_undef);
- PUSHu((UV)iv);
- break; */
- /* Uncomment this if you need to return YESs
- case PERL_constant_ISYES:
- EXTEND(SP, 1);
- PUSHs(&PL_sv_undef);
- PUSHs(&PL_sv_yes);
- break; */
- default:
- sv = sv_2mortal(newSVpvf(
- "Unexpected return type %d while processing Megahal macro %s, used",
- type, s));
- PUSHs(sv);
- }
|
This file's diff was not loaded because this changeset is very large. Load changes Loading... |
|
|
@@ -1,132 +0,0 @@ - #ifndef MEGAHAL_H
-#define MEGAHAL_H 1
-
-/*===========================================================================*/
-
-/*
- * Copyright (C) 1998 Jason Hutchens
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the license or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the Gnu Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*===========================================================================*/
-
-/*
- * $Id: megahal.h,v 1.1 2003/08/26 12:49:16 lfousse Exp $
- *
- * File: megahal.h
- *
- * Program: MegaHAL
- *
- * Purpose: To simulate a natural language conversation with a psychotic
- * computer. This is achieved by learning from the user's
- * input using a third-order Markov model on the word level.
- * Words are considered to be sequences of characters separated
- * by whitespace and punctuation. Replies are generated
- * randomly based on a keyword, and they are scored using
- * measures of surprise.
- *
- * Author: Mr. Jason L. Hutchens
- *
- * WWW: http://megahal.sourceforge.net
- *
- * E-Mail: hutch@ciips.ee.uwa.edu.au
- *
- * Contact: The Centre for Intelligent Information Processing Systems
- * Department of Electrical and Electronic Engineering
- * The University of Western Australia
- * AUSTRALIA 6907
- *
- */
-
-/*===========================================================================*/
-
-/*===========================================================================*/
-
-
-/*===========================================================================*/
-
-#ifdef SUNOS
-extern double drand48(void);
-extern void srand48(long);
-#endif
-
-/*===========================================================================*/
-
-/*
- * $Log: megahal.h,v $
- * Revision 1.1 2003/08/26 12:49:16 lfousse
- * * Added the perl interface
- * * cleaned up the python interface a bit (but this
- * still need some work by a python "expert")
- * * Added a learn_no_reply function.
- *
- * Revision 1.6 2003/08/18 21:45:23 lfousse
- * Added megahal_learn_no_reply function for quick learning, and
- * corresponding python interface.
- *
- * Revision 1.5 2000/10/16 19:48:44 davidw
- * Moved docs to subdirectory.
- *
- * Added man page for 'library' interface.
- *
- * Revision 1.4 2000/09/07 21:51:12 davidw
- * Created some library functions that I think are workable, and moved
- * everything else into megahal.c as static variables/functions.
- *
- * Revision 1.3 2000/09/07 11:43:43 davidw
- * Started hacking:
- *
- * Reduced makefile targets, eliminating non-Linux OS's. There should be
- * a cleaner way to do this.
- *
- * Added Tcl and Python C level interfaces.
- *
- * Revision 1.2 1998/04/21 10:10:56 hutch
- * Fixed a few little errors.
- *
- * Revision 1.1 1998/04/06 08:02:01 hutch
- * Initial revision
- */
-
-/*===========================================================================*/
-
-/* public functions */
-
-
-
-void megahal_setnoprompt (void);
-void megahal_setnowrap (void);
-void megahal_setnobanner (void);
-
-void megahal_seterrorfile(char *filename);
-void megahal_setstatusfile(char *filename);
-
-void megahal_initialize(void);
-
-char *megahal_initial_greeting(void);
-
-int megahal_command(char *input);
-
-char *megahal_do_reply(char *input, int log);
-void megahal_learn_no_reply(char *input, int log);
-void megahal_output(char *output);
-char *megahal_input(char *prompt);
-
-void megahal_cleanup(void);
-
-/*===========================================================================*/
-
-#endif /* MEGAHAL_H */
|
|
|
@@ -1,540 +0,0 @@ -
-/* ppport.h -- Perl/Pollution/Portability Version 2.0002
- *
- * Automatically Created by Devel::PPPort on Tue Aug 19 19:52:35 2003
- *
- * Do NOT edit this file directly! -- Edit PPPort.pm instead.
- *
- * Version 2.x, Copyright (C) 2001, Paul Marquess.
- * Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
- * This code may be used and distributed under the same license as any
- * version of Perl.
- *
- * This version of ppport.h is designed to support operation with Perl
- * installations back to 5.004, and has been tested up to 5.8.0.
- *
- * If this version of ppport.h is failing during the compilation of this
- * module, please check if a newer version of Devel::PPPort is available
- * on CPAN before sending a bug report.
- *
- * If you are using the latest version of Devel::PPPort and it is failing
- * during compilation of this module, please send a report to perlbug@perl.com
- *
- * Include all following information:
- *
- * 1. The complete output from running "perl -V"
- *
- * 2. This file.
- *
- * 3. The name & version of the module you were trying to build.
- *
- * 4. A full log of the build that failed.
- *
- * 5. Any other information that you think could be relevant.
- *
- *
- * For the latest version of this code, please retreive the Devel::PPPort
- * module from CPAN.
- *
- */
-
-/*
- * In order for a Perl extension module to be as portable as possible
- * across differing versions of Perl itself, certain steps need to be taken.
- * Including this header is the first major one, then using dTHR is all the
- * appropriate places and using a PL_ prefix to refer to global Perl
- * variables is the second.
- *
- */
-
-
-/* If you use one of a few functions that were not present in earlier
- * versions of Perl, please add a define before the inclusion of ppport.h
- * for a static include, or use the GLOBAL request in a single module to
- * produce a global definition that can be referenced from the other
- * modules.
- *
- * Function: Static define: Extern define:
- * newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL
- *
- */
-
-
-/* To verify whether ppport.h is needed for your module, and whether any
- * special defines should be used, ppport.h can be run through Perl to check
- * your source code. Simply say:
- *
- * perl -x ppport.h *.c *.h *.xs foo/bar*.c [etc]
- *
- * The result will be a list of patches suggesting changes that should at
- * least be acceptable, if not necessarily the most efficient solution, or a
- * fix for all possible problems. It won't catch where dTHR is needed, and
- * doesn't attempt to account for global macro or function definitions,
- * nested includes, typemaps, etc.
- *
- * In order to test for the need of dTHR, please try your module under a
- * recent version of Perl that has threading compiled-in.
- *
- */
-
-
-/*
-#!/usr/bin/perl
-@ARGV = ("*.xs") if !@ARGV;
-%badmacros = %funcs = %macros = (); $replace = 0;
-foreach (<DATA>) {
- $funcs{$1} = 1 if /Provide:\s+(\S+)/;
- $macros{$1} = 1 if /^#\s*define\s+([a-zA-Z0-9_]+)/;
- $replace = $1 if /Replace:\s+(\d+)/;
- $badmacros{$2}=$1 if $replace and /^#\s*define\s+([a-zA-Z0-9_]+).*?\s+([a-zA-Z0-9_]+)/;
- $badmacros{$1}=$2 if /Replace (\S+) with (\S+)/;
-}
-foreach $filename (map(glob($_),@ARGV)) {
- unless (open(IN, "<$filename")) {
- warn "Unable to read from $file: $!\n";
- next;
- }
- print "Scanning $filename...\n";
- $c = ""; while (<IN>) { $c .= $_; } close(IN);
- $need_include = 0; %add_func = (); $changes = 0;
- $has_include = ($c =~ /#.*include.*ppport/m);
-
- foreach $func (keys %funcs) {
- if ($c =~ /#.*define.*\bNEED_$func(_GLOBAL)?\b/m) {
- if ($c !~ /\b$func\b/m) {
- print "If $func isn't needed, you don't need to request it.\n" if
- $changes += ($c =~ s/^.*#.*define.*\bNEED_$func\b.*\n//m);
- } else {
- print "Uses $func\n";
- $need_include = 1;
- }
- } else {
- if ($c =~ /\b$func\b/m) {
- $add_func{$func} =1 ;
- print "Uses $func\n";
- $need_include = 1;
- }
- }
- }
-
- if (not $need_include) {
- foreach $macro (keys %macros) {
- if ($c =~ /\b$macro\b/m) {
- print "Uses $macro\n";
- $need_include = 1;
- }
- }
- }
-
- foreach $badmacro (keys %badmacros) {
- if ($c =~ /\b$badmacro\b/m) {
- $changes += ($c =~ s/\b$badmacro\b/$badmacros{$badmacro}/gm);
- print "Uses $badmacros{$badmacro} (instead of $badmacro)\n";
- $need_include = 1;
- }
- }
-
- if (scalar(keys %add_func) or $need_include != $has_include) {
- if (!$has_include) {
- $inc = join('',map("#define NEED_$_\n", sort keys %add_func)).
- "#include \"ppport.h\"\n";
- $c = "$inc$c" unless $c =~ s/#.*include.*XSUB.*\n/$&$inc/m;
- } elsif (keys %add_func) {
- $inc = join('',map("#define NEED_$_\n", sort keys %add_func));
- $c = "$inc$c" unless $c =~ s/^.*#.*include.*ppport.*$/$inc$&/m;
- }
- if (!$need_include) {
- print "Doesn't seem to need ppport.h.\n";
- $c =~ s/^.*#.*include.*ppport.*\n//m;
- }
- $changes++;
- }
-
- if ($changes) {
- open(OUT,">/tmp/ppport.h.$$");
- print OUT $c;
- close(OUT);
- open(DIFF, "diff -u $filename /tmp/ppport.h.$$|");
- while (<DIFF>) { s!/tmp/ppport\.h\.$$!$filename.patched!; print STDOUT; }
- close(DIFF);
- unlink("/tmp/ppport.h.$$");
- } else {
- print "Looks OK\n";
- }
-}
-__DATA__
-*/
-
-#ifndef _P_P_PORTABILITY_H_
-#define _P_P_PORTABILITY_H_
-
-#ifndef PERL_REVISION
-# ifndef __PATCHLEVEL_H_INCLUDED__
-# include "patchlevel.h"
-# endif
-# ifndef PERL_REVISION
-# define PERL_REVISION (5)
- /* Replace: 1 */
-# define PERL_VERSION PATCHLEVEL
-# define PERL_SUBVERSION SUBVERSION
- /* Replace PERL_PATCHLEVEL with PERL_VERSION */
- /* Replace: 0 */
-# endif
-#endif
-
-#define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION)
-
-/* It is very unlikely that anyone will try to use this with Perl 6
- (or greater), but who knows.
- */
-#if PERL_REVISION != 5
-# error ppport.h only works with Perl version 5
-#endif /* PERL_REVISION != 5 */
-
-#ifndef ERRSV
-# define ERRSV perl_get_sv("@",FALSE)
-#endif
-
-#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5))
-/* Replace: 1 */
-# define PL_Sv Sv
-# define PL_compiling compiling
-# define PL_copline copline
-# define PL_curcop curcop
-# define PL_curstash curstash
-# define PL_defgv defgv
-# define PL_dirty dirty
-# define PL_dowarn dowarn
-# define PL_hints hints
-# define PL_na na
-# define PL_perldb perldb
-# define PL_rsfp_filters rsfp_filters
-# define PL_rsfpv rsfp
-# define PL_stdingv stdingv
-# define PL_sv_no sv_no
-# define PL_sv_undef sv_undef
-# define PL_sv_yes sv_yes
-/* Replace: 0 */
-#endif
-
-#ifdef HASATTRIBUTE
-# if defined(__GNUC__) && defined(__cplusplus)
-# define PERL_UNUSED_DECL
-# else
-# define PERL_UNUSED_DECL __attribute__((unused))
-# endif
-#else
-# define PERL_UNUSED_DECL
-#endif
-
-#ifndef dNOOP
-# define NOOP (void)0
-# define dNOOP extern int Perl___notused PERL_UNUSED_DECL
-#endif
-
-#ifndef dTHR
-# define dTHR dNOOP
-#endif
-
-#ifndef dTHX
-# define dTHX dNOOP
-# define dTHXa(x) dNOOP
-# define dTHXoa(x) dNOOP
-#endif
-
-#ifndef pTHX
-# define pTHX void
-# define pTHX_
-# define aTHX
-# define aTHX_
-#endif
-
-#ifndef UVSIZE
-# define UVSIZE IVSIZE
-#endif
-
-#ifndef NVTYPE
-# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
-# define NVTYPE long double
-# else
-# define NVTYPE double
-# endif
-typedef NVTYPE NV;
-#endif
-
-#ifndef INT2PTR
-
-#if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
-# define PTRV UV
-# define INT2PTR(any,d) (any)(d)
-#else
-# if PTRSIZE == LONGSIZE
-# define PTRV unsigned long
-# else
-# define PTRV unsigned
-# endif
-# define INT2PTR(any,d) (any)(PTRV)(d)
-#endif
-#define NUM2PTR(any,d) (any)(PTRV)(d)
-#define PTR2IV(p) INT2PTR(IV,p)
-#define PTR2UV(p) INT2PTR(UV,p)
-#define PTR2NV(p) NUM2PTR(NV,p)
-#if PTRSIZE == LONGSIZE
-# define PTR2ul(p) (unsigned long)(p)
-#else
-# define PTR2ul(p) INT2PTR(unsigned long,p)
-#endif
-
-#endif /* !INT2PTR */
-
-#ifndef boolSV
-# define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no)
-#endif
-
-#ifndef gv_stashpvn
-# define gv_stashpvn(str,len,flags) gv_stashpv(str,flags)
-#endif
-
-#ifndef newSVpvn
-# define newSVpvn(data,len) ((len) ? newSVpv ((data), (len)) : newSVpv ("", 0))
-#endif
-
-#ifndef newRV_inc
-/* Replace: 1 */
-# define newRV_inc(sv) newRV(sv)
-/* Replace: 0 */
-#endif
-
-/* DEFSV appears first in 5.004_56 */
-#ifndef DEFSV
-# define DEFSV GvSV(PL_defgv)
-#endif
-
-#ifndef SAVE_DEFSV
-# define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv))
-#endif
-
-#ifndef newRV_noinc
-# ifdef __GNUC__
-# define newRV_noinc(sv) \
- ({ \
- SV *nsv = (SV*)newRV(sv); \
- SvREFCNT_dec(sv); \
- nsv; \
- })
-# else
-# if defined(USE_THREADS)
-static SV * newRV_noinc (SV * sv)
-{
- SV *nsv = (SV*)newRV(sv);
- SvREFCNT_dec(sv);
- return nsv;
-}
-# else
-# define newRV_noinc(sv) \
- (PL_Sv=(SV*)newRV(sv), SvREFCNT_dec(sv), (SV*)PL_Sv)
-# endif
-# endif
-#endif
-
-/* Provide: newCONSTSUB */
-
-/* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */
-#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION < 63))
-
-#if defined(NEED_newCONSTSUB)
-static
-#else
-extern void newCONSTSUB(HV * stash, char * name, SV *sv);
-#endif
-
-#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
-void
-newCONSTSUB(stash,name,sv)
-HV *stash;
-char *name;
-SV *sv;
-{
- U32 oldhints = PL_hints;
- HV *old_cop_stash = PL_curcop->cop_stash;
- HV *old_curstash = PL_curstash;
- line_t oldline = PL_curcop->cop_line;
- PL_curcop->cop_line = PL_copline;
-
- PL_hints &= ~HINT_BLOCK_SCOPE;
- if (stash)
- PL_curstash = PL_curcop->cop_stash = stash;
-
- newSUB(
-
-#if (PERL_VERSION < 3) || ((PERL_VERSION == 3) && (PERL_SUBVERSION < 22))
- /* before 5.003_22 */
- start_subparse(),
-#else
-# if (PERL_VERSION == 3) && (PERL_SUBVERSION == 22)
- /* 5.003_22 */
- start_subparse(0),
-# else
- /* 5.003_23 onwards */
- start_subparse(FALSE, 0),
-# endif
-#endif
-
- newSVOP(OP_CONST, 0, newSVpv(name,0)),
- newSVOP(OP_CONST, 0, &PL_sv_no), /* SvPV(&PL_sv_no) == "" -- GMB */
- newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv))
- );
-
- PL_hints = oldhints;
- PL_curcop->cop_stash = old_cop_stash;
- PL_curstash = old_curstash;
- PL_curcop->cop_line = oldline;
-}
-#endif
-
-#endif /* newCONSTSUB */
-
-#ifndef START_MY_CXT
-
-/*
- * Boilerplate macros for initializing and accessing interpreter-local
- * data from C. All statics in extensions should be reworked to use
- * this, if you want to make the extension thread-safe. See ext/re/re.xs
- * for an example of the use of these macros.
- *
- * Code that uses these macros is responsible for the following:
- * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
- * 2. Declare a typedef named my_cxt_t that is a structure that contains
- * all the data that needs to be interpreter-local.
- * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
- * 4. Use the MY_CXT_INIT macro such that it is called exactly once
- * (typically put in the BOOT: section).
- * 5. Use the members of the my_cxt_t structure everywhere as
- * MY_CXT.member.
- * 6. Use the dMY_CXT macro (a declaration) in all the functions that
- * access MY_CXT.
- */
-
-#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \
- defined(PERL_CAPI) || defined(PERL_IMPLICIT_CONTEXT)
-
-/* This must appear in all extensions that define a my_cxt_t structure,
- * right after the definition (i.e. at file scope). The non-threads
- * case below uses it to declare the data as static. */
-#define START_MY_CXT
-
-#if (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION < 68 ))
-/* Fetches the SV that keeps the per-interpreter data. */
-#define dMY_CXT_SV \
- SV *my_cxt_sv = perl_get_sv(MY_CXT_KEY, FALSE)
-#else /* >= perl5.004_68 */
-#define dMY_CXT_SV \
- SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY, \
- sizeof(MY_CXT_KEY)-1, TRUE)
-#endif /* < perl5.004_68 */
-
-/* This declaration should be used within all functions that use the
- * interpreter-local data. */
-#define dMY_CXT \
- dMY_CXT_SV; \
- my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv))
-
-/* Creates and zeroes the per-interpreter data.
- * (We allocate my_cxtp in a Perl SV so that it will be released when
- * the interpreter goes away.) */
-#define MY_CXT_INIT \
- dMY_CXT_SV; \
- /* newSV() allocates one more than needed */ \
- my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
- Zero(my_cxtp, 1, my_cxt_t); \
- sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
-
-/* This macro must be used to access members of the my_cxt_t structure.
- * e.g. MYCXT.some_data */
-#define MY_CXT (*my_cxtp)
-
-/* Judicious use of these macros can reduce the number of times dMY_CXT
- * is used. Use is similar to pTHX, aTHX etc. */
-#define pMY_CXT my_cxt_t *my_cxtp
-#define pMY_CXT_ pMY_CXT,
-#define _pMY_CXT ,pMY_CXT
-#define aMY_CXT my_cxtp
-#define aMY_CXT_ aMY_CXT,
-#define _aMY_CXT ,aMY_CXT
-
-#else /* single interpreter */
-
-
-#define START_MY_CXT static my_cxt_t my_cxt;
-#define dMY_CXT_SV dNOOP
-#define dMY_CXT dNOOP
-#define MY_CXT_INIT NOOP
-#define MY_CXT my_cxt
-
-#define pMY_CXT void
-#define pMY_CXT_
-#define _pMY_CXT
-#define aMY_CXT
-#define aMY_CXT_
-#define _aMY_CXT
-
-#endif
-
-#endif /* START_MY_CXT */
-
-#ifndef IVdf
-# if IVSIZE == LONGSIZE
-# define IVdf "ld"
-# define UVuf "lu"
-# define UVof "lo"
-# define UVxf "lx"
-# define UVXf "lX"
-# else
-# if IVSIZE == INTSIZE
-# define IVdf "d"
-# define UVuf "u"
-# define UVof "o"
-# define UVxf "x"
-# define UVXf "X"
-# endif
-# endif
-#endif
-
-#ifndef NVef
-# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \
- defined(PERL_PRIfldbl) /* Not very likely, but let's try anyway. */
-# define NVef PERL_PRIeldbl
-# define NVff PERL_PRIfldbl
-# define NVgf PERL_PRIgldbl
-# else
-# define NVef "e"
-# define NVff "f"
-# define NVgf "g"
-# endif
-#endif
-
-#ifndef AvFILLp /* Older perls (<=5.003) lack AvFILLp */
-# define AvFILLp AvFILL
-#endif
-
-#ifdef SvPVbyte
-# if PERL_REVISION == 5 && PERL_VERSION < 7
- /* SvPVbyte does not work in perl-5.6.1, borrowed version for 5.7.3 */
-# undef SvPVbyte
-# define SvPVbyte(sv, lp) \
- ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \
- ? ((lp = SvCUR(sv)), SvPVX(sv)) : my_sv_2pvbyte(aTHX_ sv, &lp))
- static char *
- my_sv_2pvbyte(pTHX_ register SV *sv, STRLEN *lp)
- {
- sv_utf8_downgrade(sv,0);
- return SvPV(sv,*lp);
- }
-# endif
-#else
-# define SvPVbyte SvPV
-#endif
-
-#endif /* _P_P_PORTABILITY_H_ */
-
-/* End of File ppport.h */
|
Loading...