Tonto | ||
---|---|---|
<< Previous | Next >> |
Once you have decided what is data and what should be a routine, you will need to define a type to hold that data.
You need to decide a name for the type (which will be the name of the module also) and the names of all the pieces of data that are held by that type. For example, below is the definition of the BUFFER type:
type buffer_type INT :: pos ! The position of the last character of the last item processed in ! buffer_str INT :: item ! The item number of the last item processed in buffer_str INT :: n_items ! The total number of items in the buffer_str BIN :: analysed ! True, if the buffer_str has been analysed STR :: comment_chars ! The comment character symbols (concatenated) to be used in the ! buffer_str BSTR :: buffer_str ! The actual buffer string end |
The above type definition is placed in the types.foo file. It must be placed after all the types which it uses, and before all the types which use it it their definition.
<< Previous | Home | Next >> |
Deciding what is data and what should be a routine | Up | Modifying the foo pre-processor |