Maple für Professional
Maple für Akademiker
Maple für Studenten
Maple Personal Edition
Maple Player
Maple Player für iPad
MapleSim für Professional
MapleSim für Akademiker
Maple T.A. - Testen & beurteilen
Maple T.A. MAA Placement Test Suite
Möbius - Online-Courseware
Machine Design / Industrial Automation
Luft- und Raumfahrt
Fahrzeugtechnik
Robotics
Energiebranche
System Simulation and Analysis
Model development for HIL
Anlagenmodelle für den Regelungsentwurf
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematikausbildung
Technik
Allgemein- und berufsbildende Schulen
Testen und beurteilen
Studierende
Finanzmodelle
Betriebsforschung
Hochleistungsrechnen
Physik
Live-Webinare
Aufgezeichnete Webinare
Geplante Veranstaltungen
MaplePrimes
Maplesoft-Blog
Maplesoft-Mitgliedschaft
Maple Ambassador Program
MapleCloud
Technische Whitepapers
E-Mail Newsletters
Maple-Bücher
Math Matters
Anwendungs-Center
MapleSim Modell-Galerie
Anwenderberichte
Exploring Engineering Fundamentals
Lehrkonzepte mit Maple
Maplesoft Welcome-Center
Resource-Center für Lehrer
Help-Center für Studierende
Printer:-SetLanguageAttribute - add language attribute to Printer module
Printer:-ApplyLanguageAttribute - apply language attribute to remaining arguments
Printer:-GetLanguageAttribute - get language attribute from Printer module
Calling Sequence
Printer:-SetLanguageAttribute(expr, ...)
Printer:-GetLanguageAttribute(str)
Printer:-ApplyLanguageAttribute(str)
Parameters
Printer
-
Printer module
expr
string (str) or equation of the form (str = val)
str
string; name of language attribute
val
algebraic, string, or procedure; value of language attribute
Description
The SetLanguageAttribute command sets and clears language attributes. Multiple arguments are processed sequentially. If an argument has the form str=val, then the language attribute str is assigned the value val. If the language attribute str already has a value, it is overwritten. If an argument has the form str, then the language attribute str is cleared.
The GetLanguageAttribute command retrieves the current value of the language attribute str.
The ApplyLanguageAttribute behaves similarly to GetLanguageAttribute: if the value of language attribute str is of type algebraic or boolean, it is returned. However, if the value of language attribute str is of type procedure, it is applied to any remaining arguments of ApplyLanguageAttribute, and the result is returned.
For more information about language attributes and their function within CodeGeneration language definitions, see Language Attributes.
Examples
Change the string delimiter character to a single quote (') and define an equivalent for the Maple print command.
cg := echo('hello');
Use language attributes to specify templates for printing procedures and if/then/else structures in a target language.
LanguageDefinition[Define]("IfSampleLanguage", extend="default", SetLanguageAttribute( "Procedure_Begin" = proc(rettype, params) (Printer:-Indent(), rettype, " ", Printer:-GetScopeName()," ", params, Printer:-Endline()) end proc, "Procedure_ParametersInBody" = false, "Procedure_End" = "", "ParameterSequence_Begin" = "(", "ParameterSequence_Delimiter" = ",", "ParameterSequence_End" = ")", "If_Begin" = proc(x) (Printer:-Indent(), "if (",x,")", Printer:-Endline()) end proc, "If_Elsif" = proc(x) (Printer:-Indent(), "else if (",x,")", Printer:-Endline()) end proc, "If_Else" = proc() (Printer:-Indent(), "else", Printer:-Endline()) end proc, "If_End" = "" ) ):
my_signum := proc(x) if x>0 then 1 elif x = 0 then 0 else -1 end if: end proc:
integer my_signum (integer x) if (0 < x) Return(1); else if (x = 0) Return(0); else Return(-1);
See Also
Define, Language Attributes, Printer
Download Help Document
Copyright © MathResources Inc. All Rights Reserved.
www.mathresources.com