faqts : Computers : Programming : Languages : Tse : File

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

TSE: File: Load: How to possibly load a file with an option to search when not found in MSDOS PATH?

Oct 3rd, 2003 17:35
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 01 October 2003 - 05:55 pm --------------------

TSE: File: Load: How to possibly load a file with an option to search 
when not found in MSDOS PATH?

---
---

1. version which can: 

  1. get its input from:

      or the command line

        e.g. 

       editfism filename1 

      or from user input

  2. read 1 (or more) DOS environment variables (like PATH, or
     INCLUDE, or your own environment variable, ...), also with a 
length greater than 255 (because of
     loading it via DOS indirection '>' in a temporary file, then
     searching there in the text for ';' using a regular expression)

  3. loads all the results in a picklist, from which you can select

  4. if a wildcard '*' is present, it will use the 'where.s' macro to
     do further searching (also in subdirectories).

  5. it gives if not found, or <enter> not selected in picklist, also
     an option to search further using 'grep'.

     1. it will change to the directory of your filename (if any)

     2. then run grep in that directory

---

--- cut here ----------------------------------------------------------

FORWARD PROC Main()

FORWARD PROC 
PROCFileEditFoundNotPath255CharactersOrGreaterMsdosSearchList( STRING 
s1, STRING s2 )

FORWARD STRING PROC FNStringGetDirectoryFilenameAddS( STRING s1, 
STRING s2 )

FORWARD STRING PROC FNStringGetShortFilenameS( STRING s1 )

// --- MAIN --- //

PROC Main()

 STRING s[255] = "m*.exe" // just some default input filename

 STRING commandlineS[255] = Query( MacroCmdLine ) // get any 
parameters typed in after the macro name (e.g. editfism myfilename1 
myfilename2)

 STRING environmentallS[255] = "PATH INCLUDE" // your list of default 
environment variables (containing your search filenames in the format 
directory1;directory2;directory3; ...; directorylast;)

 INTEGER parameterB = FALSE // flag indicating that a command line 
parameter was passed.

 INTEGER enterB = FALSE // flag indicating that you pressed enter in 
AskFilename()

 //

 IF Length( commandlineS ) // as you possibly call the macro with 
parameters

  s = commandlineS // in case a parameter has been passed, you assign 
this to the input string

  parameterB = TRUE // and you set the parameter flag to true

 ELSE

  enterB = AskFilename( "File to edit =", s, _DEFAULT_, 
_EDIT_HISTORY_ ) // if you did not press <ENTER>

 ENDIF

 //

 IF FileExists( s ) AND ( enterB OR parameterB ) // if you selected an 
already existing file

  EditFile( s ) // then edit that file

 ELSEIF parameterB OR not enterB

  // only if ( the file does not exists, and you did not press 
<ENTER> ), or ( you passed a command line parameter )

  IF YesNo( "Search Against Environment variables:" + " " + 
environmentallS + "?" ) == 1

   PROCFileEditFoundNotPath255CharactersOrGreaterMsdosSearchList( s, 
environmentallS )

  ENDIF

 ENDIF

END

<F12> Main()

// --- LIBRARY --- //

// library: file: edit: found: not: path: 255 characters or greater: 
msdos: search: list (filenamemacro=editfism.s) [kn, ni, we, 01-10-2003 
20:58:27]

PROC PROCFileEditFoundNotPath255CharactersOrGreaterMsdosSearchList( 
STRING filenameS, STRING environmentallS )

 STRING s[255] = filenameS

 STRING firstS[255] = ""

 STRING restS[255] = environmentallS

 STRING directoryS[255] = ""

 STRING filenamemsdospathS[255] = ""

 STRING filenamemsdosdirectoryS[255] = ""

 STRING filenameshortS[255] = ""

 STRING directorycurrentS[255] = ""

 STRING directoryfilenameS[255] = ""

 INTEGER currentP = 0 // bufferid of current start file

 INTEGER picklisttemporaryP = 0 // bufferid picklist

 INTEGER pathmsdostemporaryP = 0 // bufferid temporary file for PATH

 INTEGER enterB = FALSE

 INTEGER widthmaxI = 0

 INTEGER anyenvironmentfilefoundB = FALSE

 INTEGER environmentfilefoundB = FALSE

 //

 // Create some buffers

 //

 currentP = GetBufferId() // bufferid of current start file

 picklisttemporaryP = CreateTempBuffer() // bufferid picklist

 //

 // 3. search all the directories of your MSDOS path

 //

 // Your MSDOS PATH (also with length greater than 255 characters)

 // will here be stored on the 1st line of the temporary PATH file

 //

 // 3.1 create a temporary file to store the path

 //

 // choose first your default temporary directory

 filenamemsdosdirectoryS = GetEnvStr( "TEMP" )

 IF filenamemsdosdirectoryS == ""

  filenamemsdosdirectoryS = "c:\"

 ENDIF

 //

 // now read the environment variables PATH INCLUDE ...

 // one by one( separated by spaces)

 //

 WHILE restS <> ""

 // get the begin word

 firstS = GetToken( restS, " ", 1 )

 // get the rest of the string (by removing characters length first, 
then spaces in front))

 restS = Trim( SubStr( restS, Length( firstS ) + 1 + 1, Length( 
restS ) - Length( firstS ) ) )

 //

 // create a temporary file to store the current environment variable

 filenamemsdospathS = QuotePath( MakeTempName( 
filenamemsdosdirectoryS ) )

 //

 // 3.2 redirect PATH output to file

 //

 //

 Dos( "SET" + " " +  firstS + " " + ">" + filenamemsdospathS, 
_DONT_WAIT_ )

 //

 EditFile( filenamemsdospathS ) // edit file in which the environment 
information is stored

 pathmsdostemporaryP = GetBufferId() // to abandon that file later, 
get its bufferid

 BegFile() // goto the first line where that environment variable text 
is stored

 EndLine() // to search: prepare insert of ";" at end of line, to be

 InsertText( ";", _INSERT_ ) // sure there is always a ";" at end line

 BegLine() // start search at begin of the PATH line

 //

 LFind( "path *\= *\c", "ix" ) // go past 'path=' in the beginning

 //

 // 3.3 build search filenames from your given MSDOS PATH

 //

 WHILE LFind( "[~;]#\c", "cx" ) // collect all characters <> ";"

  directoryS = GetFoundText() // get the marked found characters

  //

  // get full filename

  s = FNStringGetDirectoryFilenameAddS( directoryS, filenameS )

  //

  PushPosition() // store last position, continue searching from there

  environmentfilefoundB = FileExists( s )

  // for checking if any file has been found, set global flag

  IF environmentfilefoundB AND ( NOT anyenvironmentfilefoundB )

   anyenvironmentfilefoundB = TRUE

  ENDIF

  IF environmentfilefoundB // only if the full filename is found

   GotoBufferId( picklisttemporaryP ) // then goto the picklist file

   IF NOT LFind( s, "gi" ) // if filename not already found in picklist

    IF widthmaxI < Length( s ) // make sure text width fits in window

     widthmaxI = Length( s ) // so length width equal longest filename

    ENDIF

    EndFile() // goto end of picklist

    AddLine( s ) // add this filename at the end of the picklist

   ENDIF

  ENDIF

  PopPosition() // go back to previous search position to continue

 ENDWHILE

 //

 AbandonFile( pathmsdostemporaryP ) // abandon temporary PATH file

 //

 ENDWHILE // reading the environment variables

 //

 // only if any file stored in the environment variables has been found

 IF anyenvironmentfilefoundB

  //

  // 4. sort the picklist

  //

  GotoBufferId( picklisttemporaryP ) // ask for input, so goto picklist

  PushBlock() // sort the picklist: store old block

  UnMarkBlock() // sort the picklist: make sure there is no block

  BegFile() // sort the picklist: mark file: goto begin of picklist

  MarkStream() // sort the picklist: mark file: mark whole file

  EndFile() // sort the picklist: mark file: by going to end file

  EndLine() // sort the picklist: mark file: and be sure until end line

  Sort( _IGNORE_CASE_ ) // sort now

  PopBlock() // sort the picklist: restore the old block situation

  //

  // 5. select your file from the picklist

  //

  enterB = LList( "load files", widthmaxI, 80, _ENABLE_SEARCH_ + 
_ANCHOR_SEARCH_ + _ENABLE_HSCROLL_ )

  s = GetText( 1, CurrLineLen() ) // get the last visited picklist line

  //

  // 6. abandon temporary files

  //

 ENDIF

 //

 AbandonFile( picklisttemporaryP ) // abandon temporary picklist file

 //

 // AbandonFile( pathmsdostemporaryP ) // abandon temporary PATH file

 //

 GotoBufferId( currentP ) // goto original file where started from

 //

 // 7. edit your selected picklist file

 //

 IF enterB // only if you pressed enter to leave picklist

  IF Pos( "*", s ) <> 0 // if there are wildcards in selected filename

   //

   // Here where.s macro is used. This demands short filenames:

   //

   // Workaround1: manually replace all directories with spaces

   //              with their SHORT filename in e.g. MSDOS PATH.

   //

   //              e.g. replace "c:\program files"

   //

   //                   with "c:\progra~1"

   //

   // Workaround2: 1. use 4DOS or 4NT to convert the long filename

   //              to a short filename, using @SFN, redirect

   //              output to a file, then read first line of this

   //              file.

   //              2. After that, call the 'where.s' macro

   //              with that short filename instead.

   //

   // Workaround3: best solution: use the 'GetShortPathName' API,

   //              in 'kernel32.dll', which is

   //              built in in Windows, as everybody should have

   //              this available in TSE v4.x.

   //

   // get also short filename, because macro 'where.s' later demands 
this

   filenameshortS = FNStringGetShortFilenameS( SplitPath( s, _DRIVE_ | 
_PATH_ ) )

   filenameshortS= FNStringGetDirectoryFilenameAddS( filenameshortS, 
SplitPath( s, _NAME_ | _EXT_ ) )

   //

   // call Semware 'where.s' macro with your file as parameter

   ExecMacro( "where" + " " + filenameshortS )

   PurgeMacro( "where" )

   //

  ELSEIF Length( s ) <> 0 // if you did not pressed <ESCAPE>

   s = PickFile( s, _SEARCH_SUBDIRS_ ) // show again a picklist

   EditFile( QuotePath( s ) ) // and after that, edit selected file

  ENDIF

 ELSEIF YesNo( "Would you like to grep it ?" ) == 1

  // IF Ask( "File to edit =", s, _EDIT_HISTORY_ )

   //

   // goto the directory of the given filename and then run grep

   //

   directorycurrentS = CurrDir() // store current directory to return 
to it later

   directoryfilenameS = SplitPath( filenameS, _DRIVE_ | _PATH_ ) // 
get directory of the filename (if any)

   ChDir( directoryfilenameS ) // goto directory of the filename

   //

   // run grep

   ExecMacro( "grep" + " " + s ) // then run grep

   PurgeMacro( "grep" ) // purge the macro after use

   //

   ChDir( directorycurrentS ) // restore, by going back to current 
directory

  // ENDIF

 ENDIF

END

// library: string: get: directory: filename: add 
(filenamemacro=getstfad.s) [kn, ni, th, 02-10-2003 19:58:04]

STRING PROC FNStringGetDirectoryFilenameAddS( STRING inS, STRING 
filenameS )

 // e.g. PROC Main()

 // e.g.  Message( FNStringGetDirectoryFilenameAddS( "c:\program 
files\", "ddd.txt" ) ) // gives e.g. "c:\program files\ddd.txt"

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 STRING firstS[255] = inS

 STRING characterlastS[1] = ""

 STRING s[255] = ""

 characterlastS = firstS[ Length( firstS ) ]

 IF characterlastS == '"' // remove quote if filename is quoted

  firstS = SubStr( firstS, 1, Length( firstS ) - 1 )

  IF firstS[ Length( firstS ) ] <> "\" // if last character

   firstS = firstS + "\" // is not a backslash already, add one

  ENDIF

  s = firstS + SplitPath( filenameS, _NAME_ | _EXT_ ) // full filename

  s = s + '"' // add the last double quote here back again

 ELSEIF characterlastS == "\"

  s = firstS + SplitPath( filenameS, _NAME_ | _EXT_ ) // full filename

 ELSEIF characterlastS <> "\" // unquoted filename, add backslash

  firstS = firstS + "\" // if not already there

  s = firstS + SplitPath( filenameS, _NAME_ | _EXT_ ) // full filename

 ENDIF

 RETURN( s )

END

// library: string: get: short: filename (filenamemacro=getstsfi.s) 
(author: http://www.semware.com, see macro 'f.s' in 
directory '..\mac') [kn, ni, th, 02-10-2003 19:41:35]

#IF WIN32

DLL "<kernel32.dll>"

 INTEGER PROC GetShortPathName( STRING lpszLongPath : cstrval, VAR 
STRING lpszShortPath : strptr, INTEGER cchBuffer : 
long ): "GetShortPathNameA"

END

#ENDIF

//

STRING PROC FNStringGetShortFilenameS( STRING lpszLongPath )

 // e.g. PROC Main()

 // e.g.  STRING longfilenameS[255] = "c:\autoexec.bat.nb" // make 
sure this file exists on your computer

 // e.g.  Warn( FNStringGetShortFilenameS( longfilenameS ) )

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 #IFDEF WIN32

  INTEGER h

  INTEGER lengthI

  STRING lpszShortPath[_MAXPATH_] = Format( "":_MAXPATH_:CHR( 0 ) )

  h = IIF( FileExists( lpszLongPath ), -1, Fcreate( lpszLongPath ) )

  lengthI = GetShortPathName( lpszLongPath, lpszShortPath, _MAXPATH_ )

  IF h <> -1

   Fclose( h )

   EraseDiskFile( lpszLongPath )

  ENDIF

  RETURN( IIF( lengthI > 0, lpszShortPath[1:Pos( CHR( 0 ), 
lpszShortPath ) - 1], lpszLongPath ) )

 #ELSE

  Warn( "use 4DOS / 4NT and @SFN, to redirect to a file, then read 
first line of this file" )

 #ENDIF

END

--- cut here ----------------------------------------------------------

---
---

Internet: see also:

TSE: Filename: Long: Short: Convert: How to convert long filenames to 
short filenames in TSE v4.x?
http://www.faqts.com/knowledge_base/view.phtml/aid/25064/fid/939

---
---

Note: In the versions below, because of the use STRING[255]:

      1. if your MSDOS path is longer than 255 characters, put your
         search paths in *front* of your MSDOS path, otherwise as it
         will be chopped off after 255 characters here (because of use
         of string in TSE with a maximum length of 255 characters),
         there will not be searched in it.

      2. So you might put your search paths in another variable

         1. In MSDOS type:

          SET mysearchpathS=searchpath1;searchpath2;...;searchpathlast

         2. In TSE, then get this variable (instead of MSDOS PATH), via

          pathS = GetEnvStr( "mysearchpathS" )

         below.

---
---

2. A version with a mimimum of source code:
   When found in PATH, that file is added to a list.
   You can then finally choose one of the files
   from the list.

---

PROC PROCFileEditFoundNotPathMsdosSearchList( STRING filenameS )
 STRING s[255] = filenameS
 STRING pathS[255] = GetEnvStr( "PATH" )
 STRING firstS[255] = ""
 STRING restS[255] = pathS
 STRING delimiterS[255] = ";"
 INTEGER currentP = GetBufferId()
 INTEGER temporaryP = CreateTempBuffer() 
 INTEGER enterB = FALSE
 s = PickFile( filenameS )
 IF FileExists( s )
  EditFile( s )
  RETURN()
 ENDIF
 // from here assumed the file is not found, so start searching
 Message( s ) // inform file is not found
 //
 IF YesNo( "Would you like to Search Against Path?" ) <> 1
  RETURN()
 ENDIF
 //
 WHILE restS <> ""
  firstS = GetToken( restS, delimiterS, 1 )
  restS = Trim( SubStr( restS, Length( firstS ) + 1 + 1, Length( 
restS ) - Length( firstS ) ) )
  IF firstS[ Length(firstS) ] <> "\"
   firstS = firsts + "\"
  ENDIF
  s = firstS + SplitPath( filenameS, _NAME_ | _EXT_ )
  IF FileExists( s )
   GotoBufferId( temporaryP )
   EndFile()
   AddLine( s )
   GotoBufferId( currentP )
  ENDIF
 ENDWHILE
 GotoBufferId( temporaryP )
 enterB = LList( "load files", 60, 22, _ENABLE_SEARCH_ + 
_ANCHOR_SEARCH_ + _ENABLE_HSCROLL_ )
 IF enterB
  s = GetText( 1, CurrLineLen() )
 ENDIF
 AbandonFile( temporaryP )
 GotoBufferId( currentP )
 EditFile( QuotePath( s ) )
END

PROC Main()
 STRING s[255] = "m*.exe"
 IF Ask( "File to edit =", s )
  PROCFileEditFoundNotPathMsdosSearchList( s )
 ENDIF
END

<F12> Main()

---
---

3. A version with a mimimum of source code: you can choose to add the
   files one after another

---

PROC PROCFileEditFoundNotPathMsdosSearch( STRING filenameS )
 STRING s[255] = filenameS
 STRING pathS[255] = GetEnvStr( "PATH" )
 STRING firstS[255] = ""
 STRING restS[255] = pathS
 STRING delimiterS[255] = ";"
 s = PickFile( filenameS )
 IF FileExists( s )
  EditFile( QuotePath( s ) )
  RETURN()
 ENDIF
 // from here assumed the file is not found, so start searching
 Message( s ) // inform file is not found
 //
 IF YesNo( "Would you like to Search Against Path?" ) <> 1
  RETURN()
 ENDIF
 //
 WHILE restS <> ""
  firstS = GetToken( restS, delimiterS, 1 )
  restS = Trim( SubStr( restS, Length( firstS ) + 1 + 1, Length( 
restS ) - Length( firstS ) ) )
  IF firstS[ Length(firstS) ] <> "\"
   firstS = firsts + "\"
  ENDIF
  s = firstS + SplitPath( filenameS, _NAME_ | _EXT_ )
  IF FileExists( s )
   IF YesNo( "Found in another path: do you want to load" + " " + s 
+ " " + "?" ) == 1
    EditFile( s )
   ENDIF
  ENDIF
 ENDWHILE
END

PROC Main()
 STRING s[255] = ""
 IF Ask( "File to edit =", s )
  PROCFileEditFoundNotPathMsdosSearch( s )
 ENDIF
END

<F12> Main()

---
---

4. Here a version (similar to version 3) created with the use of
   libraries:

---

---

FORWARD INTEGER PROC FNAskHistoryCentralB( STRING s1, VAR STRING s2, 
INTEGER i1 )

FORWARD INTEGER PROC FNErrorCheckEscapeB( STRING s1 )

FORWARD INTEGER PROC FNErrorCheckSB( STRING s1 )

FORWARD INTEGER PROC FNEscapeB( STRING s1 )

FORWARD INTEGER PROC FNFileCheckEditB( STRING s1 )

FORWARD INTEGER PROC FNFileCheckExistB( STRING s1 )

FORWARD INTEGER PROC FNFileCheckGotoEndB()

FORWARD INTEGER PROC FNFileGetAttributeI( STRING s1 )

FORWARD INTEGER PROC FNFileGetLineNumberCurrentI()

FORWARD INTEGER PROC FNInitializeNewBooleanFalseB()

FORWARD INTEGER PROC FNInputCheckYesNoCancelB( STRING s1 )

FORWARD INTEGER PROC FNInputCheckYesNoCancelNotB( STRING s1 )

FORWARD INTEGER PROC FNIntegerGetStringSearchInstrI( STRING s1, STRING 
s2 )

FORWARD INTEGER PROC FNLineGotoBeginB()

FORWARD INTEGER PROC FNLineInsertAfterLineGotoBeginTextInsertB( STRING 
s1 )

FORWARD INTEGER PROC FNMathCheckLogicNotB( INTEGER i1 )

FORWARD INTEGER PROC FNMathCheckNumberEqualB( INTEGER i1, INTEGER i2 )

FORWARD INTEGER PROC FNMathCheckNumberEqualZeroB( INTEGER i1 )

FORWARD INTEGER PROC FNMathCheckNumberEqualZeroNotB( INTEGER i1 )

FORWARD INTEGER PROC FNMathCheckNumberInRangeB( INTEGER i1, INTEGER 
i2, INTEGER i3 )

FORWARD INTEGER PROC FNMathCheckNumberInRangeNotB( INTEGER i1, INTEGER 
i2, INTEGER i3 )

FORWARD INTEGER PROC FNMathGetLogicFalseB()

FORWARD INTEGER PROC FNMathGetLogicTrueB()

FORWARD INTEGER PROC FNMathGetNumberInputYesNoCancelI( STRING s1 )

FORWARD INTEGER PROC FNStringCheckEmptyB( STRING s1 )

FORWARD INTEGER PROC FNStringCheckEmptyNotB( STRING s1 )

FORWARD INTEGER PROC FNStringCheckEqualB( STRING s1, STRING s2 )

FORWARD INTEGER PROC FNStringCheckEqualCharacterLastNB( STRING s1, 
STRING s2 )

FORWARD INTEGER PROC FNStringGetLengthI( STRING s1 )

FORWARD INTEGER PROC FNTextCheckInsertB( STRING s1 )

FORWARD INTEGER PROC FNTextInsertCentralB( STRING s1, INTEGER i1 )

FORWARD PROC Main()

FORWARD PROC PROCError( STRING s1 )

FORWARD PROC PROCErrorFileNotFound( STRING s1 )

FORWARD PROC PROCFileEdit( STRING s1 )

FORWARD PROC PROCFileEditFoundNotPathMsdosSearch( STRING s1 )

FORWARD PROC PROCFileGotoEnd()

FORWARD PROC PROCFileInsertEndPrepare()

FORWARD PROC PROCFileInsertTextEnd( STRING s1, STRING s2, INTEGER i1 )

FORWARD PROC PROCLineInsertAfter()

FORWARD PROC PROCLineInsertAfterLineGotoBeginTextInsert( STRING s1 )

FORWARD PROC PROCTextGotoLineBegin()

FORWARD PROC PROCTextInsert( STRING s1 )

FORWARD PROC PROCTextRemovePositionStackPop()

FORWARD PROC PROCTextSavePositionStackPush()

FORWARD PROC PROCWarn( STRING s1 )

FORWARD PROC PROCWarnCons3( STRING s1, STRING s2, STRING s3 )

FORWARD PROC PROCWarnCons4( STRING s1, STRING s2, STRING s3, STRING 
s4 )

FORWARD PROC PROCWarnCons5( STRING s1, STRING s2, STRING s3, STRING 
s4, STRING s5 )

FORWARD STRING PROC FNEscapeS()

FORWARD STRING PROC FNFilenameGetCurrentS()

FORWARD STRING PROC FNFilenameGlobalErrorS()

FORWARD STRING PROC FNFilenameSplitInPartsS( STRING s1, INTEGER i1 )

FORWARD STRING PROC FNInitializeNewStringS()

FORWARD STRING PROC FNMathGetIntegerToStringS( INTEGER i1 )

FORWARD STRING PROC FNStringGetAsciiToCharacterS( INTEGER i1 )

FORWARD STRING PROC FNStringGetCharacterEndBackSlashNotEqualInsertEndS
( STRING s1 )

FORWARD STRING PROC FNStringGetCharacterInsertLastIfEqualNotS( STRING 
s1, STRING s2 )

FORWARD STRING PROC FNStringGetCharacterSymbolCentralS( INTEGER i1 )

FORWARD STRING PROC FNStringGetCharacterSymbolSemicolonS()

FORWARD STRING PROC FNStringGetCharacterSymbolSlashBackwardS()

FORWARD STRING PROC FNStringGetCharacterSymbolSpaceS()

FORWARD STRING PROC FNStringGetConcatS( STRING s1, STRING s2 )

FORWARD STRING PROC FNStringGetConcatSeparatorS( STRING s1, STRING s2, 
STRING s3 )

FORWARD STRING PROC FNStringGetConcatTailS( STRING s1, STRING s2 )

FORWARD STRING PROC FNStringGetCons3S( STRING s1, STRING s2, STRING 
s3 )

FORWARD STRING PROC FNStringGetCons4S( STRING s1, STRING s2, STRING 
s3, STRING s4 )

FORWARD STRING PROC FNStringGetCons5S( STRING s1, STRING s2, STRING 
s3, STRING s4, STRING s5 )

FORWARD STRING PROC FNStringGetConsS( STRING s1, STRING s2 )

FORWARD STRING PROC FNStringGetEmptyS()

FORWARD STRING PROC FNStringGetEnvironmentS( STRING s1 )

FORWARD STRING PROC FNStringGetErrorS()

FORWARD STRING PROC FNStringGetFileInfoToFilenameExtensionS( STRING 
s1 )

FORWARD STRING PROC 
FNStringGetFilenameDrivePathBackSlashConcatNameExtensionS( STRING s1, 
STRING s2 )

FORWARD STRING PROC FNStringGetFilenameEndBackSlashNotEqualInsertEndS( 
STRING s1 )

FORWARD STRING PROC FNStringGetGlobalS( STRING s1 )

FORWARD STRING PROC FNStringGetHistoryInputS( STRING s1, STRING s2, 
INTEGER i1 )

FORWARD STRING PROC FNStringGetInputFilenameListPickS( STRING s1 )

FORWARD STRING PROC FNStringGetInputS( STRING s1, STRING s2 )

FORWARD STRING PROC FNStringGetLineNumberCurrentS()

FORWARD STRING PROC FNStringGetMidStringS( STRING s1, INTEGER i1, 
INTEGER i2 )

FORWARD STRING PROC FNStringGetOperatingSystemMsdosPathS()

FORWARD STRING PROC FNStringGetOperatingSystem_MsdosPathDelimiterS()

FORWARD STRING PROC FNStringGetRightStringS( STRING s1, INTEGER i1 )

FORWARD STRING PROC FNStringGetTokenFirstS( STRING s1, STRING s2 )

FORWARD STRING PROC FNStringGetTokenRestS( STRING s1, STRING s2 )

FORWARD STRING PROC FNStringGetWordRestS( STRING s1, INTEGER i1 )

FORWARD STRING PROC FNStringRemoveSpaceBeginS( STRING s1 )

FORWARD STRING PROC FNStringSearchHistoryFindInputS( STRING s1, STRING 
s2 )

// --- MAIN --- //

PROC Main()

 STRING filenameS[255] = FNInitializeNewStringS()

 filenameS = FNStringGetInputS( "file: edit: filename 
= ", "c:\temp\ddd.ddd" )

 PROCFileEditFoundNotPathMsdosSearch( filenameS )

END

<F12> Main()

// --- LIBRARY --- //

// library: string: initialize [kn, ri, mo, 09-07-2001 12:00:07]

STRING PROC FNInitializeNewStringS()

 RETURN( FNStringGetEmptyS() )

END

// library: input: input a string [kn, ni, ma, 03-08-1998 13:04:18]

STRING PROC FNStringGetInputS( STRING askS, STRING answerdefaultS )

 // e.g. PROC Main()

 // e.g.  Message( FNStringGetConcat3S( "'", FNStringGetInputS
( "Choose option (Y/n)", "Y" ), "'" ) ) // gives e.g. "Y"

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 RETURN( FNStringSearchHistoryFindInputS( askS, answerdefaultS ) )

END

// library: input: escape: test if escape was pressed [kn, ni, wo, 05-
08-1998 20:29:00]

INTEGER PROC FNEscapeB( STRING s ) // version with testing local 
variable

 RETURN( FNStringCheckEqualB( s, FNescapeS() ) )

END

// library: file: edit: found: not: path: msdos: search 
(filenamemacro=editfips.s) [kn, ni, we, 01-10-2003 13:18:55]

PROC PROCFileEditFoundNotPathMsdosSearch( STRING filenameS )

 // e.g. PROC Main()

 // e.g.  STRING filenameS[255] = FNInitializeNewStringS()

 // e.g.  filenameS = FNStringGetInputS( "file: edit: filename 
= ", "c:\temp\ddd.ddd" )

 // e.g.  IF FNEscapeB( filenameS ) RETURN() ENDIF

 // e.g.  PROCFileEditFoundNotPathMsdosSearch( filenameS )

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 //

 STRING s[255] = filenameS // create some temporary variable, to hold 
the temporary results

 STRING pathS[255] = FNStringGetOperatingSystemMsdosPathS() // get the 
current MSDOS PATH content // note: put the path where you will search 
in the beginning of the MSDOS path, otherwise because of 255 character 
string length by definition, if put after the 255th character, this 
will not be found as it is chopped off. So possibly create another 
MSDOS environment variable where you put your search path in, and load 
that environment variable instead.

 STRING firstS[255] = FNInitializeNewStringS()

 STRING restS[255] = pathS // initially assign the full MSDOS PATH to 
it

 STRING delimiterS[255] = 
FNStringGetOperatingSystem_MsdosPathDelimiterS() // gives ";", the 
MSDOS path delimiter between the directory paths

 s = FNStringGetInputFilenameListPickS( filenameS )

 IF FNFileCheckExistB( s ) // file is found, then start edit as usual 
and return

  PROCFileEdit( s )

  RETURN()

 ENDIF

 // from here assumed the file is not found, so start searching

 PROCErrorFileNotFound( s ) // inform file is not found

 //

 IF FNInputCheckYesNoCancelNotB( "Would you like to Search Against 
Path?" ) // you did not want to search for the file (so pressed 
<ESCAPE> or entered 'N'), so just return

  RETURN()

 ENDIF

 //

 // read the directories one by one from your current MSDOS path, by 
taking off the first token separated by a ';' successively

 WHILE FNStringCheckEmptyNotB( restS ) // while still first tokens on 
the given rest string do

  firstS = FNStringGetTokenFirstS( restS, delimiterS ) // get the 
first token from the given rest string

  restS = FNStringGetTokenRestS( restS, delimiterS ) // remove the 
first token from the given rest string

  // Warn( firstS ) // for debugging purposes, show the current result

  s = FNStringGetFilenameDrivePathBackSlashConcatNameExtensionS( 
firstS, filenameS )

  // Warn( s ) // for debugging purposes, show the current result

  IF FNFileCheckExistB( s )

   // Warn( s + " " + "found!" ) // for debugging purposes, show the 
current result

   IF FNInputCheckYesNoCancelB( FNStringGetCons3S( "Found in another 
path: do you want to load", s, "?" ) ) // offer an option to load it

    PROCFileEdit( s )

   ENDIF

  ENDIF

 ENDWHILE

END

// library: string: empty: return an empty string [kn, ri, za, 20-05-
2000 20:11:03]

STRING PROC FNStringGetEmptyS()

 RETURN( "" )

END

// library: input: input a string: history: find [kn, ri, sa, 25-08-
2001 21:00:25]

STRING PROC FNStringSearchHistoryFindInputS( STRING askS, STRING 
answerdefaultS )

 RETURN( FNStringGetHistoryInputS( askS, answerdefaultS, 
_FIND_HISTORY_ ) )

END

// library: string: equal: are two given strings equal? (stored 
in 'checstcf.s') [kn, zoe, wo, 04-10-2000 18:23:27]

INTEGER PROC FNStringCheckEqualB( STRING s1, STRING s2 )

 // e.g. PROC Main()

 // e.g.  STRING s1[255] = FNInitializeNewStringS()

 // e.g.  STRING s2[255] = FNInitializeNewStringS()

 // e.g.  s1 = FNStringGetInputS( "string: check: equal: first string 
= ", "a" )

 // e.g.  IF FNEscapeB( s1 ) RETURN() ENDIF

 // e.g.  s2 = FNStringGetInputS( "string: check: equal: second string 
= ", "a" )

 // e.g.  IF FNEscapeB( s2 ) RETURN() ENDIF

 // e.g.  Message( FNStringCheckEqualB( s1, s2 ) ) // gives e.g. TRUE 
when string1 is equal to string2

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 //

 // // <F12> PROCMessage( FNStringCheckEqualB( "knud", "knud" ) ) // 
gives TRUE

 // // <F12> PROCMessage( FNStringCheckEqualB( "knud", "van" ) ) // 
gives FALSE

 RETURN( s1 == s2 )

END

// library: input: escape: general output string to recognize an 
escape (e.g. in another routine). Central routine, only one occurrence 
of this constant string [kn, ri, za, 05-12-1998 18:52:24]

STRING PROC FNEscapeS()

 RETURN( "<ESCAPE>" )

END

// library: string: get: operating: system: msdos: path 
(filenamemacro=getstmpa.s) [kn, ni, we, 01-10-2003 16:53:35]

STRING PROC FNStringGetOperatingSystemMsdosPathS()

 // e.g. PROC Main()

 // e.g.  Message( FNStringGetOperatingSystemMsdosPathS() ) // gives 
e.g. the current MSDOS PATH variable value, 
like "c:\windows;c:\windows\temp;c:\windows\system32"

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 // Warn( "because of the use of a string, and this length is 255 
characters maximal, only the first 255 characters are shown" )

 // Warn( "so if you want to include information in the PATH that has 
to be used, put it in the *beginning* of your MSDOS path" )

 RETURN( FNStringGetEnvironmentS( "PATH" ) )

END

// library: string: get: operating: system: msdos: path: delimiter 
(filenamemacro=getstpde.s) [kn, ni, we, 01-10-2003 17:06:17]

STRING PROC FNStringGetOperatingSystem_MsdosPathDelimiterS()

 // e.g. PROC Main()

 // e.g.  Message( FNStringGetOperatingSystem_MsdosPathDelimiterS
() ) // gives e.g. ";"

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 RETURN( FNStringGetCharacterSymbolSemicolonS() )

END

// library: file: load: input: allows user to select filename from a 
list: R PickFile(STRING fn)* [kn, zoe, wo, 16-06-1999 01:07:08]

STRING PROC FNStringGetInputFilenameListPickS( STRING 
filespecificationS )

 // e.g. <F12> PROCMessage( FNStringGetInputFilenameListPickS
( "bib*.*" ) ) // gives e.g. bibcpp.cpp

 STRING s[255] = PickFile( filespecificationS )

 IF FNStringCheckEmptyB( s )

  s = FNEscapeS()

 ENDIF

 RETURN( s )

END

// library: file: exist: does this file exist? (e.g. not a file with 
one or more of the following attibutes set: archive, system, hidden, 
volume, directory, read only) (Verifies File Exists on Disk) R    
FileExists(STRING fn)* (filenamemacro=exisfife.s) [kn, ri, th, 08-11-
2001 05:36:09]

INTEGER PROC FNFileCheckExistB( STRING filenameS )

 // e.g. PROC Main()

 // e.g.  STRING s[255] = FNInitializeNewStringS()

 // e.g.  s = FNStringGetInputS( "file: exist: does this file exist: 
file = ", "c:\temp\ddd.ddd" )

 // e.g.  IF FNEscapeB( s ) RETURN() ENDIF

 // e.g.  Message( FNFileCheckExistB( s ) ) // gives e.g. TRUE, if 
file exists

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 RETURN( FNMathCheckNumberEqualZeroNotB( FNFileGetAttributeI( 
filenameS ) ) )

END

// library: file: edit: edit a file, with test of problems 
(filenamemacro=loadfied.s) [kn, ri, za, 02-01-1999 19:28:37]

PROC PROCFileEdit( STRING filenameS )

 // e.g. PROC Main()

 // e.g.  STRING filenameS[255] = FNInitializeNewStringS()

 // e.g.  filenameS = FNStringGetInputS( "file: edit: filename 
= ", "c:\temp\ddd.ddd" )

 // e.g.  IF FNEscapeB( filenameS ) RETURN() ENDIF

 // e.g.  PROCFileEdit( filenameS )

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 //

 // variation: IF FNMathCheckLogicNotB( FNFileCheckEditB( "" ) ) // 
opens a prompt box for a filename

 // variation: IF FNMathCheckLogicNotB( FNFileCheckEditB( "*.*" ) ) // 
opens a prompt box with filename to choose from

 // variation: IF FNMathCheckLogicNotB( FNFileCheckEditB( filenameS, 
_DONT_PROMPT_ ) ) // does not display any warnings

 // variation: IF FNMathCheckLogicNotB( FNFileCheckEditB( filenameS, 
_DONT_LOAD_ ) )

 IF FNMathCheckLogicNotB( FNFileCheckEditB( filenameS ) )

  PROCErrorFileNotFound( filenameS )

 ENDIF

END

// library: error: file: not: found (filenamemacro=fileernf.s) [kn, 
ri, we, 28-02-2001 23:02:12]

PROC PROCErrorFileNotFound( STRING filenameS )

 // e.g. PROC Main()

 // e.g.  PROCErrorFileNotFound( "xsefadafadfasdf.sdfa" )

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 STRING s[255] = FNInitializeNewStringS()

 IF FNErrorCheckEscapeB( filenameS )

  s = FNStringGetConsS( FNEscapeS(), "has been pressed" )

 ELSE

  s = FNStringGetCons3S( "file: ", filenameS, "not found / path does 
not exist" )

 ENDIF

 PROCError( s )

END

// library: input: input not yes [kn, ni, tu, 05-11-2002 16:21:35]

INTEGER PROC FNInputCheckYesNoCancelNotB( STRING infoS )

 RETURN( FNMathCheckLogicNotB( FNInputCheckYesNoCancelB( infoS ) ) )

END

// library: string: empty: is given string empty? [kn, ri, za, 20-05-
2000 20:11:08]

INTEGER PROC FNStringCheckEmptyNotB( STRING s )

 RETURN( FNMathCheckLogicNotB( FNStringCheckEmptyB( s ) ) )

END

// library: string: get: word: token: get: first: get the first word 
of a string (words delimited by some delimiter). [kn, ni, zo, 02-08-
1998 18:02:06]

STRING PROC FNStringGetTokenFirstS( STRING s, STRING delimiterS )

 // e.g. <F12> PROCMessage( FNStringGetTokenFirstS( "Knud, is the 
best", "," ) ) // gives "Knud"

 RETURN( GetToken( s, delimiterS, 1 ) )

END

// library: string: get: word: token: get: all: get all, except the 
first word of a string (words delimited by some delimiter) [kn, ni, 
zo, 02-08-1998 18:02:06]

STRING PROC FNStringGetTokenRestS( STRING inS, STRING delimiterS )

 // e.g. <F12> PROCMessage( FNStringGetTokenRestS( "Knud, is the 
best", "," ) ) // gives "Knud"

 STRING s[255] = FNStringRemoveSpaceBeginS( inS ) // take any leading 
spaces of the given input string

 INTEGER posT = FNIntegerGetStringSearchInstrI( s, delimiterS )

 IF FNMathCheckNumberEqualZeroB( posT ) RETURN( FNStringGetEmptyS() ) 
ENDIF

 RETURN( FNStringRemoveSpaceBeginS( FNStringGetWordRestS( s, posT + 
FNStringGetLengthI( delimiterS ) - 1 ) ) ) // take the part after the 
separator out, and return this without leading spaces

END

// library: string: get: filename: drive: path: backslash: concat: 
name: extension (filenamemacro=getstney.s) [kn, ni, fr, 02-05-2003 
00:59:56]

STRING PROC FNStringGetFilenameDrivePathBackSlashConcatNameExtensionS( 
STRING directoryS, STRING filenameS )

 // e.g. PROC Main()

 // e.g.  Message( 
FNStringGetFilenameDrivePathBackSlashConcatNameExtensionS
( "c:\wordproc\tse", "sc.exe" ) ) // gives e.g."c:\wordproc\tse\sc.exe"

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 RETURN( FNStringGetConcatS( 
FNStringGetFilenameEndBackSlashNotEqualInsertEndS( directoryS ), 
FNStringGetFileInfoToFilenameExtensionS( filenameS ) ) )

END

// library: input: input yes or no or cancel box. Only Yes gives TRUE 
[kn, ri, do, 01-04-1999 22:15:03]

INTEGER PROC FNInputCheckYesNoCancelB( STRING infoS )

 // e.g. <F12> PROCMessage( FNInputCheckYesNoCancelB( "Do you want to 
delete the block?" ) ) // asks yes/no/cancel

 CASE FNMathGetNumberInputYesNoCancelI( infoS )

  WHEN 0  RETURN( FNMathGetLogicFalseB() ) // <Escape> or <Cancel>

  WHEN 1  RETURN( FNMathGetLogicTrueB() ) // Yes selected

  WHEN 2  RETURN( FNMathGetLogicFalseB() ) // No selected

  OTHERWISE

   // do nothing

 ENDCASE

 RETURN( FNMathGetLogicFalseB() ) // everything else false

END

// library: string: concatenation: 3 strings [kn, zoe, fr, 17-11-2000 
13:52:07]

STRING PROC FNStringGetCons3S( STRING s1, STRING s2, STRING s3 )

 RETURN( FNStringGetConsS( FNStringGetConsS( s1, s2 ), s3 ) )

END

// library: input: input a string [kn, ni, ma, 03-08-1998 13:04:18]

STRING PROC FNStringGetHistoryInputS( STRING infoS, STRING 
answerdefaultS, INTEGER historyI )

 STRING s[255] = answerdefaultS

 INTEGER escapeB = FNInitializeNewBooleanFalseB()

 escapeB = FNMathCheckLogicNotB( FNAskHistoryCentralB( infoS, s, 
historyI ) )

 IF escapeB RETURN( FNEscapeS() ) ENDIF // <Escape> was pressed, in 
response

 IF FNStringCheckEmptyB( s ) AND FNStringCheckEmptyNotB( 
answerdefaultS )

  RETURN( FNStringGetEmptyS() ) // input of an empty string, user has 
removed the string to indicate that an empty string was wanted

 ENDIF

 IF FNStringCheckEmptyB( s )

  RETURN( answerdefaultS )

 ENDIF // <Enter> was pressed, in response (variation: IF 
FNMathCheckLogicNotB( FNStringGetLengthI( s ) ) ...)

 RETURN( s ) // response was entered

END

// library: environment: string: get (Searches for and Returns a 
Specified Environment Str) R    GetEnvStr(STRING s)* 
(filenamemacro=getstgen.s) [kn, ri, th, 25-10-2001 01:44:48]

STRING PROC FNStringGetEnvironmentS( STRING s )

 // e.g. PROC Main()

 // e.g.  STRING s[255] = FNStringGetInputS( "value: environment 
variable = ", "windir" )

 // e.g.  IF FNEscapeB( s ) RETURN() ENDIF

 // e.g.  PROCMessageCons3( s, "=", FNStringGetEnvironmentS( s ) ) // 
gives e.g. "windir=C:\WINNT", when working on a Windows2000 machine

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 STRING valueS[255] = GetEnvStr( s )

 IF FNStringCheckEmptyB( s )

  PROCWarnCons3( "environment variable", s, ": not found" )

  valueS = FNStringGetErrorS()

 ENDIF

 RETURN( valueS )

END

// library: string: get: character: symbol: semicolon 
(filenamemacro=getstsse.s) [kn, ni, we, 01-10-2003 17:01:15]

STRING PROC FNStringGetCharacterSymbolSemicolonS()

 // e.g. PROC Main()

 // e.g.  Message( FNStringGetCharacterSymbolSemicolonS() ) // gives 
e.g. ";"

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 RETURN( FNStringGetCharacterSymbolCentralS( 59 ) )

END

// library: string: empty: is given string empty? [kn, ri, za, 20-05-
2000 20:11:08]

INTEGER PROC FNStringCheckEmptyB( STRING s )

 RETURN( FNStringCheckEqualB( s, FNStringGetEmptyS() ) )

END

// library: math: number not equal to ZERO? [kn, ri, we, 04-07-2001 
13:26:56]

INTEGER PROC FNMathCheckNumberEqualZeroNotB( INTEGER x )

 RETURN( FNMathCheckLogicNotB( FNMathCheckNumberEqualZeroB( x ) ) )

END

// library: file: get: attribute: return the attributes of this file 
as an integer [kn, zoe, wo, 30-06-1999 23:17:23]

INTEGER PROC FNFileGetAttributeI( STRING filenameS )

 RETURN( FileExists( filenameS ) )

END

// library: math: check: logic: not (filenamemacro=checmaln.s) [kn, 
ri, tu, 15-05-2001 16:54:21]

INTEGER PROC FNMathCheckLogicNotB( INTEGER B )

 // e.g. PROC Main()

 // e.g.  STRING s[255] = FNInitializeNewStringS()

 // e.g.  s = FNStringGetInputS( "math: check: logic: not: number 
= ", "1" )

 // e.g.  IF FNEscapeB( s ) RETURN() ENDIF

 // e.g.  Message( FNMathCheckLogicNotB( FNStringGetToIntegerI( s ) ) )

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 RETURN( NOT B )

END

// library: file: edit: edit a file, with test of problems 
(filenamemacro=checficf.s) [kn, ni, ma, 03-08-1998 13:08:39]

INTEGER PROC FNFileCheckEditB( STRING filenameS )

 // e.g. PROC Main()

 // e.g.  Message( FNFileCheckEditB( "" ) ) // gives e.g. TRUE when 
file loaded without problems

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 INTEGER editfileB = FNMathGetLogicFalseB()

 if FNStringCheckEmptyB( filenameS )

  editfileB = EditFile()

 ELSE

  editfileB = EditFile( filenameS )

 ENDIF

 IF FNMathCheckLogicNotB( editfileB )

  PROCErrorFileNotFound( filenameS )

 ENDIF

 RETURN( editfileB )

END

// library: escape or error [kn, zoe, th, 09-11-2000 23:18:32]

INTEGER PROC FNErrorCheckEscapeB( STRING s )

 IF FNErrorCheckSB( s ) RETURN( FNMathGetLogicTrueB() ) ENDIF

 IF FNEscapeB( s ) RETURN( FNMathGetLogicTrueB() ) ENDIF

 RETURN( FNMathGetLogicFalseB() )

END

// library: string: concatenation: concatenation 2 words to 1 word 
(separated by a space) [kn, ri, wo, 25-11-1998 20:15:03]

STRING PROC FNStringGetConsS( STRING s1, STRING s2 ) // version with 
test if string empty

 // e.g. <F12> PROCMessage( FNStringGetConsS( "knud", "van" ) )

 RETURN( FNStringGetConcatSeparatorS( s1, s2, 
FNStringGetCharacterSymbolSpaceS() ) )

END

// library: error: central routine [kn, ni, ma, 03-08-1998 13:08:12]

// INTEGER ErrorGB = FNMathGetLogicFalseB()

PROC PROCError( STRING s )

 // e.g. <F12> PROCError( "this is an error" )

 PROCTextSavePositionStackPush()

 // Alarm()

 // PROCWarn( s )

 // Message( s )

 // Message( "Linenr ", FNFileGetLineNumberCurrentI(), ": ", s )

 PROCWarnCons4( "Error: Linenr", FNStringGetLineNumberCurrentS(), ":", 
s )

 // only when seriously: PROCFileInsertTextEnd( "line " + STR( 
FNFileGetLineNumberCurrentI() ) + ": " + s, FNFilenameGlobalErrorS(), 
FNMathGetLogicTrueB() )

 PROCFileInsertTextEnd( "line " + STR( FNFileGetLineNumberCurrentI() ) 
+ ": " + s, FNFilenameGlobalErrorS(), FNMathGetLogicTrueB() )

 // errorGB = FNMathGetLogicTrueB()

 PROCTextRemovePositionStackPop()

END

// library: string: space: remove: begin (filenamemacro=remostsb.s) 
[kn, ri, th, 15-02-2001 06:06:51]

STRING PROC FNStringRemoveSpaceBeginS( STRING s )

 // e.g. PROC Main()

 // e.g.  STRING s[255] = FNInitializeNewStringS()

 // e.g.  s = FNStringGetInputS( "string: space: remove: begin: string 
= ", "   test    " )

 // e.g.  IF FNEscapeB( s ) RETURN() ENDIF

 // e.g.  Message( "'", FNStringRemoveSpaceBeginS( s ), "'" ) // gives 
e.g. "test    "

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 RETURN( LTrim( s ) )

END

// library: string: search/find: find the first position of a string 
you search, in a given string / Returns Starting Position of One 
String Within Another) R    Pos(STRING needle, STRING haystack)* [kn, 
ri, za, 12-12-1998 20:08:55]

INTEGER PROC FNIntegerGetStringSearchInstrI( STRING s, STRING searchS )

 // e.g. PROC Main()  Message( IIF( FNIntegerGetStringSearchInstrI
( "This line contains a ','", "," ) <> 0, "Found", "Not Found" ) )  END

 RETURN( Pos( searchS, s ) )

END

// library: math: number equal to ZERO? [kn, ri, th, 03-05-2001 
14:19:57]

INTEGER PROC FNMathCheckNumberEqualZeroB( INTEGER x )

 RETURN( FNMathCheckNumberEqualB( x, 0 ) )

END

// library: string: get: word: token: rest: the rest of the string 
after the first N  characters (same as MID$( s$, N% ) in BASIC / 
FNStringGetMidStringS( s$, N% ) ) [kn, ri, di, 17-08-1999 01:15:41]

STRING PROC FNStringGetWordRestS( STRING s, INTEGER T ) // version via 
the more universal FNMidString

 // e.g. <F12> PROCMessage( FNStringGetWordRestS( "knud", 2 ) ) // 
gives "ud"

 // e.g. <F12> PROCMessage( FNStringGetWordRestS( "language", 4 ) ) // 
gives "uage"

 INTEGER lengthT = FNStringGetLengthI( s )

 IF FNMathCheckNumberInRangeNotB( T, 0, lengthT ) RETURN( 
FNStringGetEmptyS() ) ENDIF

 RETURN( FNStringGetRightStringS( s, FNStringGetLengthI( s ) - T ) )

END

// library: string: line: length: what is the length 
(filenamemacro=getstgle.s) [kn, ri, wo, 25-11-1998 20:20:58]

INTEGER PROC FNStringGetLengthI( STRING s )

 // e.g. PROC Main()

 // e.g.  STRING s1[255] = FNInitializeNewStringS()

 // e.g.  s1 = FNStringGetInputS( "string: line: length: string 
= ", "this is a test" )

 // e.g.  IF FNEscapeB( s1 ) RETURN() ENDIF

 // e.g.  Message( FNStringGetLengthI( s1 ) ) // gives e.g. 14

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 //

 // e.g. // <F12> Message( FNStringGetLengthI( "knud" ) ) // gives 4

 // e.g. // <F12> Message( FNStringGetLengthI( "the" ) ) // gives 3

 RETURN( Length( s ) )

END

// library: string: concatenation: concatenation 2 words tot 1 word 
[kn, zoe, th, 01-02-2001 19:32:49]

STRING PROC FNStringGetConcatS( STRING s1, STRING s2 ) // version with 
test if string empty

 RETURN( FNStringGetConcatSeparatorS( s1, s2, FNStringGetEmptyS() ) )

END

// library: string: get: filename: end: back: slash: not: equal: 
insert: end (filenamemacro=getstiep.s) [kn, ni, su, 17-08-2003  
0:24:04]

STRING PROC FNStringGetFilenameEndBackSlashNotEqualInsertEndS( STRING 
s )

 // e.g. PROC Main()

 // e.g.  Message( FNStringGetFilenameEndBackSlashNotEqualInsertEndS
( 'c:\temp\ddd' ) ) // gives e.g. a string 'c:\temp\ddd\' (so with 
always a string with a backslash '\' at the end)

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 RETURN( FNStringGetCharacterEndBackSlashNotEqualInsertEndS( s ) )

END

// library: file: filename: get: extract the filename + extension (and 
not the path) from the given filename, without a backslash 
(filenamemacro=getstfex.s) [kn, ri, di, 06-07-1999 05:22:19]

STRING PROC FNStringGetFileInfoToFilenameExtensionS( STRING s )

 // e.g. PROC Main()

 // e.g.  Message( FNStringGetFileInfoToFilenameExtensionS
( "c:\kee\bbc\taal\ddd.dok" ) ) // gives e.g. "ddd.dok"

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 RETURN( FNFilenameSplitInPartsS( s, _NAME_ | _EXT_ ) )

END

// library: (Displays Pop-Up Menu on Screen and Prompts User) R    
YesNo(STRING title)* [kn, zoe, wo, 16-06-1999 01:07:13]

INTEGER PROC FNMathGetNumberInputYesNoCancelI( STRING infoS )

 RETURN( YesNo( infoS ) )

END

// library: math: logic: false: wrapper [kn, ri, su, 22-07-2001 
15:43:08]

INTEGER PROC FNMathGetLogicFalseB()

 RETURN( FALSE )

END

// library: math: logic: true: wrapper [kn, ri, su, 22-07-2001 
15:43:12]

INTEGER PROC FNMathGetLogicTrueB()

 RETURN( TRUE )

END

// library: math: logic: false: initialize [kn, ri, su, 22-07-2001 
15:58:06]

INTEGER PROC FNInitializeNewBooleanFalseB()

 RETURN( FNMathGetLogicFalseB() )

END

// library: input: ask: find history [kn, ri, sa, 25-08-2001 20:34:13]

INTEGER PROC FNAskHistoryCentralB( STRING askS, VAR STRING 
answerdefaultS, INTEGER historyI )

 RETURN( Ask( askS, answerdefaultS, historyI ) )

END

// library: error: warning: give a warning message via 3 strings [kn, 
ri, su, 29-07-2001 18:24:52]

PROC PROCWarnCons3( STRING s1, STRING s2, STRING s3 )

 PROCWarn( FNStringGetCons3S( s1, s2, s3 ) )

END

// library: error: general output string to recognize an error (e.g. 
in another routine). Central routine, only one occurrence of this 
constant string [kn, ri, za, 05-12-1998 20:58:17]

STRING PROC FNStringGetErrorS()

 // e.g. <F12> PROCMessage( FNStringGetErrorS() ) // gives "<ERROR>"

 RETURN( "<ERROR>" )

END

// library: string: get: character: symbol: central [kn, ri, sa, 07-07-
2001 22:35:39]

STRING PROC FNStringGetCharacterSymbolCentralS( INTEGER I )

 RETURN( FNStringGetAsciiToCharacterS( I ) )

END

// library: error: test if an error occurred, via testing the 
output // version with testing local variable. Better. [kn, ni, wo, 05-
08-1998 20:27:34]

INTEGER PROC FNErrorCheckSB( STRING s )

 // e.g. <F12> PROCMessage( FNErrorCheckSB( "this is an error" ) // 
version with testing local variable. Better. ) // gives ...

 RETURN( FNStringCheckEqualB( s, FNStringGetErrorS() ) )

END

// library: string: concatenation: concatenate 2 words to 1 word, 
separated by separator S [kn, zoe, do, 01-07-1999 01:33:18]

STRING PROC FNStringGetConcatSeparatorS( STRING s1, STRING s2, STRING 
separatorS )

 IF FNStringCheckEmptyB( s1 ) RETURN( s2 ) ENDIF

 IF FNStringCheckEmptyB( s2 ) RETURN( s1 ) ENDIF

 RETURN( s1 + separatorS + s2 ) // leave this like this. Do not call a 
function, as this is a primitive function, you will get into a 
recursive loop, and get stack overflow

END

// library: string: get: character: symbol: " " 
(filenamemacro=getstssp.s) [kn, zoe, we, 25-10-2000 01:33:39]

STRING PROC FNStringGetCharacterSymbolSpaceS()

 // e.g. PROC Main()

 // e.g.  Message( FNStringGetCharacterSymbolSpaceS() ) // gives 
e.g. ...""

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 RETURN( FNStringGetCharacterSymbolCentralS( 32 ) )

END

// library: text: save: position: stack: push: store [kn, zoe, vr, 04-
06-1999 23:01:00]

PROC PROCTextSavePositionStackPush()

 // e.g. <F12> PROCTextSavePositionStackPush()

 PushPosition() // returns nothing

 // pushpopGT = pushpopGT + 1 // for checking purposes on the end of 
your routines. This must give 0 (as there as as many +1 as -1 in the 
OK case)

END

// library: error: warning: give a warning message via 4 strings [kn, 
ri, su, 29-07-2001 18:28:22]

PROC PROCWarnCons4( STRING s1, STRING s2, STRING s3, STRING s4 )

 PROCWarn( FNStringGetCons4S( s1, s2, s3, s4 ) )

END

// library: line: position: linenumber: return the current linenumber 
(Get the Number of Current Line) [kn, ni, ma, 02-08-1999 00:46:42]

STRING PROC FNStringGetLineNumberCurrentS()

 RETURN( FNMathGetIntegerToStringS( FNFileGetLineNumberCurrentI() ) )

END

// library: file: line: text: insert: end: goto the end of the given 
file, insert some text (when newlineB is TRUE, start every inserted 
line on a new line) [kn, ni, ma, 03-08-1998 13:08:29]

PROC PROCFileInsertTextEnd( STRING s, STRING filenameS, INTEGER 
newlineB )

 // e.g. <F12> PROCFileInsertTextEnd( "this is put on the end of the 
file", "myoutputfile", FNMathGetLogicTrueB() )

 PROCTextSavePositionStackPush()

 IF FNMathCheckLogicNotB( FNFileCheckEditB( filenameS ) )

  PROCTextRemovePositionStackPop()

  RETURN()

 ENDIF

 PROCFileGotoEnd()

 IF ( newlineB )

  PROCFileInsertEndPrepare()

 ENDIF

 PROCTextInsert( s )

 PROCTextRemovePositionStackPop()

END

// library: line: position: linenumber: return the current linenumber 
(Get the Number of Current Line) (filenamemacro=getfincu.s) [kn, ni, 
ma, 02-08-1999 00:46:42]

INTEGER PROC FNFileGetLineNumberCurrentI()

 // e.g. PROC Main()

 // e.g.  Message( FNFileGetLineNumberCurrentI() ) // gives e.g. 332 
if the cursor is on line 332 in the current file

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 RETURN( CurrLine() )

END

// library: file: do: return name of current do file [kn, zoe, fr, 20-
10-2000 23:34:48]

STRING PROC FNFilenameGlobalErrorS()

 RETURN( FNStringGetGlobalS( "filenameerrorGS" ) )

END

// library: text: remove: position: stack: pop: restore [kn, zoe, vr, 
04-06-1999 23:01:00]

PROC PROCTextRemovePositionStackPop()

 // e.g. <F12> PROCTextRemovePositionStackPop()

 PopPosition() // returns nothing

 // pushpopGT = pushpopGT - 1 // for checking purposes on the end of 
your routines. This must give 0 (as there as as many +1 as -1 in the 
OK case)

END

// library: math: number: compare: equal: number1 EQUAL TO number2? 
[kn, ri, th, 03-05-2001 12:51:27]

INTEGER PROC FNMathCheckNumberEqualB( INTEGER x1, INTEGER x2 )

 RETURN( x1 == x2 )

END

// library: input: math: number: integer: not within a numerical 
range? [kn, ri, su, 22-07-2001 18:24:51]

INTEGER PROC FNMathCheckNumberInRangeNotB( INTEGER I, INTEGER minI, 
INTEGER maxI )

 RETURN( FNMathCheckLogicNotB( FNMathCheckNumberInRangeB( I, minI, 
maxI ) ) )

END

// library: string: get: word: token: last: return a given integer 
amount of characters from the right of a given string (=RIGHT$ in 
BASIC) (filenamemacro=stririrs.s) [kn, ri, di, 13-10-1998 20:05:49]

STRING PROC FNStringGetRightStringS( STRING s, INTEGER karT )

 // e.g. PROC Main()

 // e.g.  STRING s[255] = FNInitializeNewStringS()

 // e.g.  STRING charactertotalS[255] = FNInitializeNewStringS()

 // e.g.  s = FNStringGetInputS( "string: word: token: get: right: 
string = ", "knud" )

 // e.g.  IF FNEscapeB( s ) RETURN() ENDIF

 // e.g.  charactertotalS = FNStringGetInputS( "string: word: token: 
get: right: character total = ", "2" )

 // e.g.  IF FNEscapeB( charactertotalS ) RETURN() ENDIF

 // e.g.  Message( FNStringGetRightStringS( s, FNStringGetToIntegerI( 
charactertotalS ) ) ) //  gives e.g. "kn"

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 //

 // e.g. // <F12> PROCMessage( FNStringGetRightStringS( "knud", 
1 ) ) //  gives "d"

 // e.g. // <F12> PROCMessage( FNStringGetRightStringS( "knud", 
2 ) ) //  gives "ud"

 // e.g. // <F12> PROCMessage( FNStringGetRightStringS( "best", 
3 ) ) //  gives "est"

 INTEGER lengthT = FNStringGetLengthI( s )

 IF FNMathCheckLogicNotB( ( 0 <= karT AND karT <= lengthT ) ) // if 
not between 0 and length( string ), return the whole given string

  karT = LengthT

 ENDIF

 RETURN( FNStringGetMidStringS( s, 1 + lengthT - karT, lengthT ) )

END

// library: string: get: backslash: if last character is not equal 
to '\', then concatenate a backslash to the end of the given string 
(filenamemacro=getstien.s) [kn, ri, sa, 24-02-2001 23:48:15]

STRING PROC FNStringGetCharacterEndBackSlashNotEqualInsertEndS( STRING 
s )

 // e.g. PROC Main()

 // e.g.  STRING s1[255] = FNInitializeNewStringS()

 // e.g.  s1 = FNStringGetInputS( "string: get: backslash: if: not 
equal insert end: string = ", "this is a string without a backslash at 
end" )

 // e.g.  IF FNEscapeB( s1 ) RETURN() ENDIF

 // e.g.  Message( FNStringGetCharacterEndBackSlashNotEqualInsertEndS( 
s1 ) ) // gives e.g. "this is a string with a backslash at end\"

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 RETURN( FNStringGetCharacterInsertLastIfEqualNotS( s, 
FNStringGetCharacterSymbolSlashBackwardS() ) )

END

// library: file: filename: get: split the given filename in its parts 
(e.g. split in drive, path, filename, extension or combinations) [kn, 
zoe, ma, 05-07-1999 18:56:12]

STRING PROC FNFilenameSplitInPartsS( STRING s, INTEGER optionV )

 // e.g. <F12> PROCMessage( FNFilenameSplitInPartsS
( "d:\kee\temp\ddd.bbc", _PATH_ ) ) // gives '\kee\temp\'

 RETURN( SplitPath( s, optionV ) )

END

// library: error: warning: give a warning message [kn, zoe, wo, 09-06-
1999 22:11:07]

PROC PROCWarn( STRING s )

 // e.g. <F12> PROCWarn( "you have forgotten to input a value" )

 Warn( s )

END

// library: string: get: character: convert: ASCII: given the ASCII 
value, what is the corresponding character? (Get Single Character 
Equivalent of an Integer). Syntax: Chr(INTEGER i)* [kn, zoe, wo, 16-06-
1999 01:06:51]

STRING PROC FNStringGetAsciiToCharacterS( INTEGER asciiI )

 // e.g. <F12> PROCMessage( FNStringGetAsciiToCharacterS( 65 ) ) // 
gives "A"

 // e.g. // <F12> PROCMessage( FNStringGetAsciiToCharacterS( 66 ) ) // 
gives "B"

 // e.g. // <F12> PROCMessage( FNStringGetAsciiToCharacterS( 
100 ) ) // gives "d"

 RETURN( Chr( asciiI ) )

END

// library: string: concatenation: 4 strings [kn, zoe, fr, 17-11-2000 
13:54:56]

STRING PROC FNStringGetCons4S( STRING s1, STRING s2, STRING s3, STRING 
s4 )

 RETURN( FNStringGetConsS( FNStringGetCons3S( s1, s2, s3 ), s4 ) )

END

// library: string: convert an integer to a string [kn, ni, ma, 03-08-
1998 00:34:05] / [number to string]

STRING PROC FNMathGetIntegerToStringS( INTEGER i )

 RETURN( Str( i ) )

END

// library: file: movement: end: goto end of file: moves to the end of 
the last line of current file (filenamemacro=gotofien.s) [kn, ri, zo, 
28-03-1999 01:08:06]

PROC PROCFileGotoEnd()

 // e.g. PROC Main()

 // e.g.  PROCFileGotoEnd()

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 IF FNMathCheckLogicNotB( FNFileCheckGotoEndB() )

  // PROCWarn( "cursor was already in end file else error: could no go 
to end of file" )

 ENDIF

END

// library: file: insert: prepare for the insertion (e.g. of text, of 
a new file, ...) [kn, zoe, th, 25-01-2001 18:03:46]

PROC PROCFileInsertEndPrepare()

 PROCFileGotoEnd()

 PROCLineInsertAfter()

 PROCTextGotoLineBegin()

END

// library: text: insert: insert text (filenamemacro=insetein.s) [kn, 
ni, ma, 10-08-1998 06:26:51]

PROC PROCTextInsert( STRING s )

 // e.g. PROC Main()

 // e.g.  STRING s[255] = FNInitializeNewStringS()

 // e.g.  s = FNStringGetInputS( "which text to insert at current 
position = ", FNStringGetEmptyS() )

 // e.g.  IF FNEscapeB( s ) RETURN() ENDIF

 // e.g.  PROCTextInsert( s )

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 IF FNStringCheckEmptyB( s )

  // PROCerror( FNFilenameGetCurrentS() + ": Attempt made to insert an 
empty string" )

  RETURN()

 ENDIF

 IF FNMathCheckLogicNotB( FNTextCheckInsertB( s ) )

  PROCerror( FNStringGetCons4S( FNFilenameGetCurrentS(), ": Text '", 
s, "' could not be inserted" ) )

 ENDIF

END

// library: string: global: get: get a global string [kn, zoe, ma, 14-
06-1999 20:54:18]

STRING PROC FNStringGetGlobalS( STRING stringglobalnameS )

 // e.g. <F12> PROCMessage( FNStringGetGlobalS( "dirGS" ) ) // e.g. 
gives "c:\"

 // e.g. <F12> PROCMessage( FNStringGetGlobalS( "dir1GS" ) ) // 
indicates first that this string does not exist, and returns the 
result '<VARIABLE NOT KNOWN>'.

 STRING s[255] = FNInitializeNewStringS()

 IF FNMathCheckLogicNotB( ExistGlobalVar( stringglobalnameS ) )

  PROCWarnCons5( "file", FNFilenameGetCurrentS(), ":", 
stringglobalnameS, ": this string is not known to this macro 
(suggestion: execute 'initglobal.mac' (or 'i.m') for this macro)" )

  RETURN( FNStringGetErrorS() )

 ENDIF

 s = GetGlobalStr( stringglobalnameS )

 RETURN( s )

END

// library: input: math: number: integer: within a numerical range? ( 
xmin <= x <= xmax ) gives TRUE [kn, ni, ma, 03-08-1998 17:32:54]

INTEGER PROC FNMathCheckNumberInRangeB( INTEGER I, INTEGER minI, 
INTEGER maxI )

 // e.g. <F12> Message( FNMathCheckNumberInRangeB( 5, 0, 10 ) ) // 
gives TRUE

 // e.g. // <F12> Message( FNMathCheckNumberInRangeB( 0, 0, 10 ) ) // 
gives TRUE

 // e.g. // <F12> Message( FNMathCheckNumberInRangeB( 10, 0, 10 ) ) // 
gives TRUE

 // e.g. // <F12> Message( FNMathCheckNumberInRangeB( 20, 0, 10 ) ) // 
gives FALSE

 RETURN( I IN minI..maxI )

 // variation:

 // IF FNMathCheckLogicNotB( I IN minI..maxI )

 //  PROCError( FNMathGetIntegerToStringS( I ) + ": must be between 
min " + FNMathGetIntegerToStringS( minI ) + " and maximum " + 
FNMathGetIntegerToStringS( maxI ))

 //  RETURN( FNMathGetLogicFalseB() )

 // ENDIF

 // RETURN( FNMathGetLogicTrueB() )

END

// library: string: get: word: token: middle: return a given integer 
amount of characters from the a given startposition (=MID$ in BASIC) 
(filenamemacro=getstmid.s) [kn, ri, di, 13-10-1998 20:29:00]

STRING PROC FNStringGetMidStringS( STRING s, INTEGER beginT, INTEGER 
totalT )

 // e.g. PROC Main()

 // e.g.  STRING s[255] = FNInitializeNewStringS()

 // e.g.  STRING positionbeginS[255] = FNInitializeNewStringS()

 // e.g.  STRING charactertotalS[255] = FNInitializeNewStringS()

 // e.g.  s = FNStringGetInputS( "string: get: MIDSTRING: string 
= ", "testing" )

 // e.g.  IF FNEscapeB( s ) RETURN() ENDIF

 // e.g.  positionbeginS = FNStringGetInputS( "string: get: MIDSTRING: 
beginposition = ", "2" )

 // e.g.  IF FNEscapeB( positionbeginS ) RETURN() ENDIF

 // e.g.  charactertotalS = FNStringGetInputS( "string: get: 
MIDSTRING: character total = ", "3" )

 // e.g.  IF FNEscapeB( charactertotalS ) RETURN() ENDIF

 // e.g.  Message( FNStringGetMidStringS( s, FNStringGetToIntegerI( 
positionbeginS ), FNStringGetToIntegerI( charactertotalS ) ) )

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 //

 //

 // Message( FNStringGetMidStringS( "knud", 2, 3 ) ) //  gives "nud"

 // Message( FNStringGetMidStringS( "knud", 3, 2 ) ) //  gives "ud"

 RETURN( SubStr( s, beginT, totalT ) )

END

// library: compare if string end is equal, if not so insert that 
string at the end (filenamemacro=getstenp.s) [kn, ri, sa, 24-02-2001 
23:06:33]

STRING PROC FNStringGetCharacterInsertLastIfEqualNotS( STRING inS, 
STRING tailS )

 // e.g. PROC Main()

 // e.g.  STRING s1[255] = FNInitializeNewStringS()

 // e.g.  STRING s2[255] = FNInitializeNewStringS()

 // e.g.  s1 = FNStringGetInputS( "string: insert: insert: string 
= ", "c:\kee" )

 // e.g.  IF FNEscapeB( s1 ) RETURN() ENDIF

 // e.g.  s2 = FNStringGetInputS( "string: insert: insert: frontS 
= ", "\" )

 // e.g.  IF FNEscapeB( s2 ) RETURN() ENDIF

 // e.g.  Message( FNStringGetCharacterInsertLastIfEqualNotS( s1, 
s2 ) ) // gives e.g. "c:\kee\"

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 // e.g. // <F12> PROCMessage( 
FNStringGetCharacterInsertLastIfEqualNotS( "c", ":" ) ) // gives "c:"

 // e.g. // <F12> PROCMessage( 
FNStringGetCharacterInsertLastIfEqualNotS( "c:", ":" ) ) // gives "c:"

 // e.g. // <F12> PROCMessage( 
FNStringGetCharacterInsertLastIfEqualNotS( "c:\kee", 
FNStringGetCharacterSymbolSlashBackwardS() ) ) // gives "c:\kee\"

 STRING s[255] = inS

 IF FNMathCheckLogicNotB( FNStringCheckEqualCharacterLastNB( s, 
tailS ) )

  // s = FNStringGetConcatS( s, tailS )

  s = FNStringGetConcatTailS( s, tailS )

 ENDIF

 RETURN( s )

END

// library: string: get: character: symbol: "\" 
(filenamemacro=getstsba.s) [kn, ri, su, 29-07-2001 15:41:11]

STRING PROC FNStringGetCharacterSymbolSlashBackwardS()

 // e.g. PROC Main()

 // e.g.  Message( FNStringGetCharacterSymbolSlashBackwardS() ) // 
gives e.g. ...""

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 RETURN( FNStringGetCharacterSymbolCentralS( 92 ) )

END

// library: file: movement: end: goto end of file: moves to the end of 
the last line of current file [kn, ri, zo, 28-03-1999 01:08:06]

INTEGER PROC FNFileCheckGotoEndB()

 // e.g. <F12> PROCMessage( FNFileCheckGotoEndB() )

 RETURN( EndFile() )

END

// library: line: insert: inserts 1 line after current line. The 
cursor is placed on the newly created line. The cursor column does not 
change (filenamemacro=inseliaf.s) [kn, ni, ma, 03-08-1998 13:35:30]

PROC PROCLineInsertAfter()

 // e.g. PROC Main()

 // e.g.  PROCLineInsertAfter()

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 PROCLineInsertAfterLineGotoBeginTextInsert( FNStringGetEmptyS() )

END

// library: line: movement: begin: goto begin of line (=column 1 of 
the current line). If the cursor is already at the beginning of the 
current line, zero is returned. See also: EndLine() 
(filenamemacro=gotolibe.s) [kn, zoe, do, 17-06-1999 00:12:52]

PROC PROCTextGotoLineBegin()

 // e.g. PROC Main()

 // e.g.  PROCTextGotoLineBegin()

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 IF FNMathCheckLogicNotB( FNLineGotoBeginB() )

  // PROCWarn( "Could not go to the beginning of the current line" )

 ENDIF

END

// library: text: insert: insert text [kn, zoe, di, 23-11-1999 
20:30:45]

INTEGER PROC FNTextCheckInsertB( STRING s )

 RETURN( FNTextInsertCentralB( s, _INSERT_ ) )

END

// library: file: filename: get: current: return current filename (as 
a string containing the complete path) (Get Full Name of Current 
Buffer) (nofilenamemacro) [kn, ni, za, 08-08-1998 00:02:37] 
[FNfilenamecurrent]

STRING PROC FNFilenameGetCurrentS()

 RETURN( CurrFilename() )

END

// library: error: warning: give a warning message via 5 strings [kn, 
ri, su, 29-07-2001 18:57:23]

PROC PROCWarnCons5( STRING s1, STRING s2, STRING s3, STRING s4, STRING 
s5 )

 P