Maple Professionel
Maple Académique
Maple Edition Étudiant
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professionel
MapleSim Académique
Maple T.A. - Suite d'examens de classement
Maple T.A. MAA Placement Test Suite
Möbius - Didacticiels de mathématiques en ligne
Machine Design / Industrial Automation
Aéronautique
Ingénierie des véhicules
Robotics
Energie
System Simulation and Analysis
Model development for HIL
Modélisation du procédé pour la conception de systèmes de contrôle
Robotics/Motion Control/Mechatronics
Other Application Areas
Enseignement des mathématiques
Enseignement de l’ingénierie
Enseignement secondaire et supérieur (CPGE, BTS)
Tests et évaluations
Etudiants
Modélisation financière
Recherche opérationnelle
Calcul haute performance
Physique
Webinaires en direct
Webinaires enregistrés
Agenda des évènements
Forum MaplePrimes
Blog Maplesoft
Membres Maplesoft
Maple Ambassador Program
MapleCloud
Livres blancs techniques
Bulletin électronique
Livres Maple
Math Matters
Portail des applications
Galerie de modèles MapleSim
Cas d'Etudes Utilisateur
Exploring Engineering Fundamentals
Concepts d’enseignement avec Maple
Centre d’accueil utilisateur Maplesoft
Centre de ressources pour enseignants
Centre d’assistance aux étudiants
redirectCallBack - handle output redirection in OpenMaple
Calling Sequence
redirectCallBack(data, name, mode)
Parameters
data
-
user_data pointer passed to StartMaple (Long)
name
name of the file stream to redirect to (byte array pointer)
mode
file mode to distinguish between writing and appending (byte array pointer)
Description
This OpenMaple function is part of the MapleCallBack structure passed as an argument to StartMaple.
The redirectCallBack function is called when the kernel executes the Maple writeto or appendto function. The intent is to redirect subsequent output.
The prototype for the function that you can assign to the entry in the MapleCallBack must look like the following.
Function RedirectCallBack(ByVal data As Long,
ByVal name as Long,
ByVal mode As Long) as Long
The name parameter specifies the name of the file to which output is appended. The mode parameter specifies the file access mode to use. The mode is "wt" for write or "at" for append. The name and mode parameters are compatible with the C library function fopen.
If the name parameter is 0, Maple is signaling that redirection is terminated. Subsequent output is sent, for example, to the main output stream.
If no redirectCallBack function is provided, any attempt to execute the Maple writeto function or appendto function produces an error (reported using the errorCallBack function or textCallBack function).
The data parameter contains the same data as passed to StartMaple in the user_data parameter.
Examples
dim useredirct as boolean
Function RedirectCallBack(ByVal data As Long, ByVal name As Long, _
ByVal mode As Long) As Long
Dim iomode As String
If name = 0 Then
Close #2
useredirect = False
Else
iomode = MaplePointerToString(mode)
If iomode = "wt" Then
Open MaplePointerToString(name) For Output As #2
useredirect = True
End If
RedirectCallBack = True
End Function
Sub TextCallBack(ByVal data As Long, ByVal tag As Integer, _
ByVal Output As Long)
Dim OutputString As String
OutputString = MaplePointerToString(Output)
If useredirect Then
Write #2, "BEGIN TextCallBack", tag
Write #2, OutputString
Write #2, "END TextCallBack"
End Sub
' assignment to MapleCallback entry
cb.lpRedirectCallBack = GetProc(AddressOf RedirectCallBack)
' test statement that will invoke the CallBackCallBack
EvalMapleStatement kv, "writeto(""somefile"");"
EvalMapleStatement kv, "x+y;"
EvalMapleStatement kv, "writeto(terminal);"
See Also
callBackCallBack, errorCallBack, OpenMaple, OpenMaple/VB/API, OpenMaple/VB/Examples, queryInterrupt, readLineCallBack, StartMaple, statusCallBack, streamCallBack, textCallBack
Download Help Document