summaryrefslogtreecommitdiff
path: root/ext/Win32CORE
diff options
context:
space:
mode:
authorYitzchak Scott-Thoennes <sthoenna@efn.org>2007-02-19 17:50:18 -0800
committerSteve Hay <SteveHay@planit.com>2007-02-22 09:09:31 +0000
commit78ff2d7be71ff9f6811d8b05bb66c4c4707951ba (patch)
treea2013860b69217e66dd1332f49526b63ed76d5b8 /ext/Win32CORE
parent097911b5e678dd1e36060b9c7d2408b8eb887a7a (diff)
downloadperl-78ff2d7be71ff9f6811d8b05bb66c4c4707951ba.tar.gz
Re: Win32 modules & cygwin
From: "Yitzchak Scott-Thoennes" <sthoenna@efn.org> Message-ID: <1254.67.42.109.122.1171965018.squirrel@67.42.109.122> Also includes integration & deletion of win32/ext/Win32API to ext/Win32API, and addition of copyright message and corrections to spacing/tabbing as suggested by Jan Dubois. p4raw-id: //depot/perl@30379
Diffstat (limited to 'ext/Win32CORE')
-rw-r--r--ext/Win32CORE/Makefile.PL6
-rw-r--r--ext/Win32CORE/Win32CORE.c82
-rw-r--r--ext/Win32CORE/Win32CORE.pm26
-rw-r--r--ext/Win32CORE/t/win32core.t6
4 files changed, 120 insertions, 0 deletions
diff --git a/ext/Win32CORE/Makefile.PL b/ext/Win32CORE/Makefile.PL
new file mode 100644
index 0000000000..0fec3061be
--- /dev/null
+++ b/ext/Win32CORE/Makefile.PL
@@ -0,0 +1,6 @@
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ 'NAME' => 'Win32CORE',
+ 'VERSION_FROM' => 'Win32CORE.pm',
+);
diff --git a/ext/Win32CORE/Win32CORE.c b/ext/Win32CORE/Win32CORE.c
new file mode 100644
index 0000000000..8a56c3e21a
--- /dev/null
+++ b/ext/Win32CORE/Win32CORE.c
@@ -0,0 +1,82 @@
+/* Win32CORE.c
+ *
+ * Copyright (C) 2007 by Larry Wall and others
+ *
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Artistic License, as specified in the README file.
+ *
+ */
+
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+static void
+forward(pTHX_ const char *function)
+{
+ dXSARGS;
+ Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT, newSVpvn("Win32",5), newSVnv(0.27));
+ SPAGAIN;
+ PUSHMARK(SP-items);
+ call_pv(function, GIMME_V);
+}
+
+#define FORWARD(function) XS(w32_##function){ forward(aTHX_ "Win32::"#function); }
+FORWARD(GetCwd)
+FORWARD(SetCwd)
+FORWARD(GetNextAvailDrive)
+FORWARD(GetLastError)
+FORWARD(SetLastError)
+FORWARD(LoginName)
+FORWARD(NodeName)
+FORWARD(DomainName)
+FORWARD(FsType)
+FORWARD(GetOSVersion)
+FORWARD(IsWinNT)
+FORWARD(IsWin95)
+FORWARD(FormatMessage)
+FORWARD(Spawn)
+FORWARD(GetTickCount)
+FORWARD(GetShortPathName)
+FORWARD(GetFullPathName)
+FORWARD(GetLongPathName)
+FORWARD(CopyFile)
+FORWARD(Sleep)
+
+/* Don't forward Win32::SetChildShowWindow(). It accesses the internal variable
+ * w32_showwindow in thread_intern and is therefore not implemented in Win32.xs.
+ */
+/* FORWARD(SetChildShowWindow) */
+
+#undef FORWARD
+
+XS(boot_Win32CORE)
+{
+ dXSARGS;
+ char *file = __FILE__;
+
+ /* these names are Activeware compatible */
+ newXS("Win32::GetCwd", w32_GetCwd, file);
+ newXS("Win32::SetCwd", w32_SetCwd, file);
+ newXS("Win32::GetNextAvailDrive", w32_GetNextAvailDrive, file);
+ newXS("Win32::GetLastError", w32_GetLastError, file);
+ newXS("Win32::SetLastError", w32_SetLastError, file);
+ newXS("Win32::LoginName", w32_LoginName, file);
+ newXS("Win32::NodeName", w32_NodeName, file);
+ newXS("Win32::DomainName", w32_DomainName, file);
+ newXS("Win32::FsType", w32_FsType, file);
+ newXS("Win32::GetOSVersion", w32_GetOSVersion, file);
+ newXS("Win32::IsWinNT", w32_IsWinNT, file);
+ newXS("Win32::IsWin95", w32_IsWin95, file);
+ newXS("Win32::FormatMessage", w32_FormatMessage, file);
+ newXS("Win32::Spawn", w32_Spawn, file);
+ newXS("Win32::GetTickCount", w32_GetTickCount, file);
+ newXS("Win32::GetShortPathName", w32_GetShortPathName, file);
+ newXS("Win32::GetFullPathName", w32_GetFullPathName, file);
+ newXS("Win32::GetLongPathName", w32_GetLongPathName, file);
+ newXS("Win32::CopyFile", w32_CopyFile, file);
+ newXS("Win32::Sleep", w32_Sleep, file);
+ /* newXS("Win32::SetChildShowWindow", w32_SetChildShowWindow, file); */
+
+ XSRETURN_YES;
+}
diff --git a/ext/Win32CORE/Win32CORE.pm b/ext/Win32CORE/Win32CORE.pm
new file mode 100644
index 0000000000..979dd84644
--- /dev/null
+++ b/ext/Win32CORE/Win32CORE.pm
@@ -0,0 +1,26 @@
+package Win32CORE;
+
+$VERSION = '0.01';
+
+use strict;
+use warnings;
+use vars qw($VERSION @ISA);
+use base qw(Exporter DynaLoader);
+no warnings "redefine";
+
+bootstrap Win32CORE $VERSION;
+
+1;
+__END__
+=head1 NAME
+
+Win32CORE - Win32 CORE functions
+
+=head1 DESCRIPTION
+
+This library provides the functions marked as [CORE] in L<Win32>. See that
+document for usage information. In cygwin, as of 5.8.6 it is no longer
+necessary to use this module; the functions should be available even without
+C<use Win32CORE;> or C<-MWin32CORE>.
+
+=cut
diff --git a/ext/Win32CORE/t/win32core.t b/ext/Win32CORE/t/win32core.t
new file mode 100644
index 0000000000..2231530bdf
--- /dev/null
+++ b/ext/Win32CORE/t/win32core.t
@@ -0,0 +1,6 @@
+#!perl
+
+use Test;
+BEGIN { plan tests => 1 };
+use Win32CORE;
+ok(1);