Logtalk 2.28.2 files.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1712 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
pmoura
2006-11-07 18:11:49 +00:00
parent 36a326908c
commit 2d7ccc1278
168 changed files with 3143 additions and 1018 deletions

View File

@@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.27.1
Release 2.28.2
Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved.
=================================================================
@@ -8,17 +8,18 @@ Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved.
This directory contains several scripts used for Logtalk packaging,
installation, and integration with Prolog compilers. Those with extension
".sh" are shell scripts for MacOS X, Linux, and similar systems. Those with
extension ".js" are JScript command-line scripts for Windows; they require
WSH 5.6 or later version to be installed and should be run using cscript.exe
from a DOS shell command line.
".sh" are Bourne-compatible shells scripts for MacOS X, Linux, and similar
systems. Those with extension ".js" are JScript command-line scripts for
Windows; they require WSH 5.6 or later version to be installed and should
be run using cscript.exe from a DOS command line shell (you may download
WSH 5.6 from http://msdn.microsoft.com/downloads/list/webdev.asp)
lgt_install.sh
shell script for installing Logtalk in a system-wide location for Unix
and Unix-like operating systems (must be run from this directory by a
user with administration privileges); accepts as an optional argument
a prefix for the installation directory, default is /usr/local)
user with administration privileges; accepts as an optional argument
a prefix for the installation directory, default is /usr/local with
useful scripts written to /usr/local/bin that should be your path)
lgt_install.js
Windows 2000/XP JScript script for completing the Logtalk installation by
setting the LOGTALKHOME system environment variable and the LOGTALKUSER
@@ -36,6 +37,11 @@ logtalk.spec
(copy the Logtalk tarball to your RPM SOURCES directory and then
run the command: rpmbuild -ba --target=noarch-*-linux logtalk.spec)
logtalk.iss
Inno Setup GUI Windows installer script; you may compile it with Inno
Setup 5.1.6 or later version to produce a Windows 2000/XP GUI installer
(http://www.jrsoftware.org/isinfo.php)
cplgtdirs.sh
cplgtdirs.js
end-user scripts for copying the Logtalk user-modifiable files and
@@ -43,7 +49,7 @@ cplgtdirs.js
LOGTALKUSER (defaults to ~/logtalk on Unix-like operating-systems
and to My Documents\logtalk on Windows when the variable is not
defined); must be run by the end-user in order to ensure proper
permissions on the copied files
permissions for the copied files
cleandist.sh
script for cleaning a Logtalk distribution in preparation for packaging
@@ -100,13 +106,16 @@ make_sicstuslgt.sh
Prolog
make_sicstuslgt.js
makes a Windows shortcut named "Logtalk - SICStus Prolog" for running
Logtalk with SICStus Prolog 3.12 (if you are using a different version,
you must edit the reference to the registry key in the script)
Logtalk with SICStus Prolog 3.12 or 4.0 (if you are using a different
version, you must edit the reference to the registry key in the script)
make_swilgt.sh
makes a shell script named "swilgt" for running Logtalk with SWI-Prolog;
the script assumes that the SWI-Prolog executable is named "swipl" on
MacOS X and named "pl" on Linux and other similar operating systems
MacOS X and named "pl" on Linux and other similar operating systems;
with multi-threading support turned on, you will get an warmless message
when halting the system regarding threads that wouldn't die: you can
supress the message by using "% swilgt 2> /dev/null"
make_swilgt.js
makes a Windows shortcut named "Logtalk - SWI-Prolog" for running Logtalk
with SWI-Prolog
@@ -120,19 +129,18 @@ make_yaplgt.js
make_xsblgt.sh
makes a shell script named "xsblgt" for running Logtalk with XSB (the
first run of the "xsblgt" script must be made as root or using sudo; each
user will need to rename the file configs/xsb.config to configs/xsb.P
and make and edit a copy of the libpaths/libpaths.pl in order to replace
all occurrences of the LOGTALKUSER environment variable with its value;
the new file should also use the .P extension)
make_xsbcvslgt.sh
similar to the script above but for running Logtalk with the XSB CVS
version (each user will need to rename the file configs/xsbcvs.config
to configs/xsbcvs.P)
make_xsbcvslgt.js
similar to the script above but for running Logtalk with the XSB CVS
version (assumes that the XSB folder is installed in C:\Program Files;
edit the path to the "xsb.exe" executable in the script if necessary)
first run of the "xsblgt" script must be made as root or using sudo);
due to lack of XSB support for dealing with environment variables in
file paths, each user must set the environment variable LOGTALKUSER to
~/logtalk
make_xsblgt.js
makes a Windows shortcut named "Logtalk - XSB" for running Logtalk with
XSB (the first call to the shortcut must be made by a user with
administrative rights; assumes that XSB is installed in C:\, edit the
path to the "xsb.exe" executable in the script if necessary; each user
will need to edit the file libpaths/libpaths_no_env_var.pl in order to
replace all occurrences of the LOGTALKUSER environment variable with its
value)
makeall_lgt.sh
simple shell script for running all the make_*lgt.sh shell scripts in

View File

@@ -0,0 +1,53 @@
#!/bin/sh
## =================================================================
## Logtalk - Object oriented extension to Prolog
## Release 2.28.2
##
## Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved.
## =================================================================
echo
echo "Uninstalling Logtalk system-level files..."
echo
if ! [ "$LOGTALKHOME" ]
then
echo "The environment variable LOGTALKHOME must be defined first!"
echo
exit 1
fi
if ! [ -d "$LOGTALKHOME" ]; then
echo "The environment variable LOGTALKHOME points to a non-existing directory!"
echo "Its current value is: $LOGTALKHOME"
echo "The variable must be set to your Logtalk installation directory!"
echo
exit 1
fi
cd $LOGTALKHOME/..
rm -rf lgt2282
rm -f logtalk
if [ -d bin ]; then
cd bin
rm -f bplgt
rm -f ciaolgt
rm -f cplgtdirs
rm -f eclipselgt
rm -f gplgt
rm -f lgt2html
rm -f lgt2pdf
rm -f lgt2xml
rm -f plclgt
rm -f qplgt
rm -f sicstuslgt
rm -f swilgt
rm -f xsblgt
rm -f yaplgt
fi
echo "Logtalk system-level uninstall completed. For uninstalling user-level"
echo "Logtalk files simply delete the LOGTALKUSER directories."
echo

208
Logtalk/scripts/logtalk.iss Executable file
View File

@@ -0,0 +1,208 @@
; Script generated by the Inno Setup Script Wizard.
#define MyAppName "Logtalk"
#define MyAppVerName "Logtalk 2.28.2"
#define MyAppPublisher "Logtalk.org"
#define MyAppURL "http://logtalk.org"
#define MyAppUrlName "Logtalk Web Site.url"
#define MyAppRegURL "http://logtalk.org/regform.html"
#define MyAppRegUrlName "Logtalk Registration.url"
#define LOGTALKHOME "{reg:HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment,LOGTALKHOME|{pf}\Logtalk}"
#define LOGTALKUSER "{reg:HKCU\Environment,LOGTALKUSER|{userdocs}\Logtalk}"
[Setup]
AppName={#MyAppName}
AppVerName={#MyAppVerName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
ChangesEnvironment=yes
DefaultDirName={#LOGTALKHOME}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
LicenseFile=C:\logtalk\LICENSE.txt
InfoBeforeFile=C:\logtalk\README.txt
OutputBaseFilename=lgt2282
Compression=lzma
SolidCompression=yes
VersionInfoVersion=2.28.2
VersionInfoCopyright=<3D> Paulo Moura, 1998-2006
AllowRootDirectory=yes
UninstallFilesDir="{userdocs}\Logtalk uninstaller"
MinVersion=0,5.0
[Types]
Name: "full"; Description: "Full installation (recommended)"
Name: "base"; Description: "Base system installation"
Name: "user"; Description: "User data files installation (must be run by all end-users)"
Name: "prolog"; Description: "Prolog integration (see documentation for compatibility details)"
Name: "custom"; Description: "Custom installation"; Flags: iscustom
[Components]
Name: "base"; Description: "Base system"; Types: full base custom; Flags: disablenouninstallwarning
Name: "user"; Description: "User data files"; Types: full user custom; Flags: checkablealone disablenouninstallwarning
Name: "user\backup"; Description: "Backup current user data files"; Types: full user custom; Flags: disablenouninstallwarning
Name: "prolog"; Description: "Prolog integration"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\bp"; Description: "B-Prolog integration (version 6.9 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\ciao"; Description: "Ciao Prolog integration (version 1.10#5 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\eclipse"; Description: "ECLiPSe integration (version 5.10#26 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\gprolog"; Description: "GNU Prolog integration (version 1.2.16 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\plc"; Description: "K-Prolog integration (version 5.1.4 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\sicstus"; Description: "SICStus Prolog integration (versions 3.12.x, 4.0)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\swi"; Description: "SWI-Prolog integration (version 5.6.16 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\xsb"; Description: "XSB integration (version 3.0 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\yap"; Description: "YAP integration (version 5.1.1 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
[Tasks]
Name: registration; Description: "&Register {#MyAppName} (opens a web page; requires an Internet connection)"; Components: base user
Name: shortcut; Description: "&Create a desktop shortcut to the Logtalk user folder"; Components: user
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Messages]
BeveledLabel=Logtalk 2.28.2 <20> Paulo Moura, 1998-2006
[Dirs]
Name: {code:GetLgtUserDir}; Components: user; Flags: uninsneveruninstall
Name: "{userdocs}\Logtalk uninstaller"
[Files]
Source: "C:\logtalk\*"; Excludes: ".*,CVS"; DestDir: "{app}"; Components: base; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\logtalk\configs\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\configs"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "C:\logtalk\contributions\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\contributions"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "C:\logtalk\examples\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\examples"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "C:\logtalk\libpaths\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\libpaths"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "C:\logtalk\library\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\library"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "C:\logtalk\xml\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\xml"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "C:\logtalk\configs\xsb.config"; DestDir: "{code:GetLgtUserDir}\configs"; DestName: "xsb.pl"; Components: user; Flags: ignoreversion uninsneveruninstall
Source: "C:\logtalk\libpaths\libpaths.pl"; DestDir: "{code:GetLgtUserDir}\libpaths"; DestName: "libpaths_no_env_var.pl"; Components: user; Flags: ignoreversion uninsneveruninstall
Source: "C:\logtalk\scripts\*.bat"; DestDir: "{win}"; Components: base; Flags: ignoreversion
Source: "C:\logtalk\xml\*.bat"; DestDir: "{win}"; Components: base; Flags: ignoreversion
[INI]
Filename: "{app}\{#MyAppUrlName}"; Section: "InternetShortcut"; Key: "URL"; String: "{#MyAppURL}"; Components: base
Filename: "{app}\{#MyAppRegUrlName}"; Section: "InternetShortcut"; Key: "URL"; String: "{#MyAppRegURL}"; Components: base
[Icons]
Name: "{group}\{#MyAppName} Bibliography"; Filename: "{app}\BIBLIOGRAPHY.bib"; Components: base
Name: "{group}\{#MyAppName} Documentation"; Filename: "{app}\manuals\index.html"; Components: base
Name: "{group}\{#MyAppName} License"; Filename: "{app}\LICENSE.txt"; Components: base
Name: "{group}\{#MyAppName} Release Notes"; Filename: "{app}\RELEASE_NOTES.txt"; Components: base
Name: "{group}\{#MyAppName} Read Me"; Filename: "{app}\README.txt"; Components: base
Name: "{group}\{#MyAppName} Customization instructions"; Filename: "{app}\CUSTOMIZE.txt"; Components: base
Name: "{group}\{#MyAppName} Web Site"; Filename: "{app}\{#MyAppUrlName}"; Components: base
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; Components: base
Name: "{code:GetLgtUserDir}\manuals"; Filename: "{app}\manuals"; Components: user
Name: "{code:GetLgtUserDir}\wenv"; Filename: "{app}\wenv"; Components: user
Name: "{userdesktop}\Logtalk user files"; Filename: "{code:GetLgtUserDir}"; Components: user; Tasks: shortcut
[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "LOGTALKHOME"; ValueData: "{app}"; Components: base; Flags: deletevalue uninsdeletevalue
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "LOGTALKUSER"; ValueData: "{code:GetLgtUserDir}"; Flags: deletevalue uninsdeletevalue
[Run]
Filename: "{cmd}"; Parameters: "/C set LOGTALKHOME={app} & cscript ""{app}\scripts\make_bplgt.js"""; Description: "B-Prolog integration"; Components: prolog\bp
Filename: "{cmd}"; Parameters: "/C set LOGTALKHOME={app} & cscript ""{app}\scripts\make_ciaolgt.js"""; Description: "Ciao Prolog integration"; Components: prolog\ciao
Filename: "{cmd}"; Parameters: "/C set LOGTALKHOME={app} & cscript ""{app}\scripts\make_eclipselgt.js"""; Description: "ECLiPSe integration"; Components: prolog\eclipse
Filename: "{cmd}"; Parameters: "/C set LOGTALKHOME={app} & cscript ""{app}\scripts\make_gplgt.js"""; Description: "GNU Prolog integration"; Components: prolog\gprolog
Filename: "{cmd}"; Parameters: "/C set LOGTALKHOME={app} & cscript ""{app}\scripts\make_plclgt.js"""; Description: "K-Prolog integration"; Components: prolog\plc
Filename: "{cmd}"; Parameters: "/C set LOGTALKHOME={app} & cscript ""{app}\scripts\make_sicstuslgt.js"""; Description: "SICStus Prolog integration"; Components: prolog\sicstus
Filename: "{cmd}"; Parameters: "/C set LOGTALKHOME={app} & cscript ""{app}\scripts\make_swilgt.js"""; Description: "SWI-Prolog integration"; Components: prolog\swi
Filename: "{cmd}"; Parameters: "/C set LOGTALKHOME={app} & cscript ""{app}\scripts\make_xsblgt.js"""; Description: "XSB integration"; Components: prolog\xsb
Filename: "{cmd}"; Parameters: "/C set LOGTALKHOME={app} & cscript ""{app}\scripts\make_yaplgt.js"""; Description: "YAP integration"; Components: prolog\yap
Filename: "{app}\RELEASE_NOTES.txt"; Description: "View the release notes"; Components: base user; Flags: postinstall shellexec skipifsilent
Filename: "{app}\CUSTOMIZE.txt"; Description: "Read the customization instructions for completing your setup"; Components: base user; Flags: postinstall shellexec skipifsilent
Filename: "{app}\{#MyAppRegUrlName}"; Flags: shellexec nowait; Tasks: registration
[UninstallDelete]
Type: filesandordirs; Name: "{app}"; Components: base
Type: filesandordirs; Name: "{group}"; Components: base
[Code]
var
LgtUserDirPage: TInputDirWizardPage;
WarningPage: TOutputMsgWizardPage;
Explanation, Warning, Scripts: String;
procedure InitializeWizard;
begin
Explanation := 'Select the folder in which Setup should install Logtalk user data files, then click Next.'
+ Chr(13) + Chr(13)
+ 'These files allows each user to independently customize Logtalk and to freely modify the provided programming examples.'
+ Chr(13) + Chr(13)
+ 'A copy of these files must exist in the user home folder in order to use the Logtalk-Prolog integration scripts available from the Start Menu.'
+ Chr(13) + Chr(13)
+ 'Addtional end-users may use this installer to make a copy of these files on their home folders after a full installation of Logtalk.';
LgtUserDirPage := CreateInputDirPage(wpSelectDir,
'Select folder for Logtalk user data files', 'Where should Logtalk user data files be installed?',
Explanation,
False, 'New Folder');
LgtUserDirPage.Add('');
LgtUserDirPage.Values[0] := ExpandConstant('{#LOGTALKUSER}');
if not IsAdminLoggedOn then
begin
Warning := 'Full installation of Logtalk requires an administrative user.'
+ Chr(13) + Chr(13)
+ 'If the base Logtalk system is already installed, you may proceed in order to setup Logtalk for you as an end-user.'
+ Chr(13) + Chr(13)
+ 'If Logtalk is already set for you, this installer will make a backup copy of your current files (if you choose the same installation folder) and will restore all user data files to their default, pristine state.';
WarningPage := CreateOutputMsgPage(wpWelcome,
'Information', 'Please read the following important information before continuing.', Warning);
end
end;
function GetLgtUserDir(Param: String): String;
begin
Result := LgtUserDirPage.Values[0]
end;
function GetCurrentDate(Param: String): String;
begin
Result := GetDateTimeString('dddddd tt', '-', '-')
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
if (PageID = wpSelectDir) and not IsAdminLoggedOn then
Result := True
else if (PageID = wpSelectComponents) and not IsAdminLoggedOn then
begin
WizardForm.TypesCombo.ItemIndex := 2;
WizardForm.TypesCombo.OnChange(nil);
Result := True
end
else if (PageID = wpReady) and not IsAdminLoggedOn then
Result := True
else
Result := False;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep = ssInstall) and DirExists(LgtUserDirPage.Values[0]) and (pos('backup', WizardSelectedComponents(False)) > 0) then
RenameFile(LgtUserDirPage.Values[0], LgtUserDirPage.Values[0] + ' backup ' + GetDateTimeString('dddddd tt', '-', '-'));
if (CurStep = ssInstall) and (pos('prolog', WizardSelectedComponents(False)) > 0) then
begin
Scripts := 'The installer needs to run a set of JScripts scripts within command shells' + Chr(13) +
'in order to integrate Logtalk with your installed Prolog compilers.' + Chr(13) + Chr(13) +
'These scripts require WSH 5.6 (or later version) to be installed.' + Chr(13) + Chr(13) +
'Make sure that any security software you may have installed do not block' + Chr(13) +
'the execution of the scripts.';
MsgBox(Scripts, mbInformation, MB_OK)
end
end;

Binary file not shown.

63
Logtalk/scripts/make_bplgt.sh Executable file
View File

@@ -0,0 +1,63 @@
#!/bin/sh
## =================================================================
## Logtalk - Object oriented extension to Prolog
## Release 2.28.2
##
## Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved.
## =================================================================
echo
echo "Creating a script named bplgt for running Logtalk with B-Prolog ..."
echo
if ! [ "$LOGTALKHOME" ]
then
echo "The environment variable LOGTALKHOME must be defined first!"
echo
exit 1
fi
if ! [ -d "$LOGTALKHOME" ]; then
echo "The environment variable LOGTALKHOME points to a non-existing directory!"
echo "Its current value is: $LOGTALKHOME"
echo "The variable must be set to your Logtalk installation directory!"
echo
exit 1
fi
if [ -z "$1" ]; then
prefix=/usr/local
else
prefix="$1"
fi
if ! [ -d "$prefix" ]; then
echo "Directory prefix does not exist!"
echo
exit 1
fi
cd "$LOGTALKHOME"
mkdir -p bin
cd bin
eval bp -g "\"set_prolog_flag(redefined, off), compile('../compiler/logtalk.pl').\""
mv ../compiler/logtalk.pl.out .
echo ":- set_prolog_flag(redefined, off)." > logtalk_bp.pl
echo ":- compile('\$LOGTALKUSER/configs/b.config')." >> logtalk_bp.pl
echo ":- load('\$LOGTALKUSER/configs/b.config')." >> logtalk_bp.pl
echo ":- load('\$LOGTALKHOME/bin/logtalk.pl')." >> logtalk_bp.pl
echo ":- compile('\$LOGTALKUSER/libpaths/libpaths.pl')." >> logtalk_bp.pl
echo ":- load('\$LOGTALKUSER/libpaths/libpaths.pl')." >> logtalk_bp.pl
echo "#/bin/sh" > bplgt
echo "bp -g \"consult('\\\$LOGTALKHOME/bin/logtalk_bp.pl'), \\\$bp_top_level\"" >> bplgt
chmod a+x bplgt
ln -sf $LOGTALKHOME/bin/bplgt $prefix/bin/bplgt
echo "Done. A link to the script was been created in $prefix/bin."
echo
echo "Users should ensure that the environment variables LOGTALKHOME"
echo "and LOGTALKUSER are defined and then run the \"cplgtdirs\" script"
echo "once prior to using the bplgt script."
echo

View File

@@ -0,0 +1,111 @@
// =================================================================
// Logtalk - Object oriented extension to Prolog
// Release 2.28.2
//
// Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved.
// =================================================================
if (ScriptEngineMajorVersion() < 5 || ScriptEngineMajorVersion() == 5 && ScriptEngineMinorVersion() < 6) {
WScript.Echo('Error! WSH 5.6 or later version needed for running this script.');
WScript.Quit(1);
}
var prolog_path = "C:\\XSB\\config\\x86-pc-windows\\bin\\xsb.exe";
if (WScript.Arguments.Unnamed.Length > 0) {
usage_help();
WScript.Quit(0);
}
WScript.Echo('');
WScript.Echo('Creating a shortcut named "Logtalk - XSB" for running Logtalk');
WScript.Echo('with XSB...');
WScript.Echo('');
var FSObject = new ActiveXObject("Scripting.FileSystemObject");
if (!FSObject.FileExists(prolog_path)) {
WScript.Echo("Error! Cannot find xsb.exe at the expected place!");
WScript.Echo("Please edit the script and update the location of the xsb.exe executable.");
WScript.Quit(1);
}
var WshShell = new ActiveXObject("WScript.Shell");
var WshSystemEnv = WshShell.Environment("SYSTEM");
var WshUserEnv = WshShell.Environment("USER");
var logtalk_home;
if (WshSystemEnv.Item("LOGTALKHOME"))
logtalk_home = WshSystemEnv.Item("LOGTALKHOME");
else if (WshUserEnv.Item("LOGTALKHOME"))
logtalk_home = WshUserEnv.Item("LOGTALKHOME")
else {
WScript.Echo("Error! The environment variable LOGTALKHOME must be defined first!");
usage_help();
WScript.Quit(1);
}
if (!FSObject.FolderExists(logtalk_home)) {
WScript.Echo("The environment variable LOGTALKHOME points to a non-existing directory!");
WScript.Echo("Its current value is: %LOGTALKHOME%");
WScript.Echo("The variable must be set to your Logtalk installation directory!");
WScript.Echo("");
usage_help();
WScript.Quit(1);
}
logtalk_home = logtalk_home.replace(/\\/g, "\\\\");
if (!FSObject.FolderExists(logtalk_home + "\\bin"))
FSObject.CreateFolder(logtalk_home + "\\bin");
var f = FSObject.CreateTextFile(logtalk_home + "\\bin\\logtalk_xsb.pl", true);
f.WriteLine(":- expand_filename('configs/xsb.pl', Path), reconsult(Path).");
f.WriteLine(":- reconsult('" + logtalk_home + "\\\\compiler\\\\logtalk.pl').");
f.WriteLine(":- expand_filename('libpaths/libpaths_no_env_var.pl', Path), reconsult(Path).");
f.Close();
var ProgramsPath = WshShell.SpecialFolders("AllUsersPrograms");
if (!FSObject.FolderExists(ProgramsPath + "\\Logtalk"))
FSObject.CreateFolder(ProgramsPath + "\\Logtalk");
var link = WshShell.CreateShortcut(ProgramsPath + "\\Logtalk\\Logtalk - XSB.lnk");
link.Arguments = "-l -e \"reconsult('%LOGTALKHOME%\\\\bin\\\\logtalk_xsb.pl').\"";
link.Description = "Runs Logtalk with XSB";
link.IconLocation = "app.exe,1";
link.TargetPath = prolog_path;
link.WindowStyle = 1;
link.WorkingDirectory = "%LOGTALKUSER%";
link.Save();
WScript.Echo('Done. The "Logtalk - XSB" shortcut was been added to the Start Menu');
WScript.Echo('Programs. Make sure that the environment variables LOGTALKHOME and');
WScript.Echo('LOGTALKUSER are defined for all users wishing to use the shortcut.');
WScript.Echo('');
WScript.Echo('The first call to the shortcut must be made by a user with');
WScript.Echo('administrative rights.');
WScript.Echo('');
WScript.Echo('Users must run the batch script "cplgtdirs" before using the');
WScript.Echo('"Logtalk - XSB" shortcut. Users must edit the contents of the');
WScript.Echo('"libpaths_no_env_var.pl" file on the "libpaths" directory in order');
WScript.Echo('to replace all occurrences of the LOGTALKUSER environment variable');
WScript.Echo('by its value.');
WScript.Echo('');
WScript.Quit(0);
function usage_help() {
WScript.Echo('');
WScript.Echo('This script creates a shortcut named "Logtalk - XSB" for running Logtalk');
WScript.Echo('with XSB. The script must be run by a user with administrative rights.');
WScript.Echo('The LOGTALKHOME environment variable must be defined before running this');
WScript.Echo('script.');
WScript.Echo('');
WScript.Echo('Usage:');
WScript.Echo(' ' + WScript.ScriptName + ' help');
WScript.Echo(' ' + WScript.ScriptName);
WScript.Echo('');
}