Commit Graph

114 Commits

Author SHA1 Message Date
guberathome
0c038365d7
IO.Raw (#1243)
* feat!: move C library wrapper funtions to IO.Raw

* docs: fixed doc string for (String.allocated?)

* docs: removed superfluous parameter names for defns

* fix: replaces IO.exit by System.exit

* fix: ./test/regression.carp for (IO.read->EOF)

* fix: ./test/system.carp

* feat: implemented IO.fwrite!

* feat!: removed IO.exit

* feat!: raw character input now returns Int instead of Char

* fix: removed irritating space chars

* fix: repaired ./example/carp_demo.carp

* fix: reverted System.exit to return an Int for SDL examples

* fix: removed System.exit!

Co-authored-by: guberatsie <gunnar.bernhardt@siemens.com>
2021-06-17 17:33:10 +02:00
guberathome
5e5cf8d4c2
Up down case (#1248)
* feat!: implemented String.ascii-to-lower and String.ascii-to-upper

* fix: corrected docstrings

* fix: added unit test for ascii-to-lower and ascii-to-upper

* fix: moved tolower- and toupper from String to Byte module

Co-authored-by: guberatsie <gunnar.bernhardt@siemens.com>
2021-06-16 09:45:32 +02:00
guberathome
6cd2a96486
clean up IO library (#1232) 2021-06-08 21:05:51 +02:00
Veit Heller
64b0dc4922
feat: add String.to-list (#1185) 2021-03-15 16:22:10 +01:00
Veit Heller
bdaf96550f
refactor: use quasiquoting in STDLIB and go through array in quasiquote (#1135) 2021-01-21 06:20:03 +01:00
Veit Heller
2d34af6aa9
feat: make empty? an interface (#1139) 2021-01-20 09:54:08 +01:00
Veit Heller
02936cc74c
feat: Derive (#1120)
* core: add derive

* fix: fix errors with set!

Notably, don't type check dynamic bindings (which can be set to
whatever) and eliminate a hang that resulted from not handling an error
at the end of the `set!` call. Also refactors some of the code in
efforts to make it a bit cleaner.

Also adds an error when `set!` can't find the variable one calls set!
on.

* feat: better derive

* test: add error test for derive

* document derive

* add derive to core documentation to generate

* core: add derive

* fix: fix errors with set!

Notably, don't type check dynamic bindings (which can be set to
whatever) and eliminate a hang that resulted from not handling an error
at the end of the `set!` call. Also refactors some of the code in
efforts to make it a bit cleaner.

Also adds an error when `set!` can't find the variable one calls set!
on.

* feat: better derive

* document derive

* feat: first completely working version of derive

* feat: make name of derivable customizable (thanks @scolsen)

* refactor: implement doc edits provided by @scolsen

* feat: change argument order for derive

* fix: change deriver error test

* test: add derive tests

* fix: change order of derive back

* docs: fix typo in derive document

Co-authored-by: scottolsen <scg.olsen@gmail.com>
2021-01-15 10:48:34 +01:00
Erik Svedäng
6f7aeaff73
feat: 'delete' interface (deciding whether a type is managed or not) (#1061)
* feat: 'delete' interface (deciding whether a type is managed or not)

* refactor: Move implements function to Interface module

* feat: Automatically implement 'delete' for types defined with `deftype`

* fix: Don't implement `delete` for Pointer

* refactor: Clarify `memberInfo` function

* fix: Also check if function types are managed

* fix: Implement 'delete' for String and StaticArray.

* fix: Manage String and Pattern. Tests run!

* feat: Add `managed?` primitive

* docs: Note about primitiveIsManaged

* test: Basic test cases for managed / nonmanaged external types

* test: Make sure `managed?` primitive works

* test: Inactivate sanitizer since we're creating leaks intentionally

* feat: Removed 'isExternalType' function

* refactor: Decide if struct member takes ref or not when printing

..based on blitable interface, and 'prn' implemntation

* refactor: Use 'blit' everywhere

* refactor: Implement `strTakesRefOrNot` in terms of `memberStrCallingConvention`

* refactor: Use `remove` over `filter not`
2020-12-20 21:21:14 +01:00
Erik Svedäng
40d55562df
fix: Pointer str & prn (#1060)
* fix: Make `str` work for (Pointer a) types

* test: Make sure that the Pointer.str compiles

* fix: Remove test case, keep function around to make sure it compiles
2020-12-09 06:19:07 +01:00
Erik Svedäng
f78fd16a71
refactor: Move code out of Macros.carp into other files (#1014)
* refactor: Move code out of Macros.carp into other files

* fix: Move back some macros needed in --no-core mode

* refactor: Remove weird 'evaluate' macros

* fix: Put back more macros

* fix: Remove transitive loading of Macros.carp

* refactor: Remove ArrayMacros.carp and put 'for' at top of Array.carp instead

* refactor: More splitting up

* refactor: Move back save-docs

* fix: Moved back some stuff

Co-authored-by: Erik Svedang <erik@Eriks-iMac.local>
2020-11-28 12:53:18 +01:00
Erik Svedäng
f3eebf1aba docs: Try adding some docs to retrigger github action 2020-11-18 22:53:13 +01:00
Jorge Acereda
e4d4a345b8 Fix suffix docs and implementation, simplify prefix. 2020-11-17 23:42:03 +01:00
Erik Svedäng
fe9b07927a feat: Bring back the original (problematic) function 2020-11-11 06:58:41 +01:00
Erik Svedang
47dfd5900b fix: Make nameOfPolymorphicFunction not add so suffix to external functions 2020-11-10 23:14:26 +01:00
hellerve
acce3a471c register-type: fix for void 2020-11-05 16:49:32 +01:00
Tim Dévé
cbda258fcc Moves StdInt functions with dependency on String into String.carp
This allows to import StdInt.carp by itself in --no-core situations
2020-10-26 19:14:50 +00:00
hellerve
91b220c051 core: add String.from-bytes 2020-07-08 21:56:14 +02:00
Erik Svedäng
14a0d7e722
Merge pull request #799 from hellerve/veit/string-to-bytes
Add String.to-bytes
2020-05-13 20:59:37 +02:00
hellerve
468c232741 core: add String.to-bytes 2020-05-13 17:15:26 +02:00
Erik Svedäng
e4e3c4208a
Merge pull request #790 from hellerve/veit/safe-num-from-string
Make Num.from-string better
2020-05-12 23:04:00 +02:00
hellerve
c569666a0a core: make from-string better 2020-05-12 22:33:40 +02:00
hellerve
eec1ad9375 test: rollback accidently commited test update 2020-05-12 21:54:48 +02:00
hellerve
8636dd467f core: add str on refs for numeric types 2020-05-12 21:50:20 +02:00
Erik Svedäng
aae743fb35
Merge pull request #769 from scolsen/implement-prim
Add an `implements` primitive, update core
2020-05-12 21:45:29 +02:00
Jorge Acereda
9b08b6df3c Merge 2020-05-11 16:10:35 +02:00
Scott Olsen
f13a2fdd9d Add some more calls to implement to make tests pass 2020-05-10 13:32:22 -04:00
scottolsen
040e9e4391 Add an implements primitive, update core
This change adds a new primitive Implements which changes interface
implementations from being implicit to being explicit. Going forward,
users will have to declare (implements <interface> <implementation>) to
explicitly add a function to an interface. This provides two benefits:

- Prevents unwitting name clashes. Previously, if one defined a function
  that happened to have the same name as an interface, it was
  automatically assumed the function implemented that interface when this
  is not always the intention, especially in large programs.
- Name flexibility. One can now implement an interface with a function
  that has a different name than the interface, which allows for greater
  flexibility.

I've updated core to make the necessary calls to the new primitive.

Since str and copy are derived automatically for types, we treat these
functions as a special case and auto-implement the interfaces.
2020-05-09 12:59:47 -04:00
hellerve
7c7bb71584 eval: final rewrite version 2020-04-17 11:58:28 +02:00
hellerve
0328b8a28a core: remove old definition of String.ends-with? (thanks @davidrusu) 2020-02-12 19:05:00 +01:00
hellerve
e9d04ce1b9 core: add check in starts-with?/ends-with? for string length 2020-02-12 17:22:03 +01:00
hellerve
ee812b37e6 core: make subarry/substring slice 2020-02-11 09:09:30 +01:00
hellerve
c0c31b6ad1 core: add Float.from-string and Double.from-string 2020-01-29 11:41:06 +01:00
Erik Svedäng
ea045be426 Merge branch 'byte-type' of https://github.com/hellerve/Carp into hellerve-byte-type 2020-01-27 10:10:58 +01:00
hellerve
cd0c09da3f core: add String.from-cstr 2020-01-13 22:49:23 +01:00
hellerve
15c27bdb49 core: allow byte as member type 2019-11-01 10:52:34 +01:00
hellerve
f1f252639f core: add a byte type 2019-11-01 10:52:34 +01:00
GrayJack
07def7db23 Fix all nth usage 2019-10-31 06:23:23 -03:00
hellerve
c6dafda518 core: reduce allocations in String.repeat 2019-10-28 18:13:40 +01:00
Jorge Acereda
7b7cb5d1e5 Substitute /= interface by a generic. 2019-09-20 23:49:20 +02:00
hellerve
aad568c941 core: make String.join take ref (for #562) 2019-09-16 20:22:01 +02:00
Jorge Acereda
aa71647d02 Fix crashes in String.join/join-with-char with empty array. 2019-09-10 21:49:00 +02:00
Erik Svedäng
eaf2a427df Implement str/prn for &Bool 2019-06-14 15:24:25 +02:00
hellerve
e9fcf87ff5 core: remove stringcopy.append 2019-05-27 18:05:44 +02:00
hellerve
e3438560ac core: add String.contains? 2019-03-23 18:41:08 +01:00
Joel Kaasinen
74d1ad179c prn and str for Ref Int
for #354
2018-12-12 08:20:20 +02:00
hellerve
a451a78f73 core: add Pattern.find-all and optimize String.split-by 2018-11-01 16:20:52 +01:00
hellerve
012f048f7f core: change from str to prn in map stringification 2018-08-07 09:32:35 +02:00
Chris Hall
21a316c70f adding StringCopy.< and StringCopy.> 2018-06-26 17:20:39 +10:00
Chris Hall
4704a06f32 Adding String.< and String.> 2018-06-26 16:00:33 +10:00
hellerve
c82916612a core: document string, remove string-join 2018-06-15 16:38:34 +02:00