02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

module-procedure-part<br />

Program units and procedures<br />

Modules<br />

is zero or more of the statements listed in Table 7-1 with the exception of the<br />

FORMAT statement. Also, specification-part must not contain statement<br />

function definitions or automatic objects. (Specifying the SAVE attribute<br />

within a module is unnecessary in <strong>HP</strong> <strong>Fortran</strong> as entities declared within a<br />

module retain their values by default.)<br />

Each entity declared in specification-part and each of the procedure<br />

defined in module-procedure-part has either the PUBLIC or PRIVATE<br />

attribute. By default, all entities have the PUBLIC attribute and are thereby<br />

accessible by use association. Entities having the PRIVATE attribute are<br />

accessible from within the module only.<br />

The PUBLIC and PRIVATE attributes and statements are fully described in<br />

Chapter 10, “<strong>HP</strong> <strong>Fortran</strong> Statements.”<br />

is:<br />

module-procedure<br />

CONTAINS<br />

module-procedure[module-procedure...]<br />

is either a function or subroutine. module-procedure has the same<br />

structure as an external function or subroutine except that the END<br />

statement of module-procedure must include the SUBROUTINE or FUNCTION<br />

keyword, as appropriate; for an external procedure this is optional. For<br />

information about external subroutines, see “External procedures” on<br />

page 129.<br />

Note the following about module procedures:<br />

They have an explicit interface within the using program unit. It is not<br />

necessary to create an interface block for a module procedure.<br />

They can also contain internal procedures.<br />

They can be passed as an actual argument.<br />

The following may be contained in a module and be made accessible by use association:<br />

Declared variables<br />

Named constants<br />

Derived-type definitions<br />

Procedure interfaces<br />

Module procedures<br />

Chapter 7 159

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!