Entry
sub1: Using version 2.0 of TSE, is there a way to copy and paste to Windows applications?
Nov 8th, 2001 16:03
Knud van Eeden,
[Internet: see:
http://www.faqts.com/knowledge_base/view.phtml/aid/12621/fid/900]
ad 1. the 'copy to Windows clipboard' macro for TSE v2.5 for DOS:
(save and compile as 'clipwcop.s')
---
FORWARD PROC Main()
FORWARD PROC PROCClipboardWCopy()
FORWARD PROC PROCCopyToWinClip()
FORWARD INTEGER PROC FNNameGlobalComputerWindows2000B()
FORWARD PROC PROCClipboardWCopyFileTseDosDefault()
FORWARD INTEGER PROC FNNameGlobalComputerDell_LatitudeC600B()
FORWARD PROC PROCClipboardWCopyFileTseDos( STRING s1, STRING s2 )
FORWARD STRING PROC FNFilenameTemporaryClipboardWindowsS()
FORWARD INTEGER PROC FNNameGlobalComputerCentralB( STRING s1 )
FORWARD STRING PROC FNComputerDellLatitudeC600S()
FORWARD INTEGER PROC FNBlockIsMarkedNotCurrentDefaultMessageB()
FORWARD PROC PROCBlockSaveOverwriteDontPromptFile( STRING s1 )
FORWARD PROC PROCTseForWindowsRunMacro( STRING s1 )
FORWARD INTEGER PROC FNStringEqualB( STRING s1, STRING s2 )
FORWARD STRING PROC FNNameGlobalComputerS()
FORWARD STRING PROC FNStringGlobalGetS( STRING s1 )
FORWARD INTEGER PROC FNBlockIsMarkedNotCurrentMessageB( STRING s1 )
FORWARD INTEGER PROC FNBlockSaveFileOverwriteDontPromptB( STRING s1 )
FORWARD PROC PROCWarnCons( STRING s1, STRING s2 )
FORWARD PROC PROCProgramRunParameter( STRING s1, STRING s2 )
FORWARD STRING PROC FNProgramWordProcessorTseForWindowsS()
FORWARD STRING PROC FNStringConcatS( STRING s1, STRING s2 )
FORWARD STRING PROC FNInitializeNewStringS()
FORWARD PROC PROCWarnCons5( STRING s1, STRING s2, STRING s3, STRING s4,
STRING s5 )
FORWARD STRING PROC FNFileNameCurrentS()
FORWARD STRING PROC FNErrorS()
FORWARD INTEGER PROC FNBlockCurrentIsMarkedB()
FORWARD PROC PROCWarn( STRING s1 )
FORWARD INTEGER PROC FNBlockSaveFileCentralB( STRING s1, INTEGER i1 )
FORWARD STRING PROC FNConsS( STRING s1, STRING s2 )
FORWARD PROC PROCProgramRunCentral( STRING s1, STRING s2 )
FORWARD STRING PROC FNStringConcatSeparatorS( STRING s1, STRING s2,
STRING s3 )
FORWARD STRING PROC FNStringEmptyS()
FORWARD STRING PROC FNCons5S( STRING s1, STRING s2, STRING s3, STRING
s4, STRING s5 )
FORWARD INTEGER PROC FNMathLogicNotB( INTEGER i1 )
FORWARD INTEGER PROC FNMathNumberEqualZeroB( INTEGER i1 )
FORWARD INTEGER PROC FNBlockCurrentMarkedTypeI()
FORWARD PROC PROCDosChildCons( STRING s1, STRING s2 )
FORWARD INTEGER PROC FNStringEmptyB( STRING s1 )
FORWARD STRING PROC FNCons4S( STRING s1, STRING s2, STRING s3, STRING
s4 )
FORWARD INTEGER PROC FNMathNumberEqualB( INTEGER i1, INTEGER i2 )
FORWARD PROC PROCDosChild( STRING s1 )
FORWARD STRING PROC FNCons3S( STRING s1, STRING s2, STRING s3 )
FORWARD PROC PROCDos( STRING s1, INTEGER i1 )
FORWARD INTEGER PROC FNDosB( STRING s1, INTEGER i1 )
FORWARD PROC PROCVideoResizeCheckWindows2000()
FORWARD STRING PROC FNProgramRun4DosS()
FORWARD STRING PROC FNWordExitPipeS()
FORWARD INTEGER PROC FNProgramRun4DosNotB( STRING s1 )
FORWARD STRING PROC FNCdrS( STRING s1 )
FORWARD INTEGER PROC FNWordExitPipeNotB( STRING s1 )
FORWARD PROC PROCVideoSizeDefault()
FORWARD INTEGER PROC FNWordFrontEqualB( STRING s1, STRING s2 )
FORWARD STRING PROC FNProgramRun4DosNotS()
FORWARD STRING PROC FNStringWordDeleteFrontS( STRING s1, STRING s2 )
FORWARD STRING PROC FNCarS( STRING s1 )
FORWARD STRING PROC FNWordExitPipeNotS()
FORWARD PROC PROCVideoLinesCentral( STRING s1 )
FORWARD STRING PROC FNIntegerToStringS( INTEGER i1 )
FORWARD INTEGER PROC FNIntegerGlobalGetI( STRING s1 )
FORWARD INTEGER PROC FNStringLengthI( STRING s1 )
FORWARD PROC PROCMacroRunKeep( STRING s1 )
FORWARD INTEGER PROC FNInitializeNewIntegerI()
FORWARD INTEGER PROC FNerrorI()
FORWARD INTEGER PROC FNMacroLoadB( STRING s1 )
FORWARD PROC PROCMacroExec( STRING s1 )
FORWARD INTEGER PROC FNIntegerMinimumAbsolute()
FORWARD INTEGER PROC FNMacroExecB( STRING s1 )
FORWARD PROC PROCWarnCons3( STRING s1, STRING s2, STRING s3 )
FORWARD INTEGER PROC FNIntegerMaximumAbsolute()
// --- MAIN --- //
PROC Main()
PROCClipboardWCopy()
END
<F12> Main()
// --- LIBRARY --- //
// library: cut/copy/paste: clipboard: copy: copy to clipboard
(filenamemacro=clipwcop.s) [kn, ni, ma, 03-08-98 13:05:39]
PROC PROCClipboardWCopy()
// e.g. PROC Main()
// e.g. PROCClipboardWCopy()
// e.g. END
// e.g.
// e.g. <F12> Main()
//
// ---
//
// Method
//
// Two macros, one running on TSE v2.5 for DOS,
// other running on TSE v3.0 for Windows
//
// Macro on TSE v2.5 for DOS:
// 1. copy marked block to file
//
// Macro on TSE v3.0 for Windows
// 1. reads that file
// 2. copy that file to the clipboard
//
// ---
//
// Install
//
// 1. change the 'Copy' menu entry in your .ui to
// ExecMacro( "clipwcop" )
// and recompile it in TSE v2.5 for DOS,
// so that this new copy action becomes active in your TSE menu
// 2. Copy the file, (which is meant to be run in TSE v3.0 for Windows
only)
// clipctwd.s
// to the TSE v3.0 for Windows directory
// 3. Compile this file
// clipctwd.s
// in TSE v3.0 for Windows
// 4. If you now select the Windows copy option in TSE v2.5 for DOS
// you will have a copy to clipboard
#IFDEF WIN32
PROCCopyToWinClip()
#ELSE
IF FNNameGlobalComputerWindows2000B()
PROCClipboardWCopyFileTseDosDefault()
ELSE
PROCCopyToWinClip()
ENDIF
#ENDIF
END
// library: cut/copy/paste: block: copy to Windows clipboard [kn, zoe,
ma, 24-05-1999 18:04:25]
PROC PROCCopyToWinClip()
// e.g. <F12> PROCCopyToWinClip()
CopyToWinClip()
// in OS2 use: PipeOut()
END
// library: file: do: is the name of the current computer the Dell
Latitude C600? [kn, ri, sa, 07-07-2001 19:57:14]
INTEGER PROC FNNameGlobalComputerWindows2000B()
RETURN( FNNameGlobalComputerDell_LatitudeC600B() )
END
// library: clipboard: copy: run this on TSE v2.5 for DOS: clipboard
via TSE v3.0 for windows to TSE v2.5 for DOS / add this name to
the 'Copy' option in your .ui file [kn, ri, su, 26-08-2001 06:34:28]
PROC PROCClipboardWCopyFileTseDosDefault()
// e.g. PROC Main()
// e.g. PROCClipboardWCopyFileTseDosDefault()
// e.g. END
// e.g.
// e.g. <F12> Main()
PROCClipboardWCopyFileTseDos( FNFilenameTemporaryClipboardWindowsS
(), "clipctwd" )
END
// library: file: do: is the name of the current computer the Dell
Latitude C600? [kn, ri, sa, 07-07-2001 19:57:14]
INTEGER PROC FNNameGlobalComputerDell_LatitudeC600B()
// e.g. <F12> Message( FNNameGlobalComputerDell_LatitudeC600B() ) //
gives TRUE when running Dell Latitude
RETURN( FNNameGlobalComputerCentralB( FNComputerDellLatitudeC600S() ) )
END
// library: clipboard: copy: central [ri, su, 26-08-2001 06:34:28]
PROC PROCClipboardWCopyFileTseDos( STRING filenameS, STRING
filenamemacroS )
IF FNBlockIsMarkedNotCurrentDefaultMessageB() RETURN() ENDIF // return
from the current procedure if no block is marked
PROCBlockSaveOverwriteDontPromptFile( filenameS )
PROCTseForWindowsRunMacro( filenamemacroS ) // make sure this macro is
compiled for TSE for Windows (so load file 'cliptwtd.s' in TSE v3.0 for
Windows, and compile it)
END
// library: clipboard: copy clipboard via TSE v3.0 for windows to TSE
v2.5 for DOS: temporary filename [kn, ri, su, 26-08-2001 06:36:08]
STRING PROC FNFilenameTemporaryClipboardWindowsS()
RETURN( "c:\dddxxx.xzy" )
END
// library: file: do: is the name of the current computer: central [kn,
ri, sa, 07-07-2001 19:57:51]
INTEGER PROC FNNameGlobalComputerCentralB( STRING s )
RETURN( FNStringEqualB( s, FNNameGlobalComputerS() ) )
END
// library: file: do: return name of current computer: Dell Latitude
[kn, ri, sa, 07-07-2001 20:00:03]
STRING PROC FNComputerDellLatitudeC600S()
// e.g. <F12> Message( FNNameGlobalComputerCompaqDellLatitudeC600S
() ) // gives ...
RETURN( FNStringGlobalGetS( "computerhomedelllatitudec600GS" ) )
END
// library: block: mark: if NO block in CURRENT file marked, give a
default message [kn, ri, zo, 17-10-1999 08:21:38]
INTEGER PROC FNBlockIsMarkedNotCurrentDefaultMessageB()
RETURN( FNBlockIsMarkedNotCurrentMessageB( "No block is marked in
current file. First mark a block" ) )
END
// library: block: save+overwrite+dontprompt [kn, ri, tu, 28-08-2001
21:11:08]
PROC PROCBlockSaveOverwriteDontPromptFile( STRING filenameS )
IF NOT ( FNBlockSaveFileOverwriteDontPromptB( filenameS ) )
PROCWarnCons( "block could not be saved in", filenameS )
ENDIF
END
// library: program: run: parameter: run TSE for Windows with a
macroname as a parameter [kn, ri, su, 26-08-2001 06:49:18]
PROC PROCTseForWindowsRunMacro( STRING filenamemacroS )
// e.g. PROC Main()
// e.g. PROCTseForWindowsRunMacro( "c:\wordproc\tse32_v3
\knud\cliptwtd.mac" ) // make sure this macro is compiled for TSE for
Windows (so load file 'cliptwtd.s' in TSE v3.0 for Windows, and compile
it)
// e.g. END
// e.g.
// e.g. <F12> Main()
PROCProgramRunParameter( FNProgramWordProcessorTseForWindowsS(),
FNStringConcatS( "-e", filenamemacroS ) )
END
// library: string: equal: Are two given strings equal? [kn, zoe, wo,
04-10-2000 18:23:27]
INTEGER PROC FNStringEqualB( STRING s1, STRING s2 )
// e.g. <F12> PROCMessage( FNStringEqualB( "knud", "knud" ) ) // gives
TRUE
// e.g. <F12> PROCMessage( FNStringEqualB( "knud", "van" ) ) // gives
FALSE
RETURN( s1 == s2 )
END
// library: file: do: return name of current computer [kn, zoe, we, 25-
10-2000 19:15:15]
STRING PROC FNNameGlobalComputerS()
RETURN( FNStringGlobalGetS( "computerGS" ) )
END
// library: string: global: get: get a global string [kn, zoe, ma, 14-
06-1999 20:54:18]
STRING PROC FNStringGlobalGetS( STRING stringglobalnameS )
// e.g. <F12> PROCMessage( FNStringGlobalGetS( "dirGS" ) ) // e.g.
gives "c:\"
// e.g. <F12> PROCMessage( FNStringGlobalGetS( "dir1GS" ) ) //
indicates first that this string does not exist, and returns the
result '<VARIABLE NOT KNOWN>'.
STRING s[255] = FNInitializeNewStringS()
IF NOT ExistGlobalVar( stringglobalnameS )
PROCWarnCons5( "file", FNFilenameCurrentS(), ":",
stringglobalnameS, ": this string is not known to this macro
(suggestion: execute 'initglobal.mac' (or 'i.m') for this macro)" )
RETURN( FNErrorS() )
ENDIF
s = GetGlobalStr( stringglobalnameS )
RETURN( s )
END
// library: block: mark: if NO block in CURRENT file marked, give a
message [kn, ri, zo, 17-10-1999 08:21:38]
INTEGER PROC FNBlockIsMarkedNotCurrentMessageB( STRING s )
// e.g. <F12> IF FNBlockIsMarkedNotCurrentMessageB( "No block is
marked in current file" ) RETURN() ENDIF // return from the current
procedure if no block is marked
INTEGER blockcurrentismarkedB = FNBlockCurrentIsMarkedB()
IF NOT ( blockcurrentismarkedb ) // block is not marked
PROCWarn( s )
ENDIF
RETURN( NOT blockcurrentismarkedB )
END
// library: block: save: overwrite [kn, ri, tu, 28-08-2001 21:09:27]
INTEGER PROC FNBlockSaveFileOverwriteDontPromptB( STRING filenameS )
RETURN( FNBlockSaveFileCentralB( filenameS, _OVERWRITE_ |
_DONT_PROMPT_ ) )
END
// library: error: warning: give a warning message via 2 strings [kn,
ri, su, 29-07-2001 18:24:52]
PROC PROCWarnCons( STRING s1, STRING s2 )
PROCWarn( FNConsS( s1, s2 ) )
END
// library: browser: run: central [kn, ri, su, 18-03-2001 02:08:08]
PROC PROCProgramRunParameter( STRING filenameS, STRING parameterS )
PROCProgramRunCentral( filenameS, parameterS )
END
// library: program: fill in here the path to your TSE v3.0 for Windows
[kn, ri, su, 26-08-2001 06:47:57]
STRING PROC FNProgramWordProcessorTseForWindowsS()
RETURN( "c:\wordproc\tse32_v3\e32.exe" )
END
// library: string: concatenation: concatenation 2 words tot 1 word
[kn, zoe, th, 01-02-2001 19:32:49]
STRING PROC FNStringConcatS( STRING s1, STRING s2 ) // version with
test if string empty
RETURN( FNStringConcatSeparatorS( s1, s2, "" ) )
END
// library: string: initialize [kn, ri, mo, 09-07-2001 12:00:07]
STRING PROC FNInitializeNewStringS()
RETURN( FNStringEmptyS() )
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 )
PROCWarn( FNCons5S( s1, s2, s3, s4, s5 ) )
END
// library: file: filename: get: current: return current filename (as a
string containing the complete path) (Get Full Name of Current Buffer)
[kn, ni, za, 08-08-1998 00:02:37] [FNfilenamecurrent]
STRING PROC FNFileNameCurrentS()
// e.g. <F12> PROCMessage( "Current filename = ",
FNFilenameCurrentS ) // gives e.g. c:\temp\ddd.dok
RETURN( CurrFilename() )
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 FNErrorS()
// e.g. <F12> PROCMessage( FNErrorS() ) // gives "<ERROR>"
RETURN( "<ERROR>" )
END
// library: block: mark: is a block marked in CURRENT file? [kn, zoe,
do, 20-05-1999 12:41:49]
INTEGER PROC FNBlockCurrentIsMarkedB()
// e.g. <F12> PROCMessage( FNBlockCurrentIsMarkedB() ) // gives ...
RETURN( FNMathLogicNotB( FNMathNumberEqualZeroB(
FNBlockCurrentMarkedTypeI() ) ) )
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: block: save [kn, ri, tu, 28-08-2001 21:06:23]
INTEGER PROC FNBlockSaveFileCentralB( STRING filenameS, INTEGER
saveoptionI )
RETURN( SaveBlock( filenameS, saveoptionI ) )
END
// library: string: concatenation: concatenation 2 words tot 1 word
(separated by a comma) [kn, ri, wo, 25-11-1998 20:15:03]
STRING PROC FNConsS( STRING s1, STRING s2 ) // version with test if
string empty
// e.g. <F12> PROCMessage( FNConsS( "knud", "van" ) )
RETURN( FNStringConcatSeparatorS( s1, s2, " " ) )
END
// library: program: run: central [kn, ri, th, 31-05-2001 17:23:31]
PROC PROCProgramRunCentral( STRING filenameS, STRING parameterS )
PROCDosChildCons( filenameS, parameterS )
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 FNStringConcatSeparatorS( STRING s1, STRING s2, STRING
separatorS )
IF FNStringEmptyB( s1 ) RETURN( s2 ) ENDIF
IF FNStringEmptyB( s2 ) RETURN( s1 ) ENDIF
RETURN( s1 + separatorS + s2 )
END
// library: string: empty: return an empty string [kn, ri, za, 20-05-
2000 20:11:03]
STRING PROC FNStringEmptyS()
RETURN( "" )
END
// library: string: concatenation: 5 strings [kn, zoe, fr, 17-11-2000
13:55:03]
STRING PROC FNCons5S( STRING s1, STRING s2, STRING s3, STRING s4,
STRING s5 )
RETURN( FNConsS( FNCons4S( s1, s2, s3, s4 ), s5 ) )
END
// library: math: logic: not [kn, ri, tu, 15-05-2001 16:54:21]
INTEGER PROC FNMathLogicNotB( INTEGER B )
RETURN( NOT B )
END
// library: math: number equal to ZERO? [kn, ri, th, 03-05-2001
14:19:57]
INTEGER PROC FNMathNumberEqualZeroB( INTEGER x )
RETURN( FNMathNumberEqualB( x, 0 ) )
END
// library: block: mark: type: return the type of the block marked in
the current file (Determines Whether a Block is Marked in Current File)
N [kn, ri, zo, 17-10-1999 07:17:38]
INTEGER PROC FNBlockCurrentMarkedTypeI()
// e.g. <F12> PROCMessage( FNBlockCurrentMarkedTypeI() ) // gives ...
RETURN( IsBlockInCurrFile() )
END
// library: system: operating system: dos: goto Dos, do the action, and
come back: concatenate input (space in between) [kn, ri, tu, 21-08-2001
23:52:50]
PROC PROCDosChildCons( STRING s1, STRING s2 )
PROCDosChild( FNConsS( s1, s2 ) )
END
// library: string: empty: is given string empty? [kn, ri, za, 20-05-
2000 20:11:08]
INTEGER PROC FNStringEmptyB( STRING s )
RETURN( FNStringEqualB( s, "" ) )
END
// library: string: concatenation: 4 strings [kn, zoe, fr, 17-11-2000
13:54:56]
STRING PROC FNCons4S( STRING s1, STRING s2, STRING s3, STRING s4 )
RETURN( FNConsS( FNCons3S( s1, s2, s3 ), s4 ) )
END
// library: math: number: number1 EQUAL TO number2? [kn, ri, th, 03-05-
2001 12:51:27]
INTEGER PROC FNMathNumberEqualB( INTEGER x1, INTEGER x2 )
RETURN( x1 == x2 )
END
// library: system: operating system: dos: goto Dos, do the action, and
come back [kn, ri, zo, 06-12-1998 04:53:24]
PROC PROCDosChild( STRING s )
// // e.g. <F12> PROCDosChild( "dir" )
// e.g. <F12> PROCDosChild( "start c:\progra~1\micros~2
\docs\xmlsdk30.chm" )
// PROCDos( s, _DONT_PROMPT_ | _TEE_OUTPUT_ )
PROCDos( s, _DONT_PROMPT_ )
END
// library: string: concatenation: 3 strings [kn, zoe, fr, 17-11-2000
13:52:07]
STRING PROC FNCons3S( STRING s1, STRING s2, STRING s3 )
RETURN( FNConsS( FNConsS( s1, s2 ), s3 ) )
END
// library: system: operating system: dos: passes a command to the
operating system [kn, zoe, wo, 16-06-1999 01:06:53]
PROC PROCDos( STRING s, INTEGER optionT )
// e.g. <F12> PROCDos( "dir", _DONT_PROMPT_ )
// e.g. <F12> PROCDos( "dir", _DEFAULT_ )
// e.g. <F12> PROCDos( "dir", _DONT_CLEAR_ )
// e.g. <F12> PROCDos( "dir", _TEE_OUTPUT_ )
// e.g. <F12> PROCDos( "dir", _RETURN_CODE )
IF NOT FNDosB( s, optionT )
PROCWarn( "DOS: child process: not succesful" )
ENDIF
PROCVideoResizeCheckWindows2000()
END
// library: system: operating system: dos: passes a command to the
operating system [kn, zoe, wo, 16-06-1999 01:06:53]
INTEGER PROC FNDosB( STRING inS, INTEGER optionS )
STRING s[255] = inS
STRING dosS[255] = FNProgramRun4DosS() // default: run 4nt in
Windows2000
STRING exitS[255] = FNWordExitPipeS() // default: pipe '<exit' file in
the input stream, to stop waiting for your key press input, and further
automating
IF FNNameGlobalComputerWindows2000B() // variation #IFDEF WINNT2000XP
IF FNProgramRun4DosNotB( s )
s = FNCdrS( s ) // remove first word
dosS = FNStringEmptyS()
ENDIF
IF FNWordExitPipeNotB( s )
s = FNCdrS( s ) // remove first word
exitS = FNStringEmptyS() // no exit string
ENDIF
s = FNCons3S( dosS, s, exitS ) // make sure 4DOS or 4NT is your
command processor, instead of MSDOS
ENDIF
RETURN( Dos( s, optionS ) )
END
// library: system: operating system: Windows2000: dos: when returning
from a DOS session you have to manually reset the video screen size
[kn, ri, sa, 07-07-2001 20:19:21]
PROC PROCVideoResizeCheckWindows2000()
// e.g. <F12> PROCVideoResizeCheckWindows2000()
IF FNNameGlobalComputerWindows2000B() // variation #IFDEF WINNT2000XP
PROCVideoSizeDefault()
ENDIF
END
// library: system: operating system: Windows2000: When going to the
DOS command line in the TSE v2.5 for DOS version, the system waits
anyhow until the user types 'exit'. Here the word 'exit' is piped from
a file [kn, ri, we, 22-08-2001 23:35:36]
STRING PROC FNProgramRun4DosS()
RETURN( "c:\4dos\4nt.exe" )
END
// library: system: operating system: Windows2000: When going to the
DOS command line in the TSE v2.5 for DOS version, the system waits
anyhow until the user types 'exit'. Here the word 'exit' is piped from
a file [kn, ri, we, 22-08-2001 23:35:36]
STRING PROC FNWordExitPipeS()
RETURN( "<keybexit.bat" )
END
// library: system: operating system: Windows2000: When going to the
DOS command line in the TSE v2.5 for DOS version, the system waits
anyhow until the user types 'exit'. Here the word 'exit' is piped from
a file [kn, ri, we, 22-08-2001 23:35:36]
INTEGER PROC FNProgramRun4DosNotB( STRING s )
RETURN( FNWordFrontEqualB( s, FNProgramRun4DosNotS() ) )
END
// library: string: word: token: get: rest: FNCdr(): Get a string,
without the first word (words delimited by a space " "). E.g. Message(
FNCarS( "Knud is the best" ) ) gives "Knud" // [kn, ni, zo, 02-08-98
15:54:17]
STRING PROC FNCdrS( STRING s )
RETURN( LTrim( FNStringWordDeleteFrontS( LTrim( s ), FNCarS(
s ) ) ) ) // Remove trailing spaces, determine the First word. Delete
the first word (=FNCarS), and finally remove the trailing spaces from
the result
END
// library: system: operating system: Windows2000: When going to the
DOS command line in the TSE v2.5 for DOS version, the system waits
anyhow until the user types 'exit'. Here the word 'exit' is piped from
a file [kn, ri, we, 22-08-2001 23:35:36]
INTEGER PROC FNWordExitPipeNotB( STRING s )
RETURN( FNWordFrontEqualB( s, FNWordExitPipeNotS() ) )
END
// library: video: screen: lines: default [kn, ri, su, 25-03-2001
03:52:20]
PROC PROCVideoSizeDefault()
// e.g. <F12> PROCVideoSizeDefault()
#IFDEF WIN32
PROCVideoLinesCentral( "-1,-1" ) // video.mac wants no spaces between
rows and columns
// PROCVideoLinesCentral( "35,110" ) // video.mac wants no spaces
between rows and columns
// PROCVideoLinesCentral( FNIntegerToStringS( FNIntegerGlobalGetI
( "videomaxrowGT" ) ) + "," + FNIntegerToStringS( FNIntegerGlobalGetI
( "videomaxcolGT" ) ) ) // video.mac wants no spaces between rows and
columns
#ELSE
PROCVideoLinesCentral( FNIntegerToStringS( FNIntegerGlobalGetI
( "videomaxrowGT" ) ) )
#ENDIF
END
// library: string: token: word: get: first: get the first word of a
string (separated by spaces) and test if equal to given string)
INTEGER PROC FNWordFrontEqualB( STRING s, STRING firstS )
// e.g. PROC Main()
// e.g. Message( FNWordFrontEqualB( "Knud van Eeden" , "Knud" ) ) //
gives TRUE
// e.g. END
// e.g.
// e.g. <F12> Main()
RETURN( FNStringEqualB( FNCarS( s ), firstS ) )
END
// library: system: operating system: Windows2000: When going to the
DOS command line in the TSE v2.5 for DOS version, the system waits
anyhow until the user types 'exit'. Here the word 'exit' is piped from
a file [kn, ri, we, 22-08-2001 23:35:36]
STRING PROC FNProgramRun4DosNotS()
RETURN( FNStringConcatS( "no", FNProgramRun4DosS() ) )
END
// library: string: word: token: delete: first: delete 1 occurence of a
given other string in front of a given string. E.g.
StringWordDeleteFront( "00001234567", "0" ) gives "0001234567".
Possible application: deleting the '0' in front of a phonenumber (e.g.
when dialling internationally). [kn, ni, zo, 02-08-98 16:30:45]
STRING PROC FNStringWordDeleteFrontS( STRING s, STRING deleteS )
// e.g. <F12> PROCMessage( FNStringWordDeleteFrontS( "this
is", "this" ) ) // gives " is"
// e.g. <F12> PROCMessage( FNStringWordDeleteFrontS( "the
girl", "the" ) ) // gives " girl"
// STRING PROC FNStringWordDeleteFirstS( STRING s, STRING deleteS )
INTEGER lengthdeleteI = FNStringLengthI( deleteS )
RETURN( SubStr( s, lengthdeleteI + 1, FNStringLengthI( s ) -
lengthdeleteI ) )
END
// library: string: word: token: get: first: FNCarS(): Get the first
word of a string (words delimited by a space " "). [kn, ni, zo, 02-08-
98 15:54:17]
STRING PROC FNCarS( STRING s )
// E.g. Message( FNCarS( "Knud is the best" ) ) gives "Knud"
// variation: RETURN( FNStringTokenFirstS( s, " " ) )
RETURN( GetToken( s, " ", 1 ) ) // faster, but not central
END
// library: system: operating system: Windows2000: When going to the
DOS command line in the TSE v2.5 for DOS version, the system waits
anyhow until the user types 'exit'. Here the word 'exit' is piped from
a file [kn, ri, we, 22-08-2001 23:35:36]
STRING PROC FNWordExitPipeNotS()
RETURN( FNStringConcatS( "no", FNWordExitPipeS() ) )
END
// library: video: screen: lines: central [kn, ri, su, 25-03-2001
03:46:20]
PROC PROCVideoLinesCentral( STRING s )
PROCMacroRunKeep( FNConsS( "video", s ) )
END
// library: string: convert an integer to a string [kn, ni, ma, 03-08-
98 00:34:05] / [number to string]
STRING PROC FNIntegerToStringS( INTEGER i )
RETURN( Str( i ) )
END
// library: integer: global: get: get a global integer [kn, zoe, th, 21-
12-2000 17:04:14]
INTEGER PROC FNIntegerGlobalGetI( STRING stringglobalnameS )
// e.g. <F12> PROCMessage( FNIntegerGlobalGetS( "GT" ) ) // e.g. gives
3
INTEGER I = FNInitializeNewIntegerI()
IF NOT ExistGlobalVar( stringglobalnameS )
PROCWarn( stringglobalnameS + ": this integer is not known to this
macro (suggestion: execute 'initglobal.mac' (or 'i.m') for this
macro)" )
RETURN( FNErrorI() )
ENDIF
I = GetGlobalInt( stringglobalnameS )
RETURN( I )
END
// library: string: line: length: what is the length [kn, ri, wo, 25-11-
1998 20:20:58]
INTEGER PROC FNStringLengthI( STRING s )
// e.g. <F12> PROCMessage( FNStringLengthI( "knud" ) ) // gives 4
// e.g. <F12> PROCMessage( FNStringLengthI( "the" ) ) // gives 3
RETURN( Length( s ) )
END
// library: macro: run a macro, then keep it [kn, zoe, fr, 27-10-2000
15:59:33]
PROC PROCMacroRunKeep( STRING macronameS )
// e.g. PROC Main()
// e.g. PROCMacroRunKeep( "mysubma1.mac myparameter11 myparameter12" )
// e.g. PROCMacroRunKeep( "mysubma2.mac myparameter21" )
// e.g. PROCMacroRunKeep( "mysubma3.mac myparameter31 myparameter32" )
// e.g. END
IF FNMacroLoadB( FNCarS( macronameS ) ) // necessary if you pass
parameters in a string
PROCMacroExec( macronameS )
ENDIF
END
// library: math: number: integer: initialize [kn, noot, mo, 09-07-2001
11:59:54]
INTEGER PROC FNInitializeNewIntegerI()
RETURN( 0 )
END
// library: error: indicate, via the returned number, that an error
occurred [kn, ri, do, 29-04-1999 21:19:56]
INTEGER PROC FNerrorI()
// e.g. <F12> PROCMessage( FNerrorI() ) // gives ...
RETURN( FNIntegerMinimumAbsolute() )
END
// library: macro: load: (Loads a Macro File From Disk Into Memory)
R LoadMacro(STRING macro_filename)* [kn, zoe, wo, 16-06-1999
01:07:06]
INTEGER PROC FNMacroLoadB( STRING macronameS )
RETURN( LoadMacro( macronameS ) )
END
// library: macro: (Executes the Requested Macro) O ExecMacro
([STRING macroname])* [kn, zoe, wo, 16-06-1999 01:06:54]
PROC PROCMacroExec( STRING macronameS )
// e.g. <F12> PROCMacroExec( "video" )
IF NOT FNMacroExecB( macronameS )
PROCWarnCons3( "macro", macronameS, ": could not be executed" )
ENDIF
END
// library: math: number: integer: minimum [kn, noot, mo, 09-07-2001
11:51:54]
INTEGER PROC FNIntegerMinimumAbsolute()
RETURN( - FNIntegerMaximumAbsolute() )
END
// library: macro: (Executes the Requested Macro) O ExecMacro
([STRING macroname])* [kn, zoe, wo, 16-06-1999 01:06:54]
INTEGER PROC FNMacroExecB( STRING macronameS )
RETURN( ExecMacro( macronameS ) )
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( FNCons3S( s1, s2, s3 ) )
END
// library: math: number: integer: maximum [kn, noot, mo, 09-07-2001
11:51:54]
INTEGER PROC FNIntegerMaximumAbsolute()
RETURN( maxint )
END
---