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