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
MaplePrintf - write formatted output to the Maple user interface from external code
MapleALGEB_Printf - write formatted output to the Maple user interface from external code
MapleALGEB_SPrintf - write formatted output to a string in external code
Calling Sequence
MaplePrintf(kv, format, hw_arg1, hw_arg2, ..., hw_argN)
MapleALGEB_Printf(kv, format, mpl_arg1, mpl_arg2, ..., mpl_argN)
MapleALGEB_SPrintf(kv, format, mpl_arg1, mpl_arg2, ..., mpl_argN)
Parameters
kv
-
kernel handle of type MKernelVector
format
output format specification
hw_arg1, ..., hw_argN
hardware data
mpl_arg1, ..., mpl_argN
type ALGEB objects
Description
These functions can be used in external code with OpenMaple or define_external.
MaplePrintf is the same as the printf function in the C standard library, except that it directs output to the Maple user interface instead of stdout. The extra arguments must all be hardware types (for example, int, float, and char*).
MapleALGEB_Printf is the same as the Maple printf function. The extra arguments must all be Maple objects (of type ALGEB). Of note in the format specification, %a, formats an object of any Maple type, whereas, for example, %d formats only Maple integers.
MapleALGEB_SPrintf is the same as the Maple sprintf function. It returns a Maple String object containing the formatted output.
When an argument to MapleALGEB_Printf or MapleALGEB_SPrintf is an expression sequence, it is formatted as if it were a list.
Examples
#include "maplec.h"
ALGEB M_DECL MyArgs( MKernelVector kv, ALGEB *args )
{
M_INT i, n;
MaplePrintf(kv,"External routine called with %ld argumentsn",
(long)(n=MapleNumArgs(kv,(ALGEB)args)));
for( i=1; i<=n; ++i ) {
MapleALGEB_Printf(kv,"arg[%d] = %an",ToMapleInteger(kv,i),args[i]);
}
if( n == 0 )
return( ToMapleString(kv,"") );
else
return( MapleALGEB_SPrintf(kv,"%a",args[1]) );
Execute the external function from Maple.
External routine called with 2 arguments arg[1] = 1 arg[2] = 2
External routine called with 3 arguments arg[1] = x^2+1 arg[2] = [1, 2] arg[3] = 2^(1/2)
See Also
CustomWrapper, define_external, OpenMaple, OpenMaple/C/API, OpenMaple/C/Examples, printf, sprintf
Download Help Document