From 9aae783e6877a8648d93a1e7b95459e6967f8c6b Mon Sep 17 00:00:00 2001 From: "John S. Urban" Date: Fri, 9 Jul 2021 15:05:04 -0400 Subject: check name used for package, executable, test, or example --- src/fpm_command_line.f90 | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) (limited to 'src/fpm_command_line.f90') diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90 index b130f89..d119443 100644 --- a/src/fpm_command_line.f90 +++ b/src/fpm_command_line.f90 @@ -28,8 +28,8 @@ use fpm_environment, only : get_os_type, get_env, & OS_CYGWIN, OS_SOLARIS, OS_FREEBSD, OS_OPENBSD use M_CLI2, only : set_args, lget, sget, unnamed, remaining, specified use M_CLI2, only : get_subcommand, CLI_RESPONSE_FILE -use fpm_strings, only : lower, split, fnv_1a -use fpm_filesystem, only : basename, canon_path, to_fortran_name, which +use fpm_strings, only : lower, split, fnv_1a, to_fortran_name, is_fortran_name +use fpm_filesystem, only : basename, canon_path, which use fpm_environment, only : run, get_command_arguments_quoted use fpm_compiler, only : get_default_compile_flags use,intrinsic :: iso_fortran_env, only : stdin=>input_unit, & @@ -517,27 +517,6 @@ contains end subroutine get_command_line_settings - function is_fortran_name(line) result (lout) - ! determine if a string is a valid Fortran name ignoring trailing spaces - ! (but not leading spaces) - character(len=*),parameter :: int='0123456789' - character(len=*),parameter :: lower='abcdefghijklmnopqrstuvwxyz' - character(len=*),parameter :: upper='ABCDEFGHIJKLMNOPQRSTUVWXYZ' - character(len=*),parameter :: allowed=upper//lower//int//'_' - character(len=*),intent(in) :: line - character(len=:),allocatable :: name - logical :: lout - name=trim(line) - if(len(name).ne.0)then - lout = .true. & - & .and. verify(name(1:1), lower//upper) == 0 & - & .and. verify(name,allowed) == 0 & - & .and. len(name) <= 63 - else - lout = .false. - endif - end function is_fortran_name - subroutine set_help() help_list_nodash=[character(len=80) :: & 'USAGE: fpm [ SUBCOMMAND [SUBCOMMAND_OPTIONS] ]|[--list|--help|--version]', & -- cgit v1.2.3 From cca5f83be11f40dd2be86671f8ec14a429540cc9 Mon Sep 17 00:00:00 2001 From: "John S. Urban" Date: Sun, 11 Jul 2021 16:11:39 -0400 Subject: all stops via fpm_stop(1) --- src/fpm_command_line.f90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/fpm_command_line.f90') diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90 index d119443..3146c56 100644 --- a/src/fpm_command_line.f90 +++ b/src/fpm_command_line.f90 @@ -138,7 +138,8 @@ contains case default ; os_type = "OS Type: UNKNOWN" end select version_text = [character(len=80) :: & - & 'Version: 0.3.0, alpha', & + & 'Version: 0.3.0, alpha', & + & 'PR: 511', & & 'Program: fpm(1)', & & 'Description: A Fortran package manager and build system', & & 'Home Page: https://github.com/fortran-lang/fpm', & -- cgit v1.2.3 From 87271c5a55ad6412114c4b153c1a8d0bd37156f5 Mon Sep 17 00:00:00 2001 From: "John S. Urban" Date: Sun, 11 Jul 2021 18:16:52 -0400 Subject: some more STOP to FPM_STOP conversions --- src/fpm_command_line.f90 | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/fpm_command_line.f90') diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90 index 3146c56..2ed7ac6 100644 --- a/src/fpm_command_line.f90 +++ b/src/fpm_command_line.f90 @@ -31,7 +31,8 @@ use M_CLI2, only : get_subcommand, CLI_RESPONSE_FILE use fpm_strings, only : lower, split, fnv_1a, to_fortran_name, is_fortran_name use fpm_filesystem, only : basename, canon_path, which use fpm_environment, only : run, get_command_arguments_quoted -use fpm_compiler, only : get_default_compile_flags +use fpm_compiler, only : get_default_compile_flags +use fpm_error, only : fpm_stop use,intrinsic :: iso_fortran_env, only : stdin=>input_unit, & & stdout=>output_unit, & & stderr=>error_unit @@ -139,7 +140,6 @@ contains end select version_text = [character(len=80) :: & & 'Version: 0.3.0, alpha', & - & 'PR: 511', & & 'Program: fpm(1)', & & 'Description: A Fortran package manager and build system', & & 'Home Page: https://github.com/fortran-lang/fpm', & @@ -245,17 +245,15 @@ contains & help_new, version_text) select case(size(unnamed)) case(1) - write(stderr,'(*(g0,/))')' directory name required' write(stderr,'(*(7x,g0,/))') & & ' fpm new NAME [[--lib|--src] [--app] [--test] [--example]]|[--full|--bare] [--backfill]' - stop 1 + call fpm_stop(1,'directory name required') case(2) name=trim(unnamed(2)) case default - write(stderr,'(g0)')' only one directory name allowed' write(stderr,'(7x,g0)') & & ' fpm new NAME [[--lib|--src] [--app] [--test] [--example]]| [--full|--bare] [--backfill]' - stop 2 + call fpm_stop(2,'only one directory name allowed') end select !*! canon_path is not converting ".", etc. name=canon_path(name) @@ -263,7 +261,7 @@ contains write(stderr,'(g0)') [ character(len=72) :: & & ' the fpm project name must be made of up to 63 ASCII letters,', & & ' numbers, underscores, or hyphens, and start with a letter.'] - stop 4 + call fpm_stop(4,' ') endif allocate(fpm_new_settings :: cmd_settings) @@ -272,13 +270,13 @@ contains write(stderr,'(*(a))')& &' --full and any of [--src|--lib,--app,--test,--example,--bare]', & &' are mutually exclusive.' - stop 5 + call fpm_stop(5,' ') elseif (any( specified([character(len=10) :: 'src','lib','app','test','example','full'])) & & .and.lget('bare') )then write(stderr,'(*(a))')& &' --bare and any of [--src|--lib,--app,--test,--example,--full]', & &' are mutually exclusive.' - stop 3 + call fpm_stop(3,' ') elseif (any( specified([character(len=10) :: 'src','lib','app','test','example']) ) )then cmd_settings=fpm_new_settings(& & backfill=lget('backfill'), & -- cgit v1.2.3