-
Notifications
You must be signed in to change notification settings - Fork 178
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
system: subprocessing interface #911
Open
perazz
wants to merge
53
commits into
fortran-lang:master
Choose a base branch
from
perazz:subprocess
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
979ba84
add c source
perazz 79ddfc4
add subprocess module
perazz adacbcf
`to_c_string`: move to strings, document
perazz 5b543a2
use temporary `getfile` and `linalg_state_type` f
perazz 519d53d
implement `join`
perazz 1449b8d
fixes to build
perazz cf35194
create submodule
perazz e8451b2
unify `sleep` interface
perazz 48da380
add single-command `run` API
perazz 1f4de32
add tests
perazz 6fbc2e6
getfile: remove trailing new line characters
perazz f9bf304
fix tests to be cross-platform
perazz 71facb3
use `nanosleep` rather than `usleep`
perazz 6ea72d1
add examples
perazz e35b37a
`kill` process
perazz 237e9ff
add process killing example
perazz 2c58fca
on Windows, redirect to `NUL` if output not requested
perazz 136b5b8
remove unused process handle
perazz d8df028
document `run` interface
perazz 94f2bdf
document `is_running`, `is_completed`, `elapsed`
perazz 3fb88e4
add `system` page
perazz 53fc8e5
document `wait`
perazz b30cae4
document `update`
perazz 122fbc6
document `kill`
perazz 56ed7c8
document `sleep`
perazz c617048
document `has_win32`
perazz ed0565c
fix
perazz c03655a
Merge branch 'subprocess' of github.com:perazz/stdlib into subprocess
perazz eb77455
Merge branch 'fortran-lang:master' into subprocess
perazz 74b6ebe
change syntax for `ifx` fix
perazz 9873bc9
fix `sleep` us -> ns
perazz 34732ff
fix `pid` size
perazz 53b03b0
full-cmd: do not use stack
perazz 5a1bd54
fix `sleep`
perazz 9b74bea
process example 2: set max_wait_time
perazz bdb2840
sleep: fix `bind(C)` interface
perazz a1aaf2f
split `run` vs `runasync`
perazz 4d5eb32
`run/runasync` docs
perazz 56f02ab
`has_win32` -> `is_windows`
perazz 15689bc
Update example_process_1.f90
perazz 060dec7
Merge branch 'master' into subprocess
perazz 3560a6f
missing `is_windows` tests
perazz e75bbc9
Merge branch 'subprocess' of github.com:perazz/stdlib into subprocess
perazz d1a4715
Update example_process_4.f90
perazz 68dca8d
Merge branch 'fortran-lang:master' into subprocess
perazz 7653cc4
add object oriented interface
perazz 06c7136
add oop example
perazz f40a547
process ID (`pid`) getter interface
perazz d2ee2f2
implement callback
perazz 3f08a8b
add callback example
perazz d694dcf
fix submodule
perazz 80a2d0a
intel fix: no inline type
perazz 20c045d
document callback and payload functionality
perazz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -459,8 +459,52 @@ The result is of the same type as `string`. | |||||
{!example/strings/example_zfill.f90!} | ||||||
``` | ||||||
|
||||||
<!-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --> | ||||||
### `join` | ||||||
|
||||||
#### Description | ||||||
|
||||||
Joins an array of strings into a single string. This function concatenates the strings from the input array, | ||||||
inserting a separator between each string (default: space). A user-defined separator may be provided, The resulting string is returned. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
|
||||||
#### Syntax | ||||||
|
||||||
`cmd = ` [[stdlib_strings(module):join(interface)]] ` (strings, separator)` | ||||||
|
||||||
#### Status | ||||||
|
||||||
Experimental | ||||||
|
||||||
#### Class | ||||||
|
||||||
Pure function | ||||||
|
||||||
#### Argument | ||||||
|
||||||
- `strings`: Array of strings (either `type(string_type)` or `character(len=*)`). | ||||||
This argument is `intent(in)`. It is an array of strings that will be concatenated together. | ||||||
- `separator`: Character scalar (optional). | ||||||
This argument is `intent(in)`. It specifies the separator to be used between the strings. If not provided, the default separator (a space) is used. | ||||||
|
||||||
#### Result value | ||||||
|
||||||
The result is of the same type as the elements of `strings` (`type(string_type)` or `character(len=:), allocatable`). | ||||||
|
||||||
#### Example | ||||||
|
||||||
```fortran | ||||||
! Example usage: | ||||||
program test_join | ||||||
type(string_type) :: result | ||||||
type(string_type), dimension(3) :: words = [string_type('hello'), string_type('world'), string_type('fortran')] | ||||||
result = join_string(words, ', ') ! Joins with comma and space | ||||||
print *, result ! Output: "hello, world, fortran" | ||||||
end program test_join | ||||||
Comment on lines
+498
to
+503
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be in a separate file. |
||||||
``` | ||||||
|
||||||
<!-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --> | ||||||
|
||||||
### `to_string` | ||||||
|
||||||
#### Description | ||||||
|
@@ -498,3 +542,33 @@ The result is an `allocatable` length `character` scalar with up to `128` cached | |||||
```fortran | ||||||
{!example/strings/example_to_string.f90!} | ||||||
``` | ||||||
|
||||||
<!-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --> | ||||||
### `to_c_string` | ||||||
|
||||||
#### Description | ||||||
|
||||||
Convert a Fortran character string to a C character array. | ||||||
This function converts a Fortran string into a C-style string, ensuring proper null-termination for use in C functions or libraries. | ||||||
|
||||||
#### Syntax | ||||||
|
||||||
`cstr = ` [[stdlib_strings(module):to_c_string(function)]] ` (value)` | ||||||
|
||||||
#### Status | ||||||
|
||||||
Experimental | ||||||
|
||||||
#### Class | ||||||
|
||||||
Pure function. | ||||||
|
||||||
#### Argument | ||||||
|
||||||
- `value`: Shall be a `character(len=*)` string. | ||||||
This is an `intent(in)` argument. | ||||||
The Fortran string that will be converted to a C character array. | ||||||
|
||||||
#### Result value | ||||||
|
||||||
The result is a `character(kind=c_char)` array with a dimension of `len(value) + 1` to accommodate the null terminator. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could have its own PR, as it is not directly associated with this PR (but needed for this PR).