Paste: Conversation about printf

Author: Various
Mode: factor
Date: Tue, 7 May 2013 13:49:28
Plain Text |
mrjbq7: Sonderblade: printf only supports literal format strings right now
[04:21am] mrjbq7: that could probably be fixed, just how it is now
[04:28am] erikc: calling out to C printf?
[04:29am] erikc: with a dynamic format string?
[04:29am] mrjbq7: printf uses EBNF to parse the format string and compile it into the format instructions at parse-time
[04:29am] mrjbq7: we don't have a run-time version i think
[04:30am] mrjbq7: one my my first projects in factor, thought that was a neat feature, didn't realize until later it meant you had to have a literal format string
[04:30am] mrjbq7: since it is consuming an unknown number of things from the stack
[04:30am] erikc: ah hehe, we'd just have to apply the EBNF at runtime
[04:31am] mrjbq7: right
[04:31am] erikc: i was gonna say, the C FFI doesnt really support varargs
[04:31am] mrjbq7: oh right
[04:31am] mrjbq7: similar problem maybe 
[04:32am] erikc: the problem with C FFI for varargs is you'd need to generate a type-specific assembly transition for each call site
[04:34am] erikc: so to do it justice you'd need to make FFI varargs be a little function that looks at the C type of the arguments, dynamically declares an anonymous C FFI function with that type signature, and then call that
[04:35am] erikc: pain in the ass 
[04:37am] mrjbq7: haha yep
[04:39am] erikc: i think the only 2 things Factor's C FFI doesn't support is that and ABI-compliant bitfields
[05:06am] mtp: lhttps://github.com/atgreen/libffi/blob/master/man/ffi_prep_cif_var.3 somewhat related, i guess!
[05:07am] mtp: s/^l//
[05:09am] mtp: you could, i suppose, use the factor ffi to bind to libffi to call variadics. 

Annotation: oi

Author: Felipe
Mode: factor
Date: Tue, 25 Jun 2013 01:23:41
Plain Text |
           ___
         /`   `'.
        /   _..---;
        |  /__..._/  .--.-.
        |.'  e e | ___\_|/____
       (_)'--.o.--|    | |    |
      .-( `-' = `-|____| |____|
     /  (         |____   ____|
     |   (        |_   | |  __|
     |    '-.--';/'/__ | | (  `|
     |      '.   \    )"";--`\ /
     \        ;   |--'    `;.-'
     |`-.__ ..-'--'`;..--'`

Annotation: 1

Author: oi
Mode: c
Date: Tue, 25 Jun 2013 01:24:22
Plain Text |
           ___
         /`   `'.
        /   _..---;
        |  /__..._/  .--.-.
        |.'  e e | ___\_|/____
       (_)'--.o.--|    | |    |
      .-( `-' = `-|____| |____|
     /  (         |____   ____|
     |   (        |_   | |  __|
     |    '-.--';/'/__ | | (  `|
     |      '.   \    )"";--`\ /
     \        ;   |--'    `;.-'
     |`-.__ ..-'--'`;..--'`

New Annotation

Summary:
Author:
Mode:
Body: