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:-Comment - display comment line in printed output
Calling Sequence
Printer:-Comment(s)
Parameters
Printer
-
Printer module
s
string to be printed as comment
Description
The procedure Comment, when used as an argument to a Print call, indicates that s should be printed as a source-code comment in the generated output.
It is frequently useful to print source-code comments in the output generated by a custom CodeGeneration translator. This is especially true when there is no exact equivalent for a Maple expression in the target language, so details about the original object would be otherwise lost in the generated output.
Note that any comments present in the Maple input do not appear as comments in the generated output, as the Maple interpreter ignores them. Thus, no comments appear in the generated output unless they are explicitly printed by a translator.
The format of a block of comment text is controlled by the language attribute "Comment". The language attribute "Comment_FormatEachLine" specifies whether each line of a multi-line comments should be formatted as a separate comment.
Examples
The following defines an extension of C that prints a comment after every if statement.
LanguageDefinition[Define]("CommentExample", extend = "C", SetLanguageAttribute( "If_Begin" = proc(x) (Printer:-Indent(), "if (",x,")\n", Printer:-Comment("This is a comment.\n")) end proc ) ):
p1 := proc(x) if x=0 then return(1) else return(2) end if; end proc:
int p1 (int x) { if (x == 0) // This is a comment. return(1); else return(2); }
See Also
Language Attributes, Print, Printer
Download Help Document
Copyright © MathResources Inc. All Rights Reserved.
www.mathresources.com