>> Finally I don't understand {shell} and {ext}. Why should 
>> these be specified by users on a per configuration bases?
>> 
>> HBIDE should be able to detect shell, and configure 
>> everything automatically. No need to add an extra layer 
>> of abstraction on that IMO.
>> 
> 
> {hbmk2} -plat=whatever -env:<something> <...>
> {hbmk2} -comp=bcc
> {hbmk2}
> 
> So now hbIDE have to deal with these components:
> {hbmk2}      To be place in .hbp
> {shell}         To be invoked
> {ext}           To have {contents} file this extension
> {contents}   To be placed in shell specific file.
> 
> You have simplified my task. Thank you.

You're welcome. Please consider dropping {shell} and {ext}.

Here is sample code. This won't consider such exotic 
case as running hbide from msys (or similar) shell, but 
that seems a slightly pervert thing to do anyway, so:

---
#include "fileio.ch"

FUNCTION RunShell( aCmd )
LOCAL cShellCmd
LOCAL cExt
LOCAL cPrefix
LOCAL fhnd
LOCAL cCmdFileName
LOCAL cCmdFile
LOCAL tmp

#if   defined( __PLATFORM__WINDOWS )
   cShellCmd := hb_getenv( "COMSPEC" ) + " /C "
   cExt := ".bat"
   cPrefix := ""
#elif defined( __PLATFORM__OS2 )
   cShellCmd := hb_getenv( "COMSPEC" ) + " /C "
   cExt := ".cmd"
   cPrefix := ""
#elif defined( __PLATFORM__UNIX )
   cShellCmd := ""
   cExt := ".sh"
   cPrefix := "#!/bin/sh" + hb_osNewLine()
#endif

IF ! Empty( cExt )

   cCmdFile := cPrefix
   FOR EACH tmp IN aCmd
      cCmdFile += tmp + hb_osNewLine()
   NEXT

   IF ( fhnd := hb_FTempCreateEx( @cCmdFileName, NIL, NIL, cExt ) ) != F_ERROR
      FWrite( fhnd, cCmdFile )
      FClose( fhnd )
      hb_processrun( cShellCmd + cCmdFileName )
      FErase( cCmdFileName )
   ENDIF
ENDIF
---

(I didn't test it, especially not on *nix, but I hope you get the idea)

Brgds,
Viktor

_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to