Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## Pull Request Template

### Description

[ description of the bug fix or new functionality ]

[ include directions for reviewers if necessary- what or how should they test or review ]

Fixes # (issue(s))

### Corresponding branches and PRs:

[ which branches of wex, lk, and ssc should be built with this PR ]

[ link any corresponding PRs in other repos, i.e. NREL/ssc#x ]

### Unit Test Impact:

[ new tests written? ]

[ expected changes in unit tests or speed of tests? ]

[ expected changes in test_results files? ]

### Checklist
- [ ] requires help revision and I added that label
- [ ] adds, removes, modifies, or deletes variables in existing compute modules
- [ ] adds a new compute module
- [ ] changes defaults
- [ ] I've tagged this PR to a milestone

### Reminders- this section can be deleted
[Checking for PySAM Incompatible API Changes]
(https://github.com/NREL/SAM/wiki/PySAM-Incompatible-API-Changes-&-Regenerating-PySAM-Files).

[When do the PySAM files need to be regenerated?]
(https://github.com/NREL/SAM/wiki/PySAM-Incompatible-API-Changes-&-Regenerating-PySAM-Files#when-do-the-pysam-files-need-to-be-regenerated-via-export_config)
44 changes: 40 additions & 4 deletions src/stdlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1862,19 +1862,55 @@ static void _ascii(lk::invoke_t &cxt) {
static void _isalpha(lk::invoke_t &cxt) {
LK_DOC("isalpha", "Returns true if the argument is an alphabetic character A-Z,a-z.", "(character):boolean");
lk_string s = cxt.arg(0).as_string();
cxt.result().assign(::isalpha(s.length() > 0 ? (int) s[0] : 0) ? 1.0 : 0.0);
double x = 0;
if (!s.IsNull()) {
try {
lk_char y = s[0];
if (y < 256 && !s.IsNull())
x = ::isalpha(s.length() > 0 ? (int)y : 0) ? 1.0 : 0.0;
}
catch (const std::exception&) {
x = 0;
}
}
cxt.result().assign(x);
//cxt.result().assign(::isalpha(s.length() > 0 ? (int) s[0] : 0) ? 1.0 : 0.0);
}

static void _isdigit(lk::invoke_t &cxt) {
LK_DOC("isdigit", "Returns true if the argument is a numeric digit 0-9.", "(character):boolean");
lk_string s = cxt.arg(0).as_string();
cxt.result().assign(::isdigit(s.length() > 0 ? (int) s[0] : 0) ? 1.0 : 0.0);
double x = 0;
if (!s.IsNull()) {
try {
lk_char y = s[0];
if (y < 256)
x = ::isdigit(s.length() > 0 ? (int)y : 0) ? 1.0 : 0.0;
}
catch (const std::exception&) {
x = 0;
}
}
cxt.result().assign(x);
// cxt.result().assign(::isdigit(s.length() > 0 ? (int) s[0] : 0) ? 1.0 : 0.0);
}

static void _isalnum(lk::invoke_t &cxt) {
static void _isalnum(lk::invoke_t& cxt) {
LK_DOC("isalnum", "Returns true if the argument is an alphanumeric A-Z,a-z,0-9.", "(character):boolean");
lk_string s = cxt.arg(0).as_string();
cxt.result().assign(::isalnum(s.length() > 0 ? (int) s[0] : 0) ? 1.0 : 0.0);
double x = 0;
if (!s.IsNull()) {
try {
lk_char y = s[0];
if (y < 256)
x = ::isalnum(s.length() > 0 ? (int)y : 0) ? 1.0 : 0.0;
}
catch (const std::exception&) {
x = 0;
}
}
cxt.result().assign(x);
// cxt.result().assign(::isalnum(s.length() > 0 ? (int) s[0] : 0) ? 1.0 : 0.0);
}

static void _char(lk::invoke_t &cxt) {
Expand Down