-
Notifications
You must be signed in to change notification settings - Fork 47
Upgrade to Dart 2.6 #7
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
05ae1f1
Remove example/pubspec.yaml (this will make deps be inherited from th…
mit-mit 8cd1ca5
Update path to libSystem (this changed when the Dart SDK was signed)
mit-mit ad9da77
Update example files to D26 breaking changes
mit-mit 17cfe06
Fix a few more paths
mit-mit f15cfc6
Prep for publishing
mit-mit 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 hidden or 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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 0.4.0-dev.2 | ||
|
||
- A few more updates to new FFI API | ||
|
||
## 0.4.0-dev.1 | ||
|
||
- Update to new FFI API | ||
|
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import 'dart:ffi'; | ||
import 'dart:io'; | ||
import 'package:ffi/ffi.dart' as ffi; | ||
|
||
// int ioctl(int, unsigned long, ...); | ||
typedef ioctlVoidNative = Int32 Function(Int32, Int64, Pointer<Void>); | ||
|
@@ -16,7 +17,7 @@ const STDERR_FILENO = 2; | |
// unsigned short ws_xpixel; /* horizontal size, pixels */ | ||
// unsigned short ws_ypixel; /* vertical size, pixels */ | ||
// }; | ||
class WinSize extends Struct<WinSize> { | ||
class WinSize extends Struct { | ||
@Int16() | ||
int ws_row; | ||
|
||
|
@@ -28,30 +29,22 @@ class WinSize extends Struct<WinSize> { | |
|
||
@Int16() | ||
int ws_ypixel; | ||
|
||
factory WinSize.allocate( | ||
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. idem |
||
int ws_row, int ws_col, int ws_xpixel, int ws_ypixel) => | ||
Pointer<WinSize>.allocate().load<WinSize>() | ||
..ws_row = ws_row | ||
..ws_col = ws_col | ||
..ws_xpixel = ws_xpixel | ||
..ws_ypixel = ws_ypixel; | ||
} | ||
|
||
main() { | ||
final DynamicLibrary libc = Platform.isMacOS | ||
? DynamicLibrary.open('libSystem.dylib') | ||
? DynamicLibrary.open("/usr/lib/libSystem.dylib") | ||
: DynamicLibrary.open("libc-2.28.so"); | ||
|
||
final ioctl = libc.lookupFunction<ioctlVoidNative, ioctlVoidDart>("ioctl"); | ||
|
||
Pointer<WinSize> winSizePointer = Pointer<WinSize>.allocate(); | ||
Pointer<WinSize> winSizePointer = ffi.allocate(); | ||
final result = ioctl(STDOUT_FILENO, TIOCGWINSZ, winSizePointer.cast()); | ||
print('result is $result'); | ||
|
||
final winSize = winSizePointer.load<WinSize>(); | ||
final winSize = winSizePointer.ref; | ||
print('Per ioctl, this console window has ${winSize.ws_col} cols and ' | ||
'${winSize.ws_row} rows.'); | ||
|
||
winSizePointer.free(); | ||
ffi.free(winSizePointer); | ||
} |
This file contains hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -2,12 +2,12 @@ name: dart_console | |
description: | ||
A helper library for command-line applications that need more control over input/output than the standard library provides. | ||
|
||
version: 0.4.0-dev.1 | ||
version: 0.4.0-dev.2 | ||
homepage: https://github.com/timsneath/dart_console | ||
author: Tim Sneath <[email protected]> | ||
|
||
environment: | ||
sdk: '>=2.6.0-dev.6.0 <3.0.0' | ||
sdk: '>=2.6.0-dev.8.2 <3.0.0' | ||
|
||
dependencies: | ||
ffi: ^0.1.3-dev.3 | ||
|
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.
Did you delete the factory on purpose?
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.
It didn't look like they were being used, and I was trying to be consistent with the previous changes in https://github.com/timsneath/dart_console/compare/new-ffi-model?expand=1. @timsneath ?