see changelog

This commit is contained in:
Eddie Runia
1999-06-13 22:07:43 +00:00
parent b3086b46ad
commit f4ecd23436
4 changed files with 89 additions and 0 deletions

View File

@@ -1,3 +1,12 @@
19990613 23:00 CET Eddie Runia
* source/rtl/environ.c
__Run() added for Borland and DJGPP
+ tests/working/dosshell.prg
Only for DOS, OS/2 & Windows
+ tests/working/cmphello.prg
This file compiles hello. Also usuable for Linux / Unix, if the system()
command functions on their compilers :-)
19990613 16:35 CET Eddie Runia
* tests/working/strip.prg; tests/working/inherit.prg;
tests/working/dynobj.prg

View File

@@ -11,6 +11,7 @@
#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(__DJGPP__)
#include <dos.h>
#include <stdlib.h>
#endif
#ifdef __WATCOMC__
@@ -28,11 +29,13 @@
#endif
#endif
HARBOUR HB___RUN(void);
HARBOUR HB_GETENV(void);
HARBOUR HB_OS(void);
HARBOUR HB_VERSION(void);
static SYMBOL symbols[] = {
{ "__RUN" , FS_PUBLIC, HB___RUN , 0 },
{ "GETENV" , FS_PUBLIC, HB_GETENV , 0 },
{ "OS" , FS_PUBLIC, HB_OS , 0 },
{ "VERSION", FS_PUBLIC, HB_VERSION, 0 }
@@ -212,3 +215,41 @@ HARBOUR HB_GETENV(void)
else
_retc("");
}
/*
* $FunctionName$
* __RUN
* $Syntax$
* __RUN( <cCommand> )
* $Argument$
* <cCommand> Command to execute
* $Description$
* This command runs an external program. Please make sure that you have
* enough free memory to be able to run the external program.
* Do not use it to run Terminate and Stay Resident programs (in case of DOS)
* since it cause several problems
* $Examples$
* __Run( "edit "+cMyTextFile ) // Runs an external editor
* __Run( "command" ) // Gives a DOS shell (DOS only)
* $Files$
* source/rtl/environ.c
* Run an external program
* $See also$
* ErrorLevel() ?? // TO DO : Is this correct ?
*/
HARBOUR HB___RUN( void )
{
#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(__DJGPP__)
if( _pcount() == 1 ) /* Parameter passed */
{
system( _parc( 1 ) );
}
else
{
PHB_ITEM pError = _errNew();
_errPutDescription( pError, "RUN: Incorrect number of arguments" );
_errLaunch( pError );
_errRelease( pError );
}
#endif
}

View File

@@ -0,0 +1,19 @@
//
// Compile Hello
//
// This program compiles hello.prg
//
function Main()
local cOs := Upper( OS() )
QOut( "About to compile Hello.prg" )
QOut()
if at( "WINDOWS", cOs ) != 0 .or. at( "DOS", cOs ) != 0 .or. ;
at( "OS/2", cOs ) // OS/2, DOS, Windows version
__Run( "..\..\bin\harbour.exe hello.prg /gHRB" )
else // Unix / Linux version
__Run( "../../bin/harbour.exe hello.prg /gHRB" )
endif
QOut( "Finished compiling" )
return nil

View File

@@ -0,0 +1,20 @@
//NOTEST // It is very frustrating if this one is auto-tested
//
// DosShell
//
// This program shell to DOS
//
// Warning : DOS only
//
function Main()
local cOs := Upper( OS() )
if at( "WINDOWS", cOs ) != 0 .or. at( "DOS", cOs ) != 0
QOut( "About to shell to DOS.." )
__Run( GetEnv("COMSPEC") )
QOut( "Hey, I am back !" )
else
QOut( "Sorry this program is for Windows and DOS only" )
endif
return nil