Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking if a file exists #240

Open
tueda opened this issue Nov 23, 2017 · 1 comment
Open

Checking if a file exists #240

tueda opened this issue Nov 23, 2017 · 1 comment
Labels
enhancement New feature or request

Comments

@tueda
Copy link
Collaborator

tueda commented Nov 23, 2017

It would be nice to have a functionality to check if a file exists in the path. One possibility of the syntax is

#if fileexists(foo.h)

#endif

The implementation should be easy, just opening and then closing the file. In this syntax, file names with ( and ) can't be handled properly, but I think this is the FORM way to discourage such crazy file names. Introducing some escapes for special characters in file names would be also easy.

There will be many way to use this file check. I'm considering usage as follows. Suppose I make a some library that have some table files. Table files can be in ASCII, which is the most portable way. But it will be faster if I use binary files (tablebase or *.sav storing expressions). Unfortunately they are most likely version-dependent. So I don't like to put the binary file in the library. Instead, I would prepare a way such that one can make them with his/her version of FORM. The library first tries to load a binary table and when impossible reads the corresponding ASCII table as a fallback. This is the way used in a Mathematica package MT.

@tueda tueda added the enhancement New feature or request label Nov 23, 2017
@vermaseren
Copy link
Owner

vermaseren commented Nov 23, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants