FileInquire¶
Asks the runtime about a unit or a file.
Declaration¶
Syntax¶
FileInquire(int label, expr? unit, expr? file, expr? iostat, expr? err,
expr? exist, expr? opened, expr? number, expr? named, expr? name,
expr? access, expr? sequential, expr? direct, expr? form,
expr? formatted, expr? unformatted, expr? recl, expr? nextrec,
expr? blank, expr? position, expr? action, expr? read, expr? write,
expr? readwrite, expr? delim, expr? pad, expr? flen,
expr? blocksize, expr? convert, expr? carriagecontrol, expr? size,
expr? pos, expr? iolength, expr* iolength_vars, expr? decimal,
expr? sign, expr? encoding, expr? stream, expr? iomsg, expr? round,
expr? pending, expr? asynchronous)
Arguments¶
Argument |
Description |
|---|---|
|
the statement label of the Fortran statement, or |
|
the unit to ask about. Exactly one of |
|
the file name to ask about. |
|
a variable receiving the I/O status: zero on success, non-zero otherwise. The statement does not abort when it is present. |
|
the label to branch to when the operation fails. |
|
a logical variable receiving whether the file exists. |
|
a logical variable receiving whether it is connected. |
|
an integer variable receiving the unit number. |
|
a logical variable receiving whether the unit has a name. |
|
a character variable receiving the file name. |
|
receives |
|
receives whether sequential access is allowed. |
|
receives whether direct access is allowed. |
|
receives |
|
receives whether formatted I/O is allowed. |
|
receives whether unformatted I/O is allowed. |
|
receives the record length. |
|
receives the number of the next record. |
|
receives the blank mode. |
|
receives the position mode. |
|
receives |
|
receives whether reading is allowed. |
|
receives whether writing is allowed. |
|
receives whether both are allowed. |
|
receives the delimiter mode. |
|
receives the pad mode. |
|
receives the length of the file. |
|
receives the block size of the connection. |
|
receives the byte order conversion mode. |
|
receives the carriage control mode. |
|
receives the size of the file in bytes. |
|
receives the current stream position. |
|
receives the record length needed for |
|
the output list to measure for |
|
receives the decimal edit mode. |
|
receives the sign mode. |
|
receives the encoding. |
|
receives whether stream access is allowed. |
|
a variable receiving the error message when the operation fails. |
|
receives the rounding mode. |
|
receives whether an asynchronous transfer is pending. |
|
receives whether asynchronous transfer is allowed. |
Return values¶
None.
Description¶
inquire is one statement with many independent outputs, and each of them is
a member here. Every member other than the thing being asked about is a
variable the runtime writes to, so a backend implements the statement by
filling in the members that are not nil.
The iolength= form is different from the others: it measures the output list
in iolength_vars instead of asking about a connection, and neither unit
nor file is given.
Examples¶
(FileInquire
:label -1
:unit (Var
:v (SymbolRef 1 "unit")
)
:file nil
:iostat nil
:err nil
:exist (Var
:v (SymbolRef 1 "exists")
)
:opened nil
:number nil
:named nil
:name nil
:access nil
:sequential nil
:direct nil
:form nil
:formatted nil
:unformatted nil
:recl nil
:nextrec nil
:blank nil
:position nil
:action nil
:read nil
:write nil
:readwrite nil
:delim nil
:pad nil
:flen nil
:blocksize nil
:convert nil
:carriagecontrol nil
:size nil
:pos nil
:iolength nil
:iolength_vars []
:decimal nil
:sign nil
:encoding nil
:stream nil
:iomsg nil
:round nil
:pending nil
:asynchronous nil
)
It comes from this complete ASR text document:
(TranslationUnit
:symtab (SymbolTable
:id 0
:symbols {
"main" (Program
:symtab (SymbolTable
:id 1
:symbols {
"exists" (Variable
:parent_symtab 1
:name "exists"
:dependencies []
:intent :Local
:symbolic_value nil
:value nil
:storage :Default
:type (Logical
:kind 4
)
:type_declaration nil
:abi :Source
:access :Public
:presence :Required
:value_attr false
:target_attr false
:contiguous_attr false
:bindc_name nil
:is_volatile false
:is_protected false
:pass_attr :NotMethod
:self_argument nil
:codims []
)
"iostat" (Variable
:parent_symtab 1
:name "iostat"
:dependencies []
:intent :Local
:symbolic_value nil
:value nil
:storage :Default
:type (Integer
:kind 4
)
:type_declaration nil
:abi :Source
:access :Public
:presence :Required
:value_attr false
:target_attr false
:contiguous_attr false
:bindc_name nil
:is_volatile false
:is_protected false
:pass_attr :NotMethod
:self_argument nil
:codims []
)
"n" (Variable
:parent_symtab 1
:name "n"
:dependencies []
:intent :Local
:symbolic_value nil
:value nil
:storage :Default
:type (Integer
:kind 4
)
:type_declaration nil
:abi :Source
:access :Public
:presence :Required
:value_attr false
:target_attr false
:contiguous_attr false
:bindc_name nil
:is_volatile false
:is_protected false
:pass_attr :NotMethod
:self_argument nil
:codims []
)
"unit" (Variable
:parent_symtab 1
:name "unit"
:dependencies []
:intent :Local
:symbolic_value nil
:value nil
:storage :Default
:type (Integer
:kind 4
)
:type_declaration nil
:abi :Source
:access :Public
:presence :Required
:value_attr false
:target_attr false
:contiguous_attr false
:bindc_name nil
:is_volatile false
:is_protected false
:pass_attr :NotMethod
:self_argument nil
:codims []
)
}
)
:name "main"
:dependencies []
:body [
(FileOpen
:label -1
:newunit (Var
:v (SymbolRef 1 "unit")
)
:filename (StringConstant
:s "data.txt"
:type (String
:kind 1
:len (IntegerConstant
:n 8
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
:len_kind :ExpressionLength
:physical_type :DescriptorString
)
)
:status (StringConstant
:s "old"
:type (String
:kind 1
:len (IntegerConstant
:n 3
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
:len_kind :ExpressionLength
:physical_type :DescriptorString
)
)
:form nil
:access nil
:iostat (Var
:v (SymbolRef 1 "iostat")
)
:iomsg nil
:action nil
:delim nil
:recl nil
:position nil
:blank nil
:encoding nil
:sign nil
:decimal nil
:round nil
:pad nil
:asynchronous nil
)
(FileRead
:label -1
:unit (Var
:v (SymbolRef 1 "unit")
)
:fmt nil
:iomsg nil
:iostat (Var
:v (SymbolRef 1 "iostat")
)
:advance nil
:size nil
:id nil
:pos nil
:values [
(Var
:v (SymbolRef 1 "n")
)
]
:overloaded nil
:is_formatted true
:nml nil
:rec nil
:pad nil
)
(FileWrite
:label -1
:unit (Var
:v (SymbolRef 1 "unit")
)
:iomsg nil
:iostat nil
:id nil
:values [
(Var
:v (SymbolRef 1 "n")
)
]
:separator nil
:end nil
:overloaded nil
:is_formatted true
:nml nil
:rec nil
:pos nil
:asynchronous nil
)
(FileBackspace
:label -1
:unit (Var
:v (SymbolRef 1 "unit")
)
:iostat nil
:iomsg nil
:err nil
)
(FileRewind
:label -1
:unit (Var
:v (SymbolRef 1 "unit")
)
:iostat nil
:err nil
:iomsg nil
)
(FileEndfile
:label -1
:unit (Var
:v (SymbolRef 1 "unit")
)
:iostat nil
:iomsg nil
:err nil
)
(Flush
:label -1
:unit (Var
:v (SymbolRef 1 "unit")
)
:err nil
:iomsg nil
:iostat nil
)
(FileInquire
:label -1
:unit (Var
:v (SymbolRef 1 "unit")
)
:file nil
:iostat nil
:err nil
:exist (Var
:v (SymbolRef 1 "exists")
)
:opened nil
:number nil
:named nil
:name nil
:access nil
:sequential nil
:direct nil
:form nil
:formatted nil
:unformatted nil
:recl nil
:nextrec nil
:blank nil
:position nil
:action nil
:read nil
:write nil
:readwrite nil
:delim nil
:pad nil
:flen nil
:blocksize nil
:convert nil
:carriagecontrol nil
:size nil
:pos nil
:iolength nil
:iolength_vars []
:decimal nil
:sign nil
:encoding nil
:stream nil
:iomsg nil
:round nil
:pending nil
:asynchronous nil
)
(FileClose
:label -1
:unit (Var
:v (SymbolRef 1 "unit")
)
:iostat nil
:iomsg nil
:err nil
:status nil
)
]
)
}
)
:items []
)