diff --git a/.gitignore b/.gitignore index d17c4c4..27d6b9a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .vscode/ build/ -*.mod \ No newline at end of file +*.mod +*.smod \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 8495f5a..4665f74 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "libs/f90getopt"] path = libs/f90getopt - url = https://github.com/PKM74/f90getopt -[submodule "libs/stdlib"] - path = libs/stdlib - url = https://github.com/fortran-lang/stdlib + url = https://github.com/PKM74/f90getopt \ No newline at end of file diff --git a/Makefile b/Makefile index 9844bb8..40d8c88 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,13 @@ FC=gfortran -FFLAGS=-std=f2008 -fdec-structure +FFLAGS=-std=f2023 -fdec-structure BUILD_DIR=build SRC_DIR=src LIBS_DIR=libs -INCLUDE_DIR=/usr/include/ +INCLUDE_DIR=/usr/include/fortran_stdlib/GNU-15.1.1/ +SYSLIB_DIR=/usr/lib/ + +STDLIB_CFLAGS := `pkg-config --cflags fortran_stdlib` +STDLIB_LIBS := `pkg-config --libs fortran_stdlib` SOURCES_FORTRAN = $(wildcard $(SRC_DIR)/*.f90) @@ -23,13 +27,12 @@ LIBS_FORTRAN = $(wildcard $(LIBS_DIR)/*.f90) \ all: always main main: - $(FC) $(FFLAGS) $(LIBS_FORTRAN) $(SOURCES_FORTRAN) -o $(BUILD_DIR)/fcc -I$(INCLUDE_DIR) - - + $(FC) $(FFLAGS) $(STDLIB_CFLAGS) $(STDLIB_LIBS) $(LIBS_FORTRAN) $(SOURCES_FORTRAN) -o $(BUILD_DIR)/fcc always: mkdir -p $(BUILD_DIR) clean: rm -rf $(BUILD_DIR) - rm $(wildcard *.mod) \ No newline at end of file + rm $(wildcard *.mod) + rm $(wildcard *.smod) \ No newline at end of file diff --git a/README.md b/README.md index bf5d62a..4f73d86 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,9 @@ I'm doing this for fun... might as well... oh and im writing it in fortran too.. This is PURE fucking masochism... -im not explaining that sentence... \ No newline at end of file +im not explaining that sentence... + +## Build Requirements +- FYPP +- fortran_stdlibs +- gfortran \ No newline at end of file diff --git a/libs/stdlib b/libs/stdlib deleted file mode 160000 index 30ccd9d..0000000 --- a/libs/stdlib +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 30ccd9d46496126a24f240ccfa6f9f9c762219a5 diff --git a/src/main.f90 b/src/main.f90 index ccb7260..8252d4b 100644 --- a/src/main.f90 +++ b/src/main.f90 @@ -15,8 +15,7 @@ program main ! local variables character(len=1) :: short ! getopt-character character(:), allocatable :: output - character(:), allocatable :: input - character(:), allocatable :: tokenized_input + character(:), allocatable :: input, tokenized_input, input_deliminators integer :: pos @@ -50,14 +49,13 @@ program main exit end if print*, "Input Data: ", input - call prttkn0(trim(input), '#') - ! call engtkn0(input, '', pos, tokenized_input) - ! print*, "Tokenized Input Data: ", tokenized_input + call tokenize(input, len(input), input_deliminators, tokenized_input) + print*, "Tokenized Input Data: ", tokenized_input case("h") print*, "USAGE: -i --input-file | -o --output-file | -v --version | -h --help" case("v") - print*, "Fortran C Compiler Version RD-00002" + print*, "Fortran C Compiler Version RD-00003" end select end do ! END processing options diff --git a/src/modules/tokenizer.f90 b/src/modules/tokenizer.f90 index 7748da8..c9c4746 100644 --- a/src/modules/tokenizer.f90 +++ b/src/modules/tokenizer.f90 @@ -2,113 +2,30 @@ ! yay.. module tokenizer + use stdlib_strings implicit none contains - subroutine prttkn0(str,del) - implicit none - character (len=9000), intent(in) :: str - character (len=20), intent(in) :: del - character (len=100) :: tkn - integer :: pos - print *,"Delimiters:" - print *,del - print *,"str:" - print *,str - pos=1 - ! - print *,"token:" - call engtkn0(str,del,pos,tkn) - do while (tkn/="") - ! do while (pos0) exit - end do - end subroutine - !'------------------------------------------------- - subroutine Tkndelim0(str,del,oldpos,newpos) - implicit none - character (len=9000), intent(in) :: str - character (len=20), intent(in) :: del - integer, intent(in) :: oldpos - integer, intent(out) :: newpos - do newpos=oldpos,LEN_TRIM(str) - if (index(str(oldpos:newpos),trim(del))>0) exit - end do - end subroutine - !'------------------------------------------------- - !************************************************** - end subroutine + + do while (i < string_length) + call slice_string(input_string, i, i+1) + i = i + 1 + end do + + end subroutine tokenize end module tokenizer \ No newline at end of file