From eb8d9bc74a0624dbc98ffb75268a3ba57bd43b40 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Fri, 24 Apr 2020 21:47:09 -0400 Subject: Initial code commit --- test.f90 | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 test.f90 (limited to 'test.f90') diff --git a/test.f90 b/test.f90 new file mode 100644 index 0000000..df42126 --- /dev/null +++ b/test.f90 @@ -0,0 +1,60 @@ +program test_render +use file_handling +use layout +use dumb_render +implicit none + + character(256)::path, arg + integer::i + + type(line), pointer::first_line + integer::iostatus + character(32)::mime + + type(dumb_renderer)::r + + if(command_argument_count() < 1) then + call usage() + stop 0 + end if + + mime = "text/plain" + + do i = 1, command_argument_count() + call get_command_argument(i, arg) + if(trim(arg) == "-g") then + mime = "text/gemini" + else if(arg(1:1) == "-") then + Print *, "Unknown option: "//trim(arg) + Print *, " " + call usage() + stop 0 + else + path = arg + end if + end do + + first_line => load_filename(trim(path), iostatus, mime) + if(iostatus == 0) then + call r%initialize() + call layout_lines(first_line, r) + else + Print *, "Error occurred while loading "//trim(path) + end if + + contains + + subroutine usage() + implicit none + + character(256)::exe + + call get_command_argument(0, exe) + Print *, "Usage: "//trim(exe)//" [-g] " + Print *, " " + Print *, " -g Treat file as text/gemini" + Print *, " " + + end subroutine usage + +end program test_render \ No newline at end of file -- cgit v1.2.3