WPCR BT >p;n:q:r-Fo7tknz7Iw_i1fޟza&I Mp[:"\N}H1Sr S<%h^ 9 ~qa$9hmK܊ {d&[iӤ]4>lW"[I/G`+ՌE66^y:v+PF5,mQvz ILۙi8YB ;rӈBO3CGtԶ~sT-HÔn7+] j} ;J'䐗,H!>3New Century Schoolbook BoldVariable Format Expressions - Technical SpecificationReport,' ' X3J3/96-109$Craig T. Dedo$Craig T. Dedo .   /4 Fortran 2000 Standard+None     "1 302Original   ,X.F 6D:\X3J3\VARIAB~1\97-109.WPDFD:\X3J3\VARIAB~1\97-109.WPD/  (3$  A!((  ގގގ       b'  ~~~    ,X~~  -(# ISO/IECJTC1/SC22/WG5-N1241  X >(#(~#((#Ɛ(X3J3/97-109#( Ɛu#((#~(3#Ԉ s X3J3ANSIFortranStandardsCommittee>(#CraigT.Dedo }% VariableFormatExpressions;(#January10,1997 D (#Page  1  ڀof32p`4New Century Schoolbook+`4New Century Schoolbook9LXp>New Century Schoolbook Bold EE2p`4New Century Schoolbook'"^3|x2p`4New Century Schoolbook+`4New Century Schoolbook9LXp>New Century Schoolbook BoldH  A!((  ގގގ     %   ֜   r^4` <hDp Lx !(#T$%&Xrގގ%  %  %  @v v  VariableFormatExpressions   М @   TechnicalSpecification    Л@SS"byCraigT.Dedo@CC"January10,1997 1.0 T Rationale " T"T"  T Avariableformatexpression(VFE)allowsaprogrammertouseanarithmeticexpressionatanyplaceinaformateditdescriptorwhereanintegercanbeused.ThecurrentFortran90standardandtheFortran95DISonlyallowformateditdescriptorswhichareeithercharacterexpressions#ގގ#ގގԀorhardcodedintothesourcecode.    T AVFEprovidestheapplicationprogrammeraconvenientandstraightforwardmethodofvaryingtheformateditdescriptoratruntime,asconditionsrequire.ManyapplicationprogrammersconsiderVFEstobeeasiertouseandlesserrorpronethantheonlycurrentalternativeofbuildingformatspecificationsincharacterexpressions.Thus,VFEsoffertheapplicationdeveloperanopportunitytosaveonprogrammingtimeandeffort,withaconsequentincreaseinproductivity. T Itistheintentofthisproposaltoratifyexistingpractice.Asurveyofexistingcompilersindicatesthatmostimplementations#ގގ#ގގԀwhichofferthisfeaturedosoinasimilar,ifnotidentical,  manner.#ގގ#ގގ T 2.0 T TechnicalSpecification T"T"  T Avariableformatexpressionisascalarnumericexpressionenclosedinsideanglebrackets,<>.AVFEcanbeusedinaformateditdescriptoranyplacethatanintegercan.Duringprogramexecution,theVFEisreevaluatedeachtimeitisencounteredinthenormalformatscan. T IftheVFEisnotofintegerdatatype,itisconvertedtointegertypebeforeitisused,accordingtotheusualrulesfordatatypeconversion.AVFEmaybeofanyKINDtypethatisdefinedontheprocessor. T TheVFEcanbeanyvalidscalarnumericexpression.Itcanincludedummyarguments,functionreferences,andnamedconstants.ItshallnotincludeanyarrayvalueddataitemoranyvariablewiththePOINTERattribute.AnyfunctionreferencedinaVFEshallnotexecuteanyI/Ooperation. T ThevalueofaVFEmustobeytherestrictionsonmagnitudeapplyingtoitsuseintheformat,oranerroroccurs. T VFEsshallnotbeusedinacharacterformatspecification(10.1.2).  +",  T VFEsareevaluatedeachtimetheyareencounteredinthescanoftheformat.IfthevalueofthevariableusedintheexpressionchangesduringtheexecutionoftheI/Ostatement,thenewvalueisusedthenexttimetheformatitemcontainingtheexpressionisprocessed.  Example   Considerthefollowingstatements: T   INTEGER  :: 0 IWIDTH,IDIGITS,IEXPONENT,NF,NE    T   REAL,ALLOCATABLE    ::  FREAL(:),EREAL(:) sq ! T   InterveningstatementsdefiningthevaluesofNFandNE :8 М T   ALLOCATE 0 FREAL(NF)    T   ALLOCATE 0 EREAL(NE)   ! T   InterveningstatementsdefiningtheelementsofFREAL,EREAL,IWIDTH,IDIGITS,   ! T     andIEXPONENT. VT   T   WRITE(*,601)FREAL,EREAL601  FORMAT(5X,F.,&    T   &5X,E.E) T If,ononeexecutionoftheWRITEstatement,NFis5,NEis3,IWIDTHis12,IDIGITSis7,andIEXPONENTis2,thenstatement601wouldbeequivalentto:601  FORMAT(5X,5F12.7,5X,3E18.7E2)   T If,onasubsequentexecutionoftheWRITEstatement,NFis6,NEis2,IWIDTHis10,ϜIDIGITSis5,andIEXPONENTis3,thenstatement601wouldbeequivalentto:#ގގ#ގގ  601  FORMAT(5X,6F10.5,5X,2E16.5E3)  #ގގV#ގގ 3.0 T EditstotheStandard 86T"T"  T Theseeditsarepreliminaryandareofferedprimarilyasabasisfordiscussion. Section10.2  T R ChangeruleR1004andthefollowingconstraintstoread:̜R1004  r      0  \   is   intliteralconstantorvfe !  Constraint: rshallbepositive. "! Constraint: rshallnothaveakindparameterspecifiedforitifrisaconstant. q#o" Theexpressionriscalleda repeatspecification.  8$6#  Section10.2.1  %% ChangerulesR1006,R1007,R1008,R1009andthelastconstraintfollowingthemtoread:̜R1006  w      0  \   is   intliteralconstantorvfe U'S' МR1007  m      0  \   is   intliteralconstantorvfe#ގގ#ގގ (( #ގގ#ގގԜR1008  d      0  \   is   intliteralconstantorvfe#ގގD#ގގ () #ގގ##ގގԜR1009  e      0  \   is   intliteralconstantorvfe#ގގz#ގގ ) * #ގގY#ގގConstraint:0 w,m,d,andeshallnothavekindparametersspecifiedforthemiftheyare <+:", constants.  " " ChangeruleR1011andtheconstraintfollowingittoread: -$/ МR1011  k      0  \   is   signedintliteralconstantorvfe   Constraint: kshallnothaveakindparameterspecifiedforitifitisaconstant.   ChangeruleR1013andtheconstraintfollowingittoread:̜R1013  n      0  \   is   intliteralconstantorvfe   Constraint: nshallnothaveakindparameterspecifiedforitifitisaconstant.   #ގގ#ގގ Section10.2.3  us Addasection10.2.3toread:&   10.2.3   VariableFormatExpressions     T Avariableformatexpressionisascalarnumericexpressionenclosedinsideanglebrackets,<>.Avariableformatexpressioncanbeusedinaformateditdescriptoranyplacethatanintegercan.'Duringprogramexecution,thevariableformatexpressionisreevaluatedeachtimeitisencounteredinthenormalformatscan.#ގގ#ގގԜR1017  vfe      0  \   is   <numericexpr> ][  Constraint:0 Thenumericexprshallnotbearrayvalued.%# " " Constraint:0 ThenumericexprshallnothavethePOINTERattribute. " " Constraint: Avfeshallnotappearinacharacterformatspecification(10.1.2).  #ގގ!#ގގ T Anyfunctionreferencedinthenumericexprshallnotexecuteanyinputoutputstatement. A?  T Ifthevfeisnotofintegerdatatype,itisconvertedtointegertypeafteritisevaluatedand  beforeitisused.AvfemaybeofanyKINDtypethatisdefinedontheprocessor.   T Thevalueofavfeshallobeytherestrictionsonmagnitudeapplyingtoitsuseintheformat. $"  T Avfeshallbeevaluatedeachtimeitisencounteredinthescanoftheformat.Ifthevalueof  thevfechangesduringtheexecutionoftheI/Ostatement,thenewvalueisusedthenexttimethe y w formatitemcontainingtheexpressionisprocessed.#ގގ)$#ގގ 4.0 T References #"T"T" #ގގ'#0 T ( DigitalEquipmentCorporation.February1995.DECFortranLanguageReferenceManual. \$Z# Maynard,MA:DigitalEquipmentCorporation.Section8.3.7,pp.8-26thru8-28. T"T" 0 T ( DigitalEquipmentCorporation.April1995.DECFortran90LanguageReferenceManual. && Maynard,MA:DigitalEquipmentCorporation.Section11.6,pp.11-44thru11-45. T"T" 0 T ( InternationalBusinessMachinesCorporation.December1993.AIX/XLFortranCompiler/6000 ) ) LanguageReferenceVersion3Release1.NorthYork,ON:InternationalBusinessMachines ) * Corporation.p.272. T"T" ISO/IEC1539-1:1991(E)InternationalStandardProgrammingLanguageFortran90,10.1.2. ", #- М[EndofWGX3J3/97-109&WG5/N1241] ,#.