diff --git a/.github/workflows/deploy_api_docs.yml.OFF b/.github/workflows/deploy_api_docs.yml.OFF new file mode 100755 index 0000000..a5556a3 --- /dev/null +++ b/.github/workflows/deploy_api_docs.yml.OFF @@ -0,0 +1,46 @@ +#name: Build FORD docs & deploy to gh-pages +name: FORD docs deployed to main +on: + push: + branches: + - main + +jobs: + build: + name: Deploy docs + runs-on: ubuntu-latest + steps: + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install dependencies + run: python -m pip install --upgrade pip ford + + - name: Checkout main + uses: actions/checkout@v1 + + - name: Build docs + run: | + ford --version + ford ford.md + ls + tree + + - name: Deploy + uses: JamesIves/github-pages-deploy-action@releases/v3 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + #BRANCH: gh_pages + BRANCH: main + FOLDER: docs/fpm-ford + TARGET_FOLDER: docs/fpm-ford +# ford(1) deletes the output directory before running +# so be careful to specify a unique subdirectory in +# your ford(1) configuration files + +# valid inputs are ['SSH', 'ACCESS_TOKEN', 'GITHUB_TOKEN', 'BRANCH', +# 'FOLDER', 'TARGET_FOLDER', 'BASE_BRANCH', 'COMMIT_MESSAGE', 'CLEAN', +# 'CLEAN_EXCLUDE', 'GIT_CONFIG_NAME', 'GIT_CONFIG_EMAIL', 'REPOSITORY_NAME', +# 'WORKSPACE', 'SINGLE_COMMIT', 'LFS', 'SILENT', 'PRESERVE'] diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100755 index 0000000..712c821 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,23 @@ +name: FORD docs deployed to gh-pages + +on: [push, pull_request] + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v1 + with: + python-version: '3.x' + - name: Install dependencies + run: pip install ford + - name: Build Documentation + run: ford ford.md + - uses: JamesIves/github-pages-deploy-action@3.7.1 + if: github.event_name == 'push' + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages + FOLDER: docs/fpm-ford + CLEAN: true diff --git a/.github/workflows/test_gfortran_macos.yml.OFF b/.github/workflows/test_gfortran_macos.yml.OFF new file mode 100755 index 0000000..811d852 --- /dev/null +++ b/.github/workflows/test_gfortran_macos.yml.OFF @@ -0,0 +1,110 @@ +name: macos with gfortran + +on: [push, pull_request] + +jobs: + Build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ macos-latest ] + include: + - os: macos-latest + gcc_v: 12 + env: + FC: gfortran + GCC_V: ${{ matrix.gcc_v }} + TZ: UTC+04:00 + + steps: + - name: Checkout code + uses: actions/checkout@v1 + + - name: Install GFortran macOS + run: | + ls /usr/local/bin/gfortran-* + ln -f -s /usr/local/bin/gfortran-${GCC_V} /usr/local/bin/gfortran + which gfortran-${GCC_V} + which gfortran + ## Alternative: + #conda create -n gf gfortran + #conda activate gf + + - name: Install fpm + run: | + echo $PATH + pwd + uname -a + wget https://raw.githubusercontent.com/urbanjost/index/main/bootstrap/fpm.F90 + mkdir -p /Users/runner/bin tmp + ulimit -c unlimited -d unlimited -f unlimited -m unlimited -t unlimited -v unlimited + gfortran fpm.F90 -Jtmp -Itmp -o /Users/runner/bin/fpm + rm -f tmp/*.mod + ls -l + + - name: Display environment + run: | + echo $PATH + pwd + uname -a + ulimit -a + echo "end" > foo.f90 + gfortran -cpp -E -dM foo.f90 + gfortran --version + fpm --version + ulimit -a + + - name: tests MacOS (release) + run: | + ulimit -c unlimited -d unlimited -f unlimited -m unlimited -t unlimited -v unlimited + exec 2>&1 + set -x + #fpm test --profile release --verbose --flag -fno-automatic # looks like bug where formats go on stack anyway + #fpm test --profile debug --verbose --flag -fmax-stack-var-size=0 # Apparently infinite loop + #fpm test --profile debug --verbose --flag -fmax-stack-var-size=2024 # loop + #fpm test --profile debug --verbose --flag -frecursive + #fpm test --profile debug --verbose --flag -static + #timeout 0.5h fpm test --profile debug --verbose + ulimit -S -t 1800 + fpm test --profile debug --verbose + + - name: tests MacOS (debug) + run: | + ulimit -c unlimited -d unlimited -f unlimited -m unlimited -t unlimited -v unlimited + exec 2>&1 + set -x + ulimit -S -t 1800 + fpm test --profile debug --verbose + + - name: cleanup MacOS + run: ls -ltras +# -fno-automatic +# Treat each program unit (except those marked as RECURSIVE) as if +# the "SAVE" statement were specified for every local variable and +# array referenced in it. Does not affect common blocks. (Some +# Fortran compilers provide this option under the name -static or +# -save.) The default, which is -fautomatic, uses the stack for +# local variables smaller than the value given by +# -fmax-stack-var-size. Use the option -frecursive to use no static +# memory. +# +# Local variables or arrays having an explicit "SAVE" attribute are +# silently ignored unless the -pedantic option is added. +# -fmax-stack-var-size=n +# This option specifies the size in bytes of the largest array that +# will be put on the stack; if the size is exceeded static memory is +# used (except in procedures marked as RECURSIVE). Use the option +# -frecursive to allow for recursive procedures which do not have a +# RECURSIVE attribute or for parallel programs. Use -fno-automatic to +# never use the stack. +# +# This option currently only affects local arrays declared with +# constant bounds, and may not apply to all character variables. +# Future versions of GNU Fortran may improve this behavior. +# +# The default value for n is 32768. +# -frecursive +# Allow indirect recursion by forcing all local arrays to be +# allocated on the stack. This flag cannot be used together with +# -fmax-stack-var-size= or -fno-automatic. diff --git a/.github/workflows/test_gfortran_mingw64_windows.yml.OFF b/.github/workflows/test_gfortran_mingw64_windows.yml.OFF new file mode 100755 index 0000000..1bb0895 --- /dev/null +++ b/.github/workflows/test_gfortran_mingw64_windows.yml.OFF @@ -0,0 +1,74 @@ +name: windows mingw64 with gfortran + +on: [push, pull_request] + +env: + CTEST_TIME_TIMEOUT: "50" # some failures hang forever + +jobs: + build: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: [ + { msystem: MINGW64, arch: x86_64 }, + ] + env: + FC: gfortran + TZ: UTC+04:00 + defaults: + run: + shell: msys2 {0} + steps: + - uses: actions/checkout@v2 + + - name: Setup MinGW native environment + uses: msys2/setup-msys2@v2 + if: contains(matrix.msystem, 'MINGW') + with: + msystem: ${{ matrix.msystem }} + update: false + install: >- + git + wget + mingw-w64-${{ matrix.arch }}-gcc + mingw-w64-${{ matrix.arch }}-gcc-fortran + + - name: Install fpm + run: | + echo $PATH + pwd + uname -a + wget https://raw.githubusercontent.com/urbanjost/index/main/bootstrap/fpm.F90 + mkdir -p tmp + gfortran fpm.F90 -Jtmp -Itmp -static -o fpm + rm -f tmp/*.mod + ls -l + + - name: tests (release) + run: | + gfortran --version + PATH=$PATH:. + ./fpm test --compiler gfortran --profile release -flag "-D _WIN32" + env: + FPM_COMPILER: gfortran + CC: gcc + CXX: g++ + FC: gfortran + TZ: UTC+04:00 + + - name: tests (debug) + run: | + PATH=$PATH:. + gfortran --version + ./fpm test --compiler gfortran --profile debug -flag "-D _WIN32" + env: + FPM_COMPILER: gfortran + CC: gcc + CXX: g++ + FC: gfortran + TZ: UTC+04:00 + + - name: cleanup + run: ls -ltras diff --git a/.github/workflows/test_gfortran_msys_meson_windows.yml.WIP.OFF b/.github/workflows/test_gfortran_msys_meson_windows.yml.WIP.OFF new file mode 100755 index 0000000..204817a --- /dev/null +++ b/.github/workflows/test_gfortran_msys_meson_windows.yml.WIP.OFF @@ -0,0 +1,65 @@ +name: msys windows gfortran + +on: [push, pull_request] + +env: + CTEST_TIME_TIMEOUT: "5" # some failures hang forever + FC: gfortran + TZ: UTC+04:00 + +jobs: + gfortran-windows-msys2-mingw64: + runs-on: windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v1 + + - name: Setup MinGW (MSYS2) + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: false + install: >- + git + wget + mingw-w64-x86_64-gcc-fortran + mingw-w64-x86_64-meson + mingw-w64-x86_64-ninja + + - name: Install fpm + shell: msys2 {0} + run: | + echo $PATH + pwd + uname -a + wget https://raw.githubusercontent.com/urbanjost/index/main/bootstrap/fpm.F90 + mkdir tmp + gfortran fpm.F90 -Itmp -Jtmp -o fpm + + - name: Run tests and demo programs (debug) + shell: msys2 {0} + run: | + gfortran --version + ./fpm test --profile release -flag "-D _WIN32" + env: + FC: gfortran + TZ: UTC+04:00 + + - name: Run tests and demo programs (release) + shell: msys2 {0} + run: | + gfortran --version + ./fpm test --profile release -flag "-D _WIN32" + env: + FC: gfortran + TZ: UTC+04:00 + + - name: Build with meson + shell: msys2 {0} + run: | + meson --version + meson setup build -Dbuildtype=debug + meson compile -C build + + - name: cleanup + run: dir diff --git a/.github/workflows/test_gfortran_msys_windows.yml.OFF b/.github/workflows/test_gfortran_msys_windows.yml.OFF new file mode 100755 index 0000000..e276909 --- /dev/null +++ b/.github/workflows/test_gfortran_msys_windows.yml.OFF @@ -0,0 +1,54 @@ +name: msys windows gfortran + +on: [push, pull_request] + +env: + CTEST_TIME_TIMEOUT: "5" # some failures hang forever + FC: gfortran + TZ: UTC+04:00 + +jobs: + gfortran-windows-msys2-mingw64: + runs-on: windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v1 + + - name: Setup MinGW (MSYS2) + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: false + install: >- + git + wget + mingw-w64-x86_64-gcc-fortran + + - name: Install fpm + shell: msys2 {0} + run: | + wget https://raw.githubusercontent.com/urbanjost/index/main/bootstrap/fpm.F90 + mkdir tmp + gfortran fpm.F90 -Jtmp -Itmp -static -o fpm + rm -f tmp/*.mod + + - name: Run tests and demo programs (debug) + shell: msys2 {0} + run: | + gfortran --version + ./fpm test --profile release -flag "-D _WIN32" + env: + FC: gfortran + TZ: UTC+04:00 + + - name: Run tests and demo programs (release) + shell: msys2 {0} + run: | + gfortran --version + ./fpm test --profile release -flag "-D _WIN32" + env: + FC: gfortran + TZ: UTC+04:00 + + - name: cleanup + run: dir diff --git a/.github/workflows/test_gfortran_ubuntu.yml.OFF b/.github/workflows/test_gfortran_ubuntu.yml.OFF new file mode 100755 index 0000000..9188dea --- /dev/null +++ b/.github/workflows/test_gfortran_ubuntu.yml.OFF @@ -0,0 +1,66 @@ +name: ubuntu with gfortran + +on: [push, pull_request] + +jobs: + Build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest ] + include: + - os: ubuntu-latest + gcc_v: 12 + + env: + FC: gfortran + GCC_V: ${{ matrix.gcc_v }} + TZ: UTC+04:00 + + steps: + - name: Checkout code + uses: actions/checkout@v1 + + - name: Install GFortran Linux + run: | + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \ + --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \ + --slave /usr/bingcov gcov /usr/bin/gcov-${GCC_V} + + - name: Install fpm + run: | + echo $PATH + pwd + uname -a + wget https://raw.githubusercontent.com/urbanjost/index/main/bootstrap/fpm.F90 + mkdir -p /home/runner/.local/bin tmp + ulimit -c unlimited -d unlimited -f unlimited -m unlimited -s unlimited -t unlimited -v unlimited -x unlimited + gfortran fpm.F90 -Itmp -Jtmp -static -o /home/runner/.local/bin/fpm + rm -f tmp/*.mod + ls -l + + - name: Display environment + run: | + #make -k -p -fNOTTHERE + echo "end" > foo.f90 + ulimit -c unlimited -d unlimited -f unlimited -m unlimited -s unlimited -t unlimited -v unlimited -x unlimited + gfortran -cpp -E -dM foo.f90 + gfortran --version + fpm --version + + - name: ubuntu with gfortran (debug) + run: | + ulimit -c unlimited -d unlimited -f unlimited -m unlimited -s unlimited -t unlimited -v unlimited -x unlimited + fpm test --profile debug --verbose + + - name: ubuntu with gfortran (release) + run: | + ulimit -c unlimited -d unlimited -f unlimited -m unlimited -s unlimited -t unlimited -v unlimited -x unlimited + fpm test --profile release + +# - name: Run demo programs (fpm run) +# run: fpm run --profile release + + - name: cleanup Linux + run: ls -ltras diff --git a/.github/workflows/test_gfortran_windows.yml.OFF b/.github/workflows/test_gfortran_windows.yml.OFF new file mode 100755 index 0000000..e8765e9 --- /dev/null +++ b/.github/workflows/test_gfortran_windows.yml.OFF @@ -0,0 +1,66 @@ +name: windows with gfortran + +on: [push, pull_request] + +jobs: + Build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-latest] + gcc_v: [10] # Version of GFortran we want to use. + include: + + - os: windows-latest + os-arch: windows-x86_64 + release-flags: --flag '--static -g -fbacktrace -O3' + exe: .exe + + env: + FC: gfortran + GCC_V: ${{ matrix.gcc_v }} + TZ: UTC+04:00 + + steps: + - name: Checkout code + uses: actions/checkout@v1 + + - name: Install fpm + run: | + echo PATH %PATH% + pwd + curl https://raw.githubusercontent.com/urbanjost/index/main/bootstrap/fpm.F90 --output fpm.F90 + mkdir tmp + gfortran -static fpm.F90 -Itmp -Jtmp -o fpm -D_WIN32 2>&1 + dir + shell: cmd + + - name: Display environment + run: | + echo PATH %PATH% + pwd + uname -a + echo "end" > foo.f90 + gfortran -cpp -E -dM foo.f90 + fpm --version + fpm build --verbose + gfortran --version + shell: cmd + + - name: tests MSWindows (debug) + run: | + fpm test --profile debug -flag "-static -D _WIN32" --verbose 2>&1 + shell: cmd + + - name: tests MSWindows (release) + run: | + fpm test --profile release -flag "-static -D _WIN32" --verbose 2>&1 + shell: cmd + + - name: cleanup MSWindows + run: dir + shell: cmd + +#set PATH=%PATH%;%CD% +#make -k -p -fNOTTHERE diff --git a/.github/workflows/test_ifx_ubuntu.yml.OFF b/.github/workflows/test_ifx_ubuntu.yml.OFF new file mode 100755 index 0000000..70b74c6 --- /dev/null +++ b/.github/workflows/test_ifx_ubuntu.yml.OFF @@ -0,0 +1,70 @@ +name: linux with intel ifx compiler + +on: [push, pull_request] + +jobs: + # Build with Intel ifx toolchain + intel-build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04] + fc: [ifx] + cc: [icc] + + env: + FC: ${{ matrix.fc }} + CC: ${{ matrix.cc }} + FPM_COMPILER: ifx + TZ: UTC+04:00 + APT_PACKAGES: >- + intel-oneapi-compiler-fortran + intel-oneapi-compiler-dpcpp-cpp-and-cpp + intel-oneapi-mkl-devel + asciidoctor + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - uses: actions/setup-python@v1 + with: + python-version: '3.x' + + - name: Add Intel repository + run: | + wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + sudo apt-get update + + - name: Install Intel oneAPI compiler + run: | + sudo apt-get install ${{ env.APT_PACKAGES }} + source /opt/intel/oneapi/setvars.sh + printenv >> $GITHUB_ENV + + - name: Install fpm + run: | + echo $PATH + pwd + uname -a + wget https://raw.githubusercontent.com/urbanjost/index/main/bootstrap/fpm.F90 + mkdir -p /home/runner/.local/bin tmp + ulimit -c unlimited -d unlimited -f unlimited -m unlimited -s unlimited -t unlimited -v unlimited -x unlimited + ifx fpm.F90 -Itmp -module tmp -o /home/runner/.local/bin/fpm + ls -l + rm -fv *.mod tmp/*.mod + + - name: Run Intel unit tests on Linux + run: | + printenv TZ + printenv FPM_COMPILER + printenv OMP_NUM_THREADS + ulimit -c unlimited -d unlimited -f unlimited -m unlimited -s unlimited -t unlimited -v unlimited -x unlimited + fpm test --profile release --compiler ifx + ls -l + env: + OMP_NUM_THREADS: 2,1 diff --git a/.github/workflows/test_intel_ubuntu.yml b/.github/workflows/test_intel_ubuntu.yml new file mode 100755 index 0000000..42a27a1 --- /dev/null +++ b/.github/workflows/test_intel_ubuntu.yml @@ -0,0 +1,70 @@ +name: linux with intel + +on: [push, pull_request] + +jobs: + # Build with Intel toolchain + intel-build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04] + fc: [ifort] + cc: [icc] + + env: + FC: ${{ matrix.fc }} + CC: ${{ matrix.cc }} + FPM_COMPILER: ifort + TZ: UTC+04:00 + APT_PACKAGES: >- + intel-oneapi-compiler-fortran + intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic + intel-oneapi-mkl-devel + asciidoctor + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - uses: actions/setup-python@v1 + with: + python-version: '3.x' + + - name: Add Intel repository + run: | + wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + sudo apt-get update + + - name: Install Intel oneAPI compiler + run: | + sudo apt-get install ${{ env.APT_PACKAGES }} + source /opt/intel/oneapi/setvars.sh + printenv >> $GITHUB_ENV + + - name: Install fpm + run: | + echo $PATH + pwd + uname -a + wget https://raw.githubusercontent.com/urbanjost/index/main/bootstrap/fpm.F90 + mkdir -p /home/runner/.local/bin tmp + ulimit -c unlimited -d unlimited -f unlimited -m unlimited -s unlimited -t unlimited -v unlimited -x unlimited + ifort fpm.F90 -Itmp -module tmp -o /home/runner/.local/bin/fpm + ls -l + rm -fv *.mod tmp/*.mod + + - name: Run Intel unit tests on Linux + run: | + printenv TZ + printenv FPM_COMPILER + printenv OMP_NUM_THREADS + ulimit -c unlimited -d unlimited -f unlimited -m unlimited -s unlimited -t unlimited -v unlimited -x unlimited + fpm test --profile release --compiler ifort + ls -l + env: + OMP_NUM_THREADS: 2,1 diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..a05c5dd --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build/* +docs/fpm-ford +docs/doxygen_out diff --git a/GNUmakefile b/GNUmakefile index 6daea38..b40cf0b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -9,10 +9,10 @@ F:= ifort SRC := rpn_stack.f90 rpn_stack_sm.f90 linked_list.f90 amap.f90 OBJ := $(SRC:%.f90=%.o) -hp: hp.f90 $(OBJ) - $(F) -o $@ hp.f90 $(OBJ) $(F_OPTS) +hp: ../app/main.f90 $(OBJ) + $(F) -o $@ ../app/main.f90 $(OBJ) $(F_OPTS) -hp.exe: hp.f90 GNUmakefile +hp.exe: /app/main.f90 GNUmakefile $(F) -o $@ $< $(F_OPTS) rpn_stack_sm.o: rpn_stack_sm.f90 @@ -27,8 +27,8 @@ linked_list.o: linked_list.f90 amap.o: amap.f90 $(F) -c -o $@ $< $(F_OPTS) -test_amap: test_amap.f90 amap.o - $(F) -o $@ test_amap.f90 amap.o +test_amap: ../test/test_amap.f90 amap.o + $(F) -o $@ ../test/test_amap.f90 amap.o clean: @rm -vf *.o *.mod *.smod *~ @@ -41,8 +41,8 @@ force: veryclean export: hp.tar -hp.tar: GNUmakefile hp.f90 $(SRC) - tar cf $@ hp.f90 $(SRC) GNUmakefile +hp.tar: GNUmakefile ../app/hp.f90 $(SRC) + tar cf $@ ../app/hp.f90 $(SRC) GNUmakefile help: @echo "SRC = $(SRC)" diff --git a/README.md b/README.md index 52abf91..4184612 100644 --- a/README.md +++ b/README.md @@ -44,3 +44,23 @@ Examples hp "2 -- complex sqrt =" -> (0.00000,-1.414214) hp -c "radians (1,pi_over_2)p ^ * degrees =" -> (1.000000,180.000000) p ``` + +## Build and Test with FPM + + To build with fpm(1) + ( as described at [Fortran Package Manager](https://github.com/fortran-lang/fpm) ) + enter: + + ```bash + git clone https://github.com/sgeard/hp.git + cd hp + fpm test + fpm run + ``` + + or just list it as a dependency in your fpm.toml project file. + +```toml + [dependencies] + hp = { git = "https://github.com/sgeard/hp.git" } +``` diff --git a/hp.f90 b/app/main.f90 similarity index 100% rename from hp.f90 rename to app/main.f90 diff --git a/docs/images/favicon.ico b/docs/images/favicon.ico new file mode 100644 index 0000000..2754147 Binary files /dev/null and b/docs/images/favicon.ico differ diff --git a/ford.md b/ford.md new file mode 100755 index 0000000..a9d570b --- /dev/null +++ b/ford.md @@ -0,0 +1,31 @@ +--- +src_dir: src + app + example + test +output_dir: docs/fpm-ford +project: hp +summary: RPN calculator in modern Fortran +project_github: https://github.com/sgeard/hp +project_download: +author: sgeard +author_email: sgeard@gmail.com +github: https://github.com/sgeard/hp +media_dir: docs/images +exclude_dir: archive + FODDER +display: public + protected +source: true +proc_internals: true +sort: permission-alpha +favicon: docs/images/favicon.ico +print_creation_date: true +extra_mods: iso_fortran_env:https://gcc.gnu.org/onlinedocs/gfortran/ISO_005fFORTRAN_005fENV.html + tomlf:https://toml-f.github.io/toml-f +creation_date: %Y-%m-%d %H:%M %z +md_extensions: markdown.extensions.toc + markdown.extensions.smarty +--- + +{!README.md!} diff --git a/fpm.toml b/fpm.toml new file mode 100644 index 0000000..caab095 --- /dev/null +++ b/fpm.toml @@ -0,0 +1,21 @@ +name = "hp" +version = "0.1.0" +license = "license" +author = "sgeard" +maintainer = "sgeard@gmail.com" +copyright = "Copyright 2023, sgeard" + +[build] + auto-executables = true + auto-tests = true + auto-examples = true + module-naming = false + +[install] + library = false + +[fortran] + implicit-typing = false + implicit-external = false + source-form = "free" + diff --git a/src/GNUmakefile b/src/GNUmakefile new file mode 100644 index 0000000..b40cf0b --- /dev/null +++ b/src/GNUmakefile @@ -0,0 +1,49 @@ +.PHONY: veryclean clean force export help + +ifdef debug +F_OPTS := -ggdb +endif + +F:= ifort + +SRC := rpn_stack.f90 rpn_stack_sm.f90 linked_list.f90 amap.f90 +OBJ := $(SRC:%.f90=%.o) + +hp: ../app/main.f90 $(OBJ) + $(F) -o $@ ../app/main.f90 $(OBJ) $(F_OPTS) + +hp.exe: /app/main.f90 GNUmakefile + $(F) -o $@ $< $(F_OPTS) + +rpn_stack_sm.o: rpn_stack_sm.f90 + $(F) -c -o $@ $< $(F_OPTS) + +rpn_stack.o: rpn_stack.f90 + $(F) -c -o $@ $< $(F_OPTS) + +linked_list.o: linked_list.f90 + $(F) -c -o $@ $< $(F_OPTS) + +amap.o: amap.f90 + $(F) -c -o $@ $< $(F_OPTS) + +test_amap: ../test/test_amap.f90 amap.o + $(F) -o $@ ../test/test_amap.f90 amap.o + +clean: + @rm -vf *.o *.mod *.smod *~ + +veryclean: clean + @rm -vf hp hp.exe hp.tar + +force: veryclean + $(MAKE) + +export: hp.tar + +hp.tar: GNUmakefile ../app/hp.f90 $(SRC) + tar cf $@ ../app/hp.f90 $(SRC) GNUmakefile + +help: + @echo "SRC = $(SRC)" + @echo "OBJ = $(OBJ)" diff --git a/amap.f90 b/src/amap.f90 similarity index 99% rename from amap.f90 rename to src/amap.f90 index 4732a4e..d9e47ca 100644 --- a/amap.f90 +++ b/src/amap.f90 @@ -177,7 +177,7 @@ contains integer, intent(out) :: iostat character(*), intent(inout) :: iomsg iostat = 0 - iomsg = "" + !iomsg = "" write(6,'(a)', iostat=iostat, iomsg=iomsg) trim(adjustl(key%k)) end subroutine write_key_t @@ -189,7 +189,7 @@ contains integer, intent(out) :: iostat character(*), intent(inout) :: iomsg iostat = 0 - iomsg = "" + !iomsg = "" write(6,'(f0.6)', iostat=iostat, iomsg=iomsg) value%v end subroutine write_value_t end module amap diff --git a/linked_list.f90 b/src/linked_list.f90 similarity index 100% rename from linked_list.f90 rename to src/linked_list.f90 diff --git a/rpn_stack.f90 b/src/rpn_stack.f90 similarity index 100% rename from rpn_stack.f90 rename to src/rpn_stack.f90 diff --git a/rpn_stack_sm.f90 b/src/rpn_stack_sm.f90 similarity index 99% rename from rpn_stack_sm.f90 rename to src/rpn_stack_sm.f90 index a830576..20772d5 100644 --- a/rpn_stack_sm.f90 +++ b/src/rpn_stack_sm.f90 @@ -153,7 +153,7 @@ contains complex(8) :: z character(len=:), allocatable :: str_re, str_im iostat = 0 - iomsg = "" + !iomsg = "" z = se%zdata if (complex_mode) then call to_string(z%re,str_re) diff --git a/test_amap.f90 b/test/test_amap.f90 similarity index 100% rename from test_amap.f90 rename to test/test_amap.f90