Would really work better as a class method of the .File class rather than
on RexxInfo. That's where we tend to put file system related stuff.

Rick

On Thu, Mar 7, 2019 at 5:22 PM Enrico Sorichetti via Oorexx-devel <
oorexx-devel@lists.sourceforge.net> wrote:

> Here is the patch to
> fix the MAXIMUM_FILENAME_LENGTH glitch
> Implement .RexxInfo~getMaxFileNameLength
>
> [enrico@enrico-imac tests]$rexx -e "say .rexxinfo~maxfilenamelength"
> 255
> [enrico@enrico-imac tests]$rexx -e "say .rexxinfo~maxpathlength"
> 1024
> [enrico@enrico-imac tests]$
>
>
> Index: interpreter/classes/RexxInfoClass.cpp
> ===================================================================
> --- interpreter/classes/RexxInfoClass.cpp       (revision 11825)
> +++ interpreter/classes/RexxInfoClass.cpp       (working copy)
> @@ -457,7 +457,18 @@
>      return new_integer(Numerics::MIN_EXPONENT);
>  }
>
> +/**
> + * Return the maximum FileName length allowed by the file system
> + *
> + * @return (Windows) MAX_PATH - 1 or (Unix) NAME_MAX, as an Integer
> object.
> + */
> +RexxObject *RexxInfo::getMaxFileNameLength()
> +{
> +    // usable length is one less, as one char is reserved for the
> terminating NUL
> +    return new_integer(SysFileSystem::MaximumFileNameLength - 1);
> +}
>
> +
>  /**
>   * Return the maximum path length allowed by the file system
>   *
> Index: interpreter/classes/RexxInfoClass.hpp
> ===================================================================
> --- interpreter/classes/RexxInfoClass.hpp       (revision 11825)
> +++ interpreter/classes/RexxInfoClass.hpp       (working copy)
> @@ -91,6 +91,7 @@
>      RexxObject *getInternalMinNumber();
>      RexxObject *getMaxExponent();
>      RexxObject *getMinExponent();
> +    RexxObject *getMaxFileNameLength();
>      RexxObject *getMaxPathLength();
>      RexxObject *getMaxArraySize();
>
> Index: interpreter/execution/CPPCode.cpp
> ===================================================================
> --- interpreter/execution/CPPCode.cpp   (revision 11825)
> +++ interpreter/execution/CPPCode.cpp   (working copy)
> @@ -1213,6 +1213,7 @@
>  CPPM(RexxInfo::getInternalMinNumber),
>  CPPM(RexxInfo::getMaxExponent),
>  CPPM(RexxInfo::getMinExponent),
> +CPPM(RexxInfo::getMaxFileNameLength),
>  CPPM(RexxInfo::getMaxPathLength),
>  CPPM(RexxInfo::getMaxArraySize),
>
> Index: interpreter/memory/Setup.cpp
> ===================================================================
> --- interpreter/memory/Setup.cpp        (revision 11825)
> +++ interpreter/memory/Setup.cpp        (working copy)
> @@ -1240,6 +1240,7 @@
>          AddMethod("internalMinNumber", RexxInfo::getInternalMinNumber, 0);
>          AddMethod("maxExponent", RexxInfo::getMaxExponent, 0);
>          AddMethod("minExponent", RexxInfo::getMinExponent, 0);
> +        AddMethod("maxFileNameLength", RexxInfo::getMaxFileNameLength, 0);
>          AddMethod("maxPathLength", RexxInfo::getMaxPathLength, 0);
>          AddMethod("maxArraySize", RexxInfo::getMaxArraySize, 0);
>
> Index: interpreter/platform/unix/SysFileSystem.hpp
> ===================================================================
> --- interpreter/platform/unix/SysFileSystem.hpp (revision 11825)
> +++ interpreter/platform/unix/SysFileSystem.hpp (working copy)
> @@ -56,13 +56,11 @@
>  #elif defined(_POSIX_PATH_MAX)
>  #define MAXIMUM_PATH_LENGTH _POSIX_PATH_MAX + 1
>  #else
> -#define MAXIMUM_PATH_LENGTH
> +#define MAXIMUM_PATH_LENGTH 1025
>  #endif
>
> -#if defined(FILENAME_MAX)
> -#define MAXIMUM_FILENAME_LENGTH FILENAME_MAX + 1
> -#elif defined(_MAX_FNAME)
> -#define MAXIMUM_FILENAME_LENGTH _MAX_FNAME + 1
> +#if defined(NAME_MAX)
> +#define MAXIMUM_FILENAME_LENGTH NAME_MAX + 1
>  #elif defined(_POSIX_NAME_MAX)
>  #define MAXIMUM_FILENAME_LENGTH _POSIX_NAME_MAX + 1
>  #else
>
> _______________________________________________
> Oorexx-devel mailing list
> Oorexx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to