Skip to content

Commit 2091217

Browse files
authoredDec 7, 2022
Merge pull request #61 from sourceryinstitute/routine_maintenance
Routine Maintenance
2 parents d83d0a4 + a0561d4 commit 2091217

11 files changed

+124
-146
lines changed
 

‎.github/workflows/CI.yml

+17-22
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,32 @@ on: [push, pull_request]
44

55
jobs:
66
Build:
7-
runs-on: ubuntu-latest
7+
runs-on: ubuntu-22.04
88
strategy:
99
fail-fast: false
10+
env:
11+
FC: gfortran
12+
GCC_V: 12
1013

1114
steps:
1215
- name: Checkout code
13-
uses: actions/checkout@v1
16+
uses: actions/checkout@v3
1417

15-
- name: Get Time
16-
id: time
17-
uses: nanzm/get-time-action@v1.0
18+
- uses: fortran-lang/setup-fpm@v4
1819
with:
19-
format: 'YYYY-MM'
20+
github-token: ${{ secrets.GITHUB_TOKEN }}
2021

21-
- name: Setup cache for opencoarrays
22-
id: cache-opencoarrays
23-
uses: actions/cache@v2
24-
with:
25-
path: "OpenCoarrays-2.9.2/"
26-
key: ${{ steps.time.outputs.time }}
27-
28-
- name: Install GFortran, OpenCoarrays,and fpm
22+
- name: Install Dependencies Ubuntu
23+
if: contains(matrix.os, 'ubuntu')
2924
run: |
30-
sudo apt install -y gfortran-11 graphviz
31-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 \
32-
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-11 \
33-
--slave /usr/bingcov gcov /usr/bin/gcov-11
34-
if [ ! -d OpenCoarrays-2.9.2 ] ; then wget -P . https://github.com/sourceryinstitute/OpenCoarrays/releases/download/2.9.2/OpenCoarrays-2.9.2.tar.gz && tar -xf OpenCoarrays-2.9.2.tar.gz && cd OpenCoarrays-2.9.2 && TERM=xterm ./install.sh -y; fi
35-
wget https://github.com/fortran-lang/fpm/releases/download/v0.1.3/fpm-0.1.3-linux-x86_64 && sudo cp fpm-0.1.3-linux-x86_64 /usr/local/bin/fpm && sudo chmod a+x /usr/local/bin/fpm
25+
sudo apt-get update
26+
sudo apt install -y gfortran-${GCC_V}
27+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
28+
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
29+
--slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V}
3630
3731
- name: Build and test
3832
run: |
39-
source OpenCoarrays-2.9.2/prerequisites/installations/opencoarrays/2.9.2/setup.sh
40-
fpm test --compiler caf --runner "cafrun -n 1"
33+
which gfortran
34+
gfortran --version
35+
fpm test

‎.github/workflows/deploy-docs.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@ on: [push, pull_request]
55

66
jobs:
77
Build:
8-
runs-on: ubuntu-latest
8+
runs-on: ubuntu-22.04
9+
10+
env:
11+
FC: gfortran
12+
GCC_V: 12
913

1014
steps:
1115
- name: Checkout code
12-
uses: actions/checkout@v2
16+
uses: actions/checkout@v3
1317

1418
- name: Install Dependencies Ubuntu
1519
run: |
1620
sudo apt-get update
17-
sudo apt install -y python-dev python build-essential graphviz
21+
sudo apt install -y gfortran-${GCC_V} python3-dev graphviz
1822
sudo pip install ford
1923
2024
- name: Build Developer Documenation

‎example/print-to-json.f90

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ program print_to_json
33
!!
44
!! Compile and run run this program by executing the following
55
!! command from the top-level directory of the dag source tree:
6-
!!
6+
!!
77
!! fpm run --example print-to-json
88
!!
99
use dag_m, only: dag_t
1010
use vertex_m, only: vertex_t
11-
use iso_varying_string, only : varying_string, var_str, char
11+
use iso_varying_string, only : varying_string, var_str
1212
implicit none
1313

1414
character(len=*), parameter :: longest_name = "iso_varying_string"
@@ -27,7 +27,7 @@ program print_to_json
2727
,dag_s => findloc(names, "dag_s", dim=1) &
2828
,main => findloc(names, "main", dim=1) &
2929
)
30-
block
30+
block
3131
type(dag_t) program_units
3232

3333
program_units = dag_t([ &
@@ -41,7 +41,7 @@ program print_to_json
4141
])
4242

4343
associate(json_object => program_units%to_json())
44-
print *, char(json_object%to_expanded_string())
44+
print *, json_object%to_expanded_string()
4545
end associate
4646
end block
4747
end associate

‎example/read-from-json.f90

+10-9
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,31 @@ program read_from_json
44
!! Compile and run run this program by executing the following
55
!! command from the top-level directory of the dag source tree:
66
!!
7-
!! fpm run --example read-from-json
7+
!! fpm run --example read-from-json
88
!!
99
use dag_m, only: dag_t
10-
use jsonff, only : parse_json_from_file, json_object_t
10+
use rojff, only : parse_json_from_file, json_object_t
1111
use iso_varying_string, only : char
1212
implicit none
1313

1414

1515
associate(parsed_json => parse_json_from_file('example/dag-dependencies.json'))
1616

1717
if (parsed_json%failed()) then
18-
associate(errors => parsed_json%errors())
19-
error stop char(errors%to_string())
20-
end associate
18+
error stop char(parsed_json%errors%to_string())
2119
end if
2220

2321
block
24-
class(json_object_t), allocatable :: json_object
2522
type(dag_t) dag
2623

27-
json_object = parsed_json%value_()
28-
dag = dag_t(json_object)
24+
select type (obj => parsed_json%value_)
25+
type is (json_object_t)
26+
dag = dag_t(obj)
27+
class default
28+
error stop "json wasn't an object: " // obj%to_compact_string()
29+
end select
2930
end block
3031

3132
end associate
3233

33-
end program
34+
end program

‎fpm.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
name = "dag"
2-
version = "2.0.1"
2+
version = "3.0.0"
33
license = "BSD"
44
author = ["Damian Rouson", "Robert Singleterry", "Brad Richardson"]
55
maintainer = "damian@sourceryinstitute.org"
66
copyright = "2020-2021 Sourcery Institute"
77

88
[dependencies]
9-
jsonff = {git = "https://gitlab.com/everythingfunctional/jsonff", tag = "v3.0.0"}
10-
erloff = {git = "https://gitlab.com/everythingfunctional/erloff", tag = "v2.1.0"}
11-
iso_varying_string = {git = "https://gitlab.com/everythingfunctional/iso_varying_string", tag = "v2.0.0"}
12-
assert = {git = "https://github.com/sourceryinstitute/assert", tag = "1.3.0"}
9+
rojff = { git = "https://gitlab.com/everythingfunctional/rojff", tag = "v1.0.0" }
10+
erloff = { git = "https://gitlab.com/everythingfunctional/erloff", tag = "v2.2.0" }
11+
iso_varying_string = { git = "https://gitlab.com/everythingfunctional/iso_varying_string", tag = "v3.0.4" }
12+
assert = { git = "https://github.com/sourceryinstitute/assert", tag = "1.4.0" }
1313

1414
[dev-dependencies]
15-
vegetables = {git = "https://gitlab.com/everythingfunctional/vegetables", tag = "v7.2.1"}
15+
veggies = { git = "https://gitlab.com/everythingfunctional/veggies", tag = "v1.0.5" }

‎src/dag_m.f90

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ module dag_m
55
!! date: 2020-Nov-30
66
!! license: Copyright (c) 2020, Sourcery Institute, BSD 3-clause license Copyright (c) 2018 Jacob Williams
77
use vertex_m, only : vertex_t
8-
use jsonff, only : json_object_t
9-
use iso_varying_string, only : varying_string
8+
use rojff, only : json_object_t
109

1110
implicit none
1211

@@ -68,7 +67,7 @@ elemental module function num_vertices(self)
6867
end function
6968

7069
pure module function depends_on(self, vertex_num) result(dependencies)
71-
!! Result is an array of the vertex numbers that depend on on vertex vertex_num
70+
!! Result is an array of the vertex numbers that depend on on vertex vertex_num
7271
implicit none
7372
class(dag_t), intent(in) :: self
7473
integer, intent(in) :: vertex_num

‎src/dag_s.f90

+22-27
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
submodule(dag_m) dag_s
22
use assert_m, only : assert
3-
use jsonff, only: &
3+
use rojff, only: &
4+
fallible_json_member_t, &
5+
fallible_json_object_t, &
46
fallible_json_string_t, &
57
fallible_json_value_t, &
68
json_array_t, &
7-
json_element_t, &
8-
json_string_t, &
9-
parse_json
10-
use erloff, only : error_list_t
9+
json_element_t
1110
use iso_fortran_env, only: iostat_end
12-
use iso_varying_string, only : varying_string, operator(//), char, get, put, var_str
11+
use iso_varying_string, only : operator(//), char
1312
use intrinsic_array_m, only : intrinsic_array_t
1413

1514
implicit none
1615

1716
type searched_and_ordered_t
1817
integer, allocatable, dimension(:) :: s, o
19-
end type
18+
end type
2019

2120
contains
2221

@@ -109,36 +108,32 @@ end function topological_sort
109108

110109
module procedure construct_from_json
111110
type(fallible_json_value_t) :: maybe_vertices
112-
type(error_list_t) errors
113111

114-
maybe_vertices = json_object%get_element("vertices")
115-
errors = maybe_vertices%errors()
116-
call assert(.not. errors%has_any(), "dag_s construct_from_json: .not. errors%has_any()", char(errors%to_string()))
112+
maybe_vertices = json_object%get("vertices")
113+
call assert( &
114+
.not. maybe_vertices%errors%has_any(), &
115+
"dag_s construct_from_json: .not. errors%has_any()", &
116+
char(maybe_vertices%errors%to_string()))
117117

118-
select type (vertices => maybe_vertices%value_())
118+
select type (vertices => maybe_vertices%value_)
119119
type is (json_array_t)
120-
dag%vertices = vertex_t(vertices%get_elements())
120+
dag%vertices = vertex_t(vertices%elements)
121121

122122
class default
123-
call assert(.false., "dag%from_json: vertices was not an array", char(vertices%to_compact_string()))
123+
call assert(.false., "dag%from_json: vertices was not an array", vertices%to_compact_string())
124124
end select
125125
dag%order = topological_sort(dag)
126126
end procedure
127127

128-
module procedure to_json
129-
type(fallible_json_string_t) maybe_key
130-
type(error_list_t) errors
131-
type(json_string_t) vertices_key
132-
type(json_array_t) vertices_value
128+
module procedure to_json
129+
type(fallible_json_object_t) maybe_result
133130

134-
maybe_key = fallible_json_string_t("vertices")
135-
errors = maybe_key%errors()
136-
call assert(.not. errors%has_any(), "dag%to_json: .not. errors%has_any()", char(errors%to_string()))
137-
138-
vertices_value = json_array_t(json_element_t(self%vertices%to_json()))
139-
vertices_key = maybe_key%string()
140-
json_object = json_object_t([vertices_key], [json_element_t(vertices_value)])
141-
end procedure
131+
maybe_result = fallible_json_object_t( &
132+
[ fallible_json_member_t("vertices", json_array_t(json_element_t(self%vertices%to_json()))) &
133+
])
134+
call assert(.not. maybe_result%errors%has_any(), "dag%to_json: .not. errors%has_any()", char(maybe_result%errors%to_string()))
135+
json_object = maybe_result%object
136+
end procedure
142137

143138
module procedure num_vertices
144139
num_vertices = size(self%vertices)

‎src/vertex_m.f90

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module vertex_m
44
!! version: v1.0
55
!! date: 2020-Nov-30
66
!! license: Copyright (c) 2020-2021, Sourcery Institute, BSD 3-clause license Copyright (c) 2018 Jacob Williams
7-
use jsonff, only : json_element_t, json_object_t, json_value_t
7+
use rojff, only : json_element_t, json_object_t, json_value_t
88
use iso_varying_string, only : varying_string
99

1010
implicit none
@@ -21,10 +21,10 @@ module vertex_m
2121
contains
2222
procedure :: to_json
2323
procedure :: edges
24-
procedure :: label
24+
procedure :: label
2525
procedure :: attributes
2626
procedure :: edges_allocated
27-
end type
27+
end type
2828

2929
interface vertex_t
3030

@@ -54,7 +54,7 @@ pure module function construct_from_components(edges, label, attributes) result(
5454
end interface
5555

5656
interface
57-
57+
5858
elemental module function edges_allocated(self) result(edges_array_allocated)
5959
!! Result is .true. iff the edges component is allocated
6060
implicit none

0 commit comments

Comments
 (0)
Please sign in to comment.