![]() |
Customizing printf
Recently I was wondering how to extend lcc-win's printf to support 128
bit integers, and searching the net I found this: http://www.gnu.org/s/hello/manual/li...ng-Printf.html Apparently gcc has an interface for customizing printf that looks quite interesting. I would like to know if anybody here has experience with using this, I am considering implementing it in lcc-win. Thanks |
Re: Customizing printf
On 11/15/2011 08:36 AM, jacob navia wrote:
> http://www.gnu.org/s/hello/manual/li...ng-Printf.html > > Apparently gcc has an interface for customizing printf that looks quite > interesting. > > I would like to know if anybody here has experience with using this, I > am considering implementing it in lcc-win. I've never used GCC's (actually, the GNU C Library's) extendible printf, but I have used Plan 9's libfmt, which has a similar idea. A Unix port is available at <http://swtch.com/plan9port/unix/>. It's a nice extension, on occasion. By the way, if you generally use Microsoft's C library in lcc-win, you might warn your users that MS printf extensions they're used to using are no longer there. --Joel |
Re: Customizing printf
jacob navia <jacob@spamsink.net> writes:
> Recently I was wondering how to extend lcc-win's printf to support 128 > bit integers, and searching the net I found this: > > http://www.gnu.org/s/hello/manual/li...ng-Printf.html > > Apparently gcc has an interface for customizing printf that looks quite > interesting. One reason that I have never used glibc's extensible printf is that GCC can't be configured to type-check the arguments for extensions, so you get warnings for correct use of extensions. -- Ben Pfaff http://benpfaff.org |
Re: Customizing printf
Le 15/11/11 19:10, Ben Pfaff a écrit :
> jacob navia<jacob@spamsink.net> writes: > >> Recently I was wondering how to extend lcc-win's printf to support 128 >> bit integers, and searching the net I found this: >> >> http://www.gnu.org/s/hello/manual/li...ng-Printf.html >> >> Apparently gcc has an interface for customizing printf that looks quite >> interesting. > > One reason that I have never used glibc's extensible printf is > that GCC can't be configured to type-check the arguments for > extensions, so you get warnings for correct use of extensions. This will not happen in lcc-win. Check functions can be provided that will be loaded by the compiler at startup or can be linked into the compiler. |
Re: Customizing printf
jacob navia <jacob@spamsink.net> writes:
> Le 15/11/11 19:10, Ben Pfaff a écrit : >> jacob navia<jacob@spamsink.net> writes: >> >>> Recently I was wondering how to extend lcc-win's printf to support 128 >>> bit integers, and searching the net I found this: >>> >>> http://www.gnu.org/s/hello/manual/li...ng-Printf.html >>> >>> Apparently gcc has an interface for customizing printf that looks quite >>> interesting. >> >> One reason that I have never used glibc's extensible printf is >> that GCC can't be configured to type-check the arguments for >> extensions, so you get warnings for correct use of extensions. > > This will not happen in lcc-win. Check functions can be provided that > will be loaded by the compiler at startup or can be linked into the > compiler. I'm glad to hear that you are planning to avoid that problem. I wish that GCC would also arrange a solution. -- char a[]="\n .CJacehknorstu";int putchar(int);int main(void){unsigned long b[] ={0x67dffdff,0x9aa9aa6a,0xa77ffda9,0x7da6aa6a,0xa6 7f6aaa,0xaa9aa9f6,0x11f6},*p =b,i=24;for(;p+=!*p;*p/=4)switch(0[p]&3)case 0:{return 0;for(p--;i--;i--)case+ 2:{i++;if(i)break;else default:continue;if(0)case 1:putchar(a[i&15]);break;}}} |
Re: Customizing printf
On 11/15/2011 03:51 PM, Ben Pfaff wrote:
> jacob navia <jacob@spamsink.net> writes: >> Le 15/11/11 19:10, Ben Pfaff a écrit : >>> One reason that I have never used glibc's extensible printf is >>> that GCC can't be configured to type-check the arguments for >>> extensions, so you get warnings for correct use of extensions. >> >> This will not happen in lcc-win. Check functions can be provided that >> will be loaded by the compiler at startup or can be linked into the >> compiler. > > I'm glad to hear that you are planning to avoid that problem. I > wish that GCC would also arrange a solution. See the examples given for libfmt at <http://swtch.com/plan9port/unix/man/fmtinstall3.html>. The example includes #pragmas suitable for Ken Thompson's C compilers (as distributed with Plan 9 or with Google Go): #pragma varargck type "X" Complex Hard to get much simpler than that... JST |
Re: Customizing printf
jacob navia was trying to save the world with his stuff:
> Recently I was wondering how to extend lcc-win's printf to support ... > ...am considering implementing it in lcc-win. You self-celebrating ****o. There only exist your things to you: that silly lcc-win and your funny containers. Stop making this newsgroup your personal advertisements page. |
Re: Customizing printf
In article <nzOwq.98710$GZ3.88426@tornado.fastwebnet.it>,
-.- <none@none.none> wrote: >jacob navia was trying to save the world with his stuff: > >> Recently I was wondering how to extend lcc-win's printf to support ... >> ...am considering implementing it in lcc-win. > >You self-celebrating ****o. There only exist your things to you: >that silly lcc-win and your funny containers. >Stop making this newsgroup your personal advertisements page. Looks like somebody didn't get enough mommy-love. -- But the Bush apologists hope that you won't remember all that. And they also have a theory, which I've been hearing more and more - namely, that President Obama, though not yet in office or even elected, caused the 2008 slump. You see, people were worried in advance about his future policies, and that's what caused the economy to tank. Seriously. (Paul Krugman - Addicted to Bush) |
Re: Customizing printf
On 2011-11-16, -.- <none@none.none> wrote:
> jacob navia was trying to save the world with his stuff: >> Recently I was wondering how to extend lcc-win's printf to support ... >> ...am considering implementing it in lcc-win. > There only exist your things to you: > that silly lcc-win and your funny containers. > Stop making this newsgroup your personal advertisements page. I have Mr. Navia plonked because of his habit of random and unjustified flames, so I thank you for calling that post to my attention, since it has some cool ideas in a field I have previously thought about. I even got as far as a test implementation of a printf which let you pass formatting functions as arguments, although I never got around to a "register new characters" feature. -s -- Copyright 2011, all wrongs reversed. Peter Seebach / usenet-nospam@seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated! I am not speaking for my employer, although they do rent some of my opinions. |
Re: Customizing printf
Seebs <usenet-nospam@seebs.net> writes:
> On 2011-11-16, -.- <none@none.none> wrote: > > jacob navia was trying to save the world with his stuff: > >> Recently I was wondering how to extend lcc-win's printf to support ... > >> ...am considering implementing it in lcc-win. > > > There only exist your things to you: > > that silly lcc-win and your funny containers. > > Stop making this newsgroup your personal advertisements page. > > I have Mr. Navia plonked because of his habit of random and unjustified > flames, so I thank you for calling that post to my attention, since it has > some cool ideas in a field I have previously thought about. I even got > as far as a test implementation of a printf which let you pass formatting > functions as arguments, although I never got around to a "register new > characters" feature. We should swap code - I implemented the "register new characters" feature... (OK, there was one 'extension' character, and you registered new modifiers to that.) Phil -- Unix is simple. It just takes a genius to understand its simplicity -- Dennis Ritchie (1941-2011), Unix Co-Creator |
| All times are GMT. The time now is 12:55 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.