Skip to content

Commit

Permalink
renamed stuff. updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholaswogan committed Jan 27, 2022
1 parent a0038ee commit cd6ed49
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 7 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

cmake_minimum_required(VERSION 3.0)
project (fortran-yaml-c LANGUAGES C Fortran)
cmake_minimum_required(VERSION 3.4)
project (FORTRAN_YAML_C VERSION 0.1.0 LANGUAGES C Fortran)

include(FortranCInterface)
FortranCInterface_VERIFY()

add_subdirectory(libyaml EXCLUDE_FROM_ALL)

add_library(fortran-yaml-c yaml_types.f90 yaml.f90 yaml.c)
add_library(fortran-yaml-c yaml_types.f90 fortran_yaml_c.f90 libyaml_interface.c)
target_link_libraries(fortran-yaml-c yaml)
target_include_directories(fortran-yaml-c PUBLIC libyaml/include)

Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
# fortran-yaml-c

This is [YAML](http://yaml.org) parser for Fortran matching the YAML 1.1 spec.

This package uses the C package [libyaml](https://github.com/yaml/libyaml) to parse yaml documents, then stores the data in Fortran derived types created by [fortran-yaml](https://github.com/BoldingBruggeman/fortran-yaml). Hence the name `fortran-yaml-c`.

## Building

First, clone this repository

```
git clone --recursive https://github.com/Nicholaswogan/fortran-yaml-c.git
```

Next, navigate to the root directory of `fortran-yaml-c`. Finally, run the following commands to build with `cmake` and run the test and example.

```
mkdir build
cd build
cmake ..
cmake --build .
./test_yaml
./example
```
2 changes: 1 addition & 1 deletion example.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

program example
use, intrinsic :: iso_fortran_env, only: output_unit
use yaml, only: parse, error_length
use fortran_yaml_c, only: parse, error_length
use yaml_types, only: type_node, type_dictionary, type_error, real_kind, &
type_list, type_list_item, type_scalar

Expand Down
5 changes: 3 additions & 2 deletions yaml.f90 → fortran_yaml_c.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module yaml
module fortran_yaml_c
use iso_c_binding
use yaml_types
implicit none
Expand Down Expand Up @@ -110,7 +110,8 @@ recursive subroutine read_value(node_c_ptr, node)
! is null
allocate(type_null::node)
else
print*,'Problem!!!'
print*,"Something terrible broke in fortran-yaml-c. If this happens report a bug!"
stop 1
endif

end subroutine
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test_yaml.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

program test
use, intrinsic :: iso_fortran_env, only: output_unit
use yaml, only: parse, error_length
use fortran_yaml_c, only: parse, error_length
use yaml_types, only: type_node

class(type_node), pointer :: root
Expand Down

0 comments on commit cd6ed49

Please sign in to comment.