(348a53415339076afc4a02fcd09f3ae36e9c4c61)
Declares rb_glob().
More...
Go to the source code of this file.
|
void | rb_glob (const char *pattern, void(*func)(const char *path, VALUE arg, void *enc), VALUE arg) |
| The "glob" operator. More...
|
|
int | ruby_glob (const char *pattern, int flags, ruby_glob_func *func, VALUE arg) |
| Identical to rb_glob(), except it returns opaque exception states instead of raising exceptions. More...
|
|
int | ruby_brace_glob (const char *pattern, int flags, ruby_glob_func *func, VALUE arg) |
| Identical to ruby_glob(), @shyouhei currently suspects. More...
|
|
Declares rb_glob().
- Author
- Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org
- Copyright
- This file is a part of the programming language Ruby. Permission is hereby granted, to either redistribute and/or modify this file, provided that the conditions mentioned in the file COPYING are met. Consult the file for details.
- Warning
- Symbols prefixed with either
RBIMPL
or rbimpl
are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will.
- Note
- To ruby-core: remember that this header can be possibly recursively included from extension libraries written in C++. Do not expect for instance
__VA_ARGS__
is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.
Definition in file glob.h.
◆ ruby_glob_func
typedef int ruby_glob_func(const char *path, VALUE arg, void *enc) |
Type of a glob callback function.
Called every time glob scans a path.
- Parameters
-
[in] | path | The path in question. |
[in] | arg | The argument passed to rb_glob(). |
[in] | enc | Encoding of the path. |
- Return values
-
-1 | Not enough memory to do the operation. |
0 | Operation successful. |
otherwise | Opaque exception state. |
- Note
- You can use rb_protect() to generate the return value.
Definition at line 49 of file glob.h.
◆ rb_glob()
void rb_glob |
( |
const char * |
pattern, |
|
|
void(*)(const char *path, VALUE arg, void *enc) |
func, |
|
|
VALUE |
arg |
|
) |
| |
The "glob" operator.
Expands the given pattern against the actual local filesystem, then iterates over the expanded filenames by calling the callback function.
- Parameters
-
[in] | pattern | A glob pattern. |
[in] | func | Identical to ruby_glob_func, except it can raise exceptions instead of returning opaque state. |
[in] | arg | Extra argument passed to func. |
- Exceptions
-
rb_eException | Can propagate what func raises. |
- Note
- The language accepted as the pattern is not a regular expression. It resembles shell's glob.
◆ ruby_brace_glob()
Identical to ruby_glob(), @shyouhei currently suspects.
Historically you had to call this function instead of ruby_glob() if the pattern included "{x,y,...}" syntax. However since commit 0f63d961169989a7f6dcf7c0487fe29da, ruby_glob() also supports that syntax. It seems as of writing these two functions provide basically the same functionality in a different implementation. Is this analysis right? Correct me! :FIXME:
- Parameters
-
[in] | pattern | A glob pattern. |
[in] | flags | No, you are not allowed to use this. Just pass 0. |
[in] | func | A callback function. |
[in] | arg | Extra argument passed to func. |
- Returns
- Return value of
func
.
Definition at line 3279 of file dir.c.
◆ ruby_glob()
Identical to rb_glob(), except it returns opaque exception states instead of raising exceptions.
- Parameters
-
[in] | pattern | A glob pattern. |
[in] | flags | No, you are not allowed to use this. Just pass 0. |
[in] | func | A callback function. |
[in] | arg | Extra argument passed to func. |
- Returns
- Return value of
func
.
Definition at line 3139 of file dir.c.