Files
harbour-core/harbour/contrib/hbnf/tempfile.prg
Przemyslaw Czerpak 16f9a67e9f 2008-12-02 11:27 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/xhb/Makefile
  * harbour/contrib/xhb/common.mak
  + harbour/contrib/xhb/xhbarr.c
    + added aSplice(), aRemove() and aMerge() functions - code borrowed
      from xHarbour by Ron Pinkas.
    ! fixed GPF trap in these functions

  * harbour/contrib/xhb/xhbfunc.c
    + added CSTR()

  * harbour/contrib/xhb/hbcompat.ch
    ! changed name of xHarbour include files - they where changed few
      months ago and now they are the same as in Harbour.
      To xHarbour users: please update hbcompat.ch in xHarbour CVS

  * harbour/contrib/xhb/filestat.c
    ! fixed UNICODE compilation

  * harbour/contrib/xhb/hblognet.prg
  * harbour/contrib/xhb/hblog.prg
    * formatting

  * harbour/contrib/hbnf/tempfile.prg
    ! do not use HB_ISBYREF() .prg function - this function does not
      exist in Harbour and does not work correctly in xHarbour

  * harbour/include/hbapiitm.h
  * harbour/source/vm/macro.c
  * harbour/source/vm/codebloc.c
  * harbour/source/vm/hashes.c
  * harbour/source/vm/garbage.c
  * harbour/source/vm/itemapi.c
  * harbour/source/vm/memvars.c
    * cleanup

  * harbour/contrib/gtwvg/Makefile
    ! fixed typo

  * harbour/contrib/gtwvg/hbgtwvg.ch
    * added new line at the end of file and changed non ANSI C // comments
      to /* */ - this file is included by C code too.

  * harbour/contrib/gtwvg/wvgwin.c
  * harbour/contrib/gtwvg/wincallb.c
    * pacified some warnings and fixed possible access to uninitialized data

  * harbour/source/compiler/harbour.y
  * harbour/source/compiler/harbour.yyc
    ! fixed possible double freeing of memory blocks in #line directives
      TOMERGE[1.0]

  * harbour/common.mak
  * harbour/source/compiler/hbmain.c
  + harbour/source/compiler/compi18n.c
    * moved hb_compI18n*() functions to separate file covered by GPL with
      Harbour exception - Thank to Mindaugas

  * harbour/include/hbcomp.h
  * harbour/include/hbcompdf.h
  * harbour/include/hbexpra.c
  * harbour/include/hbexprop.h
  * harbour/include/hbexprb.c
  * harbour/source/common/expropt1.c
  * harbour/source/compiler/Makefile
  * harbour/source/compiler/ppcomp.c
    * added support for plural forms:
         hb_i18n_ngettext[_noop|_strict]( <nExp>, <cText> | <acText> ;
                                          [, <cContext> )
      <acText> is accepted only as array of literal strings even if
      _strict suffix is missing - if it's a problem then we can change it.
      hb_i18n_ngettext_noop() is reduced only when it has valid parameters
      The default plural index expression used for reduction at compile
      time is: iif( <nExp> == 1, 1, 2 )
      If second parameter of hb_i18n_ngettext_noop() is <cText> or <acText>
      length is 1 then it's reduced to <cText> or acText[1] else if second
      parameter is <acText> with more then 1 item then it's reduced to
         <acText>[ iif( <nExp> == 1, 1, 2 ) ]
      and if <nExp> is literal numeric expression is farther reduced to
      given array item. Otherwise is not reduced and warning is generated.
      The plural forms in .pot files are generated as:
         msgid ""
         msgid_plural ""
         msgid_plural2 ""
         [...]
         msgid_pluralN ""
         msgstr[0] ""
      Then real message ID is only msgid (with context if any) and
      msgid_plural* is used only for information. When the same msgid
      is used more then once in different hb_i18n_ngettext*() calls then
      plural messages are merged.
      Please remember that for strict gettext compatibility only two plural
      forms are allowed.
    * extended i18n warnings for simple types validation, f.e.:
         hb_i18n_gettext( .t. )
    * do not generate empty .pot file when source code does not contain any
      hb_i18n_*() functions
    * store in .pot files references to real source file names with paths
      respecting #include directives
    * use hb_compIdentifierNew() to hash i18n messages at compile time
    ! fixed possible bad escape encoding of i18n strings
    + added support to control -j[01] flag using #pragma directive

      Before I'll begin to work on runtime support please test these
      modifications and inform me about problems you can see with the
      above version and missing functionality.
2008-12-02 10:26:51 +00:00

181 lines
4.5 KiB
Plaintext

/*
* $Id$
*/
/*
* File......: tempfile.prg
* Author....: Glenn Scott
* CIS ID....: 71620,1521
*
* This is an original work by Glenn Scott and is placed in the
* public domain.
*
* Modification history:
* ---------------------
*
* Rev 1.7 28 Sep 1992 23:48:48 GLENN
* Deleted #define for FLAG_CARRY as Toolkit v2.1's ftint86.ch has it.
*
* Rev 1.6 03 Oct 1991 18:36:28 GLENN
* Tim Wong from Nantucket pointed out that this DOS function actually
* leaves a file handle in AX. In order to preserve the functionality,
* I now fclose() that handle if the call is succsessful.
*
* Rev 1.5 15 Aug 1991 23:05:04 GLENN
* Forest Belt proofread/edited/cleaned up doc
*
* Rev 1.4 17 Jul 1991 22:11:18 GLENN
* Stripped off chr(0)s in the return value (aRegs[DS])
*
* Rev 1.3 03 Jul 1991 01:08:08 GLENN
* Changed one line in FT_TEST driver ( cHide == "Y" )
*
* Rev 1.2 14 Jun 1991 19:53:10 GLENN
* Minor edit to file header
*
* Rev 1.1 12 Jun 1991 02:45:40 GLENN
* Documentation mods, and convert to new ft_int86() syntax, return value.
*
* Rev 1.0 01 Apr 1991 01:02:24 GLENN
* Nanforum Toolkit
*
*/
/* $DOC$
* $FUNCNAME$
* FT_TEMPFIL()
* $CATEGORY$
* DOS/BIOS
* $ONELINER$
* Create a file with a unique name
* $SYNTAX$
* FT_TEMPFIL( [ <cPath> ] [, <lHide> ] ) -> cFileSpec
* $ARGUMENTS$
* <cPath> is the directory where you want to create the temporary
* file. If you omit this argument, the root of the current drive
* is assumed ("\").
*
* If <lHide> is .T., then the file will be created with the hidden
* attribute set. The default is .F.
* $RETURNS$
* <cFileSpec> should be your path, including the name of the newly
* created unique file. Use this with FOPEN(), etc.
*
* If a DOS error occurred when trying to create the file, a
* null string will be returned.
*
* $DESCRIPTION$
* This function uses DOS Interrupt 21, service 5Ah (Create temporary
* file) to create a unique filename in a directory you specify.
* There will be no extension. After the file is created, you may
* then fopen() it and do any i/o you need (see the test driver
* in the source code).
*
* This function requires FT_INT86().
* $EXAMPLES$
* Create a unique file in the root of the current drive:
*
* myFile := FT_TEMPFIL()
*
* Create a unique file in the current directory and hide it:
*
* myFile := FT_TEMPFIL(".\", .t.)
*
* Create a unique file on another drive, but do not hide it:
*
* myFile := FT_TEMPFIL("E:\nanfor\src\")
* $END$
*/
#ifdef HB_OS_DOS
#define FT_TEMPFILE_ORIGINAL
#endif
#ifdef HB_OS_DOS_32
#undef FT_TEMPFILE_ORIGINAL
#endif
#ifdef FT_TEMPFILE_ORIGINAL
#include "ftint86.ch"
#define DOS 33
#define TEMPNAME 90
FUNCTION FT_TEMPFIL( cPath, lHide, nHandle )
LOCAL cRet,aRegs[3]
cPath := iif( valType(cPath) != "C", ;
replicate( chr(0),13) , ;
cPath += replicate( chr(0), 13 ) ;
)
lHide := iif( valType(lHide) != "L", .f., lHide )
/*
aRegs[AX] := MAKEHI( TEMPNAME )
aRegs[CX] := iif( lHide, 2, 0 )
aRegs[DS] := cPath
aRegs[DX] := REG_DS
FT_INT86( DOS, aRegs )
*/
aRegs:=_ft_tempfil(cPath,lHide)
/* If carry flag is clear, then call succeeded and a file handle is
* sitting in AX that needs to be closed.
*/
if !ft_isBitOn( aRegs[3], FLAG_CARRY )
if pcount() >= 3
nHandle = aRegs[1]
else
fclose( aRegs[1] )
endif
cRet := alltrim( strtran( aRegs[2], chr(0) ) )
else
cRet := ""
endif
RETURN cRet
#else
#include "common.ch"
#include "fileio.ch"
FUNCTION FT_TEMPFIL( cPath, lHide, nHandle )
LOCAL cFile
Default cPath to ".\"
Default lHide to .f.
cPath = alltrim( cPath )
nHandle := HB_FTempCreate( cPath, nil, iif( lHide, FC_HIDDEN, FC_NORMAL ), @cFile )
if pcount() <= 2
fclose( nHandle )
endif
RETURN cFile
#endif /* FT_TEMPFILE_ORIGINAL */
#ifdef FT_TEST
FUNCTION MAIN( cPath, cHide )
LOCAL cFile, nHandle
cFile := FT_TEMPFIL( cPath, (cHide == "Y") )
if !empty( cFile )
QOut( cFile )
nHandle := fopen( cFile, 1 )
fwrite( nHandle, "This is a test!" )
fclose( nHandle )
else
Qout( "An error occurred" )
endif
RETURN nil
#endif