fprime
fprime copied to clipboard
Update/type refactor
| Originating Project/Creator | |
| Affected Component | |
| Affected Architectures(s) | |
| Related Issue(s) | |
| Has Unit Tests (y/n) | |
| Builds Without Errors (y/n) | |
| Unit Tests Pass (y/n) | |
| Documentation Included (y/n) |
Change Description
This contains breaking changes
This implements the initial "logical types" design approved in PR #1571. These changes amount to:
- Improving
StandardTypes.hppto include the new platform type definitions - Improving
BasicTypes.hppto include _MIN and _MAX definitions - Reworking
FpConfig.hppto usetypedef
This includes some "breaking changes".
StandardTypes.hppimplementors must implement new types, or includeDefaultTypes.hppto get default implementations. SeeFw/Types/Linux/StandardTypes.hppfor an exampleBasicTypes.hppno longer includes the types defined inFpConfig.hpp. Users should switch to includeFpConfig.hppwhen needing project-defined typesAssertArghas been renamedFwAssertArgType. Users must update.
This PR also includes some deprecated features:
- Use of
NATIVE_INT_TYPE,NATIVE_UINT_TYPEandPOINTER_CASTis no longer advised. Projects should update, at minumum, to usePlatformIntType,PlatformUIntTypeandPlatformPointerCastTyperespectively. - Use of
PlatformIntType,PlatformUIntTypeis discouraged outside of API calls returningintandunsigned intrespectively. Other uses should be replaced with new "logical types". e.g.NATIVE_INT_TYPEin port calls should be replaced withFwIndexType.
Other restrictions:
DefaultTypes.hppshould only ever be included in aStandardTypes.hppheader. All other users should be usingFpConfig.hppand trusting it to setup the types correctly.
Future Work
Define new "logical types" when identified. Replace uses of PRI[xud]NN for "logical types" with defined equivalent.
@check-spelling-bot Report
:red_circle: Please review
See the :open_file_folder: files view or the :scroll:action log for details.
Unrecognized words (2)
Ifwit Inttype
Previously acknowledged words that are now absent
ABuffer apps argparse args arity aspx autocomplete autogenerated bw bytearray cfg checkbox chmod chr ci classmethod Concat config cpp cpy cspell css csv cxx datetime delattr deserialize DHTML django dockerfile dropdown elif endfor endif endswith etree ev exe fd fh filesystem filetypes fullstack func functools gainsboro getattr getcwd getpass gh globals gz hasattr hh hpp href htm html http hu hxx hyperlink hz img ini inl ino inttype ip isabs isdir isfile isinstance issubclass iu javascript jpg json len lifecycle lightgreen lightyellow listdir ljust localtime lstrip lte mailto makedirs middleware mkdir mlist mname mq MTIME multiline MVC Mypy namespace nargs nbsp Nh noreply onchange orangered overridable pdf perl php phtml png posix proj py pytest PYTHONPATH pyw quickstart rb readline regex rmdir rmtree rng rp rstrip rtf rx setattr shutil splitext splitlines startswith staticmethod strftime structs stylesheet svg sys td timezone tl tmp tmpl toc toolchain tooltip tt tz url urllib utc utils uuid vm vue vx whitelist wp writelines wx xhtml xls xlsx xml xmlns yml zsh zuTo accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands
... in a clone of the [email protected]:LeStarch/fprime.git repository
on the update/type-refactor branch (:information_source: how do I use this?):
update_files() {
perl -e '
my @expect_files=qw('".github/actions/spelling/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spelling/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}
comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/nasa/fprime/issues/comments/1203253756" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json
patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")
patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")
update_files
rm $comment_body
git add -u
If the flagged items are false positives
If items relate to a ...
-
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txtfile matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^refers to the file's path from the root of the repository, so^README\.md$would exclude README.md (on whichever branch you're using). -
well-formed pattern.
If you can write a pattern that would match it, try adding it to the
patterns.txtfile.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
Do autocoders need to switch to FpConfig.hpp
look-up int pointer t
Rename StandardTypes.hpp -> PlatformTypes.hpp
@check-spelling-bot Report
:red_circle: Please review
See the :open_file_folder: files view or the :scroll:action log for details.
Unrecognized words (1)
Inttype
Previously acknowledged words that are now absent
ABuffer apps argparse args arity aspx autocomplete autogenerated bw bytearray cfg checkbox chmod chr ci classmethod Concat config cpp cpy cspell css csv cxx datetime delattr deserialize DHTML django dockerfile dropdown elif endfor endif endswith etree ev exe fd fh filesystem filetypes fullstack func functools gainsboro getattr getcwd getpass gh globals gz hasattr hh hpp href htm html http hu hxx hyperlink hz img ini inl ino inttype ip isabs isdir isfile isinstance issubclass iu javascript jpg json len lifecycle lightgreen lightyellow listdir ljust localtime lstrip lte mailto makedirs middleware mkdir mlist mname mq MTIME multiline MVC Mypy namespace nargs nbsp Nh noreply onchange orangered overridable pdf perl php phtml png posix proj py pytest PYTHONPATH pyw quickstart rb readline regex rmdir rmtree rng rp rstrip rtf rx setattr shutil splitext splitlines startswith staticmethod strftime structs stylesheet svg sys td timezone tl tmp tmpl toc toolchain tooltip tt tz url urllib utc utils uuid vm vue vx whitelist wp writelines wx xhtml xls xlsx xml xmlns yml zsh zuTo accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands
... in a clone of the [email protected]:LeStarch/fprime.git repository
on the update/type-refactor branch (:information_source: how do I use this?):
update_files() {
perl -e '
my @expect_files=qw('".github/actions/spelling/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spelling/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}
comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/nasa/fprime/issues/comments/1203487164" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json
patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")
patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")
update_files
rm $comment_body
git add -u
If the flagged items are false positives
If items relate to a ...
-
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txtfile matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^refers to the file's path from the root of the repository, so^README\.md$would exclude README.md (on whichever branch you're using). -
well-formed pattern.
If you can write a pattern that would match it, try adding it to the
patterns.txtfile.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
@check-spelling-bot Report
:red_circle: Please review
See the :open_file_folder: files view or the :scroll:action log for details.
Unrecognized words (1)
Inttype
Previously acknowledged words that are now absent
ABuffer apps argparse args arity aspx autocomplete autogenerated bw bytearray cfg checkbox chmod chr ci classmethod Concat config cpp cpy cspell css csv cxx datetime delattr deserialize DHTML django dockerfile dropdown elif endfor endif endswith etree ev exe fd fh filesystem filetypes fullstack func functools gainsboro getattr getcwd getpass gh globals gz hasattr hh hpp href htm html http hu hxx hyperlink hz img ini inl ino inttype ip isabs isdir isfile isinstance issubclass iu javascript jpg json len lifecycle lightgreen lightyellow listdir ljust localtime lstrip lte mailto makedirs middleware mkdir mlist mname mq MTIME multiline MVC Mypy namespace nargs nbsp Nh noreply onchange orangered overridable pdf perl php phtml png posix proj py pytest PYTHONPATH pyw quickstart rb readline regex rmdir rmtree rng rp rstrip rtf rx setattr shutil splitext splitlines startswith staticmethod strftime structs stylesheet svg sys td timezone tl tmp tmpl toc toolchain tooltip tt tz url urllib utc utils uuid vm vue vx whitelist wp writelines wx xhtml xls xlsx xml xmlns yml zsh zuTo accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands
... in a clone of the [email protected]:LeStarch/fprime.git repository
on the update/type-refactor branch (:information_source: how do I use this?):
update_files() {
perl -e '
my @expect_files=qw('".github/actions/spelling/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spelling/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}
comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/nasa/fprime/issues/comments/1203587905" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json
patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")
patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")
update_files
rm $comment_body
git add -u
If the flagged items are false positives
If items relate to a ...
-
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txtfile matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^refers to the file's path from the root of the repository, so^README\.md$would exclude README.md (on whichever branch you're using). -
well-formed pattern.
If you can write a pattern that would match it, try adding it to the
patterns.txtfile.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
Also, the Python Autocoder files still use AssertArg e.g. Autocoders/Python/src/fprime_ac/generators/templates/component/cpp.py ? I suspect those files are no longer maintained.
I tried this one out and it compiled with my system. But is https://github.com/nasa/fprime/pull/1615 a duplicate of this PR?