aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-05-01 16:49:35 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2020-05-01 16:49:35 -0400
commit873ffd8201fd520122d8ec94bdd4230d79d0331c (patch)
tree77aa57644e471db464db45f2784af57ec870af54
parentc7a908cc5adede6ca34519059f2e324dc6737ff6 (diff)
downloadLR-87-873ffd8201fd520122d8ec94bdd4230d79d0331c.tar.gz
LR-87-873ffd8201fd520122d8ec94bdd4230d79d0331c.zip
Added input and error display members to the renderer.
-rw-r--r--dumb_render.f9043
-rw-r--r--render.f9014
2 files changed, 57 insertions, 0 deletions
diff --git a/dumb_render.f90 b/dumb_render.f90
index 7832891..21d6c34 100644
--- a/dumb_render.f90
+++ b/dumb_render.f90
@@ -32,6 +32,10 @@ implicit none
procedure :: is_link_visible => dumb_text_visible
procedure :: draw_link => dumb_link_draw
+
+ procedure :: request_input => dumb_request_input
+
+ procedure :: draw_error => dumb_draw_error
end type dumb_renderer
@@ -181,4 +185,43 @@ contains
end subroutine dumb_link_draw
+ function dumb_request_input(self, question, answer)
+ implicit none
+
+ class(dumb_renderer)::self
+ character(*), intent(in)::question
+ character(*), intent(out)::answer
+ logical::dumb_request_input
+
+ ! Line Feed
+ Print *, " "
+
+ answer = " "
+
+ Print *, question
+ Read *, answer
+
+ ! Line Feed
+ Print *, " "
+
+ dumb_request_input = (len_trim(answer) > 0)
+
+ end function dumb_request_input
+
+ subroutine dumb_draw_error(self, text)
+ implicit none
+
+ class(dumb_renderer)::self
+ character(*), intent(in)::text
+
+ ! Line Feed
+ Print *, " "
+
+ Print *, "ERROR: "//trim(text)
+
+ ! Line Feed
+ Print *, " "
+
+ end subroutine dumb_draw_error
+
end module dumb_render \ No newline at end of file
diff --git a/render.f90 b/render.f90
index 6d19729..684197c 100644
--- a/render.f90
+++ b/render.f90
@@ -27,6 +27,10 @@ implicit none
procedure(calculate_height), deferred::link_height
procedure(calculate_visibility), deferred::is_link_visible
procedure(draw_link), deferred::draw_link
+
+ procedure(request_input), deferred::request_input
+
+ procedure(draw_text), deferred::draw_error
end type renderer
@@ -86,6 +90,16 @@ implicit none
character(*), intent(in)::text, url
end subroutine draw_link
end interface
+
+ abstract interface
+ function request_input(self, question, answer)
+ import::renderer
+ class(renderer)::self
+ character(*), intent(in)::question
+ character(*), intent(out)::answer
+ logical::request_input
+ end function request_input
+ end interface
contains