Comments (2)
I can see the appeal of having a built-in println
function or statement, but that's tricky. For example, Wuffs-the-language has not needed a string type so far (other than for error messages), or varargs, whether variant in number or in type, especially as every call argument is currently explicitly named: it's foo(a:x, b:y)
not just foo(x, y)
.
Instead, I've been adding printf
s to the generated C code. It's crude, but it suffices. That's why, in gen/c/std/*.c
, there's
// Uncomment this #include for printf-debugging.
// #include <stdio.h>
If you're using the wuffs
command line tool, such as wuffs test
, be aware of flags like -ccompilers
, -focus
and -skipgen
. Run wuffs test -?
for some brief documentation.
As for packages outside of std
, I definitely want to support that one day, but it hasn't been the highest priority thing to work on yet.
You can run wuffs-c
directly, or you can fork wuffs and add your own code under std
. Maybe a symlink would work, if you're just playing around and don't care yet about version control, I haven't tried. Yeah, the workflow isn't ideal. Sorry.
from wuffs.
For example, Wuffs-the-language has not needed a string type so far (other than for error messages), or varargs
That's a good point. I'm afraid I don't have a good, specific proposal of what I would add to the language, then. Varargs wouldn't be necessary, but "empty interface" and string types would still be necessary for a println func to be useful.
Is there any way that we could allow printfs in wuffs, as opposed to a print/println? For example, forgetting the syntax for a moment, suppose I could do:
//wuffs:c printf("length = %d", length);
That is, telling the wuffs-c generator to include a line in the C output at this position. Then, if I were generating/testing Go, I'd instead write something like //wuffs:go fmt.Println("length", length)
.
I realise including this in the language as a formal feature can get ugly; it doesn't need to be guaranteed to work forever, much like Go's print/println. And I also imagine that the include dance with printf
in C might get tricky. But it seems to me like a possible way to introduce debug prints without having to worry about Wuff's syntax and language features, nor with modifying generated code by hand.
A different version of this idea is a println; //wuffs:println("length =", length)
, which would get translated to printf
, fmt.Println
, or whatever the language equivalent is. Narrower and perhaps simpler to implement reliably, but also not as powerful as "insert any C statement here".
If you're using the wuffs command line tool, such as wuffs test
If only I could without hacks :)
Yeah, the workflow isn't ideal. Sorry.
Oh, that is fine - wuffs-c
is not hard to use. I think a "hello world" example using it, complete with how to build a working binary, would be very useful though. It took me a good half hour to figure that out, when the solution wasn't really complex. I just had to dig through the codebase, which is a bit unnecessary. I'll open an issue about it.
from wuffs.
Related Issues (20)
- Slow f64 parsing HOT 13
- RGB/BGR 16 bit treated like RGBA/BGRA? HOT 1
- OSS-Fuzz issue 59018 HOT 1
- [JPEG] unsupported DQT after SOF markers HOT 1
- OSS-Fuzz issue 59182 HOT 1
- OSS-Fuzz issue 59540 HOT 1
- OSS-Fuzz issue 59966 HOT 1
- A question regarding auxiliary C++ API HOT 4
- What is the status of version 0.3? HOT 3
- Empty slice manipulation triggers UBSAN by offsetting from a null pointer. HOT 2
- error: conversion to ‘uint32_t’ {aka ‘unsigned int’} from ‘int’ may change the sign of the result HOT 3
- OSS-Fuzz issue 66816 HOT 1
- PNG's are stored in RGB order but Wuffs returns BGR/BGRA? HOT 1
- Decode PNG with gray+alpha as 2 channels (i.e. YA not BGRA) HOT 5
- Warning about always true comparison of integers HOT 1
- std/crc64 doesn't build for 32-bit x86 HOT 1
- Allowing LA and RGBA PNGs with a tRNS chunk HOT 2
- How to get the correct 'transparency' value in the DecodeImage API? HOT 2
- wuffs 0.4 significantly slower than 0.3 decoding PNGs HOT 27
- wuffs significantly slower than OpenCV 4.9.0 when decoding PNGs for 7680x4320 image HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wuffs.