Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
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