faqts : Computers : Programming : Languages : Tse : Clipboard : TSE

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

1 of 3 people (33%) answered Yes
Recently 1 of 3 people (33%) answered Yes

Entry

sub4: Using version 2.0 of TSE, is there a way to copy and paste to Windows applications?

Nov 8th, 2001 16:05
Knud van Eeden,


[Internet: see: 
http://www.faqts.com/knowledge_base/view.phtml/aid/12621/fid/900]

ad 4. the 'paste to Windows clipboard' macro for the external program
   (here TSE v3.0 for Windows):
   (save this in the macro directory of TSE v3.0, and compile this
   macro as 'clipptwd.s')

----

FORWARD PROC Main()

FORWARD PROC PROCClipboardWPasteTseWindows_TseDosDefault()

FORWARD PROC PROCClipboardWPasteTseWindowsTseDos( STRING s1 )

FORWARD STRING PROC FNFilenameTemporaryClipboardWindowsS()

FORWARD PROC PROCClipboardWPasteBlockToFileContentClear( STRING s1 )

FORWARD PROC PROCFileSaveOverwrite( STRING s1 )

FORWARD PROC PROCFileAbandon( STRING s1 )

FORWARD PROC PROCEditorAbandon()

FORWARD PROC PROCFileContentClearNoReturn( STRING s1 )

FORWARD PROC PROCClipboardWPaste()

FORWARD PROC PROCFileEdit( STRING s1 )

FORWARD PROC PROCFileSaveOverwriteCurrent()

FORWARD PROC PROCFileAbandonCurrent()

FORWARD INTEGER PROC FNGetBufferIdI()

FORWARD PROC PROCBufferGoto( INTEGER i1 )

FORWARD PROC PROCBufferEmptyCurrent( INTEGER i1 )

FORWARD PROC PROCFileSaveAsOverwritePromptNo( STRING s1 )

FORWARD PROC PROCPasteFromWinClip()

FORWARD INTEGER PROC FNNameGlobalComputerWindows2000B()

FORWARD PROC PROCClipboardWPasteTseDosGetDefault()

FORWARD INTEGER PROC FNFileEditB( STRING s1 )

FORWARD PROC PROCErrorFileNotFound( STRING s1 )

FORWARD PROC PROCFileSaveAsOverwrite( STRING s1 )

FORWARD STRING PROC FNFileNameCurrentS()

FORWARD INTEGER PROC FNFileAbandonB()

FORWARD PROC PROCWarn( STRING s1 )

FORWARD INTEGER PROC FNGetBufferCentralIdI( STRING s1 )

FORWARD INTEGER PROC FNBufferGotoB( INTEGER i1 )

FORWARD PROC PROCFileSaveAsOption( STRING s1, INTEGER i1 )

FORWARD INTEGER PROC FNNameGlobalComputerDell_LatitudeC600B()

FORWARD PROC PROCClipboardWPasteTseDosGet( STRING s1, STRING s2 )

FORWARD PROC PROCError( STRING s1 )

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

FORWARD PROC PROCMessageCons( STRING s1, STRING s2 )

FORWARD INTEGER PROC FNFileSaveAsOptionB( STRING s1, INTEGER i1 )

FORWARD INTEGER PROC FNNameGlobalComputerCentralB( STRING s1 )

FORWARD STRING PROC FNComputerDellLatitudeC600S()

FORWARD PROC PROCTseForWindowsRunMacro( STRING s1 )

FORWARD PROC PROCFileBlockRead( STRING s1 )

FORWARD PROC PROCPositionPush()

FORWARD INTEGER PROC FNLineNumberCurrentT()

FORWARD PROC PROCPositionPop()

FORWARD STRING PROC FNConsS( STRING s1, STRING s2 )

FORWARD PROC PROCMessage( STRING s1 )

FORWARD INTEGER PROC FNStringEqualB( STRING s1, STRING s2 )

FORWARD STRING PROC FNNameGlobalComputerS()

FORWARD STRING PROC FNStringGlobalGetS( STRING s1 )

FORWARD PROC PROCProgramRunParameter( STRING s1, STRING s2 )

FORWARD STRING PROC FNProgramWordProcessorTseForWindowsS()

FORWARD STRING PROC FNStringConcatS( STRING s1, STRING s2 )

FORWARD INTEGER PROC FNFileBlockReadB( STRING s1 )

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

FORWARD STRING PROC FNInitializeNewStringS()

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

FORWARD STRING PROC FNErrorS()

FORWARD PROC PROCProgramRunCentral( STRING s1, STRING s2 )

FORWARD INTEGER PROC FNFileBlockReadCentralB( STRING s1, INTEGER i1 )

FORWARD INTEGER PROC FNStringEmptyB( STRING s1 )

FORWARD STRING PROC FNStringEmptyS()

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

FORWARD PROC PROCDosChildCons( STRING s1, STRING s2 )

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

FORWARD PROC PROCDosChild( STRING s1 )

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()

 PROCClipboardWPasteTseWindows_TseDosDefault()

END



<F12> Main()



// --- LIBRARY --- //



// library: clipboard: paste: run this on TSE v3.0 for Windows on 
Windows2000 computer: copy clipboard via TSE v3.0 for windows to TSE 
v2.5 for DOS (filenamemacro=clipptwd.s) [kn, ri, su, 26-08-2001 
06:34:28]

PROC PROCClipboardWPasteTseWindows_TseDosDefault()

 // e.g. PROC Main()

 // e.g.  PROCClipboardWPasteTseWindows_TseDosDefault()

 // e.g. END

 // e.g.

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

 PROCClipboardWPasteTseWindowsTseDos( 
FNFilenameTemporaryClipboardWindowsS() )

END



// library: clipboard: paste: copy clipboard via TSE v3.0 for windows 
to TSE v2.5 for DOS [kn, ri, su, 26-08-2001 06:34:28]

PROC PROCClipboardWPasteTseWindowsTseDos( STRING filenameS )

 PROCClipboardWPasteBlockToFileContentClear( filenameS )

 PROCFileSaveOverwrite( filenameS )

 PROCFileAbandon( filenameS )

 PROCEditorAbandon() // go back to DOS() after running

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: cut/copy/paste: block: clipboard: paste: paste block to 
file [kn, ri, su, 26-08-2001 06:42:17]

PROC PROCClipboardWPasteBlockToFileContentClear( STRING filenameS )

 PROCFileContentClearNoReturn( filenameS )

 PROCClipboardWPaste()

END



// library: file: save: overwrite: given filename [kn, ri, su, 26-08-
2001 07:00:12]

PROC PROCFileSaveOverwrite( STRING filenameS )

 PROCFileEdit( filenameS )

 PROCFileSaveOverwriteCurrent()

END



// library: file: abandon: via editing this file, then abandon [kn, ri, 
tu, 21-08-2001 22:57:34]

PROC PROCFileAbandon( STRING filenameS )

 PROCFileEdit( filenameS )

 PROCFileAbandonCurrent()

END



// library: editor: abandon: default [kn, ri, tu, 28-08-2001 21:23:53]

PROC PROCEditorAbandon()

 AbandonEditor()

END



// library: file: delete: clear the contents of the file [kn, zoe, we, 
15-11-2000 11:19:37]

PROC PROCFileContentClearNoReturn( STRING filenameS )

 // e.g. <F12> PROCFileContentClear( "myfile" )

 INTEGER fileP

 PROCFileEdit( filenameS )

 fileP = FNGetBufferIdI() // get current bufferid

 PROCBufferGoto( fileP ) // goto this buffer

 PROCBufferEmptyCurrent( fileP )

 PROCFileSaveAsOverwritePromptNo( filenameS )

END



// library: cut/copy/paste: clipboard: paste: paste from clipboard 
(filenamemacro=clipwpas.s) [kn, ni, ma, 03-08-98 13:06:10]

PROC PROCClipboardWPaste()

 // e.g. PROC Main()

 // e.g.  PROCClipboardWPaste()

 // 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. call TSE v3.0 for Windows with a macro

 // 2. read the file that TSE v3.0 for Windows has created, by

 //    pasting from the clipboard, and saving this in a file

 // 3. insert this file at the cursor position

 //

 // Macro on TSE v3.0 for Windows

 // 1. paste the Windows clipboard content in a file

 //

 // ---

 //

 // Install

 //

 // 1. change the 'Paste' menu entry in your .ui to

 //     ExecMacro( "clipwpas" )

 //   and recompile it in TSE v2.5 for DOS,

 //   so that this new paste action becomes active in your TSE menu

 // 2. Copy the file, (which is meant to be run in TSE v3.0 for Windows 
only)

 //     clipptwd.s

 //    to the TSE v3.0 for Windows directory

 // 3. Compile this file

 //     clipptwd.s

 //    in TSE v3.0 for Windows

 // 4. If you now select the Windows paste option in TSE v2.5 for DOS

 //    you will have a paste from clipboard

 #IFDEF WIN32

  PROCPasteFromWinClip()

 #ELSE

  IF FNNameGlobalComputerWindows2000B()

   PROCClipboardWPasteTseDosGetDefault()

  ELSE

   PROCPasteFromWinClip()

  ENDIF

 #ENDIF

END



// library: file: edit: edit a file, with test of problems [kn, ri, za, 
02-01-1999 19:28:37]

PROC PROCFileEdit( STRING filenameS )

 // e.g. <F12> PROCFileEdit( "myfile" )

 // variation: IF NOT FNFileEditB( "" ) // opens a prompt box for a 
filename

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

 // variation: IF NOT FNFileEditB( filenameS, _DONT_PROMPT_ ) // does 
not display any warnings

 // variation: IF NOT FNFileEditB( filenameS, _DONT_LOAD_ )

 IF NOT FNFileEditB( filenameS )

  PROCErrorFileNotFound( filenameS )

 ENDIF

END



// library: file: save: overwrite: current filename [kn, ri, su, 26-08-
2001 07:00:12]

PROC PROCFileSaveOverwriteCurrent()

 PROCFileSaveAsOverwrite( FNFilenameCurrentS() )

END



// library: file: quit: abandon: (Exit File--No Save. Removes the 
current or specified buffer from the editor, without any prompt, 
discarding all unsaved changes). Syntax: AbandonFile( [ INTEGER 
buffer_id ] ). See also: FileChanged(), QuitFile(), SaveAndQuitFile(), 
EmptyBuffer() [kn, zoe, wo, 16-06-1999 01:06:25]

PROC PROCFileAbandonCurrent()

 IF NOT FNFileAbandonB()

  PROCWarn( "file could not be abandoned" )

 ENDIF

END



// library: (Returns the Unique Id of Requested or Current Buffer) O 
GetBufferId([STRING name])* [kn, zoe, th, 25-01-2001 11:12:56]

INTEGER PROC FNGetBufferIdI()

 RETURN( FNGetBufferCentralIdI( FNFilenameCurrentS() ) )

END



// library: buffer: goto: goto the numbered buffer [kn, zoe, di, 03-10-
2000 18:56:20]

PROC PROCBufferGoto( INTEGER fileP )

 // e.g. <F12> PROCBufferGoto( FNBufferCreateTemporaryI() )

 IF NOT FNBufferGotoB( fileP )

  PROCWarn( "Buffer: Goto: : Not succesful" )

 ENDIF

END



// library: delete: text: buffer: delete: all: deletes all the text in 
the current buffer [kn, ni, ma, 02-08-1999 04:47:49]

PROC PROCBufferEmptyCurrent( INTEGER fileP )

 // e.g. <F12> PROCBufferEmptyCurrent( FNBufferCreateTemporaryI() )

 EmptyBuffer( fileP )

END



// library: file: save: save as: overwrite and no prompt [kn, ri, su, 
26-08-2001 07:48:19]

PROC PROCFileSaveAsOverwritePromptNo( STRING filenameS )

 PROCFileSaveAsOption( filenameS, _OVERWRITE_ | _DONT_PROMPT_ )

END



// library: cut/copy/paste: block: paste from Windows clipboard [kn, 
ri, tu, 28-08-2001 22:04:46]

PROC PROCPasteFromWinClip()

 PasteFromWinClip()

 // 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: paste: run this on TSE v2.5 for DOS: get file with content 
of the clipboard: run TSE for Windows with a macroname as a parameter 
[kn, ri, su, 26-08-2001 06:49:18]

PROC PROCClipboardWPasteTseDosGetDefault()

 // e.g. PROC Main()

 // e.g.  PROCClipboardWPasteTseDosGetDefault()

 // e.g. END

 // e.g.

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

 PROCClipboardWPasteTseDosGet( FNFilenameTemporaryClipboardWindowsS
(), "c:\wordproc\tse32_v3\knud\clipctwd.mac" )

END



// library: file: edit: edit a file, with test of problems [kn, ni, ma, 
03-08-98 13:08:39]

INTEGER PROC FNFileEditB( STRING filenameS )

 // e.g. <F12> PROCMessage( FNFileEditB( "myfile" ) ) // gives TRUE

 IF NOT EditFile( filenameS )

  PROCErrorFileNotFound( filenameS )

  RETURN( FALSE )

 ENDIF

 RETURN( TRUE )

END



// library: error: file: not: found [kn, ri, we, 28-02-2001 23:02:12]

PROC PROCErrorFileNotFound( STRING filenameS )

 PROCError( FNCons3S( "file: ", filenameS, " not found / path does not 
exist" ) )

END



// library: file: save: save as: overwrite [kn, zoe, tu, 10-10-2000 
19:29:50]

PROC PROCFileSaveAsOverwrite( STRING filenameS )

 // e.g. <F12> PROCFileSaveAsOverwrite( "myfilename" )

 PROCFileSaveAsOption( filenameS, _OVERWRITE_ )

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: file: quit: abandon: (Exit File--No Save. Removes the 
current or specified buffer from the editor, without any prompt, 
discarding all unsaved changes). Syntax: AbandonFile( [ INTEGER 
buffer_id ] ). See also: FileChanged(), QuitFile(), SaveAndQuitFile(), 
EmptyBuffer() [kn, zoe, wo, 16-06-1999 01:06:25]

INTEGER PROC FNFileAbandonB()

 // e.g. <F12> PROCMessage( FNFileAbandonB() ) // gives non zero number 
if successful, zero (FALSE) on failure

 RETURN( AbandonFile() )

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: (Returns the Unique Id of Requested or Current Buffer) O 
GetBufferId([STRING name])* [kn, zoe, th, 25-01-2001 11:12:23]

INTEGER PROC FNGetBufferCentralIdI( STRING filenameS )

 RETURN( GetBufferId( filenameS ) )

END



// library: buffer: goto: goto the numbered buffer [kn, zoe, di, 03-10-
2000 18:56:20]

INTEGER PROC FNBufferGotoB( INTEGER fileP )

 // e.g. <F12> PROCMessage( FNBufferGotoB( FNBufferCreateTemporaryI
() ) ) // gives ...

 RETURN( GotoBufferId( fileP ) <> 0 )

END



// library: file: save: save as (Saves Current Buffer on Disk Under 
Specified Name) O    SaveAs([STRING filename [, INTEGER option]])* [kn, 
ri, zo, 28-03-1999 04:52:46]

PROC PROCFileSaveAsOption( STRING filenameS, INTEGER optionI )

 // e.g. <F12> PROCFileSaveAsOption( "myfilename", _DEFAULT_ )

 // e.g. <F12> PROCFileSaveAsOption( "myfilename", _APPEND_ )

 // e.g. <F12> PROCFileSaveAsOption( "myfilename", _OVERWRITE_ )

 // e.g. <F12> PROCFileSaveAsOption( "myfilename", _DONT_PROMPT_ )

 PROCMessageCons( "saving file (save as):", filenameS )

 IF NOT FNFileSaveAsOptionB( filenameS, optionI )

  PROCerror( "file: " + filenameS + ": could not be 'saved as'" )

 ENDIF

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: paste: run this on TSE v2.5 for DOS: get file with content 
of the clipboard: run TSE for Windows with a macroname as a parameter 
[kn, ri, su, 26-08-2001 06:49:18]

PROC PROCClipboardWPasteTseDosGet( STRING filenameS, STRING 
filenamemacroS )

 PROCTseForWindowsRunMacro( filenamemacroS ) // make sure this macro is 
compiled for TSE for Windows (so load file 'clipctwd.s' in TSE v3.0 for 
Windows, and compile it)

 PROCFileBlockRead( filenameS )

END



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

// INTEGER ErrorGB = FALSE

PROC PROCError( STRING s )

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

 PROCPositionPush()

 // Alarm()

 // PROCWarn( s )

 // Message( s )

 // PROCWarn( "Linenr ", FNLineNumberCurrentT(), ": ", s )

 Message( "Linenr ", FNLineNumberCurrentT(), ": ", s )

 // only when seriously: PROCFileTextInsertEnd( "line " + STR( 
FNLineNumberCurrentT() ) + ": " + s, filenameerrorGS, TRUE )

 // errorGB = TRUE

 PROCPositionPop()

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: message: via 2 strings [kn, ri, su, 29-07-2001 18:24:52]

PROC PROCMessageCons( STRING s1, STRING s2 )

 PROCMessage( FNConsS( s1, s2 ) )

END



// library: file: save: save as [kn, ri, zo, 28-03-1999 04:52:46]

INTEGER PROC FNFileSaveAsOptionB( STRING filenameS, INTEGER optionI )

 // e.g. <F12> PROCMessage( FNFileSaveAsOptionB( "filename", 
_APPEND_ ) )

 INTEGER saveasokB = TRUE

 PROCMessageCons( "saving file (save as):", filenameS )

 IF NOT SaveAs( filenameS, optionI )

  PROCerror( "file: " + filenameS + ": could not be 'saved as'" )

  saveasokB = FALSE

 ELSE

  saveasokB = TRUE

 ENDIF

 RETURN( saveasokB )

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: 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\clipctwd.mac" ) // make sure this macro is compiled for TSE for 
Windows (so load file 'clipctwd.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: file: block: insert/read [kn, ri, ma, 27-12-1999 02:47:25]

PROC PROCFileBlockRead( STRING filenameS )

 // e.g. <F12> PROCFileBlockRead( "ddd.ddd" )

 IF NOT FNFileBlockReadB( filenameS )

  PROCWarn( "File " + filenameS + ": Read: Block: not succesful" )

 ENDIF

END



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

PROC PROCPositionPush()

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

 PushPosition()

 // 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: line: position: linenumber: return the current linenumber 
(Get the Number of Current Line) [kn, ni, ma, 02-08-1999 00:46:42]

INTEGER PROC FNLineNumberCurrentT()

 RETURN( CurrLine() )

END



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

PROC PROCPositionPop()

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

 PopPosition()

 // 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: 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: (Write Specified Expression(s) on Editor Status Line) R    
Message(expr [, expr2]...)* [kn, zoe, wo, 16-06-1999 01:07:07]

PROC PROCMessage( STRING s )

 Message( s )

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: 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: file: block: insert [kn, ri, ma, 27-12-1999 02:47:25]

INTEGER PROC FNFileBlockReadB( STRING filenameS )

 RETURN( FNFileBlockReadCentralB( filenameS, _DONT_PROMPT_ ) )

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: 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: 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: program: run: central [kn, ri, th, 31-05-2001 17:23:31]

PROC PROCProgramRunCentral( STRING filenameS, STRING parameterS )

 PROCDosChildCons( filenameS, parameterS )

END



// library: file: block: read [kn, zoe, fr, 20-10-2000 20:19:03]

INTEGER PROC FNFileBlockReadCentralB( STRING filenameS, INTEGER caseI )

 RETURN( InsertFile( filenameS, caseI ) )

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: 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: 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: 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: 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: 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

---