Commit Graph

662 Commits (115493781b240a55f621de556890cf801b0b3aec)

Author SHA1 Message Date
Bastian Buck aa49bc2708
os: implement os.truncate() + improve error handling (#9752) 2021-04-16 11:53:44 +03:00
Bastian Buck 546dc91967
os: create os.hostname() and os.chown() + os.uname() for windows (#9722) 2021-04-15 01:49:05 +02:00
crthpl 14434cc86a
all: bare metal support (fix `-freestanding`) (#9624) 2021-04-14 07:50:50 +02:00
Lukas Neubert ada763e0f4
fmt: remove parenthesis around single ident (#9696) 2021-04-12 16:01:03 +03:00
Henrixounez 7ba13a415a
os: handle fread errors (#9687) 2021-04-12 10:26:08 +03:00
Lukas Neubert 1d5ed89138
fmt: remove trailing space in comments (#9620) 2021-04-07 15:25:11 +02:00
Delyan Angelov db84d5e221
os: cleanup os.environ implementation 2021-04-06 18:02:12 +03:00
Delyan Angelov d8cb24eef0 ci: fix -cflags -Werror jobs 2021-04-05 23:42:26 +03:00
Delyan Angelov 19b915b105 ci: fix windows-tcc job 2021-04-05 23:35:22 +03:00
Delyan Angelov 10619d098c
ci: fix a race in vlib/v/compiler_errors_test.v execution on m1 2021-04-05 22:57:59 +03:00
Delyan Angelov b041681c00 tests: bump limits to reduce flakyness on m1 with latest clang 2021-04-05 22:38:55 +03:00
Delyan Angelov 291a88bc62
ci: fix some of `v test-cleancode` 4 2021-04-05 21:39:32 +03:00
Delyan Angelov fec89c7efb
ci: fix some of `v test-cleancode` 1 2021-04-05 20:47:32 +03:00
Delyan Angelov 90b123c27b
ci: fix self compilation on windows 2021-04-05 15:47:43 +03:00
Delyan Angelov 5c07cbf5d3
ci: fix `v -cc clang-11 -cflags -Werror cmd/v` 2021-04-05 08:09:04 +03:00
Alexander Medvednikov e399c07a2f os: fix a C warning 2021-04-05 06:42:20 +03:00
Delyan Angelov 8a362588aa
ci: fix os.environ :-| 2021-04-04 21:11:17 +03:00
Delyan Angelov accd4d83bf
ci: fix compilation 2021-04-04 20:14:51 +03:00
Alexander Medvednikov 6c8199c9d9 os: fix compilation on linux 2021-04-04 17:48:21 +03:00
Alexander Medvednikov 57e6138a61 all: remove byteptr and charptr; replace them with &byte and &char 2021-04-04 17:43:32 +03:00
Delyan Angelov c698fa1a58
all: support `v -watch run` (#9577) 2021-04-04 16:05:06 +02:00
Bastian Buck 15d9f50be9
os: add x64 mode for struct and raw read/write (#9512) 2021-03-30 11:40:23 +02:00
Bastian Buck 69dff4b384
os: make os module handle large files (#9439) 2021-03-26 07:51:55 +01:00
Delyan Angelov b7c01db1f9
builtin: add .vstring_literal and .vstring_literal_with_len for converting read only strings like os.args 2021-03-23 22:10:28 +02:00
Delyan Angelov 7f91b75cbc
builtin: fix leaks in `os.execute()` and `[]string{} == []string{}` 2021-03-23 20:36:19 +02:00
Alexander Medvednikov a53aaaf9e7 os: fix a leak in read_lines() 2021-03-22 12:20:55 +03:00
zakuro c8416f9a54
all: deprecate write_str and replace it with write_string (#9369) 2021-03-20 17:25:51 +01:00
zakuro e3c0f305b2
os: deprecate `os.File.write_bytes` and add `os.File.write_ptr` (#9370) 2021-03-20 09:02:28 +02:00
zakuro 29884fa2a9
os: deprecate read_at and add read_from to implement RandomReader (#9371) 2021-03-19 12:35:08 +02:00
JalonSolov 9ea88c090b
os: fix warning write_str -> write_string (#9368) 2021-03-19 03:36:27 +01:00
Alexander Medvednikov bb79df932b net/os: deprecate write_str() in favor of write_string() 2021-03-19 04:51:31 +03:00
Delyan Angelov b7a5fa7fbe
os: fix `v -cflags "-Werror" test vlib/os/` 2021-03-18 19:45:04 +02:00
Nick Treleaven 446631ceb5
checker: fixed array cannot implicitly convert to fooptr (again) (#9302) 2021-03-15 15:55:07 +02:00
Delyan Angelov 3951c351c6
os: simplify Process (remove chainability of Process method calls) 2021-03-15 09:23:43 +02:00
yuyi 945769a4f6
all: implement reference receiver optimization for big structs (#9268) 2021-03-14 18:11:21 +01:00
Delyan Angelov 125be84e3d
builtin: fix `-d debug_realloc`, add realloc_data/3 2021-03-14 14:54:35 +02:00
Alexander Medvednikov 2f1810634e checker: do not allow direct initialization of builtin types (s := string{}) 2021-03-13 18:20:46 +03:00
Lukas Neubert fecf4a6f58
os: fix rmdir_all panic with hidden dirs (#9271) 2021-03-13 08:43:38 +02:00
StunxFS 90d942e2ec
os: add missing '.exe' in os_test.v (#9269) 2021-03-12 18:05:29 +02:00
Delyan Angelov def53fd73f
os: prevent os.exists_in_system_path() from panicing 2021-03-12 17:05:26 +02:00
Delyan Angelov 995db65471
os: fix os.cp_all, by making the dst folder, if it does not exist already 2021-03-12 16:29:27 +02:00
Enzo 99abd46ac9
os: add `(read|write)_raw[_at]` to File (#9171) 2021-03-10 18:45:12 +02:00
Delyan Angelov d7049ae2da
os: deprecate os.exec (returning ?os.Result), in favour of os.execute, which returns os.Result (#8974) 2021-03-08 20:52:13 +02:00
Lukas Neubert fdcfe397d4
fmt: write empty or blocks the same as empty fn bodies, empty structs, etc (#9136) 2021-03-06 21:04:51 +02:00
Bartimus ce92bf8da0
os.File: add .read_struct_at and .write_struct_at (#9114) 2021-03-06 20:44:53 +02:00
R cqls 204f57d227
os: update C apis used in os_android.c.v (#9134) 2021-03-05 19:20:11 +02:00
joe-conigliaro 2d73411396
checker: define missing C fn args & check C & JS args (#8770) 2021-03-05 17:41:11 +03:00
Delyan Angelov 5e0e44eb69
os: move file methods to vlib/os/file.c.v, document them, add new file.read_struct and file.write_struct and tests 2021-03-04 14:54:39 +02:00
spaceface b712af56fd
all: bring back `panic(err.msg)` -> `panic(err)` (#9022) 2021-03-01 00:18:14 +01:00
spaceface d63b7bc35a
all: update repo to use the new error handling syntax (#8950) 2021-02-28 23:20:21 +03:00
spaceface b9a381f101
all: migrate to the new Option (p. 1) (#8924) 2021-02-28 22:24:29 +03:00
Delyan Angelov 20f9bdfa8e
os: fixes for os.input(), os.get_raw_stdin(), os.get_raw_line() in case of stdin EOF 2021-02-27 20:02:36 +02:00
Alexander Medvednikov 3a2d696fac time: time.wait() => time.sleep() 2021-02-27 20:41:06 +03:00
Nick Treleaven aed348fb80
os: tag some File methods that take voidptr as unsafe - write_bytes, write_bytes_at (#8985) 2021-02-27 10:11:17 +02:00
Nick Treleaven c03798e390
checker: disallow implicit conversion from fixed array to fooptr (#8823) 2021-02-26 00:28:47 +01:00
Delyan Angelov fba28d2dcc
ci: increase the timeout for test_os_process (false positives on macos) 2021-02-22 17:24:52 +02:00
Delyan Angelov 5d653a37b6
os: make process_test.v more portable (prepare for windows) 2021-02-22 09:42:00 +02:00
zakuro ac4791045f
time: consolidate the different sleep functions into time.wait(Duration) (#8853) 2021-02-21 17:05:03 +02:00
Stanislav Ershov c190b6a131
vlib: remove older deprecated functions (#8864) 2021-02-20 20:42:55 +02:00
Stanislav Ershov 6a752512b2
os: fix os.real_path on Windows (#8822) 2021-02-19 11:20:06 +02:00
Nick Treleaven 4ccf991f61
checker: warn when casting a fixed array (use `&arr[0]` instead) (#8787) 2021-02-17 20:45:11 +01:00
Nick Treleaven 4a0367a63c
vlib: add [unsafe] tag to more functions: tos, string_from_wide, strings.Builder: write_bytes, free (#8766) 2021-02-15 17:15:52 +02:00
zakuro 4e2418e9cf
os: add test for os.file_name (#8757) 2021-02-15 07:37:35 +01:00
Nick Treleaven ea803113c3
checker: check `unsafe` V function calls (#8752) 2021-02-14 19:31:42 +01:00
Uwe Krüger 374739b804
all: rename `[ref_only]` -> `[heap]` (#8718) 2021-02-13 16:52:01 +02:00
Nick Treleaven d03c1d615a
os: improve `rm` error message (#8719) 2021-02-13 13:51:38 +01:00
Larpon 65f2420516
os: fix cp_all mkdir panic (#8680) 2021-02-12 01:55:36 +02:00
SurmanPP f2ad6dd4d9
os: fix os.walk, when passing paths ending with path_separator (#8672) 2021-02-10 18:48:01 +02:00
kristof de spiegeleer 2d875260e8
examples: Process examples (#8598) 2021-02-07 05:19:05 +01:00
Lukas Neubert d660f2cc6f
fmt: insert newline after last HashStmt (#8482) 2021-02-01 14:50:41 +01:00
Nick Treleaven 64d12cdc8d
checker: check number of C function arguments for some cases (#8444) 2021-01-30 18:33:36 +01:00
Julia Bogdan Filipchuk d26ac0f6cb
vfmt: add ability to use vfmt as a filter from stdin to stdout (#8432) 2021-01-30 12:38:54 +02:00
Delyan Angelov 4e2b908f21
ci: fix `os` compilation on windows 2021-01-26 17:41:27 +02:00
Delyan Angelov e5a84719ca
all: require calling `optfn() ?` / `optfn() or {...}` for `fn optfn() ? {}` 2021-01-26 16:43:17 +02:00
Delyan Angelov dbaccd4272
vfmt: shorten `main.const_name` to just `const_name` 2021-01-25 20:57:33 +02:00
Delyan Angelov 728344ff65
ci: fix `v test-cleancode` 2021-01-25 12:55:01 +02:00
Alexander Medvednikov c21f57ff59 os: vfmt os.v 2021-01-23 10:33:53 +01:00
Alexander Medvednikov 45cc3ec664 sokol: remove an absolute import 2021-01-23 10:32:00 +01:00
Alexander Medvednikov d991712b3c gg: native rendering mode on macOS 2021-01-23 10:25:43 +01:00
Lukas Neubert 8b61891348
fmt: smarter if condition wrapping (#8201) 2021-01-23 10:33:22 +02:00
Lukas Neubert ac2c3847af
all: update copyright to 2019-2021 (#8029) 2021-01-18 13:20:06 +01:00
Daniel Däschle 53941c4a0a
fmt: fix if cond break readability (#8132) 2021-01-16 02:12:17 +01:00
Delyan Angelov 995f27a7c0
builtin,os: use more precise C. declarations for C.fread, C.fwrite and C.qsort 2021-01-15 12:15:31 +02:00
Delyan Angelov adf084eeed
cgen: fix address violations for `return error(abc)`, reduce leaks in `os` 2021-01-14 04:58:26 +02:00
zakuro 254df0ca62
fmt: improve string quotes (#8075) 2021-01-13 06:05:27 +01:00
zakuro 33694665f0
fmt: align each contiguous field of struct. not the whole. (#7981) 2021-01-12 04:38:43 +01:00
yuyi a1c67232d0
checker: fix duplicate variable name (fix #265) (#7982) 2021-01-10 21:41:29 +01:00
Delyan Angelov 722a603222
cgen: fix os.args initialization, so that `const x = os.args[0]` works 2021-01-10 15:17:24 +02:00
Nick Treleaven 8fc33bc27d
checker: warn when casting number or a voidptr to reference type outside unsafe (#7900) 2021-01-05 20:07:45 +02:00
clubby789 0ab6a8cd01
os: add a `posix_set_permission_bit` function (#7754) 2021-01-04 19:57:17 +02:00
zakuro dd516858d4
fmt: align struct field comments (#7632) 2021-01-03 21:10:25 +01:00
yuyi 7ce3c5e206
os: change os.mv/2 return type to `?` (#7738) 2020-12-31 11:33:39 +02:00
Delyan Angelov b4f02adc32
os: add os.execve/3 (extracted from unix_spawn_process); use os.execvp/2 in v.util.launch_tool/3 2020-12-30 18:14:03 +02:00
Delyan Angelov fe7fa7077e
ci: fix for os.execvp on macos (cargs << charptr(cmdpath.str) too) 2020-12-28 20:20:56 +02:00
Delyan Angelov 8fe85bcc33
ci: fix for os.execvp on macos (<<charptr()) 2020-12-28 20:15:30 +02:00
Delyan Angelov 4c40891d5e
ci: fix for os.execvp on macos (<<) 2020-12-28 20:10:57 +02:00
Delyan Angelov a8b2745019
ci: fix for os.execvp on macos 2020-12-28 20:01:19 +02:00
Delyan Angelov ef786f9a75
os: add os.execvp/2 2020-12-28 19:35:52 +02:00
Lukas Neubert 06fdf34214
fmt: unwrap long single line ifs (#7608) 2020-12-27 14:20:30 +01:00
Delyan Angelov e26e0c3f72
os: restore some of the deprecated os.File methods 2020-12-26 14:57:51 +02:00
spaceface 214290d55b
fmt: add a space around single-line `unsafe` expressions (#7505) 2020-12-23 19:13:42 +01:00
Alexander Medvednikov 875f7a77a9 checker: arr1=arr2 warning 2020-12-20 10:42:46 +01:00
Delyan Angelov 8addb31440
os: fix typo in AAssetManager 2020-12-17 09:08:23 +02:00
Delyan Angelov 1ee57649b9
os: vfmt all of `os` .v files, add it to `v test-cleancode` with no exceptions 2020-12-16 14:15:11 +02:00
Delyan Angelov 88a8507dd8
os: vfmt most of `os`, add it to `v test-cleancode` 2020-12-16 11:08:23 +02:00
Delyan Angelov bd07177ef0
vlib: prepare os for -Wimpure-v 2020-12-15 09:58:33 +02:00
yuyi 947ceb1595
os: format os.v (#7334) 2020-12-15 09:33:31 +02:00
ka-weihe 4d025582c0
cgen: fix shadowing warning (#7289) 2020-12-12 23:06:02 +01:00
yuyi 095327134e
os: fix trailing slash in dir() (#7283) 2020-12-12 10:59:43 +01:00
Alexander Medvednikov 1abb40dc46 cgen: use `cur_mode ast.Module` instead of a string 2020-12-08 19:52:33 +01:00
Alexander Medvednikov a1c0bb3585 os: File.write_string() 2020-12-08 19:37:33 +01:00
Daniel Däschle 334d605d90
tools,vls: add `v test-parser examples/hello_world.v` (#7145) 2020-12-06 12:42:56 +02:00
heronwr f8af866f76
builtin: make v_realloc use int parameter instead of u32 (#7080) 2020-12-02 15:35:11 +02:00
Delyan Angelov b11d285680
v: support multiple paths in VMODULES env variable (#7048) 2020-11-30 18:31:37 +01:00
Delyan Angelov aae5812337 os: cleanup os.find_abs_path_of_executable/1 2020-11-30 08:40:39 +02:00
ka-weihe 9367dcda10
all: fix remaining c warnings and add -Werror to CI (#7021) 2020-11-29 21:23:37 +02:00
Delyan Angelov 018bd6aac3 os: fix flaky test in process_test.v 2020-11-21 18:01:21 +02:00
Delyan Angelov d633261a99
os: add Process (#6786) 2020-11-16 17:32:50 +01:00
Emily Hudson cd2a2cef25
vlib/net: add buffered IO, x.net -> net (#6754) 2020-11-15 22:54:47 +02:00
Alexander Medvednikov 1c257abc23 autofree: simplify: merge tmp arg logic with scope vars 2020-11-09 14:24:46 +01:00
Alexander Medvednikov 507d724ee6 autofree: free before return tests 2020-11-09 11:54:45 +01:00
Delyan Angelov 4b35495fbe all: support VMODULES environment variable (defaulting to ~/.vmodules) 2020-11-08 08:07:17 +02:00
Delyan Angelov 0ba5544446 checker: add a check for `ptr = Abc{}` 2020-11-07 21:19:46 +02:00
spaceface777 a9e9554b11
all: fix most C warnings (#6758) 2020-11-06 16:26:59 +02:00
Alexander Medvednikov 1b1d17cfb5 os: basic proof of concept stdout capture; autofree: small fixes 2020-11-05 08:44:37 +01:00
Ekopalypse cc4bb71f29
os: prevent unnecessary dependencies when importing `os` on windows (#6741) 2020-11-04 10:19:46 +02:00
Delyan Angelov f7698ea160 v symlink: fix windows PATH setting (cmd.exe needs C: not c:) 2020-10-22 17:31:37 +03:00
Delyan Angelov 50a2b033b7 ci: fix failing tests on windows too 2020-10-15 15:54:44 +03:00
Alexander Medvednikov 7da1afa140 all: switch to the new fn arg syntax everywhere; add lots of vfmt -verify tests 2020-10-15 12:32:28 +02:00
Delyan Angelov 3795aaab5c v test-fmt: reformat some skipped files, comment on the remaining ones 2020-10-15 00:39:09 +03:00
Ekopalypse 2622070f14
os: ensure that setenv creates the key on windows (#6560) 2020-10-04 19:43:28 +02:00
Enzo fd88bfbac8
fmt: fix formatting of anon args (#6545) 2020-10-04 06:32:47 +02:00
Alexander Medvednikov 4879661f5a os: remove base_dir(); dir() and base() fixes 2020-10-01 01:25:52 +02:00
Lukas Neubert 3a8be4d8d9
os: home_dir() remove trailing slash (#6512) 2020-09-30 16:02:54 +02:00
Delyan Angelov dc954bbb03 all: use `macos` consistently in os.user_os and the compiler 2020-09-29 22:32:20 +03:00
Delyan Angelov 03258db26d ci: other mut vlib test fixes 2020-09-27 11:18:55 +03:00
Alexander Medvednikov e2c7126d11 checker: verify mutability of method args 2020-09-27 03:14:24 +02:00
Daniel Däschle abc98c273c
parser: require assign on type alias (#6477) 2020-09-25 12:02:32 +02:00
Marcin 34884c1631
os: fix binary mode read/write on windows (#6431) 2020-09-20 16:28:45 +02:00
Daniel Däschle c960b5979e
vlib: fix incompatible pointer warning (#6385) 2020-09-16 17:40:02 +03:00
Nick Treleaven b552c29bef
os: add fn `read_bytes_into` with buffer argument (#6365) 2020-09-14 15:34:34 +02:00
Delyan Angelov 2bd4355a4c os: add check for path.len == 0 in vfopen 2020-09-13 18:08:58 +03:00
Delyan Angelov 8c71ba8912 os: add more error checking for os.read_bytes and os.read_file 2020-09-13 18:03:19 +03:00
Delyan Angelov 60ecb7e4b6 os: change f.write and f.writeln to return options too 2020-09-12 08:39:28 +03:00
Delyan Angelov ce6d2759f5 os: add os.open_stdin/0 and os.File.get_line/0 2020-09-10 16:57:03 +03:00
Larpon 51d7d7cfae
os: fix os.mv edge case and Windows style paths (#6302) 2020-09-06 13:12:07 +02:00
Larpon b4b898b769
os: enable is_file tests (#6312) 2020-09-06 12:39:02 +02:00
Larpon 81778e507f
os: is_file() (#6301) 2020-09-04 22:27:52 +02:00
Larpon efa49bfbb7
os: make behave more like Unix "mv" command (#6300) 2020-09-04 13:08:47 +02:00
Delyan Angelov 718a4692dd os: enable test_write_and_read_bytes again 2020-08-29 07:43:31 +03:00