Skip to content

Commit

Permalink
Reorganise docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rjfarmer committed Feb 10, 2024
1 parent 6487a2b commit b2fe00b
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 86 deletions.
86 changes: 2 additions & 84 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,92 +403,10 @@ Bug reports are of course welcome and PR's should target the main branch.

For those wanting to get more involved, adding Fortran examples to the test suite of currently untested or unsupported features would be helpful. Bonus points if you also provide a Python test case (that can be marked ``@pytest.mark.skip`` if it does not work) that demonstrates the proposed interface to the new Fortran feature. Features with test cases will move higher in the order of things I add to the code.

See [how to write a test case](tests/README.md) for details on how to write test cases.
See [how to write a test case](docs/test_suite.md) for details on how to write test cases.

For those wanting to go further and add the new feature themselves open a bug report and we can chat about what needs doing.

## Debugging

For those wanting to dig further into ``gfort2py``.

Assuming that you loaded things as:

````python
x = gf.fFort(SO, MOD)
````

You can find out the available Fortran variables/procedures module information with:

````python
var = x._module['variable_name']
````

### Variables

For variables you can create a ``fVar`` (the object that handles converting too and from Python to Fortran) with:

````python
fvar = gf.fVar.fVar(var,x._module)
````

Note that at this point the ``fvar`` has no idea where to look for the variable. If you want to access its value in a module then

````python
fvar.in_dll(x._lib)
print(fvar.value)
````

and you can then set the value (after calling ``in_dll``) with:

````python
fvar.value = value
````

### Procedures

For a procedure you can do:

````python
proc = x._module['procedure_name']
````

and its Fortran object is:

````python
fproc = gf.fProc.fProc(x._lib,proc,x._module)
````

Calling the procedure is then:

````python
fproc(*args,**kwargs)
````

To access the arguments of a procedure then:

````python
args = [x._module[i.ref] for i in proc.args().symbol]
````

The return value of a function is accessed via:

````python
return_arg = x._module[proc.return_arg()]
````

### Derived types

To access a derived type (the type definition not an instance of the type)

````python
dt_type = x._module['Derived_name']
````

Note the capitalization, derived types start with a capital.

Similar to a variable, to access an instance of a derived type variable its:

````python
dt_var = x._module['dt_variable_name']
dt_fvar = gf.fVar.fVar(dt_var,x._module)
````
[Debugging instructions are here](docs/debugging.md)
83 changes: 83 additions & 0 deletions docs/debugging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
For those wanting to dig further into ``gfort2py``.

Assuming that you loaded things as:

````python
x = gf.fFort(SO, MOD)
````

You can find out the available Fortran variables/procedures module information with:

````python
var = x._module['variable_name']
````

## Variables

For variables you can create a ``fVar`` (the object that handles converting too and from Python to Fortran) with:

````python
fvar = gf.fVar.fVar(var,x._module)
````

Note that at this point the ``fvar`` has no idea where to look for the variable. If you want to access its value in a module then

````python
fvar.in_dll(x._lib)
print(fvar.value)
````

and you can then set the value (after calling ``in_dll``) with:

````python
fvar.value = value
````

## Procedures

For a procedure you can do:

````python
proc = x._module['procedure_name']
````

and its Fortran object is:

````python
fproc = gf.fProc.fProc(x._lib,proc,x._module)
````

Calling the procedure is then:

````python
fproc(*args,**kwargs)
````

To access the arguments of a procedure then:

````python
args = [x._module[i.ref] for i in proc.args().symbol]
````

The return value of a function is accessed via:

````python
return_arg = x._module[proc.return_arg()]
````

## Derived types

To access a derived type (the type definition not an instance of the type)

````python
dt_type = x._module['Derived_name']
````

Note the capitalization, derived types start with a capital.

Similar to a variable, to access an instance of a derived type variable its:

````python
dt_var = x._module['dt_variable_name']
dt_fvar = gf.fVar.fVar(dt_var,x._module)
````
4 changes: 2 additions & 2 deletions docs/support.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ These platforms are fully supported and all features should work. We test for al

- x86_64/Linux/CPython
- x86_64/MacOS/CPython
- x86_64/Windows/CPython (via Choco)
- x64/Windows/CPython (via Choco)


## Level 2 Support

These platforms are fully supported and all features should work. However we only test a single supported Python and gfortran version.

- x86_64/Linux/PyPy
- x86_64/Windows/CPython (via Cygwin)
- x64/Windows/CPython (via Cygwin)
- arm32v7/Linux/CPython
- riscv64/Linux/CPython

Expand Down
File renamed without changes.

0 comments on commit b2fe00b

Please sign in to comment.