summary refs log tree commit diff stats
path: root/lib/pure/asyncfile.nim
Commit message (Expand)AuthorAgeFilesLines
* Fix OSError `errorCode` field is not assigned a value (#22954)握猫猫2023-11-171-16/+16
* complete std prefixes for stdlib (#22887)ringabout2023-10-301-3/+3
* Fix IndexDefect in asyncfile.readLine (#22774)CMD2023-10-011-0/+2
* remove decades-deprecated Win32 API *A function support (#21315)tersec2023-03-021-8/+3
* fixes #20526; use `nimPreviewSlimSystem` for documentation build (#20714)ringabout2022-11-011-1/+1
* Markdown code blocks migration part 7 (#20547)Andrey Makarov2022-10-121-10/+11
* move widestrs out of system (#20462)metagn2022-10-011-0/+2
* make more standard libraries work with `nimPreviewSlimSystem` (#20343)ringabout2022-09-271-0/+3
* Fix #15150 (#18730)konsumlamm2021-08-311-1/+2
* Change stdlib imports to use std prefix in most examples (#17202)Danil Yarantsev2021-02-281-1/+1
* use single backtick (#17166)flywind2021-02-231-7/+7
* fix #15148 (#15149)flywind2020-08-081-4/+11
* ARC works for async on Windows (#13179)Andreas Rumpf2020-01-171-8/+4
* [backport] run nimpretty on asyncnarimiran2019-09-301-1/+1
* make more parts of the stdlib compile with --styleCheck:errorAraq2019-07-101-27/+27
* Added FileMode to comment on asyncfile openAsync (#8008)Jimmie Houchin2018-06-111-1/+1
* fixes #7347, asyncfile.getFileSize (#7354)andri lim2018-03-171-0/+4
* Fix AsyncFile open flags. Fixes #5531Ruslan Mustakov2018-02-171-7/+6
* Revert 3db460f5045e790b54ea382 as requested by @Araq.Dominik Picheta2018-01-281-5/+6
* Fix typo in asyncfile.Dominik Picheta2017-11-241-1/+1
* The AsyncFD type now implies that the underlying FD is registered.Dominik Picheta2017-11-241-8/+7
* Added newAsyncFile proc (#6129)Yuriy Glukhov2017-07-211-8/+13
* Fixes #5532 win async write (#5791)Andreas Rumpf2017-05-141-4/+6
* Posix from detect (#5697)Jacek Sieka2017-04-121-2/+3
* getFileSize and setFileSize procedures for File and AsyncFileEmery Hemingway2017-04-051-3/+21
* Implement asyncfile.readToStream.Dominik Picheta2017-03-231-0/+10
* Various fixes to FutureStreams based on PR feedback.Dominik Picheta2017-02-261-5/+8
* fixed premature finishing of httpclient.downloadFileAraq2017-02-251-4/+2
* Implement streamed async/sync downloadFile and deprecate old one.Dominik Picheta2017-02-111-0/+12
* Fix asyncfile in Windows Server 2003Dmitry Polienko2016-11-141-4/+13
* Some small fixes to changes introduced by #4683.Dominik Picheta2016-09-061-0/+2
* Add async IO operations with buffers on files and socketsAnatoly Galiulin2016-09-061-0/+141
* Make some proper closes.cheatfate2016-06-091-0/+1
* Correct proper usage of getOverlappedResult()cheatfate2016-04-131-2/+2
* lib: Trim .nim files trailing whitespaceAdam Strzelecki2015-09-041-5/+5
* lib/pure/a-c - Dropped 'T' from typespdw2015-06-041-17/+17
* Fix doc for asyncfiledef2015-03-111-8/+8
* Export AsyncFile. Add asyncfile module to docgen.Dominik Picheta2015-03-061-2/+2
* Fix a few more warningsdef2015-02-171-11/+11
* Happy new year!Guillaume Gelin2015-01-061-1/+1
* s/sock/fd/. Fixes #1487.Dominik Picheta2014-09-271-2/+2
* Removed async console FDs.Dominik Picheta2014-09-081-33/+1
* Added asyncfile.readLine and async stdin/out/err. Ref #1487.Dominik Picheta2014-09-061-0/+45
* Implemented asyncfile for Posix.Dominik Picheta2014-09-051-8/+64
* Add asyncfile module.Dominik Picheta2014-09-051-0/+256
lass="w"> } for (long long int i = 0; i < SIZE(inst.ingredients); ++i) { if (!types_match(inst.products.at(i), inst.ingredients.at(i))) { raise_error << maybe(get(Recipe, r).name) << "can't copy " << inst.ingredients.at(i).original_string << " to " << inst.products.at(i).original_string << "; types don't match\n" << end(); goto finish_checking_instruction; } } break; } // End Primitive Recipe Checks default: { // Defined Recipe Checks // End Defined Recipe Checks } } finish_checking_instruction:; } } :(scenario copy_checks_reagent_count) % Hide_errors = true; recipe main [ 1:number <- copy 34, 35 ] +error: ingredients and products should match in '1:number <- copy 34, 35' :(scenario write_scalar_to_array_disallowed) % Hide_errors = true; recipe main [ 1:array:number <- copy 34 ] +error: main: can't copy 34 to 1:array:number; types don't match :(scenario write_scalar_to_array_disallowed_2) % Hide_errors = true; recipe main [ 1:number, 2:array:number <- copy 34, 35 ] +error: main: can't copy 35 to 2:array:number; types don't match :(scenario write_scalar_to_address_disallowed) % Hide_errors = true; recipe main [ 1:address:number <- copy 34 ] +error: main: can't copy 34 to 1:address:number; types don't match :(code) bool types_match(reagent lhs, reagent rhs) { // '_' never raises type error if (is_dummy(lhs)) return true; // to sidestep type-checking, use /raw in the source. // this is unsafe, and will be highlighted in red inside vim. just for some tests. if (is_raw(rhs)) return true; // allow writing 0 to any address if (rhs.name == "0" && is_mu_address(lhs)) return true; if (is_literal(rhs)) return !is_mu_array(lhs) && !is_mu_address(lhs) && size_of(rhs) == size_of(lhs); if (!lhs.type) return !rhs.type; return types_match(lhs.type, rhs.type); } // two types match if the second begins like the first // (trees perform the same check recursively on each subtree) bool types_match(type_tree* lhs, type_tree* rhs) { if (!lhs) return true; if (!rhs || rhs->value == 0) { if (lhs->value == get(Type_ordinal, "array")) return false; if (lhs->value == get(Type_ordinal, "address")) return false; return size_of(rhs) == size_of(lhs); } if (lhs->value != rhs->value) return false; return types_match(lhs->left, rhs->left) && types_match(lhs->right, rhs->right); } // hacky version that allows 0 addresses bool types_match(const reagent lhs, const type_tree* rhs, const vector<double>& data) { if (is_dummy(lhs)) return true; if (rhs->value == 0) { if (lhs.type->value == get(Type_ordinal, "array")) return false; if (lhs.type->value == get(Type_ordinal, "address")) return scalar(data) && data.at(0) == 0; return size_of(rhs) == size_of(lhs); } if (lhs.type->value != rhs->value) return false; return types_match(lhs.type->left, rhs->left) && types_match(lhs.type->right, rhs->right); } bool is_raw(const reagent& r) { return has_property(r, "raw"); } bool is_mu_array(reagent r) { if (!r.type) return false; if (is_literal(r)) return false; return r.type->value == get(Type_ordinal, "array"); } bool is_mu_address(reagent r) { if (!r.type) return false; if (is_literal(r)) return false; return r.type->value == get(Type_ordinal, "address"); } bool is_mu_number(reagent r) { if (!r.type) return false; if (is_literal(r)) return r.properties.at(0).second->value == "literal-number" || r.properties.at(0).second->value == "literal"; if (r.type->value == get(Type_ordinal, "character")) return true; // permit arithmetic on unicode code points return r.type->value == get(Type_ordinal, "number"); } bool is_mu_scalar(reagent r) { if (!r.type) return false; if (is_literal(r)) return !r.properties.at(0).second || r.properties.at(0).second->value != "literal-string"; if (is_mu_array(r)) return false; return size_of(r) == 1; }