Compare commits

..

301 Commits

Author SHA1 Message Date
Doug Coleman 0a77f6c679 factor: fixing [[ ]] and some unit tests 2018-08-02 18:29:04 -04:00
Doug Coleman 343674189c factor: Let url"" and sbuf"" work without spaces.
Also url[[]] if you define a url[[ word.
2018-08-02 10:37:02 -04:00
Doug Coleman c715b0d505 factor: fix load-all 2018-08-02 09:23:30 -04:00
Doug Coleman 1a57f8180a modern.out: Fix using 2018-08-02 08:49:20 -04:00
Doug Coleman acc5dc6add pcre: fix :: 2018-08-02 08:39:31 -04:00
Doug Coleman 924b434336 Revert "factor: vocab:word -> vocab::word"
This reverts commit 354f1cbd34.
2018-08-02 08:21:52 -04:00
Doug Coleman ac58033aff alien.library: fix docs circularity 2018-08-02 08:06:16 -04:00
Doug Coleman a1ad3385b9 factor: more char: 2018-08-02 08:03:45 -04:00
Doug Coleman 7730fc5c64 Merge remote-tracking branch 'origin/master' into modern-harvey2 2018-08-02 07:57:42 -04:00
Doug Coleman 69c000088d Merge remote-tracking branch 'origin/master' into modern-harvey2 2018-06-29 03:17:55 -05:00
Doug Coleman 53b1a81049 Merge branch 'master' into modern-harvey2 2018-06-20 00:26:12 -05:00
Doug Coleman ca5e76ef1e fjsc: all my gits complainin about this one 2018-06-19 23:55:37 -05:00
Doug Coleman 62ff48da56 Merge remote-tracking branch 'origin/master' into modern-harvey2 2018-04-21 14:45:35 -05:00
Doug Coleman cbf77f34cc extra: updates 2018-03-23 18:01:15 -05:00
Doug Coleman 2c7a579ecd cocoa: Update. 2018-03-23 17:59:10 -05:00
Doug Coleman 25bf216bf4 Merge remote-tracking branch 'origin/master' into modern-harvey2 2018-03-23 16:36:01 -05:00
Doug Coleman 4c164b1ae6 factor: change some spacing with ; on its own line 2018-03-19 00:03:27 -05:00
Doug Coleman 6bed1364f2 factor: update syntax. 2018-03-18 23:14:46 -05:00
Doug Coleman da19b780b1 factor: all-paths [ ] rewrite-paths 2018-03-18 23:09:46 -05:00
Doug Coleman 5d66a88b0d modern: Disable <foo> matching. 2018-03-18 18:27:49 -05:00
Doug Coleman df20fb9ddb Merge remote-tracking branch 'origin/master' into modern-harvey2 2018-03-18 17:30:26 -05:00
Doug Coleman ddfe23ccca Merge branch 'master' into modern-harvey2 2018-03-15 11:48:24 -05:00
Doug Coleman e7cd3e3635 Merge remote-tracking branch 'origin' into modern-harvey2 2018-03-11 00:44:10 -06:00
Doug Coleman c7f12617a6 factor: port changes. 2018-03-06 19:07:37 -06:00
Doug Coleman 64ccdc40a0 Merge remote-tracking branch 'origin/master' into modern-harvey2 2018-03-06 10:57:40 -06:00
Doug Coleman c041cc69f0 boolean-expr: fix load error 2018-02-18 12:46:02 -06:00
Doug Coleman c53892a128 bootstrap.syntax: Fix bootstrap. 2018-02-18 11:41:02 -06:00
Doug Coleman a2e8fb9050 Merge remote-tracking branch 'origin/master' into modern-harvey2 2018-02-18 11:29:09 -06:00
Doug Coleman 6338e5308d Merge branch 'modern-harvey2' of factorcode.org:/git/factor into modern-harvey2 2018-02-16 21:24:55 -06:00
Doug Coleman 5c3f6a2a8d Merge remote-tracking branch 'origin/master' into modern-harvey2 2018-02-11 14:47:21 -06:00
Doug Coleman 6614e8b414 Merge remote-tracking branch 'origin/master' into modern-harvey2 2018-02-10 15:26:43 -06:00
Doug Coleman 50a768f6e2 windows: fix bootstrap 2018-02-10 15:04:43 -06:00
Doug Coleman a19c2b0c33 extra: fix namespacing 2018-02-10 12:54:25 -06:00
Doug Coleman 1b5afce9f8 gpu.shaders: Fix docs 2018-02-10 12:12:51 -06:00
Doug Coleman ab9d9bfe04 minesweeper: port to new parser syntax. 2018-02-10 11:43:24 -06:00
Doug Coleman ddcd6b2af0 Merge remote-tracking branch 'origin/master' into modern-harvey2 2018-02-10 11:18:18 -06:00
Doug Coleman 804f605680 boids: fix using 2018-02-10 10:51:50 -06:00
Doug Coleman be5f77a319 multi-methods: Rename stuff. About to refactor. 2018-01-28 11:42:58 -06:00
Doug Coleman de247bf0fa cocoa: METHOD: -> COCOA-METHOD: for now. 2018-01-28 09:15:33 -06:00
Doug Coleman 81d713f6e6 syntax: Add INITIALIZED-SYMBOL:, STARTUP-HOOK:, and SHUTDOWN-HOOK: 2018-01-28 01:34:51 -06:00
Doug Coleman d2d8f02d50 decimals: break a word up. 2018-01-27 12:01:51 -06:00
Doug Coleman 144da45241 math.vectors.simd: fix functor. 2018-01-27 12:01:51 -06:00
Doug Coleman 5ef60f2f21 math.vectors.simd: better implementation. 2018-01-27 12:01:51 -06:00
Doug Coleman 06dd84bc69 cocoa: update syntax 2018-01-27 10:38:35 -06:00
Doug Coleman 5d8b912216 Merge remote-tracking branch 'origin/master' into modern-harvey2 2018-01-27 09:43:21 -06:00
Doug Coleman f5853bda82 Merge remote-tracking branch 'origin/master' into modern-harvey2 2018-01-17 17:38:39 -06:00
Doug Coleman 3cbe0a1598 core: add ': 2018-01-02 22:32:23 -08:00
Doug Coleman daa7be5b7f core: fix bootstrap. 2018-01-02 22:31:08 -08:00
Doug Coleman a52d513883 cli.git: Get the branch name instead of HEAD sometimes. 2018-01-02 19:51:48 -08:00
Doug Coleman 72833e950a modern: Handle ``3</foo>`` 2017-12-31 18:40:38 -08:00
Doug Coleman 14216fd486 modern: Support ``<tag> </tag>``, ``<tag/>``, and ``<tag a: 1/>``
Eventually we can support <html></html> with no spaces.
Look into supporting <tag a="1"/> instead of <tag a: 1/>
2017-12-31 17:49:12 -08:00
Doug Coleman f9991cd248 modern: Fix ': parsing. 2017-12-31 14:34:17 -08:00
Doug Coleman 825891c7ef syntax: add ': for fried words 2017-12-29 11:09:53 -08:00
Doug Coleman 957733a147 modern.out: fix scope 2017-12-29 11:09:46 -08:00
Doug Coleman 63837139cd extra: fix word/syntax 2017-12-29 00:50:16 -08:00
Doug Coleman 9de4592de5 pcre: fix word scope 2017-12-29 00:47:48 -08:00
Doug Coleman ef7fafd07e modern: word got removed, use different one 2017-12-29 00:44:37 -08:00
Doug Coleman 354f1cbd34 factor: vocab:word -> vocab::word 2017-12-29 00:43:25 -08:00
Doug Coleman 30905e9aa8 stage2: remove debugging 2017-12-28 23:16:11 -08:00
Doug Coleman ef0fe3f61a math.vectors.simd.cords: fix whitespace 2017-12-28 19:30:13 -08:00
Doug Coleman 2de1c21781 modern.paths: remove a ton of words 2017-12-28 19:29:44 -08:00
Doug Coleman b535707035 modern.paths: remove functors special casing. they should all work now. 2017-12-28 19:18:49 -08:00
Doug Coleman d096d6b740 functors: no UPPER: in stack effects 2017-12-28 19:15:31 -08:00
Doug Coleman 92f7613545 math.blas.matrices: Remove dead code 2017-12-28 19:09:11 -08:00
Doug Coleman 10d59ade55 functors: use SYNTAX: instead of top-level code 2017-12-28 19:06:10 -08:00
Doug Coleman a40fef851a math.blas.matrices: port back to new functors 2017-12-28 18:51:51 -08:00
Doug Coleman 41859c47e7 math.blas.vectors: strings 2017-12-28 18:51:32 -08:00
Doug Coleman bb07cd3d48 functors2: same -> inline 2017-12-28 18:51:21 -08:00
Doug Coleman b095c40e73 math.blas.vectors: Use new functors. 2017-12-28 18:30:26 -08:00
Doug Coleman 048f86f366 math.blas: move back 2017-12-28 18:04:07 -08:00
Doug Coleman b6dcb71a1a math.similarity: fix using 2017-12-28 17:55:01 -08:00
Doug Coleman c84805146d ui.gadgets.charts.lines: Fix using list.
Use ``SPECIALIZED-ARRAYS: float`` in order to create it if it doesnt exist.
2017-12-28 17:54:54 -08:00
Doug Coleman 9c5804777b gml.ui: fix color: 2017-12-28 17:47:25 -08:00
Doug Coleman efa9b2d01d functors2: rename SAME-FUNCTOR: to INLINE-FUNCTOR: 2017-12-28 17:28:58 -08:00
Doug Coleman 5c18a4514d random.sfmt: move back again 2017-12-28 17:27:39 -08:00
Doug Coleman f7d9b7d50d gml: fix simd 2017-12-28 17:16:22 -08:00
Doug Coleman 887184e0e5 math.factors.simd: fix repr 2017-12-28 17:16:12 -08:00
Doug Coleman f24a2e8ef7 present: add present for pointer 2017-12-28 17:15:51 -08:00
Doug Coleman 233c3dcebd cords: updated functors syntax. ugly. 2017-12-28 16:52:05 -08:00
Doug Coleman 7ccaf78071 removed: redadd these. 2017-12-28 16:03:25 -08:00
Doug Coleman 032e819f3c simd: Port to new functors. kind of ugly. 2017-12-28 16:03:14 -08:00
Doug Coleman d8a947b53d functors: workin on it 2017-12-27 20:58:00 -08:00
Doug Coleman 43bc6c08d6 factor: fix load 2017-12-26 16:06:54 -08:00
Doug Coleman 79ae918e29 basis: buncha simd moved 2017-12-26 15:46:08 -08:00
Doug Coleman d835fd8b82 present: add a ``M\\ callable present`` 2017-12-26 15:45:35 -08:00
Doug Coleman 1e9b407037 alien.complex: Fix functor 2017-12-26 12:04:00 -08:00
Doug Coleman 1ca1a9b6b3 compiler: move simd for now 2017-12-26 12:03:50 -08:00
Doug Coleman 7b62d963c7 compiler.tree.debugger: fix _ 2017-12-26 12:03:35 -08:00
Doug Coleman 38e93e9308 functors2: Redo FROM: for same-functors. Execute top-level code from functors, too. 2017-12-26 11:49:20 -08:00
Doug Coleman d6c834cea9 tuple-arrays: load fix 2017-12-25 15:36:59 -08:00
Doug Coleman a9b437c5f4 modern.compiler: fix identifiers more 2017-12-25 15:06:28 -08:00
Doug Coleman f27c35a7dd basis: fix bit-vectors 2017-12-25 15:06:14 -08:00
Doug Coleman 0134a5fc3f alien.fortran: better name 2017-12-24 20:24:49 -08:00
Doug Coleman fbeb5a7b1a modern.compiler: fix a couple identifier words. 2017-12-24 20:09:49 -08:00
Doug Coleman f1926d3423 factor: extra works!
extra-vocabs [ dup . flush vocab>identifiers ] map
2017-12-24 19:59:02 -08:00
Doug Coleman deef6a0744 extra: Annotations imported a bad CAPS: 2017-12-24 19:21:35 -08:00
Doug Coleman a35dd209c3 modern: basis works with vocabs>identifiers
basis-vocabs [ dup . flush vocab>identifiers ] map
2017-12-24 19:16:13 -08:00
Doug Coleman b865681a39 modern: Can turn all of the core vocabs into tuples now.
core-bootstrap-vocabs [ dup . flush vocab>identifiers ] map
2017-12-24 18:27:30 -08:00
Doug Coleman 4b58fb57a6 modern.compiler: add strings 2017-12-24 15:58:26 -08:00
Doug Coleman ed43df35fb modern: Allow FOO: FOO; again 2017-12-24 15:14:03 -08:00
Doug Coleman 7785fea284 gadgets.labeled: Fix COLOR: to color: 2017-12-24 15:13:43 -08:00
Doug Coleman 3d83bb9f06 Merge remote-tracking branch 'local-master/master' into modern-harvey2 2017-12-24 14:59:58 -08:00
Doug Coleman c79b4f2e61 travis: Don't test forestdb anymore. 2017-12-10 13:02:35 -06:00
Doug Coleman 588c591424 modern: no concatenative syntax yet. 2017-12-03 23:13:00 -06:00
Doug Coleman b14955365c modern: better compound literals. 2017-12-03 22:47:44 -06:00
Doug Coleman 57872a8a17 modern: Clearer concatenative lexing check. 2017-12-03 22:23:28 -06:00
Doug Coleman 527fa59fc6 modern: A little less duplication. 2017-12-03 21:45:19 -06:00
Doug Coleman 8a07105d9d factor: Fix spacing found by ``all-factor-paths [ ] rewrite-paths`` 2017-12-03 19:23:37 -06:00
Doug Coleman 650bff4793 modern: A bit of duplication but it all works?
The top vs nested parsing can be cleaned up with a flag but the stack shuffling has to be done....
2017-12-03 19:21:37 -06:00
Doug Coleman 3a95591005 merger: COLOR: -> color: 2017-12-03 19:21:14 -06:00
Doug Coleman 7f51295293 modern: refactoring.
realized that functors with names like ( T: int -- ) don't work like they are supposed to because of nesting.
2017-12-03 19:11:01 -06:00
Doug Coleman 06e40a39bc modern.slices: Add a way to push characters back to the buffer. 2017-12-03 18:31:08 -06:00
Doug Coleman 411c2376c7 modern: Don't keep around duplicate closing delimiters like { ")" ")" } for stack effects. 2017-12-03 17:09:31 -06:00
Doug Coleman 76ce988587 factor: punt on other functors until the new parser compiles them. 2017-12-03 10:52:21 -06:00
Doug Coleman 49981c22db alien.complex.functor: functors2 2017-12-03 10:52:03 -06:00
Doug Coleman dbfeeebe38 compiler: Ghetto functor hack for now.
Quotations are strings temporarily. This is because unparse is not in core, so you can't just interpolate a quotation text into a template.
2017-12-02 19:54:11 -06:00
Doug Coleman 8e8b5f59f5 factor: update sorting functor by adding a name type to functors2. 2017-12-02 19:05:25 -06:00
Doug Coleman 3964553ed5 functors: use in compiler. 2017-12-02 18:07:34 -06:00
Doug Coleman 56d437a1e7 alien.destructors: new functors. 2017-12-02 17:21:49 -06:00
Doug Coleman 7616f6e95d factor: add inlined quotations in stack effects 2017-12-02 16:38:11 -06:00
Doug Coleman b45af1dcd6 functors: Fix up look sharp 2017-12-02 12:01:02 -06:00
Doug Coleman 036bc70a47 specialized-arrays: bootstraps 2017-12-02 10:41:57 -06:00
Doug Coleman 1950722e04 functors2: Fix IN: for same-functor 2017-12-02 10:12:04 -06:00
Doug Coleman 78eea5071b annotations: Use SAME-FUNCTOR: to put in the annotations vocab. 2017-12-02 08:06:38 -06:00
Doug Coleman 43e0ce4977 functors2: terrible duplication but about to reimplement it in terms of functors. 2017-12-02 08:05:27 -06:00
Doug Coleman ec05bf7be9 core: Add support for quotations inside stack-effects.
Disabled: Preconditions for functors are awkward to implement without creating new syntax. Instead, allow stack effects of the form ( x: [ 1 + ] -- y ) everywhere.
2017-11-25 18:44:37 -06:00
Doug Coleman 384ffc1025 specialized-arrays: Works as a new functor!! 2017-11-24 21:46:16 -06:00
Doug Coleman f8c54fd2bf core: Move new functors to core.
Also move enough to implement them in an ok style. I would prefer to use formatting in core, but it depends on calendar, etc.
2017-11-24 20:06:44 -06:00
Doug Coleman bc285f7072 core: Move multiline and interpolate to core.
caveats: peg.ebnf needs to find :> and let[ in "syntax" not locals anymore.
- You have to define a word ``IN: syntax`` before Factor picks up syntax changes
- You have to add a syntax word to core/bootstrap/syntax.factor
2017-11-24 19:12:04 -06:00
Doug Coleman 43628c8340 core: Move more things to core.
Tricky things:
f props>> == @ _ are not defined in syntax
2017-11-24 18:42:30 -06:00
Doug Coleman 085dbe716f core: Move hashtables.identity and hashtables.wrapped into core. 2017-11-24 16:46:47 -06:00
Doug Coleman 05387aa750 namespaces.extras: Fix new functors. 2017-11-23 02:44:22 -06:00
Doug Coleman 9eecd977c9 namespaces.extras: Try to use generate-vocab. 2017-11-22 22:32:16 -06:00
Doug Coleman c73541919c ui.backend.cocoa.views: Remove touchbar stuff for now. 2017-11-22 16:28:11 -06:00
Doug Coleman 1a1e407939 bootstrap.image.upload: Change username. 2017-11-22 15:45:31 -06:00
Doug Coleman f79a135a77 Merge remote-tracking branch 'origin/master' into modern-harvey 2017-11-22 15:40:25 -06:00
Doug Coleman b19b521b9c namespaces.extras: Add a new functors prototype.
IN: foo
FUNCTOR: foo goes into the vocab where it's declared

Instantiated ``FOO: bar`` go into ``foo:functors:foo:bar:92801082101``
2017-11-22 15:39:46 -06:00
Doug Coleman bf82be86b1 Merge branch 'master' into modern-harvey 2017-11-11 11:45:46 -06:00
Doug Coleman 8c14132c9b io.files.info.windows: Fix rename. 2017-11-11 14:18:32 -06:00
Doug Coleman ce38445abc modern: line endings 2017-10-27 20:25:43 -05:00
Doug Coleman b9e2b14cf0 modern: fix FOO>bar to \FOO>bar 2017-10-27 20:24:37 -05:00
Doug Coleman 8b2e42300f modern: Fix FOO>bar and remove duplicated words. 2017-10-27 20:24:12 -05:00
Doug Coleman 1fda1f7525 windows: FOO>bar is a section end FOO>, so use \FOO>bar for now. 2017-10-27 20:22:22 -05:00
Doug Coleman 0319ff7920 math: rename >fraction to fraction>parts 2017-10-27 20:21:48 -05:00
Doug Coleman 815591e10c factor: m: { a b } -> M\\ a b 2017-10-12 21:22:41 -05:00
Doug Coleman 5e1295f89e modern: Add error checking for enough tokens.
modern.slices had a bug in find-from* where it was taking the length of
a quotation instead of the original string.
2017-10-12 19:26:07 -05:00
Doug Coleman 083d08878a modern: Support one: 1 two:: 1 2 three::: 1 2 3 syntax
Also M\ 1 M\\ 1 2 M\\\ { { { etc
2017-10-12 19:10:44 -05:00
Doug Coleman b3bd9b1215 find.extras: Fix syntax for new parser 2017-10-12 18:46:02 -05:00
Doug Coleman d7c12986c6 math.similarity: Add Jaccard similarity metric 2017-10-11 17:17:05 -05:00
Doug Coleman e9ad224752 libssl: Fix SSL struct again.
int main() {
	SSL *ssl;
	printf("sizeof SSL %lu\n", sizeof(SSL));
	printf("SSL_MAX_SID_CTX_LENGTH %d\n", SSL_MAX_SID_CTX_LENGTH);
	printf("offsetof generate_session_id %ld\n", offsetof(struct ssl_st, generate_session_id));
	printf("offsetof mac_flags %ld\n", offsetof(struct ssl_st, mac_flags));
	printf("offsetof write_hash %ld\n", offsetof(struct ssl_st, write_hash));
	printf("offsetof session %ld\n", offsetof(struct ssl_st, session));
	printf("offsetof error_code %ld\n", offsetof(struct ssl_st, error_code));
	printf("offsetof debug %ld\n", offsetof(struct ssl_st, debug));
	printf("offsetof verify_callback %ld\n", offsetof(struct ssl_st, verify_callback));
	printf("offsetof ctx %ld\n", offsetof(struct ssl_st, ctx));
	printf("offsetof ex_data %ld\n", offsetof(struct ssl_st, ex_data));
	printf("offsetof first_packet %ld\n", offsetof(struct ssl_st, first_packet));
	printf("offsetof verify_result %ld\n", offsetof(struct ssl_st, verify_result));
	printf("offsetof client_CA %ld\n", offsetof(struct ssl_st, client_CA));
	printf("offsetof references %ld\n", offsetof(struct ssl_st, references));
	printf("offsetof tlsext_status_type %ld\n", offsetof(struct ssl_st, tlsext_status_type));
	printf("offsetof tlsext_ocsp_resplen %ld\n", offsetof(struct ssl_st, tlsext_ocsp_resplen));
	printf("offsetof tlsext_ecpointformatlist %ld\n", offsetof(struct ssl_st, tlsext_ecpointformatlist));
	printf("offsetof tls_session_ticket_ext_cb_arg %ld\n", offsetof(struct ssl_st, tls_session_ticket_ext_cb_arg));
	printf("offsetof next_proto_negotiated %ld\n", offsetof(struct ssl_st, next_proto_negotiated));
	printf("offsetof alpn_client_proto_list_len %ld\n", offsetof(struct ssl_st, alpn_client_proto_list_len));
	printf("offsetof srp_ctx %ld\n", offsetof(struct ssl_st, srp_ctx));
	return 0;
}

clang ssl.c -I /usr/local/opt/openssl/include && ./a.out
2017-10-08 00:04:29 -05:00
Doug Coleman 9a7406d98d Revert "Revert "openssl.libssl: The SSL struct has grown a lot.""
This reverts commit 86c086bafc.
2017-10-07 23:31:06 -05:00
Doug Coleman ccaad8b3be cuda: Update api to 9.0+ 2017-10-07 21:14:48 -05:00
Doug Coleman 4b35f2e0d9 factor: fix bootstrap. 2017-10-04 22:39:20 -05:00
Doug Coleman cada003d7f factor: Rename ``M\ array generic`` to ``m: { array generic }``.
The problem with M\ is that it has an arity of 1 where we need it to have arity 2. Also, for multimethods, the \ disables parsing of the array that follows, e.g. ``M\ { string string } multimethod-name`` parses as ``M\ {`` and leaves the rest unparsed. This is obviously wrong.

An alternative syntax that should be implement and looks ok is ``m{ array generic }``
2017-10-01 09:51:31 -05:00
Doug Coleman 8e14c52dd1 game.input.demos.key-caps: \foo\ syntax works. 2017-09-30 21:33:26 -05:00
Doug Coleman a450350854 modern.compiler: literals>tuples works. 2017-09-30 17:32:18 -05:00
Doug Coleman 57e668d704 modern.compiler: Convert slices to objects. 2017-09-30 14:14:38 -05:00
Doug Coleman 6fe38fde00 modern: Fix case for "<PRIVATE FOO: foo PRIVATE>"
At the end of a file the length of the string is f, so this needs to be
fixed up for calculations.
2017-09-30 14:14:38 -05:00
Doug Coleman 2ce052c981 vm: Line up larger memory output. 2017-09-30 14:14:38 -05:00
Doug Coleman f0e121051d find.extras: Add an old prototype parser and some cool util words.
These words are not fast enough to be the main parser.
2017-09-30 13:58:59 -05:00
Doug Coleman affbc492d7 modern.compiler: wip 2017-09-30 08:52:03 -05:00
Doug Coleman 5a8f9284ab sequences.extras: add count-head and count-tail 2017-09-28 22:41:21 -05:00
Doug Coleman 577d4618ca core: keep nip cleanup. 2017-09-28 22:20:32 -05:00
Doug Coleman 5582ea1b02 escape-strings: Fix case where string ends in ] or ]=
Add escape-strings for nested strings.
2017-09-28 22:19:46 -05:00
Doug Coleman 86c086bafc Revert "openssl.libssl: The SSL struct has grown a lot."
This reverts commit a1fe918276.

Crashes.
2017-09-24 23:16:01 -05:00
Doug Coleman a1fe918276 openssl.libssl: The SSL struct has grown a lot.
Maybe this is related to #1860.
2017-09-24 23:09:23 -05:00
Doug Coleman 8e4fe207f1 modern: Fix compound syntax unit tests. 2017-09-24 22:22:40 -05:00
Doug Coleman 516a6909ac unicode: Bump the version number, use CONSTANT: 2017-09-24 19:27:18 -05:00
Doug Coleman f7ddfb44b7 unicode.collation: Fixes 40k+ unit tests, but is a change from Unicode 9.0 to 10.0
It looks like the fourth weights in the collation algorithm now generate fewer 0xffff, particularly when the secondary and tertiary slots are zero.
2017-09-24 19:26:02 -05:00
Doug Coleman 341f2c3307 xml: Word names like foo]] are not allowed.
Names like foo]] are alternative syntax for closing foo[ ] forms, e.g. foo[ foo].

foo]] parses as a foo] closer and then another ]
2017-09-24 13:15:10 -05:00
Doug Coleman c3e137c08a escape-strings: Fix syntax. 2017-09-24 13:12:49 -05:00
Doug Coleman e8a72b0268 modern: Disallow compound syntax for now. 2017-09-24 12:40:32 -05:00
Doug Coleman b8a502d7e2 math.functions.integer-logs: Word names like (foo) should only exist if foo exists. 2017-09-24 12:32:09 -05:00
Doug Coleman c1bdb4b11e unicode: Update to Unicode 10.0 from last year's patch. 2017-09-20 21:00:31 -05:00
Doug Coleman f5657ac469 Merge branch 'modern-harvey' of github.com:factor/factor into modern-harvey 2017-09-20 18:19:36 -05:00
Doug Coleman 4c017a7f76 zealot: use n-groups 2017-09-18 19:27:58 -05:00
Doug Coleman 03db55e15b Merge remote-tracking branch 'origin/master' into modern-harvey 2017-09-18 17:37:25 -05:00
Doug Coleman e42fcb812e Merge remote-tracking branch 'origin/master' into modern-harvey 2017-09-18 17:34:40 -05:00
Doug Coleman 4b065d4790 tools.test: Working on crazy unit tests. 2017-09-16 23:25:54 -05:00
Doug Coleman 9ef9cae60f escape-strings: Add a way to find minmal escapes for a lua/magic
string.
2017-09-16 17:21:31 -05:00
Doug Coleman 722a335b68 io.streams.string: Add with-error-string-writer for unit testing. 2017-09-16 16:57:41 -05:00
Doug Coleman aeebe0bbbe debugger: Support for assert-string 2017-09-16 16:50:17 -05:00
Doug Coleman 6939b2ca5f io.errors: Add words to print to error-stream as easily as to
output-stream.
2017-09-16 16:50:04 -05:00
Doug Coleman 3c8da3722d sequences: Add assert-string=.
assert-sequence= prints strings as sequences of numbers, which is less
useful for writing unit tests.
2017-09-16 16:45:42 -05:00
Doug Coleman f32b6a171c tools.test: Add UNIT-TEST: top-level form. 2017-09-16 15:42:10 -05:00
Doug Coleman 76a6235940 zealot.factor: Print a message for each step. 2017-09-16 12:27:04 -05:00
Doug Coleman 4d3bc90e9d zealot: ensure that the github source exists on disk. 2017-09-16 12:21:00 -05:00
Doug Coleman 70076fa7cd tools.coverage: fix using 2017-09-16 11:23:16 -05:00
Doug Coleman 153f5372d3 factor: Really disable long unit tests for zealot. Only test root by
root.
2017-09-16 11:08:35 -05:00
Doug Coleman 122a73b5ac basis: Fix a couple of trivial regressions. 2017-09-16 10:59:33 -05:00
Doug Coleman 0a7b50f208 Revert "tools.deploy.test: shake-and-bake is a long-unit-test"
This reverts commit a09cc13a17.
2017-09-16 10:49:40 -05:00
Doug Coleman a09cc13a17 tools.deploy.test: shake-and-bake is a long-unit-test 2017-09-16 10:23:29 -05:00
Doug Coleman 00c4069640 zealot.factor: Disable long unit tests. 2017-09-16 09:58:59 -05:00
Doug Coleman 953ddc566f factor: Fix test errors. 2017-09-16 08:58:20 -05:00
Doug Coleman 1b138a74ec zealot.factor: Test core, load basis and extra images for testing. 2017-09-16 06:38:11 -05:00
Doug Coleman 3dc8f5e039 core: Fix using list. 2017-09-16 06:32:01 -05:00
Doug Coleman fbbf2eb550 zealot.factor: Try to load/test basis/extra in two processes. 2017-09-16 02:24:39 -05:00
Doug Coleman 51d5ca0695 zealot: Load basis/extra in parallel. 2017-09-16 02:05:45 -05:00
Doug Coleman 160632c3e6 Nmakefile: Let cl decide how many threads to use. 2017-09-15 19:40:26 -05:00
Doug Coleman 233d29d8de Nmakefile: Parallel! 2017-09-15 19:07:29 -05:00
Doug Coleman ea429d347d rosetta-code: Can't use array[ ] on words that are not compiled yet. 2017-09-15 17:56:01 -05:00
Doug Coleman c24680b93d zealot: tweak to make it work on windows.
mason uses build.cmd to build factor, but that's super slow for some
reason. using nmake gives you normal speeds!
2017-09-15 17:25:16 -05:00
Doug Coleman 7ff2b9c345 zealot: Initial commit.
Zealot is a replacement for mason that allows parallel testing, testing
branches, and over-engineered git commands.
2017-09-15 01:01:43 -05:00
Doug Coleman 994485a90c cli.git, web-services.github: Better api. 2017-09-15 00:34:50 -05:00
Doug Coleman 6dc30e953e io.pathnames: Add 3append-path. 2017-09-14 23:11:22 -05:00
Doug Coleman b8f9b6f8db gpu.util: fix load error 2017-09-11 18:07:36 -05:00
Doug Coleman ff93f58304 Merge branch 'master' into modern-harvey 2017-09-11 17:59:01 -05:00
Doug Coleman eb1bcf642c factor: fix load-all 2017-09-11 17:46:06 -05:00
Doug Coleman 5d7c397b00 ui.backend.x11.keys: Fix bad refactor. 2017-09-11 17:08:32 -05:00
Doug Coleman 93a358038d build.sh: Update branch. 2017-09-11 17:07:08 -05:00
Doug Coleman e846674a2f basis: Fix load errors. 2017-09-11 17:06:27 -05:00
Doug Coleman 5dd6256550 Merge branch 'master' of git://factorcode.org/git/factor into modern-harvey 2017-09-11 16:39:02 -05:00
Doug Coleman 200b5192ed factor: commit weekend work. 2017-09-11 16:37:47 -05:00
Doug Coleman f5f7770d30 combinators.smart.syntax: Add some useful smart combinators syntax. 2017-09-11 16:37:47 -05:00
Doug Coleman 50602dc1a4 windows.kernel32: Don't use /* */ 2017-09-08 23:33:00 -05:00
Doug Coleman 17f3281844 build.cmd: Let Windows build other branches. 2017-09-08 23:32:45 -05:00
Doug Coleman d4612f2140 Merge branch 'master' of git://factorcode.org/git/factor into modern-harvey 2017-09-06 21:52:37 -05:00
Doug Coleman 060a98a01a modern: Fix unit tests 2017-09-04 14:26:17 -05:00
Doug Coleman 646b627854 factor: remove trailing whitespace 2017-09-04 14:10:34 -05:00
Doug Coleman 3e77867cd2 modern: no postprocessing for concatenated tokens, instead...
take tokens until there is whitespace between them, then start a new
group of tokens
2017-09-04 14:07:52 -05:00
Doug Coleman 0e1eb52c4c modern: the looping is tricky...this version is correct 2017-09-04 11:47:57 -05:00
Doug Coleman d8d7c0cd3c modern: Allow comound literals 2017-09-04 11:33:47 -05:00
Doug Coleman d3497b9f6b modern: working on compound tokens 2017-09-04 11:04:55 -05:00
Doug Coleman 2773cbf889 modern.out: Add a <renamed> word to keep spacing correct when
refactoring.

"math" [ dup { [ slice? ] [ seq>> string? ] } 1&& [ dup >upper <renamed> ] when ] rewrite-vocab
2017-09-03 13:28:39 -05:00
Doug Coleman 9a983d611f modern: refactorig 2017-09-03 12:59:44 -05:00
Doug Coleman 2e89f86d16 modern.compiler: fix map-literals 2017-09-03 12:32:30 -05:00
Doug Coleman 26f74e9d83 modern: working on the compiler 2017-09-03 12:13:06 -05:00
Doug Coleman 7cdede9a5f Merge branch 'master' into modern-harvey 2017-08-31 23:32:47 -05:00
Doug Coleman 1626d19711 git: update syntax 2017-08-31 22:52:00 -05:00
Doug Coleman 29708329ab core: Fix how \words are parsed. 2017-08-31 21:21:15 -05:00
Doug Coleman 199e710597 modern.out: maybe simplify 2017-08-31 21:21:15 -05:00
Doug Coleman 14139f8fad modern.out: Remove symbol. 2017-08-31 21:21:15 -05:00
Doug Coleman 1316cdee79 modern.out: Cleanup. No variable needed. 2017-08-31 21:21:15 -05:00
Doug Coleman 4b61c0b776 modern: Found some more trailing whitespace. 2017-08-31 21:21:15 -05:00
Doug Coleman 3fec06f36e modern.out: Trying to trim trailing whitespace. 2017-08-31 21:21:15 -05:00
Doug Coleman fb6defd60f modern: More whitespace cleanup and rewrite all files except functors! 2017-08-31 21:21:15 -05:00
Doug Coleman e4f64e80bf modern: Remove functor paths for now. 2017-08-31 21:21:15 -05:00
Doug Coleman 1a4d1ce24e modern: exclude basis test path. 2017-08-31 21:21:15 -05:00
Doug Coleman e6ea0392e3 successor: Remove some whitespace. 2017-08-31 21:21:15 -05:00
Doug Coleman 2e68e170fc modern: Rewriting core paths works! 2017-08-31 21:21:15 -05:00
Doug Coleman b826b9bacc modern.out: add rewriting to disk 2017-08-31 21:21:15 -05:00
Doug Coleman 1771fbb909 graphviz: Update this nightmare :p 2017-08-31 21:21:15 -05:00
Doug Coleman c9d2ed1458 help.markup: Allow \ wrapped related-words. 2017-08-31 21:21:14 -05:00
Doug Coleman 6ef39d8b6e factor: Removing /* */ and fixing up using lists. 2017-08-31 21:21:14 -05:00
Doug Coleman ce4c3f2f43 alien.remote-control: Fix I[[ ]] 2017-08-31 21:21:14 -05:00
Doug Coleman c0cad4ed80 classes.struct: Fix SYMBOL: \bit: 2017-08-31 21:21:14 -05:00
Doug Coleman b0858e48b8 core: \foo is literally just foo. To escape it, do ``\ foo`` instead.
Fix smalltalk too.
2017-08-31 21:21:14 -05:00
Doug Coleman fbaa172732 smalltalk: Allow SELECTOR: \foo: and ``M: foo \bar`` 2017-08-31 21:21:14 -05:00
Doug Coleman 5fb483099f cocoa: Prefer ``send: foo`` or ``send: \foo:`` instead of ``send\ foo:`` 2017-08-31 21:21:14 -05:00
Doug Coleman 8d2d8f99e9 modern.out: Write core/ to disk in two ways. 2017-08-31 21:21:14 -05:00
Doug Coleman 4ede4769e2 modern: Fix strings. They were out of order. 2017-08-31 21:21:14 -05:00
Doug Coleman 5bb1c2b520 modern: Fix : ; and add unit tests. 2017-08-31 21:21:14 -05:00
Doug Coleman 55eb8f3c21 modern: make lex-all actually lex everything 2017-08-31 21:21:14 -05:00
Doug Coleman baa6af4831 factor: All RENAME: and FROM: and EXCLUDE: to have \foo as word names.
Grab bag of other cleanups. tests and docs parse!
2017-08-31 21:21:14 -05:00
Doug Coleman 13d9a78ec6 interpolate: [I -> I[[ 2017-08-31 21:21:14 -05:00
Doug Coleman 55df44923f infix: literally just a string dsl. 2017-08-31 21:21:14 -05:00
Doug Coleman dccba5f9c3 compiler: d: and r: had too many spaces. 2017-08-31 21:21:14 -05:00
Doug Coleman 3aa096e2e5 docs: Update docs. 2017-08-31 21:21:14 -05:00
Doug Coleman 4cba08aa8c xml: update syntax. XML-DOC[[ ]] and XML-CHUNK[[ ]] 2017-08-31 21:21:14 -05:00
Doug Coleman 2551028f98 factor: Fixing postpone: etc in docs 2017-08-31 21:21:14 -05:00
Doug Coleman 5a5776068c project-euler.011: Better name for matrix diagonals. 2017-08-31 21:21:14 -05:00
Doug Coleman 22e59d7838 docs: Escaping a lot. 2017-08-31 21:21:14 -05:00
Doug Coleman 15a7484b6f factor: STRING: foo ; to CONSTANT: foo [[ ]] 2017-08-31 21:21:14 -05:00
Doug Coleman 2114b7efc5 factor: ALIEN: to alien: 2017-08-31 21:21:13 -05:00
Doug Coleman 5507c2b676 factor: [let to let[, [| to |[ 2017-08-31 21:21:13 -05:00
Doug Coleman 28ffd303cb factor: random syntax update 2017-08-31 21:21:13 -05:00
Doug Coleman 88e772ef17 docs: postpone: \foo 2017-08-31 21:21:13 -05:00
Doug Coleman 9fc62092a4 factor: SEL: to selector\ postpone: \foo 2017-08-31 21:21:13 -05:00
Doug Coleman 4a2fffe2f3 windows: GUID: to guid: 2017-08-31 21:21:13 -05:00
Doug Coleman 5a119fa9f7 syntax: Allow postpone: \foo 2017-08-31 21:21:13 -05:00
Doug Coleman 3861e85d09 regexp: Allow more syntax. Update yaml. 2017-08-31 21:21:13 -05:00
Doug Coleman 54ef674a99 cocoa: -> to send\ ?-> to ?send\ SUPER-> to super\ 2017-08-31 21:21:13 -05:00
Doug Coleman f561911211 modern: Allow foo\ words 2017-08-31 21:21:13 -05:00
Doug Coleman 147ae66ab5 factor: SYNTAX: \foo 2017-08-31 21:21:13 -05:00
Doug Coleman 7ca280aee6 factor: SYNTAX: \FOO: 2017-08-31 21:21:13 -05:00
Doug Coleman 39a9b21e98 modern: handle \[[ \[=[ 2017-08-31 21:21:13 -05:00
Doug Coleman 161a50c0b8 modern: Still support ``\ foo`` for now. 2017-08-31 21:21:13 -05:00
Doug Coleman fbb5f871c4 compiler: r: d: 2017-08-31 21:21:13 -05:00
Doug Coleman a2eb7b854d core: SYNTAX: should allow \FOO words. 2017-08-31 21:21:13 -05:00
Doug Coleman 15fe8c3844 modern: Backslashes should be like \AVL{ instead of \ AVL{
The only thing that matters is a leading \
Backslashed patterns: \foo \foo\bar
Non-backslashed patterns: foo\bar foo\bar{
2017-08-31 21:21:13 -05:00
Doug Coleman c436f6dbad factor: char: postpone: color: hexcolor: flexhexcolor: decimal: 2017-08-31 21:21:13 -05:00
Doug Coleman 9a94118c9d modern: Fixing backslashes. 2017-08-31 21:21:12 -05:00
Doug Coleman 4f5837b41c modern: Don't need a delimiter stack. Yet? 2017-08-31 21:21:12 -05:00
Doug Coleman bb6ffbd9e2 modern: Allow :foo: and handle :> correctly. Add unit tests. 2017-08-31 21:21:12 -05:00
Doug Coleman 6c5bc17c58 factor: CHAR: ; -> CHAR: \; 2017-08-31 21:21:12 -05:00
Doug Coleman eb173e2caa factor: Add more character escapes. 2017-08-31 21:21:12 -05:00
Doug Coleman 7cf91e005d strings.parser: Add more escape codes. 2017-08-31 21:21:12 -05:00
Doug Coleman 84e40810cd factor: CHAR: : -> CHAR: \:, same for [{( 2017-08-31 21:21:12 -05:00
Doug Coleman f049487021 modern: Add some more terminators. 2017-08-31 21:21:12 -05:00
Doug Coleman acfb3a8992 strings.parser: Add character escapes for :[{(.
You will need to bootstrap or change them to ``char: :`` then ``char: \:`` in strings.parser.
2017-08-31 21:21:12 -05:00
Doug Coleman 2d77edf9a2 modern-tests: Add some unit tests. 2017-08-31 21:21:12 -05:00
Doug Coleman 317c74193d system-info.macosx: Add the next macOS name before @mrjbq7 does! 2017-08-31 21:21:12 -05:00
Doug Coleman 3892047d2d system-info: Add hyperthreads. Windows needs to implement this.
The whole system-info needs a better api in general. At least this patch fixes cli.git on macOS.
2017-08-31 21:21:12 -05:00
Doug Coleman 58e09f4a58 modern: Add some words to lex every root. 2017-08-31 21:20:43 -05:00
Doug Coleman 137384cdea modern: Don't allow patterns like ``foo: ;`` 2017-08-31 21:20:43 -05:00
Doug Coleman c06f0eb5f7 modern: Fix up a bit. 2017-08-31 21:20:43 -05:00
Doug Coleman 530ebd49ee modern: Fix sections. 2017-08-31 21:20:43 -05:00
Doug Coleman e7a5101366 modern: Allow <FOO to interrupt a FOO: 2017-08-31 21:20:43 -05:00
Doug Coleman 69d5125b87 modern: Fix some bugs with (=( and order of tokens. 2017-08-31 21:20:43 -05:00
Doug Coleman f04c919e79 modern: Add a flag for interrupting FOO: words with another FOO: 2017-08-31 21:20:43 -05:00
Doug Coleman 218530209f modern: Add a stripped-down parser from what I had. 2017-08-31 21:20:43 -05:00
2621 changed files with 1741235 additions and 777503 deletions

1
.gitattributes vendored
View File

@ -1,3 +1,2 @@
*.factor text eol=lf
*.html text eol=lf
misc/vim/*/*/generated.vim linguist-generated

55
.gitignore vendored
View File

@ -1,34 +1,33 @@
*#*#
*.*.marks
*.RES
*.a
*.bak
*.dll
*.dylib
*.exe
*.exp
*.gch*
*.image
*.lib
*.o
*.obj
*.res
*.s
*.so
*~
.#*
*.gch*
*.obj
*.o
*.s
*.exe
Factor/factor
*.a
*.dll
*.lib
*.exp
*.res
*.RES
*.image
factor.image.fresh
*.dylib
factor.com
*#*#
.DS_Store
.gdb_history
*.*.marks
.*.swm
.*.swn
.*.swo
.*.swp
.DS_Store
.gdb_history
/factor
/logs
/work
Factor.app/Contents/MacOS/factor
Factor.app/Contents/_CodeSignature
a.out
logs
work
*.bak
.#*
checksums.txt
factor.com
factor.image.fresh
*.so
a.out
Factor.app/Contents/_CodeSignature

View File

@ -31,19 +31,7 @@ addons:
- cmake
- libaio-dev
- libsnappy-dev
- libgtk2.0-dev
- gtk2-engines-pixbuf
before_install:
- uname -s
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export HOMEBREW_NO_AUTO_UPDATE=1 ; fi # Don't let homebrew upgrade itself
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rm -rf ~/.gnupg/; fi # https://github.com/rvm/rvm/issues/3110
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -sSL https://rvm.io/mpapis.asc | gpg --import - ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -sSL https://get.rvm.io | bash -s stable; fi # https://github.com/travis-ci/travis-ci/issues/6307
#- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rvm reload ; fi # for homebrew to have 2.6.3, which takes too long. instead we just use HOMEBREW_NO_AUTO_UPDATE=1
#- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rvm install ruby-2.6.3 ; fi # for homebrew
#- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rvm use 2.6 ; fi # for homebrew
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./build.sh deps-macosx ; else ./build.sh deps-apt-get ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew ls --versions snappy > /dev/null || brew install snappy; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew ls --versions cmake > /dev/null || brew install cmake; fi
@ -56,11 +44,14 @@ before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew services start redis; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew services start postgresql; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew services start memcached; fi
- if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then
wget https://github.com/vmt/udis86/archive/v1.7.2.tar.gz && tar xzvf v1.7.2.tar.gz &&
( cd udis86-1.7.2/ && ./autogen.sh && ./configure --enable-shared=yes && make && sudo make install ) &&
( [[ "$TRAVIS_OS_NAME" != "osx" ]] && sudo ldconfig || true );
fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rm -rf ~/.gnupg/; fi # https://github.com/rvm/rvm/issues/3110
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -#LO https://rvm.io/mpapis.asc; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then gpg --import mpapis.asc; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -sSL https://get.rvm.io | bash -s stable; fi # https://github.com/travis-ci/travis-ci/issues/6307
- >
wget https://github.com/vmt/udis86/archive/v1.7.2.tar.gz && tar xzvf v1.7.2.tar.gz &&
( cd udis86-1.7.2/ && ./autogen.sh && ./configure --enable-shared=yes && make && sudo make install ) &&
( [[ "$TRAVIS_OS_NAME" != "osx" ]] && sudo ldconfig || true )
- git remote set-branches --add origin master
- git remote set-branches --add origin clean-windows-x86-64
- git remote set-branches --add origin clean-windows-x86-32
@ -74,8 +65,8 @@ script:
- export CI_BRANCH="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}"
- echo "CI_BRANCH=${CI_BRANCH}"
- DEBUG=1 ./build.sh net-bootstrap < /dev/null
- "./factor -e='USING: memory vocabs.hierarchy tools.test namespaces ; \"zealot\" load f long-unit-tests-enabled? set-global save'"
- "./factor -e='USING: memory vocabs.hierarchy ; \"zealot\" load save'"
- './factor -run=zealot.cli-changed-vocabs'
- './factor -run=tools.test `./factor -run=zealot.cli-changed-vocabs | paste -s -d " " -`'
- './factor -run=zealot.help-lint `./factor -run=zealot.cli-changed-vocabs | paste -s -d " " -`'
- './factor -run=help.lint `./factor -run=zealot.cli-changed-vocabs | paste -s -d " " -`'
- "./factor -e='USING: modern.paths tools.test sequences system kernel math random ; core-vocabs os macosx? [ dup length 3 /i sample ] when [ test ] each'"

View File

@ -1,25 +1,12 @@
ifdef CONFIG
VERSION = 0.99
GIT_LABEL = $(shell echo `git describe --all`-`git rev-parse HEAD`)
BUNDLE = Factor.app
DEBUG ?= 0
REPRODUCIBLE ?= 0
# gmake's default CXX is g++, we prefer c++
SHELL_CXX = $(shell printenv CXX)
ifeq ($(SHELL_CXX),)
CXX=c++
else
CXX=$(SHELL_CXX)
endif
XCODE_PATH ?= /Applications/Xcode.app
MACOSX_32_SDK ?= MacOSX10.11.sdk
MACOSX_SDK ?= MacOSX10.13.sdk
include $(CONFIG)
CFLAGS += -Wall \
CFLAGS = -Wall \
-pedantic \
-DFACTOR_VERSION="$(VERSION)" \
-DFACTOR_GIT_LABEL="$(GIT_LABEL)" \
@ -27,16 +14,12 @@ ifdef CONFIG
CXXFLAGS += -std=c++11
ifneq ($(DEBUG), 0)
ifdef DEBUG
CFLAGS += -g -DFACTOR_DEBUG
else
CFLAGS += -O3
endif
ifneq ($(REPRODUCIBLE), 0)
CFLAGS += -DFACTOR_REPRODUCIBLE
endif
ENGINE = $(DLL_PREFIX)factor$(DLL_SUFFIX)$(DLL_EXTENSION)
EXECUTABLE = factor$(EXE_SUFFIX)$(EXE_EXTENSION)
CONSOLE_EXECUTABLE = factor$(EXE_SUFFIX)$(CONSOLE_EXTENSION)
@ -156,8 +139,6 @@ help:
@echo "linux-ppc-32"
@echo "linux-ppc-64"
@echo "linux-arm"
@echo "freebsd-x86-32"
@echo "freebsd-x86-64"
@echo "macosx-x86-32"
@echo "macosx-x86-64"
@echo "macosx-x86-fat"
@ -167,18 +148,11 @@ help:
@echo "Additional modifiers:"
@echo ""
@echo "DEBUG=1 compile VM with debugging information"
@echo "REPRODUCIBLE=1 compile VM without timestamp"
@echo "SITE_CFLAGS=... additional optimization flags"
@echo "X11=1 force link with X11 libraries instead of Cocoa (only on Mac OS X)"
ALL = factor factor-ffi-test factor-lib
freebsd-x86-32:
$(MAKE) $(ALL) CONFIG=vm/Config.freebsd.x86.32
freebsd-x86-64:
$(MAKE) $(ALL) CONFIG=vm/Config.freebsd.x86.64
macosx-x86-32:
$(MAKE) $(ALL) macosx.app CONFIG=vm/Config.macosx.x86.32

View File

@ -1,4 +1,4 @@
Copyright (c) 2020, Slava Pestov, et al.
Copyright (c) 2018, Slava Pestov, et al.
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -8,21 +8,21 @@ VERSION = 0.99
!IF [git describe --all > git-describe.tmp] == 0
GIT_DESCRIBE = \
!INCLUDE <git-describe.tmp>
!IF [del git-describe.tmp] == 0
!IF [rm git-describe.tmp] == 0
!ENDIF
!ENDIF
!IF [git rev-parse HEAD > git-id.tmp] == 0
GIT_ID = \
!INCLUDE <git-id.tmp>
!IF [del git-id.tmp] == 0
!IF [rm git-id.tmp] == 0
!ENDIF
!ENDIF
!IF [git rev-parse --abbrev-ref HEAD > git-branch.tmp] == 0
GIT_BRANCH = \
!INCLUDE <git-branch.tmp>
!IF [del git-branch.tmp] == 0
!IF [rm git-branch.tmp] == 0
!ENDIF
!ENDIF
@ -58,13 +58,6 @@ CL_FLAGS = $(CL_FLAGS) $(CL_FLAGS_VISTA)
PLAF_DLL_OBJS = vm\os-windows-x86.64.obj vm\cpu-x86.obj
SUBSYSTEM_COM_FLAGS = console
SUBSYSTEM_EXE_FLAGS = windows
!ELSE
CL_FLAGS = $(CL_FLAGS) $(CL_FLAGS_VISTA)
PLAF_DLL_OBJS = vm\os-windows-x86.64.obj vm\cpu-x86.obj
SUBSYSTEM_COM_FLAGS = console
SUBSYSTEM_EXE_FLAGS = windows
!ENDIF
!IF DEFINED(DEBUG)
@ -72,10 +65,6 @@ LINK_FLAGS = $(LINK_FLAGS) /DEBUG
CL_FLAGS = $(CL_FLAGS) /Zi /DFACTOR_DEBUG
!ENDIF
!IF DEFINED(REPRODUCIBLE)
CL_FLAGS = $(CL_FLAGS) /DFACTOR_REPRODUCIBLE
!ENDIF
ML_FLAGS = /nologo /safeseh
EXE_OBJS = vm\main-windows.obj vm\factor.res
@ -150,16 +139,6 @@ factor.com: $(EXE_OBJS) $(DLL_OBJS)
factor.exe: $(EXE_OBJS) $(DLL_OBJS)
link $(LINK_FLAGS) /out:factor.exe /SUBSYSTEM:$(SUBSYSTEM_EXE_FLAGS) $(EXE_OBJS) $(DLL_OBJS)
# If we compile factor.exe, run mt.exe, and run factor.exe,
# then Windows caches the manifest. Even on a recompile without applying
# the mt.exe tool, if the factor.exe.manifest file is present, the manifest
# is applied. To avoid this, we delete the .manifest file on clean
# and copy it from a reference file on compilation and mt.exe.
#
factor.exe.manifest: factor.exe
copy factor.exe.manifest.in factor.exe.manifest
mt -manifest factor.exe.manifest -outputresource:"factor.exe;#1"
all: factor.com factor.exe factor.dll.lib libfactor-ffi-test.dll
!ENDIF
@ -191,15 +170,12 @@ clean:
if exist factor.lib del factor.lib
if exist factor.com del factor.com
if exist factor.exe del factor.exe
if exist factor.exe.manifest del factor.exe.manifest
if exist factor.exp del factor.exp
if exist factor.dll del factor.dll
if exist factor.dll.lib del factor.dll.lib
if exist factor.dll.exp del factor.dll.exp
if exist libfactor-ffi-test.dll del libfactor-ffi-test.dll
if exist libfactor-ffi-test.exp del libfactor-ffi-test.exp
if exist libfactor-ffi-test.lib del libfactor-ffi-test.lib
.PHONY: all default x86-32 x86-64 x86-32-vista x86-64-vista clean factor.exe.manifest
.PHONY: all default x86-32 x86-64 x86-32-vista x86-64-vista clean
.SUFFIXES: .rs

View File

@ -28,17 +28,17 @@ a boot image stored on factorcode.org.
To check out Factor:
* `git clone git://github.com/factor/factor.git`
* `git clone git://factorcode.org/git/factor.git`
* `cd factor`
To build the latest complete Factor system from git, either use the
build script:
* Unix: `./build.sh update`
* Windows: `build.cmd`
* Unix: `./build.sh update`
or download the correct boot image for your system from
http://downloads.factorcode.org/images/master/, put it in the `factor`
http://downloads.factorcode.org/images/master/, put it in the factor
directory and run:
* Unix: `make` and then `./factor -i=boot.unix-x86.64.image`
@ -127,25 +127,6 @@ The Factor source tree is organized as follows:
* `misc/` - editor modes, icons, etc
* `unmaintained/` - now at [factor-unmaintained](https://github.com/factor/factor-unmaintained)
## Source History
During Factor's lifetime, sourcecode has lived in many repositories. Unfortunately, the first import in Git did not keep history. History has been partially recreated from what could be salvaged. Due to the nature of Git, it's only possible to add history without disturbing upstream work, by using replace objects. These need to be manually fetched, or need to be explicitly added to your git remote configuration.
Use:
`git fetch origin 'refs/replace/*:refs/replace/*'`
or add the following line to your configuration file
```
[remote "origin"]
url = ...
fetch = +refs/heads/*:refs/remotes/origin/*
...
fetch = +refs/replace/*:refs/replace/*
```
Then subsequent fetches will automatically update any replace objects.
## Community
Factor developers meet in the `#concatenative` channel on
@ -154,7 +135,5 @@ anything related to Factor or language design in general.
* [Factor homepage](https://factorcode.org)
* [Concatenative languages wiki](https://concatenative.org)
* [Mailing list](factor-talk@lists.sourceforge.net)
* Search for "factorcode" on [Gitter](https://gitter.im/)
Have fun!

View File

@ -1,12 +1,12 @@
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types alien.complex.functor kernel
sequences ;
USING: accessors alien alien.c-types alien.complex.functor
classes.struct kernel math quotations ;
FROM: alien.c-types => float double ;
IN: alien.complex
<<
{ "float" "double" } [ dup "complex-" prepend define-complex-type ] each
>>
COMPLEX-TYPE: float complex-float
COMPLEX-TYPE: double complex-double
<<
! This overrides the fact that small structures are never returned

View File

@ -1,32 +1,27 @@
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien alien.c-types classes.struct functors
kernel math math.functions quotations ;
USING: functors2 ;
IN: alien.complex.functor
<FUNCTOR: define-complex-type ( N T -- )
INLINE-FUNCTOR: complex-type ( n: existing-word t: name -- ) [[
USING: alien alien.c-types classes.struct kernel quotations ;
QUALIFIED: math
N-type IS ${N}
<<
STRUCT: ${t} { real ${n} } { imaginary ${n} } ;
T-class DEFINES-CLASS ${T}
: <${t}> ( z -- alien )
math:>rect ${t} <struct-boa> >c-ptr ;
<T> DEFINES <${T}>
*T DEFINES *${T}
: *${t} ( alien -- z )
${t} memory>struct [ real>> ] [ imaginary>> ] bi math:rect> ; inline
WHERE
>>
STRUCT: T-class { real N-type } { imaginary N-type } ;
\ ${t} lookup-c-type
[ <${t}> ] >>unboxer-quot
[ *${t} ] >>boxer-quot
complex >>boxed-class
drop
: <T> ( z -- alien )
>rect T-class <struct-boa> >c-ptr ;
: *T ( alien -- z )
T-class memory>struct [ real>> ] [ imaginary>> ] bi rect> ; inline
T-class lookup-c-type
<T> 1quotation >>unboxer-quot
*T 1quotation >>boxer-quot
complex >>boxed-class
drop
;FUNCTOR>
]]

View File

@ -30,7 +30,7 @@ HELP: <c-array>
}
} ;
HELP: c-array{
HELP: \c-array{
{ $description "Literal syntax, consists of a C-type followed by a series of values terminated by " { $snippet "}" } }
{ $notes "The appropriate specialized array vocabulary must be loaded; otherwise, an error will be thrown. See the " { $vocab-link "specialized-arrays" } " vocabulary for details on the underlying sequence type constructed." }
{ $errors "Throws an error if the type does not exist, the necessary specialized array vocabulary is not loaded, or the requested size is negative." } ;
@ -41,8 +41,8 @@ HELP: memory>byte-array
HELP: cast-array
{ $values { "byte-array" byte-array } { "c-type" "a C type" } { "array" "a specialized array" } }
{ $description "Converts a " { $link byte-array } " into a specialized array by interpreting the bytes in it as machine-specific values. Code using this word is unportable." }
{ $notes "The appropriate specialized array vocabulary must be loaded, otherwise an error will be thrown. See the " { $vocab-link "specialized-arrays" } " vocabulary for details on the underlying sequence type constructed." }
{ $description "Converts a byte array into a specialized array by interpreting the bytes in as machine-specific values. Code which uses this word is unportable." }
{ $notes "The appropriate specialized array vocabulary must be loaded; otherwise, an error will be thrown. See the " { $vocab-link "specialized-arrays" } " vocabulary for details on the underlying sequence type constructed." }
{ $errors "Throws an error if the type does not exist, the necessary specialized array vocabulary is not loaded, or the requested size is negative." } ;
HELP: malloc-array
@ -182,7 +182,7 @@ $nl
{ $subsections "alien.enums" }
"A utility for defining " { $link "destructors" } " for deallocating memory:"
{ $subsections "alien.destructors" }
"C struct and union types can be defined with " { $link POSTPONE: STRUCT: } " and " { $link POSTPONE: UNION-STRUCT: } ". See " { $link "classes.struct" } " for details. For passing arrays to and from C, use the " { $link "specialized-arrays" } " vocabulary." ;
"C struct and union types can be defined with " { $link postpone: \STRUCT: } " and " { $link postpone: \UNION-STRUCT: } ". See " { $link "classes.struct" } " for details. For passing arrays to and from C, use the " { $link "specialized-arrays" } " vocabulary." ;
HELP: malloc-string
{ $values { "string" string } { "encoding" "an encoding descriptor" } { "alien" c-ptr } }
@ -202,7 +202,7 @@ HELP: <c-direct-array>
{ $notes "The appropriate specialized array vocabulary must be loaded; otherwise, an error will be thrown. See the " { $vocab-link "specialized-arrays" } " vocabulary for details on the underlying sequence type constructed." } ;
ARTICLE: "c-strings" "C strings"
"C string types are arrays with shape " { $snippet "{ c-string encoding }" } ", where " { $snippet "encoding" } " is an encoding descriptor. The type " { $link c-string } " is an alias for " { $snippet "{ c-string utf8 }" } ". See " { $link "encodings-descriptors" } " for information about encoding descriptors. In " { $link POSTPONE: TYPEDEF: } ", " { $link POSTPONE: FUNCTION: } ", " { $link POSTPONE: CALLBACK: } ", and " { $link POSTPONE: STRUCT: } " definitions, the shorthand syntax " { $snippet "c-string[encoding]" } " can be used to specify the string encoding."
"C string types are arrays with shape " { $snippet "{ c-string encoding }" } ", where " { $snippet "encoding" } " is an encoding descriptor. The type " { $link c-string } " is an alias for " { $snippet "{ c-string utf8 }" } ". See " { $link "encodings-descriptors" } " for information about encoding descriptors. In " { $link postpone: \TYPEDEF: } ", " { $link postpone: \FUNCTION: } ", " { $link postpone: \CALLBACK: } ", and " { $link postpone: \STRUCT: } " definitions, the shorthand syntax " { $snippet "c-string[encoding]" } " can be used to specify the string encoding."
$nl
"Using C string types triggers automatic conversions:"
{ $list
@ -211,7 +211,7 @@ $nl
"Passing an already encoded " { $link byte-array } " also works and performs no conversion."
}
{ "Returning a C string from a C function allocates a Factor string in the Factor heap; the memory pointed to by the returned pointer is then decoded with the requested encoding into the Factor string." }
{ "Reading " { $link c-string } " slots of " { $link POSTPONE: STRUCT: } " or " { $link POSTPONE: UNION-STRUCT: } " returns Factor strings." }
{ "Reading " { $link c-string } " slots of " { $link postpone: \STRUCT: } " or " { $link postpone: \UNION-STRUCT: } " returns Factor strings." }
}
$nl
"Care must be taken if the C function expects a pointer to a string with its length represented by another parameter rather than a null terminator. Passing the result of calling " { $link length } " on the string object will not suffice. This is because a Factor string of " { $emphasis "n" } " characters will not necessarily encode to " { $emphasis "n" } " bytes. The correct idiom for C functions which take a string with a length is to first encode the string using " { $link encode } ", and then pass the resulting byte array together with the length of this byte array."
@ -257,4 +257,4 @@ ARTICLE: "c-out-params" "Output parameters in C"
{ $code
"1234 { c-string } [ do_frob ] with-out-parameters"
}
"which would put the function's return value and error string on the stack." ;
"which would put the functions return value and error string on the stack." ;

View File

@ -46,7 +46,7 @@ SPECIALIZED-ARRAY: foo
{ f } [ B{ } binary-zero? ] unit-test
{ t } [ S{ foo f 0 f f } binary-zero? ] unit-test
{ f } [ S{ foo f 1 f f } binary-zero? ] unit-test
{ f } [ S{ foo f 0 ALIEN: 8 f } binary-zero? ] unit-test
{ f } [ S{ foo f 0 alien: 8 f } binary-zero? ] unit-test
{ f } [ S{ foo f 0 f t } binary-zero? ] unit-test
{ t t f } [
foo-array{

View File

@ -66,7 +66,7 @@ M: word <c-direct-array>
M: pointer <c-direct-array>
drop void* <c-direct-array> ;
SYNTAX: c-array{ \ } [ unclip >c-array ] parse-literal ;
SYNTAX: \c-array{ \ } [ unclip >c-array ] parse-literal ;
SYNTAX: c-array@
scan-object [ scan-object scan-object ] dip

View File

@ -1,7 +1,7 @@
IN: alien.destructors
USING: help.markup help.syntax alien destructors ;
HELP: DESTRUCTOR:
HELP: \DESTRUCTOR:
{ $syntax "DESTRUCTOR: word" }
{ $description "Defines four things:"
{ $list
@ -25,6 +25,6 @@ HELP: DESTRUCTOR:
ARTICLE: "alien.destructors" "Alien destructors"
"The " { $vocab-link "alien.destructors" } " vocabulary defines a utility parsing word for defining new disposable classes."
{ $subsections POSTPONE: DESTRUCTOR: } ;
{ $subsections postpone: \DESTRUCTOR: } ;
ABOUT: "alien.destructors"

View File

@ -1,32 +1,22 @@
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors destructors effects functors generalizations
kernel parser sequences ;
USING: functors2 ;
IN: alien.destructors
TUPLE: alien-destructor alien ;
<FUNCTOR: define-destructor ( F -- )
INLINE-FUNCTOR: destructor ( f: existing-word -- ) [[
USING: accessors alien.destructors effects generalizations
destructors kernel literals sequences ;
F-destructor DEFINES-CLASS ${F}-destructor
<F-destructor> DEFINES <${F}-destructor>
&F DEFINES &${F}
|F DEFINES |${F}
N [ F stack-effect out>> length ]
TUPLE: ${f}-destructor < alien-destructor ;
WHERE
: <${f}-destructor> ( alien -- destructor )
${f}-destructor boa ; inline
TUPLE: F-destructor < alien-destructor ;
: &${f} ( alien -- alien ) dup <${f}-destructor> &dispose drop ; inline
: <F-destructor> ( alien -- destructor )
F-destructor boa ; inline
: |${f} ( alien -- alien ) dup <${f}-destructor> |dispose drop ; inline
M: F-destructor dispose alien>> F N ndrop ;
: &F ( alien -- alien ) dup <F-destructor> &dispose drop ; inline
: |F ( alien -- alien ) dup <F-destructor> |dispose drop ; inline
;FUNCTOR>
SYNTAX: DESTRUCTOR: scan-word define-destructor ;
M: ${f}-destructor dispose alien>> ${f} $[ \ ${f} stack-effect out>> length ] ndrop ;
]]

View File

@ -4,7 +4,7 @@ USING: help.markup help.syntax kernel math quotations
classes.struct ;
IN: alien.endian
HELP: BE-PACKED-STRUCT:
HELP: \BE-PACKED-STRUCT:
{ $description "Defines a packed " { $link struct } " where endian-unaware types become big-endian types. Note that endian-aware types will override the big-endianness of this " { $link struct } " declaration; little-endian types will stay little-endian. On big-endian platforms, the endian-unaware types will not change since they are the correct endianness already." }
{ $unchecked-example
"! When run on a big-endian platform, this struct should prettyprint the same as defined"
@ -17,7 +17,7 @@ IN: scratchpad
STRUCT: s1 { a char[7] } { b be32 initial: 0 } ;"
} ;
HELP: BE-STRUCT:
HELP: \BE-STRUCT:
{ $description "Defines a " { $link struct } " where endian-unaware types become big-endian types. Note that endian-aware types will override the big-endianness of this " { $link struct } " declaration; little-endian types will stay little-endian. On big-endian platforms, the endian-unaware types will not change since they are the correct endianness already." }
{ $unchecked-example
"! When run on a big-endian platform, this struct should prettyprint the same as defined"
@ -30,7 +30,7 @@ IN: scratchpad
STRUCT: s1 { a be32 initial: 0 } { b le32 initial: 0 } ;"
} ;
HELP: LE-PACKED-STRUCT:
HELP: \LE-PACKED-STRUCT:
{ $description "Defines a packed " { $link struct } " where endian-unaware types become little-endian types. Note that endian-aware types will override the little-endianness of this " { $link struct } " declaration; big-endian types will stay big-endian. On little-endian platforms, the endian-unaware types will not change since they are the correct endianness already." }
{ $unchecked-example
"! When run on a little-endian platform, this struct should prettyprint the same as defined"
@ -43,7 +43,7 @@ IN: scratchpad
STRUCT: s1 { a char[7] } { b int initial: 0 } ;"
} ;
HELP: LE-STRUCT:
HELP: \LE-STRUCT:
{ $description "Defines a " { $link struct } " where endian-unaware types become little-endian types. Note that endian-aware types will override the little-endianness of this " { $link struct } " declaration; big-endian types will stay big-endian. On little-endian platforms, the endian-unaware types will not change since they are the correct endianness already." }
{ $unchecked-example
"! When run on a little-endian platform, this struct should prettyprint the same as defined"
@ -141,10 +141,10 @@ ARTICLE: "alien.endian" "Alien endian-aware types"
}
"Syntax for making endian-aware structs out of native types:"
{ $subsections
POSTPONE: LE-STRUCT:
POSTPONE: BE-STRUCT:
POSTPONE: LE-PACKED-STRUCT:
POSTPONE: BE-PACKED-STRUCT:
postpone: \LE-STRUCT:
postpone: \BE-STRUCT:
postpone: \LE-PACKED-STRUCT:
postpone: \BE-PACKED-STRUCT:
} ;
ABOUT: "alien.endian"

View File

@ -147,18 +147,18 @@ ERROR: unsupported-endian-type endian slot ;
[ compute-struct-offsets ] [ drop 1 ]
(define-struct-class) ;
SYNTAX: LE-STRUCT:
SYNTAX: \LE-STRUCT:
parse-struct-definition
little-endian define-endian-struct-class ;
SYNTAX: BE-STRUCT:
SYNTAX: \BE-STRUCT:
parse-struct-definition
big-endian define-endian-struct-class ;
SYNTAX: LE-PACKED-STRUCT:
SYNTAX: \LE-PACKED-STRUCT:
parse-struct-definition
little-endian define-endian-packed-struct-class ;
SYNTAX: BE-PACKED-STRUCT:
SYNTAX: \BE-PACKED-STRUCT:
parse-struct-definition
big-endian define-endian-packed-struct-class ;

View File

@ -7,7 +7,7 @@ HELP: define-enum
{ $values
{ "word" word } { "base-type" c-type } { "members" "sequence of word and value pairs" }
}
{ $description "Defines an enum. This is the run-time equivalent of " { $link POSTPONE: ENUM: } "." } ;
{ $description "Defines an enum. This is the run-time equivalent of " { $link postpone: \ENUM: } "." } ;
HELP: enum>number
{ $values
@ -23,6 +23,6 @@ HELP: number>enum
}
{ $description "Convert a number to an enum." } ;
{ POSTPONE: ENUM: define-enum enum>number number>enum } related-words
{ postpone: \ENUM: define-enum enum>number number>enum } related-words
ABOUT: "alien.enums"

View File

@ -1 +0,0 @@
Jack Lucas

View File

@ -1,26 +0,0 @@
USING: alien.libraries.finder arrays assocs
combinators.short-circuit io io.encodings.utf8 io.files
io.files.info io.launcher kernel sequences sets splitting system
unicode ;
IN: alien.libraries.finder.freebsd
<PRIVATE
: parse-ldconfig-lines ( string -- triple )
[ ":-" split1 [ drop ] dip
"=>" split1 [ [ blank? ] trim ] bi@
2array
] map ;
: load-ldconfig-cache ( -- seq )
"/sbin/ldconfig -r" utf8 [ lines ] with-process-reader
rest parse-ldconfig-lines ;
: name-matches? ( lib double -- ? )
first swap ?head [ ?first CHAR: . = ] [ drop f ] if ;
PRIVATE>
M: freebsd find-library*
"l" prepend load-ldconfig-cache
[ name-matches? ] with find nip ?first dup [ ".so" append ] when ;

View File

@ -1 +0,0 @@
freebsd

View File

@ -1,3 +0,0 @@
USING: alien.libraries.finder sequences tools.test ;
{ t } [ "kernel32.dll" "kernel32" find-library subseq? ] unit-test

View File

@ -1,9 +0,0 @@
USING: alien.libraries io.pathnames system windows.errors
windows.kernel32 ;
IN: alien.libraries.windows
M: windows >deployed-library-path
file-name ;
M: windows dlerror ( -- message )
GetLastError n>win32-error-string ;

View File

@ -122,6 +122,7 @@ TYPEDEF: int alien-parser-test-int ! reasonably unique name...
] unit-test
! Redefinitions
{ } [
[ C-TYPE: hi TYPEDEF: void* hi ] with-compilation-unit
] unit-test
<<
C-TYPE: hi
TYPEDEF: void* hi
>>

View File

@ -21,7 +21,7 @@ ERROR: bad-array-type ;
: (parse-c-type) ( string -- type )
{
{ [ "*" ?tail ] [ (parse-c-type) <pointer> ] }
{ [ CHAR: ] over member? ] [ parse-array-type ] }
{ [ char: \] over member? ] [ parse-array-type ] }
{ [ dup search ] [ parse-word ] }
[ parse-word ]
} cond ;

View File

@ -11,7 +11,7 @@ M: alien pprint*
{
{ [ dup expired? ] [ drop \ BAD-ALIEN pprint-word ] }
{ [ dup pinned-c-ptr? not ] [ drop "( displaced alien )" text ] }
[ \ ALIEN: [ alien-address >hex text ] pprint-prefix ]
[ \ alien: [ alien-address >hex text ] pprint-prefix ]
} cond ;
M: dll pprint* dll-path dup "DLL\" " "\"" pprint-string ;

View File

@ -16,7 +16,7 @@ IN: alien.remote-control.tests
image-path :> image
[
[I
I[[
#include <vm/master.h>
#include <stdio.h>
#include <stdbool.h>
@ -32,7 +32,7 @@ int main(int argc, char **argv)
printf("Done.\n");
return 0;
}
I]
]]
] with-string-writer
[ compile-file ] with-temp-directory
[ run-test ] with-temp-directory ;

View File

@ -2,33 +2,33 @@ IN: alien.syntax
USING: alien alien.c-types alien.enums alien.libraries classes.struct
help.markup help.syntax see ;
HELP: DLL"
HELP: \DLL"
{ $syntax "DLL\" path\"" }
{ $values { "path" "a pathname string" } }
{ $description "Constructs a DLL handle at parse time." } ;
HELP: ALIEN:
{ $syntax "ALIEN: address" }
HELP: \alien:
{ $syntax "alien: address" }
{ $values { "address" "a non-negative hexadecimal integer" } }
{ $description "Creates an alien object at parse time." }
{ $notes "Alien objects are invalidated between image saves and loads, and hence source files should not contain alien literals; this word is for interactive use only. See " { $link "alien-expiry" } " for details." } ;
ARTICLE: "syntax-aliens" "Alien object literal syntax"
{ $subsections
POSTPONE: ALIEN:
POSTPONE: DLL"
postpone: \alien:
postpone: \DLL"
} ;
HELP: LIBRARY:
HELP: \LIBRARY:
{ $syntax "LIBRARY: name" }
{ $values { "name" "a logical library name" } }
{ $description "Sets the logical library for consequent " { $link POSTPONE: FUNCTION: } ", " { $link POSTPONE: C-GLOBAL: } " and " { $link POSTPONE: CALLBACK: } " definitions, as well as " { $link POSTPONE: &: } " forms." }
{ $description "Sets the logical library for consequent " { $link postpone: \FUNCTION: } ", " { $link postpone: \C-GLOBAL: } " and " { $link postpone: \CALLBACK: } " definitions, as well as " { $link postpone: \&: } " forms." }
{ $notes "Logical library names are defined with the " { $link add-library } " word." } ;
HELP: FUNCTION:
HELP: \FUNCTION:
{ $syntax "FUNCTION: return name ( parameters )" }
{ $values { "return" "a C return type" } { "name" "a C function name" } { "parameters" "a comma-separated sequence of type/name pairs; " { $snippet "type1 arg1, type2 arg2, ..." } } }
{ $description "Defines a new word " { $snippet "name" } " which calls the C library function with the same " { $snippet "name" } " in the logical library given by the most recent " { $link POSTPONE: LIBRARY: } " declaration."
{ $description "Defines a new word " { $snippet "name" } " which calls the C library function with the same " { $snippet "name" } " in the logical library given by the most recent " { $link postpone: \LIBRARY: } " declaration."
$nl
"The new word must be compiled before being executed." }
{ $examples
@ -45,26 +45,26 @@ $nl
"The answer to the question is 42."
} }
"Using the " { $link c-string } " type instead of " { $snippet "char*" } " causes the FFI to automatically convert Factor strings to C strings. See " { $link "c-strings" } " for more information on using strings with the FFI."
{ $notes "To make a Factor word with a name different from the C function, use " { $link POSTPONE: FUNCTION-ALIAS: } "." } ;
{ $notes "To make a Factor word with a name different from the C function, use " { $link postpone: \FUNCTION-ALIAS: } "." } ;
HELP: FUNCTION-ALIAS:
HELP: \FUNCTION-ALIAS:
{ $syntax "FUNCTION-ALIAS: factor-name
return c_name ( parameters ) ;" }
{ $values { "factor-name" "a Factor word name" } { "return" "a C return type" } { "name" "a C function name" } { "parameters" "a comma-separated sequence of type/name pairs; " { $snippet "type1 arg1, type2 arg2, ..." } } }
{ $description "Defines a new word " { $snippet "factor-name" } " which calls the C library function named " { $snippet "c_name" } " in the logical library given by the most recent " { $link POSTPONE: LIBRARY: } " declaration."
{ $description "Defines a new word " { $snippet "factor-name" } " which calls the C library function named " { $snippet "c_name" } " in the logical library given by the most recent " { $link postpone: \LIBRARY: } " declaration."
$nl
"The new word must be compiled before being executed." }
{ $notes "Note that the parentheses and commas are only syntax sugar and can be omitted. They serve no purpose other than to make the declaration easier to read." } ;
{ POSTPONE: FUNCTION: POSTPONE: FUNCTION-ALIAS: } related-words
{ postpone: \FUNCTION: postpone: \FUNCTION-ALIAS: } related-words
HELP: TYPEDEF:
HELP: \TYPEDEF:
{ $syntax "TYPEDEF: old new" }
{ $values { "old" "a C type" } { "new" "a C type" } }
{ $description "Aliases the C type " { $snippet "old" } " under the name " { $snippet "new" } "." }
{ $notes "This word differs from " { $link typedef } " in that it runs at parse time, to ensure correct ordering of operations when loading source files. Words defined in source files are compiled before top-level forms are run, so if a source file defines C binding words and uses " { $link typedef } ", the type alias won't be available at compile time." } ;
HELP: ENUM:
HELP: \ENUM:
{ $syntax "ENUM: type words... ;" "ENUM: type < base-type words..." }
{ $values { "type" { $maybe "a name to typedef to int" } } { "words" "a sequence of word names" } }
{ $description "Creates a c-type that boxes and unboxes integer values to symbols. A symbol is defined for each member word. The base c-type can optionally be specified and defaults to " { $link int } ". A constructor word " { $snippet "<type>" } " is defined for converting from integers to singletons. The generic word " { $link enum>number } " converts from singletons to integers. Enum-typed values are automatically prettyprinted as their singleton words. Unrecognizing enum numbers are kept as numbers." }
@ -81,25 +81,25 @@ HELP: ENUM:
{ $code "ENUM: tv_peripherals_4 < uint\n{ appletv 1 } { chromecast 2 } { roku 4 } ;" }
} ;
HELP: C-TYPE:
HELP: \C-TYPE:
{ $syntax "C-TYPE: type" }
{ $values { "type" "a new C type" } }
{ $description "Defines a new, opaque C type. Since it is opaque, " { $snippet "type" } " will not be directly usable as a parameter or return type of a " { $link POSTPONE: FUNCTION: } " or as a slot of a " { $link POSTPONE: STRUCT: } ". However, it can be used as the type of a " { $link pointer } "." $nl
{ $description "Defines a new, opaque C type. Since it is opaque, " { $snippet "type" } " will not be directly usable as a parameter or return type of a " { $link postpone: \FUNCTION: } " or as a slot of a " { $link postpone: \STRUCT: } ". However, it can be used as the type of a " { $link pointer } "." $nl
{ $snippet "C-TYPE:" } " can also be used to forward declare C types, allowing circular dependencies to occur between types. For example:"
{ $code "C-TYPE: forward
STRUCT: backward { x forward* } ;
STRUCT: forward { x backward* } ;" } }
{ $notes "Primitive C types are displayed using " { $snippet "C-TYPE:" } " syntax when they are " { $link see } "n." } ;
HELP: CALLBACK:
HELP: \CALLBACK:
{ $syntax "CALLBACK: return type ( parameters )" }
{ $values { "return" "a C return type" } { "type" "a type name" } { "parameters" "a comma-separated sequence of type/name pairs; " { $snippet "type1 arg1, type2 arg2, ..." } } }
{ $description "Defines a new function pointer C type word " { $snippet "type" } ". The newly defined word works both as a C type and as a wrapper for " { $link alien-callback } " for callbacks that accept the given return type and parameters. The ABI of the callback is decided from the ABI of the active " { $link POSTPONE: LIBRARY: } " declaration." }
{ $description "Defines a new function pointer C type word " { $snippet "type" } ". The newly defined word works both as a C type and as a wrapper for " { $link alien-callback } " for callbacks that accept the given return type and parameters. The ABI of the callback is decided from the ABI of the active " { $link postpone: \LIBRARY: } " declaration." }
{ $examples
{ $code
"CALLBACK: bool FakeCallback ( int message, void* payload )"
": MyFakeCallback ( -- alien )"
" [| message payload |"
" |[ message payload |"
" \"message #\" write"
" message number>string write"
" \" received\" write nl"
@ -108,28 +108,28 @@ HELP: CALLBACK:
}
} ;
HELP: &:
HELP: \&:
{ $syntax "&: symbol" }
{ $values { "symbol" "A C global variable name" } }
{ $description "Pushes the address of a symbol named " { $snippet "symbol" } " from the current library, set with " { $link POSTPONE: LIBRARY: } "." } ;
{ $description "Pushes the address of a symbol named " { $snippet "symbol" } " from the current library, set with " { $link postpone: \LIBRARY: } "." } ;
HELP: typedef
{ $values { "old" "a C type" } { "new" "a C type" } }
{ $description "Aliases the C type " { $snippet "old" } " under the name " { $snippet "new" } "." }
{ $notes "Using this word in the same source file which defines C bindings can cause problems, because words are compiled before top-level forms are run. Use the " { $link POSTPONE: TYPEDEF: } " word instead." } ;
{ $notes "Using this word in the same source file which defines C bindings can cause problems, because words are compiled before top-level forms are run. Use the " { $link postpone: \TYPEDEF: } " word instead." } ;
{ POSTPONE: TYPEDEF: typedef } related-words
{ postpone: \TYPEDEF: typedef } related-words
HELP: C-GLOBAL:
HELP: \C-GLOBAL:
{ $syntax "C-GLOBAL: type name" }
{ $values { "type" "a C type" } { "name" "a C global variable name" } }
{ $description "Defines a getter " { $snippet "name" } " and setter " { $snippet "set-name" } " for the global value in the current library, set with " { $link POSTPONE: LIBRARY: } "." } ;
{ $description "Defines a getter " { $snippet "name" } " and setter " { $snippet "set-name" } " for the global value in the current library, set with " { $link postpone: \LIBRARY: } "." } ;
ARTICLE: "alien.enums" "Enumeration types"
"The " { $vocab-link "alien.enums" } " vocab contains the implementation for " { $link POSTPONE: ENUM: } " C types, and provides words for converting between enum singletons and integers. It is possible to dispatch off of members of an enum."
"The " { $vocab-link "alien.enums" } " vocab contains the implementation for " { $link postpone: \ENUM: } " C types, and provides words for converting between enum singletons and integers. It is possible to dispatch off of members of an enum."
$nl
"Defining enums:"
{ $subsection POSTPONE: ENUM: }
{ $subsection postpone: \ENUM: }
"Defining enums at run-time:"
{ $subsection define-enum }
"Conversions between enums and integers:"

View File

@ -6,37 +6,37 @@ strings.parser vocabs words ;
<< "alien.arrays" require >> ! needed for bootstrap
IN: alien.syntax
SYNTAX: DLL" lexer get skip-blank parse-string dlopen suffix! ;
SYNTAX: \DLL" lexer get skip-blank parse-string dlopen suffix! ;
SYNTAX: ALIEN: 16 scan-base <alien> suffix! ;
SYNTAX: \alien: 16 scan-base <alien> suffix! ;
SYNTAX: BAD-ALIEN <bad-alien> suffix! ;
SYNTAX: \BAD-ALIEN <bad-alien> suffix! ;
SYNTAX: LIBRARY: scan-token current-library set ;
SYNTAX: \LIBRARY: scan-token current-library set ;
SYNTAX: FUNCTION:
SYNTAX: \FUNCTION:
(FUNCTION:) make-function define-inline ;
SYNTAX: FUNCTION-ALIAS:
SYNTAX: \FUNCTION-ALIAS:
scan-token create-function
(FUNCTION:) (make-function) define-inline ;
SYNTAX: CALLBACK:
SYNTAX: \CALLBACK:
(CALLBACK:) define-inline ;
SYNTAX: TYPEDEF:
SYNTAX: \TYPEDEF:
scan-c-type CREATE-C-TYPE dup save-location typedef ;
SYNTAX: ENUM:
SYNTAX: \ENUM:
parse-enum (define-enum) ;
SYNTAX: C-TYPE:
SYNTAX: \C-TYPE:
void CREATE-C-TYPE typedef ;
SYNTAX: &:
SYNTAX: \&:
scan-token current-library get '[ _ _ address-of ] append! ;
SYNTAX: C-GLOBAL: scan-c-type scan-new-word define-global ;
SYNTAX: \C-GLOBAL: scan-c-type scan-new-word define-global ;
SYNTAX: pointer:
SYNTAX: \pointer:
scan-c-type <pointer> suffix! ;

View File

@ -1,7 +1,5 @@
USING: base64 byte-arrays io.encodings.ascii io.encodings.string
kernel sequences splitting strings tools.test ;
{ t } [ 256 <iota> >byte-array dup >base64 base64> = ] unit-test
USING: base64 io.encodings.ascii io.encodings.string kernel
sequences splitting strings tools.test ;
{ "abcdefghijklmnopqrstuvwxyz" } [ "abcdefghijklmnopqrstuvwxyz" ascii encode >base64 base64> ascii decode
] unit-test
@ -41,9 +39,3 @@ kernel sequences splitting strings tools.test ;
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJKb2UifQ.ipevRNuRP6HflG8cFKnmUPtypruRC4fb1DWtoLL62SY"
"." split [ base64> ] map
] unit-test
{ "01a+b/cd" } [ "\xd3V\xbeo\xf7\x1d" >base64 "" like ] unit-test
{ "\xd3V\xbeo\xf7\x1d" } [ "01a+b/cd" base64> "" like ] unit-test
{ "01a-b_cd" } [ "\xd3V\xbeo\xf7\x1d" >urlsafe-base64 "" like ] unit-test
{ "\xd3V\xbeo\xf7\x1d" } [ "01a-b_cd" urlsafe-base64> "" like ] unit-test

View File

@ -1,9 +1,8 @@
! Copyright (C) 2008 Doug Coleman, Daniel Ehrenberg.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays assocs byte-arrays combinators fry growable io
io.encodings.binary io.streams.byte-array kernel kernel.private
literals locals math math.bitwise namespaces sbufs sequences
sequences.private ;
USING: arrays combinators fry io io.binary io.encodings.binary
io.streams.byte-array kernel literals math namespaces sbufs
sequences ;
IN: base64
ERROR: malformed-base64 ;
@ -11,10 +10,8 @@ ERROR: malformed-base64 ;
<PRIVATE
<<
CONSTANT: alphabet $[
CONSTANT: alphabet
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
>byte-array
]
: alphabet-inverse ( alphabet -- seq )
dup supremum 1 + f <array> [
@ -26,134 +23,80 @@ CONSTANT: alphabet $[
alphabet nth ; inline
: base64>ch ( ch -- ch )
$[ alphabet alphabet-inverse 0 CHAR: = pick set-nth ] nth
[ malformed-base64 ] unless* { fixnum } declare ; inline
$[ alphabet alphabet-inverse 0 char: = pick set-nth ] nth
[ malformed-base64 ] unless* ; inline
: encode3 ( x y z -- a b c d )
{ fixnum fixnum fixnum } declare {
[ [ -2 shift ch>base64 ] [ 2 bits 4 shift ] bi ]
[ [ -4 shift bitor ch>base64 ] [ 4 bits 2 shift ] bi ]
[ [ -6 shift bitor ch>base64 ] [ 6 bits ch>base64 ] bi ]
} spread ; inline
: (write-lines) ( column byte-array -- column' )
output-stream get dup '[
_ stream-write1 1 + dup 76 = [
drop B{ char: \r char: \n } _ stream-write 0
] when
] each ; inline
:: (stream-write-lines) ( column data stream -- column' )
column data over 71 > [
[
stream stream-write1 1 + dup 76 = [
drop 0
B{ CHAR: \r CHAR: \n } stream stream-write
] when
] each
] [
stream stream-write 4 +
] if ; inline
: write-lines ( column byte-array -- column' )
over [ (write-lines) ] [ write ] if ; inline
: stream-write-lines ( column data stream -- column' )
pick [ (stream-write-lines) ] [ stream-write ] if ; inline
: encode3 ( seq -- byte-array )
be> { -18 -12 -6 0 } '[
shift 0x3f bitand ch>base64
] with B{ } map-as ; inline
: write-lines ( column data -- column' )
output-stream get stream-write-lines ; inline
: encode-pad ( seq n -- byte-array )
[ 3 0 pad-tail encode3 ] [ 1 + ] bi* head-slice
4 char: = pad-tail ; inline
:: (encode-base64) ( input output column -- )
4 <byte-array> :> data
column [ input stream-read1 dup ] [
input stream-read1
input stream-read1
[ [ 0 or ] bi@ encode3 ] 2keep [ 0 1 ? ] bi@ + {
{ 0 [ ] }
{ 1 [ drop CHAR: = ] }
{ 2 [ 2drop CHAR: = CHAR: = ] }
} case data (4sequence) output stream-write-lines
] while 2drop ; inline
: (encode-base64) ( stream column -- )
3 pick stream-read dup length {
{ 0 [ 3drop ] }
{ 3 [ encode3 write-lines (encode-base64) ] }
[ encode-pad write-lines (encode-base64) ]
} case ;
PRIVATE>
: encode-base64 ( -- )
input-stream get output-stream get f (encode-base64) ;
input-stream get f (encode-base64) ;
: encode-base64-lines ( -- )
input-stream get output-stream get 0 (encode-base64) ;
input-stream get 0 (encode-base64) ;
<PRIVATE
: read1-ignoring ( ignoring stream -- ch )
dup stream-read1 pick dupd member-eq?
dup stream-read1 pick dupd member?
[ drop read1-ignoring ] [ 2nip ] if ; inline recursive
: push-ignoring ( accum ch -- accum )
dup { f 0 } member-eq? [ drop ] [ suffix! ] if ; inline
: read-into-ignoring ( accum n ignoring stream -- accum )
'[ _ _ read1-ignoring push-ignoring ] times ; inline
: read-ignoring ( n ignoring stream -- accum )
pick <sbuf> [
'[ _ _ read1-ignoring [ ] _ push-if ] times
] keep ;
[ [ <sbuf> ] keep ] 2dip read-into-ignoring ; inline
: decode4 ( a b c d -- x y z )
{ fixnum fixnum fixnum fixnum } declare {
[ base64>ch 2 shift ]
[ base64>ch [ -4 shift bitor ] [ 4 bits 4 shift ] bi ]
[ base64>ch [ -2 shift bitor ] [ 2 bits 6 shift ] bi ]
[ base64>ch bitor ]
} spread ; inline
: decode4 ( seq -- )
[ 0 [ base64>ch swap 6 shift bitor ] reduce 3 >be ]
[ [ char: = = ] count ] bi
[ write ] [ head-slice* write ] if-zero ; inline
:: (decode-base64) ( input output -- )
3 <byte-array> :> data
[ B{ CHAR: \n CHAR: \r } input read1-ignoring dup ] [
B{ CHAR: \n CHAR: \r } input read1-ignoring CHAR: = or
B{ CHAR: \n CHAR: \r } input read1-ignoring CHAR: = or
B{ CHAR: \n CHAR: \r } input read1-ignoring CHAR: = or
[ decode4 data (3sequence) ] 3keep
[ CHAR: = eq? 1 0 ? ] tri@ + +
[ head-slice* ] unless-zero
output stream-write
] while drop ;
: (decode-base64) ( stream -- )
4 "\n\r" pick read-ignoring dup length {
{ 0 [ 2drop ] }
{ 4 [ decode4 (decode-base64) ] }
[ drop 4 char: = pad-tail decode4 (decode-base64) ]
} case ;
PRIVATE>
: decode-base64 ( -- )
input-stream get output-stream get (decode-base64) ;
<PRIVATE
: ensure-encode-length ( base64 -- base64 )
dup length 3 /mod zero? [ 1 + ] unless 4 *
output-stream get expand ;
: ensure-decode-length ( seq -- seq )
dup length 4 /mod zero? [ 1 + ] unless 3 *
output-stream get expand ;
PRIVATE>
input-stream get (decode-base64) ;
: >base64 ( seq -- base64 )
binary [
ensure-encode-length
binary [ encode-base64 ] with-byte-reader
] with-byte-writer ;
binary [ binary [ encode-base64 ] with-byte-reader ] with-byte-writer ;
: base64> ( base64 -- seq )
binary [
ensure-decode-length
binary [ decode-base64 ] with-byte-reader
] with-byte-writer ;
binary [ binary [ decode-base64 ] with-byte-reader ] with-byte-writer ;
: >base64-lines ( seq -- base64 )
binary [
ensure-encode-length
binary [ encode-base64-lines ] with-byte-reader
] with-byte-writer ;
: >urlsafe-base64 ( seq -- base64 )
>base64 H{
{ CHAR: + CHAR: - }
{ CHAR: / CHAR: _ }
} substitute ;
: urlsafe-base64> ( base64 -- seq )
H{
{ CHAR: - CHAR: + }
{ CHAR: _ CHAR: / }
} substitute base64> ;
: >urlsafe-base64-lines ( seq -- base64 )
>base64-lines H{
{ CHAR: + CHAR: - }
{ CHAR: / CHAR: _ }
} substitute ;
binary [ binary [ encode-base64-lines ] with-byte-reader ] with-byte-writer ;

View File

@ -1 +1 @@
Base64 encoding/decoding (RFC 3548)
Base64 encoding/decoding

View File

@ -1,2 +1 @@
algorithms
collections

View File

@ -29,14 +29,14 @@ $nl
bit-array>integer
}
"Bit array literal syntax:"
{ $subsections POSTPONE: ?{ } ;
{ $subsections postpone: \?{ } ;
ABOUT: "bit-arrays"
HELP: ?{
HELP: \?{
{ $syntax "?{ elements... }" }
{ $values { "elements" "a list of booleans" } }
{ $description "Marks the beginning of a literal bit array. Literal bit arrays are terminated by " { $link POSTPONE: } } "." }
{ $description "Marks the beginning of a literal bit array. Literal bit arrays are terminated by " { $link postpone: \} } "." }
{ $examples { $code "?{ t f t }" } } ;
HELP: bit-array

View File

@ -1,8 +1,8 @@
! Copyright (C) 2007, 2011 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien alien.accessors byte-arrays fry io.binary
kernel kernel.private locals math math.bitwise parser sequences
sequences.private vocabs.loader ;
kernel kernel.private locals math math.bitwise parser
prettyprint.custom sequences sequences.private ;
IN: bit-arrays
TUPLE: bit-array
@ -86,7 +86,7 @@ M: bit-array resize
M: bit-array byte-length length bits>bytes ; inline
SYNTAX: ?{ \ } [ >bit-array ] parse-literal ;
SYNTAX: \?{ \ } [ >bit-array ] parse-literal ;
: integer>bit-array ( n -- bit-array )
dup 0 =
@ -98,4 +98,6 @@ SYNTAX: ?{ \ } [ >bit-array ] parse-literal ;
INSTANCE: bit-array sequence
{ "bit-arrays" "prettyprint" } "bit-arrays.prettyprint" require-when
M: bit-array pprint-delims drop \ ?{ \ } ;
M: bit-array >pprint-sequence ;
M: bit-array pprint* pprint-object ;

View File

@ -1,6 +0,0 @@
USING: bit-arrays kernel prettyprint.custom ;
IN: bit-arrays.prettyprint
M: bit-array pprint-delims drop \ ?{ \ } ;
M: bit-array >pprint-sequence ;
M: bit-array pprint* pprint-object ;

View File

@ -15,7 +15,7 @@ $nl
<bit-vector>
}
"Literal syntax:"
{ $subsections POSTPONE: ?V{ }
{ $subsections postpone: \?V{ }
"If you don't care about initial capacity, a more elegant way to create a new bit vector is to write:"
{ $code "?V{ } clone" } ;
@ -32,8 +32,8 @@ HELP: >bit-vector
{ $values { "seq" sequence } { "vector" bit-vector } }
{ $description "Outputs a freshly-allocated bit vector with the same elements as a given sequence." } ;
HELP: ?V{
HELP: \?V{
{ $syntax "?V{ elements... }" }
{ $values { "elements" "a list of booleans" } }
{ $description "Marks the beginning of a literal bit vector. Literal bit vectors are terminated by " { $link POSTPONE: } } "." }
{ $description "Marks the beginning of a literal bit vector. Literal bit vectors are terminated by " { $link postpone: \} } "." }
{ $examples { $code "?V{ t f t }" } } ;

View File

@ -1,13 +1,14 @@
! Copyright (C) 2008, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: bit-arrays classes.parser growable kernel parser
vectors.functor vocabs.loader ;
USING: bit-arrays classes growable kernel math parser
prettyprint.custom sequences sequences.private vectors.functor ;
IN: bit-vectors
<< "bit-vector" create-class-in \ bit-array \ <bit-array> define-vector >>
VECTORIZED: bit bit-array <bit-array>
SYNTAX: ?V{ \ } [ >bit-vector ] parse-literal ;
SYNTAX: \?V{ \ } [ >bit-vector ] parse-literal ;
M: bit-vector contract 2drop ;
{ "bit-vectors" "prettyprint" } "bit-vectors.prettyprint" require-when
M: bit-vector >pprint-sequence ;
M: bit-vector pprint-delims drop \ ?V{ \ } ;
M: bit-vector pprint* pprint-object ;

View File

@ -1,7 +0,0 @@
USING: bit-vectors kernel prettyprint.custom ;
IN: bit-vectors.prettyprint
M: bit-vector >pprint-sequence ;
M: bit-vector pprint-delims drop \ ?V{ \ } ;
M: bit-vector pprint* pprint-object ;

View File

@ -25,7 +25,7 @@ HELP: seek
HELP: align
{ $values { "n" integer } { "bitstream" bit-reader } }
{ $description "Moves the read cursor of the bit-reader forward until its position in bits from the start of the stream is an even multiple of n. If it is already such a multiple, the cursor is not moved at all." } ;
{ $description "Moves the read cursor of the bit-reader forward until its position in bits from the start of the stream is an even multiple of n. If it is already such a multiple, the cursor is not moved at all. " } ;
HELP: enough-bits?
{ $values { "n" integer } { "bs" bit-reader } { "?" boolean } }

View File

@ -166,10 +166,10 @@ ERROR: not-enough-bits n bit-reader ;
bs bytes>> subseq endian> execute( seq -- x )
n bs subseq-endian execute( bignum n bs -- bits ) ;
M: lsb0-bit-reader peek
M: lsb0-bit-reader peek ( n bs -- bits )
\ le> \ subseq>bits-le (peek) ;
M: msb0-bit-reader peek
M: msb0-bit-reader peek ( n bs -- bits )
\ be> \ subseq>bits-be (peek) ;
:: bit-writer-bytes ( writer -- bytes )

View File

@ -4,7 +4,7 @@ USING: assocs bootstrap.image checksums checksums.md5
http.client io.files kernel math.parser splitting urls ;
IN: bootstrap.image.download
CONSTANT: url URL" http://downloads.factorcode.org/images/master/"
CONSTANT: url url"http://downloads.factorcode.org/images/master/"
: download-checksums ( -- alist )
url "checksums.txt" >url derive-url http-get nip

View File

@ -46,7 +46,7 @@ HELP: sub-primitives
ARTICLE: "bootstrap.image" "Bootstrapping new images"
"A new image can be built from source; this is known as " { $emphasis "bootstrap" } ". Bootstrap is a two-step process. The first stage is the creation of a bootstrap image from a running Factor instance:"
{ $subsections make-image make-my-image }
{ $subsections make-image }
"The second bootstrapping stage is initiated by running the resulting bootstrap image:"
{ $code "./factor -i=boot.x86.32.image" }
"This stage loads additional code, compiles all words, and creates a final " { $snippet "factor.image" } "."

View File

@ -1,15 +1,15 @@
! Copyright (C) 2004, 2011 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs byte-arrays classes
classes.builtin classes.private classes.tuple
classes.tuple.private combinators combinators.short-circuit
combinators.smart command-line compiler.codegen.relocation
compiler.units fry generic generic.single.private grouping
hashtables hashtables.private io io.binary io.encodings.binary
io.files io.pathnames kernel kernel.private layouts locals make
math math.order namespaces namespaces.private parser
parser.notes prettyprint quotations sequences sequences.private
source-files strings system vectors vocabs words ;
USING: accessors arrays assocs byte-arrays classes classes.builtin
classes.private classes.tuple classes.tuple.private combinators
combinators.short-circuit combinators.smart
compiler.codegen.relocation compiler.units fry generic
generic.single.private grouping hashtables hashtables.private io
io.binary io.encodings.binary io.files io.pathnames kernel
kernel.private layouts locals make math math.order namespaces
namespaces.private parser parser.notes prettyprint quotations
sequences sequences.private source-files strings system vectors
vocabs words ;
IN: bootstrap.image
: arch-name ( os cpu -- arch )
@ -540,8 +540,3 @@ PRIVATE>
: make-my-image ( -- )
my-arch-name make-image ;
: make-image-main ( -- )
command-line get [ make-my-image ] [ [ make-image ] each ] if-empty ;
MAIN: make-image-main

View File

@ -778,8 +778,8 @@ CONSTANT: all-primitives {
{
"tools.profiler.sampling.private"
{
{ "set-profiling" ( n -- ) "set_profiling" { object } { } f }
{ "get-samples" ( -- samples/f ) "get_samples" { } { object } f }
{ "profiling" ( n -- ) "sampling_profiler" { object } { } f }
{ "(get-samples)" ( -- samples/f ) "get_samples" { } { object } f }
}
}
{

View File

@ -1,10 +1,10 @@
! Copyright (C) 2008 Slava Pestov.
! Copyright (C) 2015 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: bootstrap.image checksums checksums.openssl fry io
io.directories io.encodings.ascii io.encodings.utf8 io.files
USING: bootstrap.image checksums checksums.openssl cli.git fry
io io.directories io.encodings.ascii io.encodings.utf8 io.files
io.files.temp io.files.unique io.launcher io.pathnames kernel
make math.parser namespaces sequences splitting system unicode ;
make math.parser namespaces sequences splitting system ;
IN: bootstrap.image.upload
SYMBOL: upload-images-destination
@ -21,11 +21,7 @@ SYMBOL: build-images-destination
or ;
: factor-git-branch ( -- name )
image-path parent-directory [
{ "git" "rev-parse" "--abbrev-ref" "HEAD" }
utf8 <process-reader> stream-contents
[ blank? ] trim-tail
] with-directory ;
image-path parent-directory git-current-branch ;
: git-branch-destination ( -- dest )
build-images-destination get
@ -47,7 +43,14 @@ SYMBOL: build-images-destination
] each
] with-file-writer ;
: scp-name ( -- path ) "scp" ;
! Windows scp doesn't like pathnames with colons, it treats them as hostnames.
! Workaround for uploading checksums.txt created with temp-file.
! e.g. C:\Users\\Doug\\AppData\\Local\\Temp/factorcode.org\\Factor/checksums.txt
! ssh: Could not resolve hostname c: no address associated with name
HOOK: scp-name os ( -- path )
M: object scp-name "scp" ;
M: windows scp-name "pscp" ;
: upload-images ( -- )
[

View File

@ -1,5 +1,4 @@
USING: accessors combinators namespaces sequences system vocabs
;
USING: accessors combinators namespaces sequences system vocabs ;
IN: bootstrap.io
"bootstrap.compiler" require

View File

@ -1,6 +1,6 @@
! Copyright (C) 2004, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: command-line compiler.units continuations definitions io
USING: combinators command-line compiler.units continuations definitions io
io.pathnames kernel math math.parser memory namespaces parser
parser.notes sequences sets splitting system
vocabs vocabs.loader ;
@ -13,8 +13,8 @@ SYMBOL: bootstrap-time
: strip-encodings ( -- )
os unix? [
[
P" resource:core/io/encodings/utf16/utf16.factor"
P" resource:core/io/encodings/utf16n/utf16n.factor" [ forget ] bi@
path"resource:core/io/encodings/utf16/utf16.factor"
path"resource:core/io/encodings/utf16n/utf16n.factor" [ forget ] bi@
"io.encodings.utf16"
"io.encodings.utf16n" [ loaded-child-vocab-names [ forget-vocab ] each ] bi@
] with-compilation-unit
@ -75,6 +75,30 @@ CONSTANT: default-components
(command-line) parse-command-line
{
{ [ os windows? ] [ "alien.libraries.windows" ] }
{ [ os unix? ] [ "alien.libraries.unix" ] }
} cond require
! { "hashtables.identity" "prettyprint" } "hashtables.identity.prettyprint" require-when
! { "hashtables.identity" "mirrors" } "hashtables.identity.mirrors" require-when
! { "hashtables.wrapped" "prettyprint" } "hashtables.wrapped.prettyprint" require-when
! { "typed" "prettyprint" } "typed.prettyprint" require-when
! { "typed" "compiler.cfg.debugger" } "typed.debugger" require-when
{ "hashtables.identity" "prettyprint" } "hashtables.identity.prettyprint" require-when
{ "hashtables.identity" "mirrors" } "hashtables.identity.mirrors" require-when
{ "hashtables.wrapped" "prettyprint" } "hashtables.wrapped.prettyprint" require-when
"summary" require
"eval" require
! "deques" require
! "command-line.startup" require
{ "locals" "prettyprint" } "locals.prettyprint" require-when
{ "typed" "prettyprint" } "typed.prettyprint" require-when
{ "typed" "compiler.cfg.debugger" } "typed.debugger" require-when
"stack-checker.row-polymorphism" reload
! Set dll paths
os windows? [ "windows" require ] when

View File

@ -38,9 +38,9 @@ M: cache-assoc dispose* clear-assoc ;
PRIVATE>
: purge-cache ( cache -- )
dup [ assoc>> ] [ max-age>> ] bi V{ } clone [
[ assoc>> ] [ max-age>> ] bi V{ } clone [
'[
nip dup age>> 1 + [ >>age ] keep
_ < [ drop t ] [ _ dispose-to f ] if
] assoc-filter >>assoc drop
] assoc-filter! drop
] keep [ last rethrow ] unless-empty ;

View File

@ -401,22 +401,6 @@ HELP: day-of-year
}
} ;
HELP: week-number
{ $values { "timestamp" timestamp } { "[1,53]" integer } }
{ $description "Calculates the ISO 8601 week number from 1 to 53 (leap years). See " { $snippet "https://en.wikipedia.org/wiki/ISO_week_date" } }
{ $examples
"Last day of 2018 is already in the first week of 2019."
{ $example "USING: calendar prettyprint ;"
"2018 12 31 <date> week-number ."
"1"
}
"2020 is a leap year with 53 weeks, and January 1st, 2021 is still in week 53 of 2020."
{ $example "USING: calendar prettyprint ;"
"2021 1 1 <date> week-number ."
"53"
}
} ;
HELP: sunday
{ $values { "timestamp" timestamp } { "new-timestamp" timestamp } }
{ $description "Returns the Sunday from the current week, which starts on a Sunday." } ;
@ -589,7 +573,6 @@ ARTICLE: "calendar-facts" "Calendar facts"
days-in-month
day-of-year
day-of-week
week-number
}
"Calculating a Julian day number:"
{ $subsections julian-day-number }

View File

@ -194,9 +194,3 @@ IN: calendar
! pm
[ now 30 pm ] [ not-in-interval? ] must-fail-with
{ 1 } [ 2018 12 31 <date> week-number ] unit-test
{ 16 } [ 2019 4 17 <date> week-number ] unit-test
{ 53 } [ 2021 1 1 <date> week-number ] unit-test

View File

@ -40,10 +40,10 @@ CONSTANT: day-counts { 0 31 28 31 30 31 30 31 31 30 31 30 31 }
GENERIC: leap-year? ( obj -- ? )
M: integer leap-year?
M: integer leap-year? ( year -- ? )
dup 100 divisor? 400 4 ? divisor? ;
M: timestamp leap-year?
M: timestamp leap-year? ( timestamp -- ? )
year>> leap-year? ;
: (days-in-month) ( year month -- n )
@ -121,10 +121,10 @@ GENERIC: easter ( obj -- obj' )
h l + 7 m * - 114 + 31 /mod 1 + ;
M: integer easter
M: integer easter ( year -- timestamp )
dup easter-month-day <date> ;
M: timestamp easter
M: timestamp easter ( timestamp -- timestamp )
clone
dup year>> easter-month-day
swapd >>day swap >>month ;
@ -167,52 +167,52 @@ GENERIC: +second ( timestamp x -- timestamp )
{ [ day>> 29 = ] [ month>> 2 = ] [ leap-year? not ] } 1&&
[ 3 >>month 1 >>day ] when ;
M: integer +year
M: integer +year ( timestamp n -- timestamp )
[ + ] curry change-year adjust-leap-year ;
M: real +year
M: real +year ( timestamp n -- timestamp )
[ float>whole-part swapd days-per-year * +day swap +year ] unless-zero ;
: months/years ( n -- months years )
12 /rem [ 1 - 12 ] when-zero swap ; inline
M: integer +month
M: integer +month ( timestamp n -- timestamp )
[ over month>> + months/years [ >>month ] dip +year ] unless-zero ;
M: real +month
M: real +month ( timestamp n -- timestamp )
[ float>whole-part swapd average-month * +day swap +month ] unless-zero ;
M: integer +day
M: integer +day ( timestamp n -- timestamp )
[
over >date< julian-day-number + julian-day-number>date
[ >>year ] [ >>month ] [ >>day ] tri*
] unless-zero ;
M: real +day
M: real +day ( timestamp n -- timestamp )
[ float>whole-part swapd 24 * +hour swap +day ] unless-zero ;
: hours/days ( n -- hours days )
24 /rem swap ;
M: integer +hour
M: integer +hour ( timestamp n -- timestamp )
[ over hour>> + hours/days [ >>hour ] dip +day ] unless-zero ;
M: real +hour
M: real +hour ( timestamp n -- timestamp )
float>whole-part swapd 60 * +minute swap +hour ;
: minutes/hours ( n -- minutes hours )
60 /rem swap ;
M: integer +minute
M: integer +minute ( timestamp n -- timestamp )
[ over minute>> + minutes/hours [ >>minute ] dip +hour ] unless-zero ;
M: real +minute
M: real +minute ( timestamp n -- timestamp )
[ float>whole-part swapd 60 * +second swap +minute ] unless-zero ;
: seconds/minutes ( n -- seconds minutes )
60 /rem swap >integer ;
M: number +second
M: number +second ( timestamp n -- timestamp )
[ over second>> + seconds/minutes [ >>second ] dip +minute ] unless-zero ;
: (time+) ( timestamp duration -- timestamp' duration )
@ -291,7 +291,8 @@ GENERIC: time- ( time1 time2 -- time3 )
[ neg +year 0 ] change-year drop
] if ;
M: timestamp <=> [ >gmt tuple-slots ] compare ;
M: timestamp <=> ( ts1 ts2 -- n )
[ >gmt tuple-slots ] compare ;
: same-day? ( ts1 ts2 -- ? )
[ >gmt >date< <date> ] same? ;
@ -375,9 +376,8 @@ M: duration time-
GENERIC: days-in-year ( obj -- n )
M: integer days-in-year leap-year? 366 365 ? ;
M: timestamp days-in-year year>> days-in-year ;
M: integer days-in-year ( year -- n ) leap-year? 366 365 ? ;
M: timestamp days-in-year ( timestamp -- n ) year>> days-in-year ;
: days-in-month ( timestamp -- n )
>date< drop (days-in-month) ;
@ -538,16 +538,6 @@ M: integer end-of-year 12 31 <date> ;
: unix-time>timestamp ( seconds -- timestamp )
[ unix-1970 ] dip +second ; inline
: (week-number) ( timestamp -- [0,53] )
[ day-of-year ] [ day-of-week [ 7 ] when-zero ] bi - 10 + 7 /i ;
: week-number ( timestamp -- [1,53] )
dup (week-number) {
{ 0 [ year>> 1 - end-of-year (week-number) ] }
{ 53 [ year>> 1 + <year> (week-number) 1 = 1 53 ? ] }
[ nip ]
} case ;
{
{ [ os unix? ] [ "calendar.unix" ] }
{ [ os windows? ] [ "calendar.windows" ] }

View File

@ -15,14 +15,14 @@ MACRO: formatted ( spec -- quot )
} cond
] map [ cleave ] curry ;
: pad-00 ( n -- str ) number>string 2 char: 0 pad-head ;
: formatted>string ( spec -- string )
'[ _ formatted ] with-string-writer ; inline
: pad-00 ( n -- str ) number>string 2 CHAR: 0 pad-head ;
: pad-0000 ( n -- str ) number>string 4 char: 0 pad-head ;
: pad-0000 ( n -- str ) number>string 4 CHAR: 0 pad-head ;
: pad-00000 ( n -- str ) number>string 5 CHAR: 0 pad-head ;
: pad-00000 ( n -- str ) number>string 5 char: 0 pad-head ;
: write-00 ( n -- ) pad-00 write ;
@ -52,15 +52,15 @@ MACRO: formatted ( spec -- quot )
GENERIC: day. ( obj -- )
M: integer day.
M: integer day. ( n -- )
number>string dup length 2 < [ bl ] when write ;
M: timestamp day.
M: timestamp day. ( timestamp -- )
day>> day. ;
GENERIC: month. ( obj -- )
M: array month.
M: array month. ( pair -- )
first2
[ month-name write bl number>string print ]
[ 1 zeller-congruence ]
@ -71,15 +71,15 @@ M: array month.
1 + + 7 mod zero? [ nl ] [ bl ] if
] with each-integer nl ;
M: timestamp month.
M: timestamp month. ( timestamp -- )
[ year>> ] [ month>> ] bi 2array month. ;
GENERIC: year. ( obj -- )
M: integer year.
M: integer year. ( n -- )
12 [ 1 + 2array month. nl ] with each-integer ;
M: timestamp year.
M: timestamp year. ( timestamp -- )
year>> year. ;
: timestamp>mdtm ( timestamp -- str )

View File

@ -1 +0,0 @@
time

View File

@ -28,16 +28,16 @@ ERROR: invalid-timestamp-format ;
: read-sp ( -- token ) " " read-token ;
: signed-gmt-offset ( dt ch -- dt' )
{ { CHAR: + [ 1 ] } { CHAR: - [ -1 ] } } case time* ;
{ { char: + [ 1 ] } { char: - [ -1 ] } } case time* ;
: read-rfc3339-gmt-offset ( ch -- dt )
{
{ f [ instant ] }
{ CHAR: Z [ instant ] }
{ char: Z [ instant ] }
[
[
read-00 hours
read1 { { CHAR: : [ read-00 ] } { f [ 0 ] } } case minutes
read1 { { char: \: [ read-00 ] } { f [ 0 ] } } case minutes
time+
] dip signed-gmt-offset
]
@ -58,7 +58,7 @@ ERROR: invalid-timestamp-format ;
read-ymd
"Tt \t" expect
read-hms
read1 { { CHAR: . [ read-rfc3339-seconds ] } [ ] } case
read1 { { char: . [ read-rfc3339-seconds ] } [ ] } case
read-rfc3339-gmt-offset
<timestamp> ;
@ -66,7 +66,7 @@ ERROR: invalid-timestamp-format ;
[ (rfc3339>timestamp) ] with-string-reader ;
: parse-rfc822-military-offset ( string -- dt )
first CHAR: A - {
first char: A - {
-1 -2 -3 -4 -5 -6 -7 -8 -9 f -10 -11 -12
1 2 3 4 5 6 7 8 9 10 11 12 0
} nth hours ;
@ -101,7 +101,7 @@ CONSTANT: rfc822-named-zones H{
: (rfc822>timestamp) ( -- timestamp )
"," read-token day-abbreviations3 member? check-timestamp drop
read1 CHAR: \s assert=
read1 char: \s assert=
read-sp checked-number
read-sp month-abbreviations index 1 + check-timestamp
read-sp checked-number spin
@ -117,7 +117,7 @@ CONSTANT: rfc822-named-zones H{
: (cookie-string>timestamp-1) ( -- timestamp )
"," read-token check-day-name
read1 CHAR: \s assert=
read1 char: \s assert=
"-" read-token checked-number
"-" read-token month-abbreviations index 1 + check-timestamp
read-sp checked-number spin

View File

@ -31,7 +31,7 @@ IN: calendar.unix
: timezone-name ( -- string )
get-time zone>> ;
M: unix gmt-offset
M: unix gmt-offset ( -- hours minutes seconds )
get-time gmtoff>> 3600 /mod 60 /mod ;
: current-timeval ( -- timeval )

View File

@ -18,7 +18,7 @@ IN: calendar.windows
]
} cleave \ SYSTEMTIME <struct-boa> ;
: SYSTEMTIME>timestamp ( SYSTEMTIME -- timestamp )
: \SYSTEMTIME>timestamp ( SYSTEMTIME -- timestamp )
{
[ wYear>> ]
[ wMonth>> ]
@ -28,14 +28,14 @@ IN: calendar.windows
[ [ wSecond>> ] [ wMilliseconds>> 1000 / ] bi + ]
} cleave instant <timestamp> ;
M: windows gmt-offset
M: windows gmt-offset ( -- hours minutes seconds )
TIME_ZONE_INFORMATION <struct>
dup GetTimeZoneInformation {
{ TIME_ZONE_ID_INVALID [ win32-error ] }
{ TIME_ZONE_ID_INVALID [ win32-error-string throw ] }
{ TIME_ZONE_ID_UNKNOWN [ Bias>> ] }
{ TIME_ZONE_ID_STANDARD [ Bias>> ] }
{ TIME_ZONE_ID_DAYLIGHT [ [ Bias>> ] [ DaylightBias>> ] bi + ] }
} case neg 60 /mod 0 ;
M: windows gmt
SYSTEMTIME <struct> [ GetSystemTime ] keep SYSTEMTIME>timestamp ;
SYSTEMTIME <struct> [ GetSystemTime ] keep \SYSTEMTIME>timestamp ;

View File

@ -31,11 +31,11 @@ GENERIC: from ( channel -- value )
PRIVATE>
M: channel to
M: channel to ( value channel -- )
dup receivers>>
[ dup wait to ] [ nip (to) ] if-empty ;
M: channel from
M: channel from ( channel -- value )
[ self ] dip
notify senders>>
[ (from) ] unless-empty

View File

@ -58,7 +58,6 @@ $nl
$nl
"Given the id from the snippet above, a remote node can put items in the channel (where 123456 is the id):"
$nl
{ $snippet "\"myhost.com\" 9001 <node> 123456 <remote-channel>\n\"hello\" over to" }
;
{ $snippet "\"myhost.com\" 9001 <node> 123456 <remote-channel>\n\"hello\" over to" } ;
ABOUT: "channels.remote"

View File

@ -60,10 +60,10 @@ C: <remote-channel> remote-channel
PRIVATE>
M: remote-channel to
M: remote-channel to ( value remote-channel -- )
[ id>> swap to-message boa ] keep send-message drop ;
M: remote-channel from
M: remote-channel from ( remote-channel -- value )
[ id>> from-message boa ] keep send-message ;
[

View File

@ -1,4 +1,4 @@
USING: checksums checksums.adler-32 strings tools.test ;
{ 300286872 } [ "Wikipedia" adler-32 checksum-bytes ] unit-test
{ 2679885283 } [ 10000 CHAR: a <string> adler-32 checksum-bytes ] unit-test
{ 2679885283 } [ 10000 char: a <string> adler-32 checksum-bytes ] unit-test

View File

@ -8,10 +8,10 @@ SINGLETON: adler-32
CONSTANT: adler-32-modulus 65521
M: adler-32 checksum-bytes
M: adler-32 checksum-bytes ( bytes checksum -- value )
drop
[ sum 1 + ]
[ [ dup length [1,b] <reversed> vdot ] [ length ] bi + ] bi
[ [ dup length [1,b] <reversed> v. ] [ length ] bi + ] bi
[ adler-32-modulus mod ] bi@ 16 shift bitor ;
INSTANCE: adler-32 checksum

View File

@ -1,4 +1,4 @@
USING: checksums checksums.bsd strings tools.test ;
{ 15816 } [ "Wikipedia" bsd checksum-bytes ] unit-test
{ 47937 } [ 10000 CHAR: a <string> bsd checksum-bytes ] unit-test
{ 47937 } [ 10000 char: a <string> bsd checksum-bytes ] unit-test

View File

@ -5,7 +5,7 @@ IN: checksums.bsd
SINGLETON: bsd
M: bsd checksum-bytes
M: bsd checksum-bytes ( bytes checksum -- value )
drop 0 [
[ [ -1 shift ] [ 1 bitand 15 shift ] bi + ] dip
+ 0xffff bitand

View File

@ -36,5 +36,5 @@ M: crc16 checksum-bytes
M: crc16 checksum-lines
init-crc16
[ [ (crc16) ] each CHAR: \n (crc16) ] each
finish-crc16 ; inline
[ [ (crc16) ] each char: \n (crc16) ] each
finish-crc16 ; inline

View File

@ -1,8 +1,7 @@
! Copyright (C) 2013 John Benediktsson
! See http://factorcode.org/license.txt for BSD license
USING: checksums grouping io.binary kernel locals math sequences
;
USING: checksums grouping io.binary kernel locals math sequences ;
IN: checksums.fletcher

View File

@ -38,67 +38,67 @@ CONSTANT: fnv1-256-basis 0xdd268dbcaac550362d98c384c4e576ccc8b1536847b6bbb31023b
CONSTANT: fnv1-512-basis 0xb86db0b1171f4416dca1e50f309990acac87d059c90000000000000000000d21e948f68a34c192f62ea79bc942dbe7ce182036415f56e34bac982aac4afe9fd9
CONSTANT: fnv1-1024-basis 0x5f7a76758ecc4d32e56d5a591028b74b29fc4223fdada16c3bf34eda3674da9a21d9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004c6d7eb6e73802734510a555f256cc005ae556bde8cc9c6a93b21aff4b16c71ee90b3
M: fnv1-32 checksum-bytes
M: fnv1-32 checksum-bytes ( bytes checksum -- value )
drop
fnv1-32-basis swap
[ swap fnv1-32-prime * bitxor fnv1-32-mod bitand ] each ;
M: fnv1a-32 checksum-bytes
M: fnv1a-32 checksum-bytes ( bytes checksum -- value )
drop
fnv1-32-basis swap
[ bitxor fnv1-32-prime * fnv1-32-mod bitand ] each ;
M: fnv1-64 checksum-bytes
M: fnv1-64 checksum-bytes ( bytes checksum -- value )
drop
fnv1-64-basis swap
[ swap fnv1-64-prime * bitxor fnv1-64-mod bitand ] each ;
M: fnv1a-64 checksum-bytes
M: fnv1a-64 checksum-bytes ( bytes checksum -- value )
drop
fnv1-64-basis swap
[ bitxor fnv1-64-prime * fnv1-64-mod bitand ] each ;
M: fnv1-128 checksum-bytes
M: fnv1-128 checksum-bytes ( bytes checksum -- value )
drop
fnv1-128-basis swap
[ swap fnv1-128-prime * bitxor fnv1-128-mod bitand ] each ;
M: fnv1a-128 checksum-bytes
M: fnv1a-128 checksum-bytes ( bytes checksum -- value )
drop
fnv1-128-basis swap
[ bitxor fnv1-128-prime * fnv1-128-mod bitand ] each ;
M: fnv1-256 checksum-bytes
M: fnv1-256 checksum-bytes ( bytes checksum -- value )
drop
fnv1-256-basis swap
[ swap fnv1-256-prime * bitxor fnv1-256-mod bitand ] each ;
M: fnv1a-256 checksum-bytes
M: fnv1a-256 checksum-bytes ( bytes checksum -- value )
drop
fnv1-256-basis swap
[ bitxor fnv1-256-prime * fnv1-256-mod bitand ] each ;
M: fnv1-512 checksum-bytes
M: fnv1-512 checksum-bytes ( bytes checksum -- value )
drop
fnv1-512-basis swap
[ swap fnv1-512-prime * bitxor fnv1-512-mod bitand ] each ;
M: fnv1a-512 checksum-bytes
M: fnv1a-512 checksum-bytes ( bytes checksum -- value )
drop
fnv1-512-basis swap
[ bitxor fnv1-512-prime * fnv1-512-mod bitand ] each ;
M: fnv1-1024 checksum-bytes
M: fnv1-1024 checksum-bytes ( bytes checksum -- value )
drop
fnv1-1024-basis swap
[ swap fnv1-1024-prime * bitxor fnv1-1024-mod bitand ] each ;
M: fnv1a-1024 checksum-bytes
M: fnv1a-1024 checksum-bytes ( bytes checksum -- value )
drop
fnv1-1024-basis swap
[ bitxor fnv1-1024-prime * fnv1-1024-mod bitand ] each ;

View File

@ -47,7 +47,7 @@ CONSTANT: n 0xe6546b64
PRIVATE>
M: murmur3-32 checksum-bytes
M: murmur3-32 checksum-bytes ( bytes checksum -- value )
seed>> 32 bits main-loop end-case avalanche ;
INSTANCE: murmur3-32 checksum

View File

@ -38,13 +38,13 @@ M: evp-md-context dispose*
: set-digest ( name ctx -- )
handle>> swap digest-named f EVP_DigestInit_ex ssl-error ;
M: openssl-checksum initialize-checksum-state
M: openssl-checksum initialize-checksum-state ( checksum -- evp-md-context )
maybe-init-ssl name>> <evp-md-context> [ set-digest ] keep ;
M: evp-md-context add-checksum-bytes
M: evp-md-context add-checksum-bytes ( ctx bytes -- ctx' )
[ dup handle>> ] dip dup length EVP_DigestUpdate ssl-error ;
M: evp-md-context get-checksum
M: evp-md-context get-checksum ( ctx -- value )
handle>>
{ { int EVP_MAX_MD_SIZE } int }
[ EVP_DigestFinal_ex ssl-error ] with-out-parameters

View File

@ -64,7 +64,4 @@ USING: checksums checksums.ripemd strings tools.test ;
0x69 0x7b 0xdb 0xe1 0x6d
0x37 0xf9 0x7f 0x68 0xf0
0x83 0x25 0xdc 0x15 0x28
} } [ 1000000 CHAR: a <string> ripemd-160 checksum-bytes ] unit-test
} } [ 1000000 char: a <string> ripemd-160 checksum-bytes ] unit-test

View File

@ -5,7 +5,7 @@ IN: checksums.sha.tests
{ "a9993e364706816aba3e25717850c26c9cd0d89d" } [ "abc" sha1 checksum-bytes bytes>hex-string ] unit-test
{ "84983e441c3bd26ebaae4aa1f95129e5e54670f1" } [ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" sha1 checksum-bytes bytes>hex-string ] unit-test
! [ "34aa973cd4c4daa4f61eeb2bdbad27316534016f" ] [ 1000000 CHAR: a fill string>sha1str ] unit-test ! takes a long time...
! [ "34aa973cd4c4daa4f61eeb2bdbad27316534016f" ] [ 1000000 char: a fill string>sha1str ] unit-test ! takes a long time...
{ "dea356a2cddd90c7a7ecedc5ebb563934f460452" } [ "0123456701234567012345670123456701234567012345670123456701234567"
10 swap <array> concat sha1 checksum-bytes bytes>hex-string ] unit-test

View File

@ -7,10 +7,10 @@ IN: circular.tests
{ 0 } [ { 0 1 2 3 4 } <circular> 0 swap virtual@ drop ] unit-test
{ 2 } [ { 0 1 2 3 4 } <circular> 2 swap virtual@ drop ] unit-test
{ CHAR: t } [ "test" <circular> 0 swap nth ] unit-test
{ char: t } [ "test" <circular> 0 swap nth ] unit-test
{ "test" } [ "test" <circular> >string ] unit-test
{ CHAR: e } [ "test" <circular> 5 swap nth-unsafe ] unit-test
{ char: e } [ "test" <circular> 5 swap nth-unsafe ] unit-test
{ [ 1 2 3 ] } [ { 1 2 3 } <circular> [ ] like ] unit-test
{ [ 2 3 1 ] } [ { 1 2 3 } <circular> [ rotate-circular ] keep [ ] like ] unit-test
@ -19,9 +19,9 @@ IN: circular.tests
{ [ 3 1 2 ] } [ { 1 2 3 } <circular> 1 over change-circular-start 1 over change-circular-start [ ] like ] unit-test
{ [ 3 1 2 ] } [ { 1 2 3 } <circular> -100 over change-circular-start [ ] like ] unit-test
{ "fob" } [ "foo" <circular> CHAR: b 2 pick set-nth >string ] unit-test
{ "boo" } [ "foo" <circular> CHAR: b 3 pick set-nth-unsafe >string ] unit-test
{ "ornact" } [ "factor" <circular> 4 over change-circular-start CHAR: n 2 pick set-nth >string ] unit-test
{ "fob" } [ "foo" <circular> char: b 2 pick set-nth >string ] unit-test
{ "boo" } [ "foo" <circular> char: b 3 pick set-nth-unsafe >string ] unit-test
{ "ornact" } [ "factor" <circular> 4 over change-circular-start char: n 2 pick set-nth >string ] unit-test
{ "bcd" } [ 3 <circular-string> "abcd" [ over circular-push ] each >string ] unit-test
@ -29,7 +29,7 @@ IN: circular.tests
! This no longer fails
! [ "test" <circular> 5 swap nth ] must-fail
! [ "foo" <circular> CHAR: b 3 rot set-nth ] must-fail
! [ "foo" <circular> char: b 3 rot set-nth ] must-fail
{ { } } [ 3 <growing-circular> >array ] unit-test
{ { 1 2 } } [

View File

@ -116,7 +116,7 @@ M: struct-mirror delete-at
M: struct-mirror clear-assoc
object>> reset-struct-slots ;
M: struct-mirror >alist
M: struct-mirror >alist ( mirror -- alist )
object>> [
[ drop "underlying" ] [ >c-ptr ] bi 2array 1array
] [

View File

@ -28,10 +28,10 @@ HELP: <struct>
{ <struct> <struct-boa> malloc-struct memory>struct } related-words
HELP: STRUCT:
HELP: \STRUCT:
{ $syntax "STRUCT: class { slot type } { slot type } ... ;" }
{ $values { "class" "a new " { $link struct } " class to define" } { "slots" "a list of slot specifiers" } }
{ $description "Defines a new " { $link struct } " type. The syntax is nearly identical to " { $link POSTPONE: TUPLE: } "; however, there are some additional restrictions on struct types:"
{ $description "Defines a new " { $link struct } " type. The syntax is nearly identical to " { $link postpone: \TUPLE: } "; however, there are some additional restrictions on struct types:"
{ $list
{ "Struct classes cannot have a superclass defined." }
{ "The slots of a struct must all have a type declared. The type must be a C type." }
@ -39,45 +39,45 @@ HELP: STRUCT:
}
"Additionally, structs may use bit fields. A slot specifier may use the syntax " { $snippet "bits: n" } " to specify that the bit width of the slot is " { $snippet "n" } ". Bit width may be specified on signed or unsigned integer slots. The layout of bit fields is not guaranteed to match that of any particular C compiler." } ;
HELP: S{
HELP: \S{
{ $syntax "S{ class slots... }" }
{ $values { "class" "a " { $link struct } " class word" } { "slots" "slot values" } }
{ $description "Marks the beginning of a literal struct. The syntax is identical to tuple literal syntax with " { $link POSTPONE: T{ } { $snippet " }" } "; either the assoc syntax (that is, " { $snippet "S{ class { slot value } { slot value } ... }" } ") or the simple syntax (" { $snippet "S{ class f value value ... }" } ") can be used." } ;
{ $description "Marks the beginning of a literal struct. The syntax is identical to tuple literal syntax with " { $link postpone: \T{ } { $snippet " }" } "; either the assoc syntax (that is, " { $snippet "S{ class { slot value } { slot value } ... }" } ") or the simple syntax (" { $snippet "S{ class f value value ... }" } ") can be used." } ;
HELP: S@
{ $syntax "S@ class alien" }
{ $values { "class" "a " { $link struct } " class word" } { "alien" "a literal alien" } }
{ $description "Marks the beginning of a literal struct at a specific C address. The prettyprinter uses this syntax when the memory backing a struct object is invalid. This syntax should not generally be used in source code." } ;
{ POSTPONE: S{ POSTPONE: S@ } related-words
{ postpone: \S{ postpone: S@ } related-words
HELP: UNION-STRUCT:
HELP: \UNION-STRUCT:
{ $syntax "UNION-STRUCT: class { slot type } { slot type } ... ;" }
{ $values { "class" "a new " { $link struct } " class to define" } { "slots" "a list of slot specifiers" } }
{ $description "Defines a new " { $link struct } " type where all of the slots share the same storage. See " { $link POSTPONE: STRUCT: } " for details on the syntax." } ;
{ $description "Defines a new " { $link struct } " type where all of the slots share the same storage. See " { $link postpone: \STRUCT: } " for details on the syntax." } ;
HELP: PACKED-STRUCT:
HELP: \PACKED-STRUCT:
{ $syntax "PACKED-STRUCT: class { slot type } { slot type } ... ;" }
{ $values { "class" "a new " { $link struct } " class to define" } { "slots" "a list of slot specifiers" } }
{ $description "Defines a new " { $link struct } " type with no alignment padding between slots or at the end. In all other respects, behaves like " { $link POSTPONE: STRUCT: } "." } ;
{ $description "Defines a new " { $link struct } " type with no alignment padding between slots or at the end. In all other respects, behaves like " { $link postpone: \STRUCT: } "." } ;
HELP: define-struct-class
{ $values
{ "class" class } { "slots" "a sequence of " { $link struct-slot-spec } "s" }
}
{ $description "Defines a new " { $link struct } " class. This is the runtime equivalent of the " { $link POSTPONE: STRUCT: } " syntax." } ;
{ $description "Defines a new " { $link struct } " class. This is the runtime equivalent of the " { $link postpone: \STRUCT: } " syntax." } ;
HELP: define-packed-struct-class
{ $values
{ "class" class } { "slots" "a sequence of " { $link struct-slot-spec } "s" }
}
{ $description "Defines a new " { $link struct } " class. This is the runtime equivalent of the " { $link POSTPONE: PACKED-STRUCT: } " syntax." } ;
{ $description "Defines a new " { $link struct } " class. This is the runtime equivalent of the " { $link postpone: \PACKED-STRUCT: } " syntax." } ;
HELP: define-union-struct-class
{ $values
{ "class" class } { "slots" "a sequence of " { $link struct-slot-spec } "s" }
}
{ $description "Defines a new " { $link struct } " class where all of the slots share the same storage. This is the runtime equivalent of the " { $link POSTPONE: UNION-STRUCT: } " syntax." } ;
{ $description "Defines a new " { $link struct } " class where all of the slots share the same storage. This is the runtime equivalent of the " { $link postpone: \UNION-STRUCT: } " syntax." } ;
HELP: malloc-struct
{ $values
@ -111,7 +111,7 @@ HELP: read-struct
HELP: struct
{ $class-description "The parent class of all struct types." } ;
{ struct POSTPONE: STRUCT: POSTPONE: UNION-STRUCT: } related-words
{ struct postpone: \STRUCT: postpone: \UNION-STRUCT: } related-words
HELP: struct-class
{ $class-description "The metaclass of all " { $link struct } " classes." } ;
@ -145,10 +145,10 @@ ARTICLE: "classes.struct.examples" "Struct class examples"
} ;
ARTICLE: "classes.struct.define" "Defining struct classes"
"Struct classes are defined using a syntax similar to the " { $link POSTPONE: TUPLE: } " syntax for defining tuple classes:"
{ $subsections POSTPONE: STRUCT: POSTPONE: PACKED-STRUCT: }
"Struct classes are defined using a syntax similar to the " { $link postpone: \TUPLE: } " syntax for defining tuple classes:"
{ $subsections postpone: \STRUCT: postpone: \PACKED-STRUCT: }
"Union structs are also supported, which behave like structs but share the same memory for all the slots."
{ $subsections POSTPONE: UNION-STRUCT: } ;
{ $subsections postpone: \UNION-STRUCT: } ;
ARTICLE: "classes.struct.create" "Creating instances of structs"
"Structs can be allocated with " { $link new } "- and " { $link boa } "-like constructor words. Additional words are provided for building structs from C memory and from existing buffers:"
@ -163,8 +163,8 @@ ARTICLE: "classes.struct.create" "Creating instances of structs"
(struct)
(malloc-struct)
}
"Structs have literal syntax, similar to " { $link POSTPONE: T{ } " for tuples:"
{ $subsections POSTPONE: S{ } ;
"Structs have literal syntax, similar to " { $link postpone: \T{ } " for tuples:"
{ $subsections postpone: \S{ } ;
ARTICLE: "classes.struct.c" "Passing structs to C functions"
"Structs can be passed and returned by value, or by reference."

View File

@ -133,7 +133,7 @@ STRUCT: struct-test-bar
[ make-mirror clear-assoc ] keep
] unit-test
{ POSTPONE: STRUCT: }
{ postpone: \STRUCT: }
[ struct-test-foo struct-definer-word ] unit-test
UNION-STRUCT: struct-test-float-and-bits
@ -145,7 +145,7 @@ UNION-STRUCT: struct-test-float-and-bits
{ 123 } [ [ struct-test-foo malloc-struct &free y>> ] with-destructors ] unit-test
{ POSTPONE: UNION-STRUCT: }
{ postpone: \UNION-STRUCT: }
[ struct-test-float-and-bits struct-definer-word ] unit-test
STRUCT: struct-test-string-ptr
@ -492,7 +492,7 @@ PACKED-STRUCT: packed-struct-test
{ 10 } [ "g" packed-struct-test offset-of ] unit-test
{ 11 } [ "h" packed-struct-test offset-of ] unit-test
{ POSTPONE: PACKED-STRUCT: }
{ postpone: \PACKED-STRUCT: }
[ packed-struct-test struct-definer-word ] unit-test
STRUCT: struct-1 { a c:int } ;

View File

@ -144,7 +144,7 @@ M: struct-class initial-value* <struct> t ; inline
GENERIC: struct-slot-values ( struct -- sequence )
M: struct-class reader-quot
dup type>> array? [ dup type>> first define-array-vocab drop ] when
dup type>> array? [ dup type>> first underlying-type define-specialized-array ] when
nip '[ _ read-struct-slot ] ;
M: struct-class writer-quot
@ -330,7 +330,7 @@ M: struct-class reset-class
[ call-next-method ]
} cleave ;
SYMBOL: bits:
SYMBOL: \bits:
<PRIVATE
@ -378,16 +378,16 @@ PRIVATE>
dup [ name>> ] map check-duplicate-slots ;
PRIVATE>
SYNTAX: STRUCT:
SYNTAX: \STRUCT:
parse-struct-definition define-struct-class ;
SYNTAX: PACKED-STRUCT:
SYNTAX: \PACKED-STRUCT:
parse-struct-definition define-packed-struct-class ;
SYNTAX: UNION-STRUCT:
SYNTAX: \UNION-STRUCT:
parse-struct-definition define-union-struct-class ;
SYNTAX: S{
SYNTAX: \S{
scan-word dup struct-slots parse-tuple-literal-slots suffix! ;
SYNTAX: S@
@ -412,7 +412,7 @@ SYNTAX: S@
PRIVATE>
FUNCTOR-SYNTAX: STRUCT:
FUNCTOR-SYNTAX: \STRUCT:
scan-param suffix!
[ 8 <vector> ] append!
[ parse-struct-slots* ] [ ] while

View File

@ -7,7 +7,7 @@ HELP: run-apple-script
{ $description "Runs the provided uncompiled AppleScript code." }
{ $notes "Currently, return values are unsupported." } ;
HELP: APPLESCRIPT:
HELP: \APPLESCRIPT:
{ $syntax "APPLESCRIPT: word [[ ...applescript string... ]] " }
{ $values { "word" "a new word to define" } { "...applescript string..." "AppleScript source text" } }
{ $description "Defines a word that when called will run the provided uncompiled AppleScript. The word has stack effect " { $snippet "( -- )" } " due to return values being currently unsupported." } ;

View File

@ -7,10 +7,10 @@ multiline words ;
IN: cocoa.apple-script
: run-apple-script ( str -- )
[ NSAppleScript -> alloc ] dip
<NSString> -> initWithSource: -> autorelease
f -> executeAndReturnError: drop ;
[ NSAppleScript send: alloc ] dip
<NSString> send: \initWithSource: send: autorelease
f send: \executeAndReturnError: drop ;
SYNTAX: APPLESCRIPT:
SYNTAX: \APPLESCRIPT:
scan-new-word scan-object
[ run-apple-script ] curry ( -- ) define-declared ;

View File

@ -6,7 +6,7 @@ HELP: <NSString>
{ $values { "str" string } { "alien" alien } }
{ $description "Allocates an autoreleased " { $snippet "CFString" } "." } ;
{ <NSString> <CFString> CF>string } related-words
{ <NSString> <CFString> CFString>string } related-words
HELP: with-autorelease-pool
{ $values { "quot" quotation } }

View File

@ -4,16 +4,16 @@ USING: alien.c-types alien.syntax cocoa cocoa.classes
cocoa.runtime core-foundation.strings kernel sequences ;
IN: cocoa.application
: <NSString> ( str -- alien ) <CFString> -> autorelease ;
: <NSString> ( str -- alien ) <CFString> send: autorelease ;
CONSTANT: NSApplicationDelegateReplySuccess 0
CONSTANT: NSApplicationDelegateReplyCancel 1
CONSTANT: NSApplicationDelegateReplyFailure 2
: with-autorelease-pool ( quot -- )
NSAutoreleasePool -> new [ call ] [ -> release ] bi* ; inline
NSAutoreleasePool send: new [ call ] [ send: release ] bi* ; inline
: NSApp ( -- app ) NSApplication -> sharedApplication ;
: NSApp ( -- app ) NSApplication send: sharedApplication ;
CONSTANT: NSAnyEventMask 0xffffffff
@ -24,24 +24,24 @@ FUNCTION: void NSBeep ( )
: add-observer ( observer selector name object -- )
[
[ NSNotificationCenter -> defaultCenter ] 2dip
[ NSNotificationCenter send: defaultCenter ] 2dip
sel_registerName
] 2dip -> addObserver:selector:name:object: ;
] 2dip send: \addObserver:selector:name:object: ;
: remove-observer ( observer -- )
[ NSNotificationCenter -> defaultCenter ] dip
-> removeObserver: ;
[ NSNotificationCenter send: defaultCenter ] dip
send: \removeObserver: ;
: cocoa-app ( quot -- )
[ call NSApp -> run ] with-cocoa ; inline
[ call NSApp send: run ] with-cocoa ; inline
: install-delegate ( receiver delegate -- )
-> alloc -> init -> setDelegate: ;
send: alloc send: init send: \setDelegate: ;
: running.app? ( -- ? )
! Test if we're running a .app.
".app"
NSBundle -> mainBundle -> bundlePath CF>string
NSBundle send: mainBundle send: bundlePath CFString>string
subseq? ;
: assert.app ( message -- )

View File

@ -2,36 +2,36 @@ USING: cocoa.messages help.markup help.syntax strings
alien core-foundation ;
IN: cocoa
HELP: ->
{ $syntax "-> selector" }
HELP: \send:
{ $syntax "send: selector" }
{ $values { "selector" "an Objective C method name" } }
{ $description "A sugared form of the following:" }
{ $code "\"selector\" send" } ;
HELP: SUPER->
{ $syntax "-> selector" }
HELP: \super:
{ $syntax "super: selector" }
{ $values { "selector" "an Objective C method name" } }
{ $description "A sugared form of the following:" }
{ $code "\"selector\" send-super" } ;
{ send super-send POSTPONE: -> POSTPONE: SUPER-> } related-words
{ send super-send postpone: \send: postpone: \super: } related-words
HELP: IMPORT:
HELP: \IMPORT:
{ $syntax "IMPORT: name" }
{ $description "Makes an Objective C class available for use." }
{ $examples
{ $code "IMPORT: QTMovie" "QTMovie \"My Movie.mov\" <NSString> f -> movieWithFile:error:" }
{ $code "IMPORT: QTMovie" "QTMovie \"My Movie.mov\" <NSString> f send: \\movieWithFile:error:" }
} ;
ARTICLE: "objc-calling" "Calling Objective C code"
"Before an Objective C class can be used, it must be imported; by default, a small set of common classes are imported automatically, but additional classes can be imported as needed."
{ $subsections POSTPONE: IMPORT: }
{ $subsections postpone: \IMPORT: }
"Every imported Objective C class has as corresponding class word in the " { $vocab-link "cocoa.classes" } " vocabulary. Class words push the class object in the stack, allowing class methods to be invoked."
$nl
"Messages can be sent to classes and instances using a pair of parsing words:"
{ $subsections
POSTPONE: ->
POSTPONE: SUPER->
postpone: \send:
postpone: \super:
}
"These parsing words are actually syntax sugar for a pair of ordinary words; they can be used instead of the parsing words if the selector name is dynamically computed:"
{ $subsections

View File

@ -4,15 +4,15 @@ namespaces tools.test ;
IN: cocoa.tests
<CLASS: Foo < NSObject
METHOD: void foo: NSRect rect [
COCOA-METHOD: void foo: NSRect rect [
gc rect "x" set
] ;
;CLASS>
: test-foo ( -- )
Foo -> alloc -> init
dup 1.0 2.0 101.0 102.0 <CGRect> -> foo:
-> release ;
Foo send: alloc send: init
dup 1.0 2.0 101.0 102.0 <CGRect> send: \foo:
send: release ;
{ } [ test-foo ] unit-test
@ -22,14 +22,14 @@ IN: cocoa.tests
{ 102.0 } [ "x" get CGRect-h ] unit-test
<CLASS: Bar < NSObject
METHOD: NSRect bar [ test-foo "x" get ] ;
COCOA-METHOD: NSRect bar [ test-foo "x" get ] ;
;CLASS>
{ } [
Bar [
-> alloc -> init
dup -> bar "x" set
-> release
send: alloc send: init
dup send: bar "x" set
send: release
] compile-call
] unit-test
@ -40,15 +40,15 @@ IN: cocoa.tests
! Make sure that we can add methods
<CLASS: Bar < NSObject
METHOD: NSRect bar [ test-foo "x" get ] ;
COCOA-METHOD: NSRect bar [ test-foo "x" get ] ;
METHOD: int babb: int x [ x sq ] ;
COCOA-METHOD: int babb: int x [ x sq ] ;
;CLASS>
{ 144 } [
Bar [
-> alloc -> init
dup 12 -> babb:
swap -> release
send: alloc send: init
dup 12 send: \babb:
swap send: release
] compile-call
] unit-test

View File

@ -11,18 +11,19 @@ sent-messages [ H{ } clone ] initialize
: remember-send ( selector -- )
dup sent-messages get set-at ;
SYNTAX: ->
scan-token dup remember-send
SYNTAX: \send:
scan-token unescape-token dup remember-send
[ lookup-method suffix! ] [ suffix! ] bi \ send suffix! ;
SYNTAX: ?->
SYNTAX: \?send:
dup last cache-stubs
scan-token dup remember-send
scan-token unescape-token dup remember-send
suffix! \ send suffix! ;
SYNTAX: SEL:
scan-token dup remember-send
<selector> suffix! \ cocoa.messages:selector suffix! ;
SYNTAX: \selector:
scan-token unescape-token
[ remember-send ]
[ <selector> suffix! \ cocoa.messages:selector suffix! ] bi ;
SYMBOL: super-sent-messages
@ -31,19 +32,18 @@ super-sent-messages [ H{ } clone ] initialize
: remember-super-send ( selector -- )
dup super-sent-messages get set-at ;
SYNTAX: SUPER->
scan-token dup remember-super-send
SYNTAX: \super:
scan-token unescape-token dup remember-super-send
[ lookup-method suffix! ] [ suffix! ] bi \ super-send suffix! ;
SYMBOL: frameworks
frameworks [ V{ } clone ] initialize
[ frameworks get [ load-framework ] each ] "cocoa" add-startup-hook
SYNTAX: FRAMEWORK: scan-token [ load-framework ] [ frameworks get push ] bi ;
SYNTAX: \FRAMEWORK: scan-token [ load-framework ] [ frameworks get push ] bi ;
SYNTAX: IMPORT: scan-token [ ] import-objc-class ;
SYNTAX: \IMPORT: scan-token [ ] import-objc-class ;
"Importing Cocoa classes..." print

View File

@ -5,27 +5,27 @@ core-foundation.strings kernel splitting ;
IN: cocoa.dialogs
: <NSOpenPanel> ( -- panel )
NSOpenPanel -> openPanel
dup 1 -> setCanChooseFiles:
dup 0 -> setCanChooseDirectories:
dup 1 -> setResolvesAliases:
dup 1 -> setAllowsMultipleSelection: ;
NSOpenPanel send: openPanel
dup 1 send: \setCanChooseFiles:
dup 0 send: \setCanChooseDirectories:
dup 1 send: \setResolvesAliases:
dup 1 send: \setAllowsMultipleSelection: ;
: <NSDirPanel> ( -- panel ) <NSOpenPanel>
dup 1 -> setCanChooseDirectories: ;
dup 1 send: \setCanChooseDirectories: ;
: <NSSavePanel> ( -- panel )
NSSavePanel -> savePanel
dup 1 -> setCanChooseFiles:
dup 0 -> setCanChooseDirectories:
dup 0 -> setAllowsMultipleSelection: ;
NSSavePanel send: savePanel
dup 1 send: \setCanChooseFiles:
dup 0 send: \setCanChooseDirectories:
dup 0 send: \setAllowsMultipleSelection: ;
CONSTANT: NSOKButton 1
CONSTANT: NSCancelButton 0
: (open-panel) ( panel -- paths )
dup -> runModal NSOKButton =
[ -> filenames CF>string-array ] [ drop f ] if ;
dup send: runModal NSOKButton =
[ send: filenames CFString>string-array ] [ drop f ] if ;
: open-panel ( -- paths ) <NSOpenPanel> (open-panel) ;
@ -36,5 +36,5 @@ CONSTANT: NSCancelButton 0
: save-panel ( path -- path/f )
[ <NSSavePanel> dup ] dip
split-path -> runModalForDirectory:file: NSOKButton =
[ -> filename CF>string ] [ drop f ] if ;
split-path send: \runModalForDirectory:file: NSOKButton =
[ send: filename CFString>string ] [ drop f ] if ;

View File

@ -17,7 +17,7 @@ CONSTANT: NS-EACH-BUFFER-SIZE 16
] with-destructors ; inline
:: (NSFastEnumeration-each) ( ... object quot: ( ... elt -- ) state stackbuf count -- ... )
object state stackbuf count -> countByEnumeratingWithState:objects:count: :> items-count
object state stackbuf count send: \countByEnumeratingWithState:objects:count: :> items-count
items-count 0 = [
state itemsPtr>> [ items-count id <c-direct-array> ] [ stackbuf ] if* :> items
items-count <iota> [ items nth quot call ] each

View File

@ -14,7 +14,7 @@ HELP: super-send
HELP: objc-class
{ $values { "string" string } { "class" alien } }
{ $description "Outputs the Objective C class named by " { $snippet "string" } ". This class can then be used as the receiver in message sends calling class methods, for example:"
{ $code "NSMutableArray -> alloc" } }
{ $code "NSMutableArray send: alloc" } }
{ $errors "Throws an error if there is no class named by " { $snippet "string" } "." } ;
HELP: objc-meta-class

View File

@ -45,7 +45,7 @@ super-message-senders [ H{ } clone ] initialize
TUPLE: selector-tuple name object ;
: selector-name ( name -- name' )
CHAR: . over index [ 0 > [ "." split1 nip ] when ] when* ;
char: . over index [ 0 > [ "." split1 nip ] when ] when* ;
MEMO: <selector> ( name -- sel )
selector-name f selector-tuple boa ;
@ -126,7 +126,6 @@ H{
{ "@" id }
{ "#" Class }
{ ":" SEL }
{ "(" c:void* }
}
cell {
{ 4 [ H{
@ -188,7 +187,7 @@ cell {
assoc-union alien>objc-types set-global
: objc-struct-type ( i string -- ctype )
[ CHAR: = ] 2keep index-from swap subseq
[ char: = ] 2keep index-from swap subseq
objc>struct-types get at* [ drop void* ] unless ;
ERROR: no-objc-type name ;
@ -200,9 +199,9 @@ ERROR: no-objc-type name ;
: (parse-objc-type) ( i string -- ctype )
[ [ 1 + ] dip ] [ nth ] 2bi {
{ [ dup "rnNoORV" member? ] [ drop (parse-objc-type) ] }
{ [ dup CHAR: ^ = ] [ 3drop void* ] }
{ [ dup CHAR: { = ] [ drop objc-struct-type ] }
{ [ dup CHAR: [ = ] [ 3drop void* ] }
{ [ dup char: ^ = ] [ 3drop void* ] }
{ [ dup char: \{ = ] [ drop objc-struct-type ] }
{ [ dup char: \[ = ] [ 3drop void* ] }
[ 2nip decode-type ]
} cond ;
@ -238,7 +237,7 @@ ERROR: no-objc-type name ;
: method-collisions ( -- collisions )
objc-methods get >alist
[ first CHAR: . swap member? ] filter
[ first char: . swap member? ] filter
[ first "." split1 nip ] collect-by
[ nip values members length 1 > ] assoc-filter ;

View File

@ -6,15 +6,15 @@ IN: cocoa.nibs
: load-nib ( name -- )
NSBundle
swap <NSString> NSApp -> loadNibNamed:owner:
swap <NSString> NSApp send: \loadNibNamed:owner:
drop ;
: nib-named ( nib-name -- anNSNib )
<NSString> NSNib -> alloc swap f -> initWithNibNamed:bundle:
dup [ -> autorelease ] when ;
<NSString> NSNib send: alloc swap f send: \initWithNibNamed:bundle:
dup [ send: autorelease ] when ;
: nib-objects ( anNSNib -- objects/f )
f
{ void* } [ -> instantiateNibWithOwner:topLevelObjects: ]
{ void* } [ send: \instantiateNibWithOwner:topLevelObjects: ]
with-out-parameters
swap [ CF>array ] [ drop f ] if ;
swap [ CFArray>array ] [ drop f ] if ;

View File

@ -1,26 +1,25 @@
! Copyright (C) 2006, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.accessors arrays cocoa cocoa.application
core-foundation.arrays core-foundation.strings kernel sequences
;
core-foundation.arrays core-foundation.strings kernel sequences ;
IN: cocoa.pasteboard
CONSTANT: NSStringPboardType "NSStringPboardType"
: pasteboard-string? ( pasteboard -- ? )
NSStringPboardType swap -> types CF>string-array member? ;
NSStringPboardType swap send: types CFString>string-array member? ;
: pasteboard-string ( pasteboard -- str )
NSStringPboardType <NSString> -> stringForType:
dup [ CF>string ] when ;
NSStringPboardType <NSString> send: \stringForType:
dup [ CFString>string ] when ;
: set-pasteboard-types ( seq pasteboard -- )
swap <CFArray> -> autorelease f -> declareTypes:owner: drop ;
swap <CFArray> send: autorelease f send: \declareTypes:owner: drop ;
: set-pasteboard-string ( str pasteboard -- )
NSStringPboardType <NSString>
dup 1array pick set-pasteboard-types
[ swap <NSString> ] dip -> setString:forType: drop ;
[ swap <NSString> ] dip send: \setString:forType: drop ;
: pasteboard-error ( error -- f )
"Pasteboard does not hold a string" <NSString>

View File

@ -8,10 +8,10 @@ core-foundation.utilities fry io.backend kernel macros math
quotations sequences ;
IN: cocoa.plists
: >plist ( value -- plist ) >cf -> autorelease ;
: >plist ( value -- plist ) >cf send: autorelease ;
: write-plist ( assoc path -- )
[ >plist ] [ normalize-path <NSString> ] bi* 0 -> writeToFile:atomically:
[ >plist ] [ normalize-path <NSString> ] bi* 0 send: \writeToFile:atomically:
[ "write-plist failed" throw ] unless ;
DEFER: plist>
@ -19,30 +19,30 @@ DEFER: plist>
<PRIVATE
: (plist-NSNumber>) ( NSNumber -- number )
dup -> doubleValue dup >integer =
[ -> longLongValue ] [ -> doubleValue ] if ;
dup send: doubleValue dup >integer =
[ send: longLongValue ] [ send: doubleValue ] if ;
: (plist-NSData>) ( NSData -- byte-array )
dup -> length <byte-array> [ -> getBytes: ] keep ;
dup send: length <byte-array> [ send: \getBytes: ] keep ;
: (plist-NSArray>) ( NSArray -- vector )
[ plist> ] NSFastEnumeration-map ;
: (plist-NSDictionary>) ( NSDictionary -- hashtable )
dup [ [ nip ] [ -> valueForKey: ] 2bi [ plist> ] bi@ ] with
dup [ [ nip ] [ send: \valueForKey: ] 2bi [ plist> ] bi@ ] with
NSFastEnumeration>hashtable ;
: (read-plist) ( NSData -- id )
NSPropertyListSerialization swap kCFPropertyListImmutable f
{ void* }
[ -> propertyListFromData:mutabilityOption:format:errorDescription: ]
[ send: \propertyListFromData:mutabilityOption:format:errorDescription: ]
with-out-parameters
[ -> release "read-plist failed" throw ] when* ;
[ send: release "read-plist failed" throw ] when* ;
MACRO: objc-class-case ( alist -- quot )
[
dup callable?
[ first2 [ '[ dup _ execute -> isKindOfClass: c-bool> ] ] dip 2array ]
[ first2 [ '[ dup _ execute send: \isKindOfClass: c-bool> ] ] dip 2array ]
unless
] map '[ _ cond ] ;
@ -52,7 +52,7 @@ ERROR: invalid-plist-object object ;
: plist> ( plist -- value )
{
{ NSString [ CF>string ] }
{ NSString [ CFString>string ] }
{ NSNumber [ (plist-NSNumber>) ] }
{ NSData [ (plist-NSData>) ] }
{ NSArray [ (plist-NSArray>) ] }
@ -63,5 +63,5 @@ ERROR: invalid-plist-object object ;
: read-plist ( path -- assoc )
normalize-path <NSString>
NSData swap -> dataWithContentsOfFile:
NSData swap send: \dataWithContentsOfFile:
[ (read-plist) plist> ] [ "read-plist failed" throw ] if* ;

View File

@ -1,23 +1,23 @@
USING: help.markup help.syntax strings alien hashtables ;
IN: cocoa.subclassing
HELP: <CLASS:
HELP: \<CLASS:
{ $syntax "<CLASS: name < superclass protocols... imeth... ;CLASS>" }
{ $values { "name" "a new class name" } { "superclass" "a superclass name" } { "protocols" "zero or more protocol names" } { "imeth" "instance method definitions using " { $link POSTPONE: METHOD: } } }
{ $description "Defines a new Objective C class. Instance methods are defined with the " { $link POSTPONE: METHOD: } " parsing word."
{ $values { "name" "a new class name" } { "superclass" "a superclass name" } { "protocols" "zero or more protocol names" } { "imeth" "instance method definitions using " { $link postpone: \COCOA-METHOD: } } }
{ $description "Defines a new Objective C class. Instance methods are defined with the " { $link postpone: \COCOA-METHOD: } " parsing word."
$nl
"This word is preferred to calling " { $link define-objc-class } ", because it creates a class word in the " { $vocab-link "cocoa.classes" } " vocabulary at parse time, allowing code to refer to the class word in the same source file where the class is defined." } ;
{ define-objc-class POSTPONE: <CLASS: POSTPONE: METHOD: } related-words
{ define-objc-class postpone: \<CLASS: postpone: \COCOA-METHOD: } related-words
HELP: METHOD:
{ $syntax "METHOD: return foo: type1 arg1 bar: type2 arg2 baz: ... [ body ] ;" }
HELP: \COCOA-METHOD:
{ $syntax "COCOA-METHOD: return foo: type1 arg1 bar: type2 arg2 baz: ... [ body ] ;" }
{ $values { "return" "a C type name" } { "type1" "a C type name" } { "arg1" "a local variable name" } { "body" "arbitrary code" } }
{ $description "Defines a method inside of a " { $link POSTPONE: <CLASS: } " form." } ;
{ $description "Defines a method inside of a " { $link postpone: \<CLASS: } " form." } ;
ARTICLE: "objc-subclassing" "Subclassing Objective C classes"
"Objective C classes can be subclassed, with new methods defined in Factor, using parsing words:"
{ $subsections POSTPONE: <CLASS: POSTPONE: METHOD: }
{ $subsections postpone: \<CLASS: postpone: \COCOA-METHOD: }
"Objective C class definitions are saved in the image. If the image is saved and Factor is restarted with the saved image, custom class definitions are made available to the Objective C runtime when they are first accessed from within Factor." ;
ABOUT: "objc-subclassing"

View File

@ -71,12 +71,12 @@ IN: cocoa.subclassing
TUPLE: cocoa-protocol name ;
C: <cocoa-protocol> cocoa-protocol
SYNTAX: COCOA-PROTOCOL:
SYNTAX: \COCOA-PROTOCOL:
scan-token <cocoa-protocol> suffix! ;
SYMBOL: ;CLASS>
SYMBOL: \;CLASS>
SYNTAX: <CLASS:
SYNTAX: \<CLASS:
scan-token
"<" expect
scan-token
@ -101,7 +101,7 @@ SYNTAX: <CLASS:
[ [ make-local ] map ] H{ } make
(parse-lambda) <lambda> ?rewrite-closures first ;
SYNTAX: METHOD:
SYNTAX: \COCOA-METHOD:
scan-c-type
parse-selector
parse-method-body [ swap ] 2dip 4array ";" expect

View File

@ -1,23 +1,22 @@
! Copyright (C) 2017 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types cocoa cocoa.classes cocoa.messages
cocoa.runtime combinators core-foundation.strings kernel locals
;
cocoa.runtime combinators core-foundation.strings kernel locals ;
IN: cocoa.touchbar
: make-touchbar ( seq self -- touchbar )
[ NSTouchBar -> alloc -> init dup ] dip -> setDelegate: {
[ swap <CFStringArray> { void { id SEL id } } ?-> setDefaultItemIdentifiers: ]
[ swap <CFStringArray> { void { id SEL id } } ?-> setCustomizationAllowedItemIdentifiers: ]
[ NSTouchBar send: alloc send: init dup ] dip send: setDelegate: {
[ swap <CFStringArray> send: \setDefaultItemIdentifiers: ]
[ swap <CFStringArray> send: \setCustomizationAllowedItemIdentifiers: ]
[ nip ]
} 2cleave ;
:: make-NSTouchBar-button ( self identifier label-string action-string -- button )
NSCustomTouchBarItem -> alloc
identifier <CFString> { id { id SEL id } } ?-> initWithIdentifier: :> item
NSCustomTouchBarItem send: alloc
identifier <CFString> send: \initWithIdentifier: :> item
NSButton
label-string <CFString>
self
action-string lookup-selector { id { id SEL id id SEL } } ?-> buttonWithTitle:target:action: :> button
item button -> setView:
action-string lookup-selector send: \buttonWithTitle:target:action: :> button
item button send: \setView:
item ;

View File

@ -1,11 +1,9 @@
! Copyright (C) 2006, 2009 Slava Pestov
! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types alien.syntax classes.struct cocoa.runtime
core-graphics.types kernel literals layouts ;
core-graphics.types ;
IN: cocoa.types
CONSTANT: NSNotFound $[ 32bit? 0x7fffffff 0x7fffffffffffffff ? ]
TYPEDEF: long NSInteger
TYPEDEF: ulong NSUInteger

View File

@ -59,21 +59,21 @@ CONSTANT: NSOpenGLProfileVersion3_2Core 0x3200
CONSTANT: NSOpenGLProfileVersion4_1Core 0x4100
: <GLView> ( class dim pixel-format -- view )
[ -> alloc ]
[ send: alloc ]
[ [ 0 0 ] dip first2 <CGRect> ]
[ handle>> ] tri*
-> initWithFrame:pixelFormat:
dup 1 -> setPostsBoundsChangedNotifications:
dup 1 -> setPostsFrameChangedNotifications: ;
send: \initWithFrame:pixelFormat:
dup 1 send: \setPostsBoundsChangedNotifications:
dup 1 send: \setPostsFrameChangedNotifications: ;
: view-dim ( view -- dim )
-> bounds
send: bounds
[ CGRect-w >fixnum ] [ CGRect-h >fixnum ] bi
2array ;
: mouse-location ( view event -- loc )
[
-> locationInWindow f -> convertPoint:fromView:
send: locationInWindow f send: \convertPoint:fromView:
[ x>> ] [ y>> ] bi
] [ drop -> frame CGRect-h ] 2bi
] [ drop send: frame CGRect-h ] 2bi
swap - [ >integer ] bi@ 2array ;

View File

@ -22,19 +22,19 @@ CONSTANT: NSBackingStoreNonretained 1
CONSTANT: NSBackingStoreBuffered 2
: <NSWindow> ( rect style class -- window )
[ -> alloc ] curry 2dip NSBackingStoreBuffered 1
-> initWithContentRect:styleMask:backing:defer: ;
[ send: alloc ] curry 2dip NSBackingStoreBuffered 1
send: \initWithContentRect:styleMask:backing:defer: ;
: class-for-style ( style -- NSWindow/NSPanel )
0x1ef0 bitand zero? NSWindow NSPanel ? ;
: <ViewWindow> ( view rect style -- window )
dup class-for-style <NSWindow> [ swap -> setContentView: ] keep
dup dup -> contentView -> setInitialFirstResponder:
dup 1 -> setAcceptsMouseMovedEvents:
dup 0 -> setReleasedWhenClosed: ;
dup class-for-style <NSWindow> [ swap send: \setContentView: ] keep
dup dup send: contentView send: \setInitialFirstResponder:
dup 1 send: \setAcceptsMouseMovedEvents:
dup 0 send: \setReleasedWhenClosed: ;
: window-content-rect ( window -- rect )
dup -> class swap
[ -> frame ] [ -> styleMask ] bi
-> contentRectForFrameRect:styleMask: ;
dup send: class swap
[ send: frame ] [ send: styleMask ] bi
send: \contentRectForFrameRect:styleMask: ;

View File

@ -1 +0,0 @@
colors

View File

@ -4,21 +4,21 @@ USING: help.markup help.syntax strings colors ;
HELP: named-color
{ $values { "name" string } { "color" color } }
{ $description "Outputs a named color from the color database." }
{ $notes "In most cases, " { $link POSTPONE: COLOR: } " should be used instead." }
{ $notes "In most cases, " { $link postpone: \color: } " should be used instead." }
{ $errors "Throws an error if the color is not listed in " { $snippet "rgb.txt" } ", " { $snippet "factor-colors.txt" } " or " { $snippet "solarized-colors.txt" } "." } ;
HELP: named-colors
{ $values { "keys" "a sequence of strings" } }
{ $description "Outputs a sequence of all colors in the " { $snippet "rgb.txt" } " database." } ;
HELP: COLOR:
{ $syntax "COLOR: name" }
HELP: \color:
{ $syntax "color: name" }
{ $description "Parses as a " { $link color } " object with the given name." }
{ $errors "Throws an error if the color is not listed in " { $snippet "rgb.txt" } "." }
{ $examples
{ $code
"USING: colors.constants io.styles ;"
"\"Hello!\" { { foreground COLOR: cyan } } format nl"
"\"Hello!\" { { foreground color: cyan } } format nl"
}
} ;
@ -27,7 +27,7 @@ ARTICLE: "colors.constants" "Standard color database"
{ $subsections
named-color
named-colors
POSTPONE: COLOR:
postpone: \color:
} ;
ABOUT: "colors.constants"

View File

@ -2,4 +2,4 @@
! See http://factorcode.org/license.txt for BSD license.
USING: colors colors.constants tools.test ;
{ t } [ COLOR: light-green rgba? ] unit-test
{ t } [ color: light-green rgba? ] unit-test

View File

@ -1,7 +1,7 @@
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel assocs math math.parser memoize io.encodings.utf8
io.files lexer parser colors sequences splitting ascii ;
USING: ascii assocs colors io.encodings.utf8 io.files kernel
lexer math math.parser sequences splitting ;
IN: colors.constants
<PRIVATE
@ -9,7 +9,7 @@ IN: colors.constants
: parse-color ( line -- name color )
first4
[ [ string>number 255 /f ] tri@ 1.0 <rgba> ] dip
[ blank? ] trim-head H{ { CHAR: \s CHAR: - } } substitute swap ;
[ blank? ] trim-head H{ { char: \s char: - } } substitute swap ;
: parse-colors ( lines -- assoc )
[ "!" head? ] reject
@ -31,4 +31,4 @@ ERROR: no-such-color name ;
: named-color ( name -- color )
dup colors at [ ] [ no-such-color ] ?if ;
SYNTAX: COLOR: scan-token named-color suffix! ;
SYNTAX: \color: scan-token named-color suffix! ;

View File

@ -1 +0,0 @@
colors

Some files were not shown because too many files have changed in this diff Show More