Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-07 Thread Sergei Gavrikov
On Mon, 7 Apr 2014, Jan Nijtmans wrote: > 2014-04-07 19:34 GMT+02:00 Sergei Gavrikov wrote: > > > Could you, please, take a look on this puzzle? > > Thanks! Regards, Sergei ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://li

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-07 Thread Jan Nijtmans
2014-04-07 19:34 GMT+02:00 Sergei Gavrikov : > Hi Jan > > I found one exception, if there is digit 'b' (only) on the second > position (only) in a hexadecimal number > Could you, please, take a look on this puzzle? Regards, Jan Nijtmans __

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-07 Thread Sergei Gavrikov
On Fri, 4 Apr 2014, Sergei Gavrikov wrote: > On Fri, 4 Apr 2014, Jan Nijtmans wrote: > > > An additional issue is that binary/octal/hex numbers cannot contain > > dots, so they must be handled separately anyway. Done here: > > > > [the issues

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-05 Thread Jan Nijtmans
2014-04-04 10:57 GMT+02:00 Stephan Beal : > Maybe if you want to output your UUIDs in binary format... that might be fun > to do each year on April 1st. ;-) Regards, Jan Nijtmans ___ fossil-users

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-04 Thread B Harder
I think th1 "happens" to basically be a subset of Tcl, but is not "designed" to strictly be a subset of Tcl, fwiw. On 4/4/14, Jan Nijtmans wrote: > 2014-04-04 10:54 GMT+02:00 Mark Janssen : >> Why can't n-ary numbers have dots? 0b1.11 is a perfectly valid >> representation of 1.75. > > $ tcls

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-04 Thread Sergei Gavrikov
On Fri, 4 Apr 2014, Jan Nijtmans wrote: > An additional issue is that binary/octal/hex numbers cannot contain > dots, so they must be handled separately anyway. Done here: > [the issues went away] Thank you very much! Now we have the comfo

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-04 Thread Jan Nijtmans
2014-04-04 11:06 GMT+02:00 Jan Nijtmans : > Since th1 is supposed to be a subset of Tcl, I don't think > that th1 should invent any syntax which Tcl doesn't support. > (Feel free to write a Tcl TIP, but I don't think it has a high > chance to be accepted.) Noted that the floating point format acce

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-04 Thread Jan Nijtmans
2014-04-04 10:54 GMT+02:00 Mark Janssen : > Why can't n-ary numbers have dots? 0b1.11 is a perfectly valid > representation of 1.75. $ tclsh8.6 % expr 0+0b1.1 missing operator at _@_ in expression "0+0b1_@_.1" % Since th1 is supposed to be a subset of Tcl, I don't think that t

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-04 Thread Stephan Beal
On Fri, Apr 4, 2014 at 10:54 AM, Mark Janssen wrote: > Why can't n-ary numbers have dots? 0b1.11 is a perfectly valid > representation of 1.75. > i would argue that in the context of fossil, which rarely uses floating point numbers and never uses binary numbers, such a feature is YAGNI[1]. Maybe

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-04 Thread Mark Janssen
On Fri, Apr 4, 2014 at 10:28 AM, Jan Nijtmans wrote: > > > An additional issue is that binary/octal/hex numbers cannot contain > dots, so they must be handled separately anyway. Done here: > > > > Why can't n-ary numbers have dots? 0b1.11 is

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-04 Thread Jan Nijtmans
2014-04-03 23:23 GMT+02:00 Sergei Gavrikov : > It seems that should not reload isdigit validator for octal and binary > numbers, otherwise early break on illegal digit returns bad tokens: for > example, for "0b2" sequence thNextNumber() will return "0b" token, for > "0o8" sequence it will return "0

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-03 Thread Ron Wilson
On Thu, Apr 3, 2014 at 10:34 AM, Jan Nijtmans wrote: > See: > > > Newer languages have been abandoning the prefix 0, as decimal numbers > > are often represented with leading zeroes. The prefix q was introduced to > > avoid the prefix o being mistaken for a zer

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-03 Thread Sergei Gavrikov
On Thu, 3 Apr 2014, Sergei Gavrikov wrote: > On Thu, 3 Apr 2014, Sergei Gavrikov wrote: > > > The fix is attached. > ^^^ > > Please, forget it! Sorry. It seems that should not reload isdigit validator for octal and binary numbers, otherwise early break on illegal digit returns b

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-03 Thread Sergei Gavrikov
On Thu, 3 Apr 2014, Sergei Gavrikov wrote: > The fix is attached. ^^^ Please, forget it! Sorry. Sergei ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-us

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-03 Thread Sergei Gavrikov
On Thu, 3 Apr 2014, Sergei Gavrikov wrote: > TH does trig on such typos > > expr 0+0b2 > expr 0+0o8 I mean % fossil test-th-eval 'expr 0+0b2' fossil: ../src/th.c:2140: exprMakeTree: Assertion `!apToken[jj] || !apToken[0]' failed. Aborted > So, for the new three things I would enter t

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-03 Thread Sergei Gavrikov
On Thu, 3 Apr 2014, Jan Nijtmans wrote: > 2014-04-03 15:10 GMT+02:00 Sergei Gavrikov : > > Good point. Thak you. With new patch TH1 works as Tcl 8.5 > > While on it, I added binary as well. > > Thanks! Sure, '0b' also will be helpful for

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-03 Thread Jan Nijtmans
2014-04-03 15:10 GMT+02:00 Sergei Gavrikov : > Good point. Thak you. With new patch TH1 works as Tcl 8.5 While on it, I added binary as well. Thanks! Regards, Jan Nijtmans ___ fossil

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-03 Thread Jan Nijtmans
2014-04-03 15:14 GMT+02:00 Stephan Beal : > Weird - i've never seen octals written that way, but i trust Jan's judgement > implicitly regarding issued of "TCL-ness." See: > Newer languages have been abandoning the prefix 0, as decimal numbers > are often repre

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-03 Thread Stephan Beal
On Thu, Apr 3, 2014 at 3:10 PM, Sergei Gavrikov wrote: > On Thu, 3 Apr 2014, Jan Nijtmans wrote:Good point. Thak you. With new > patch TH1 works as Tcl 8.5 > > % expr {0o10+10+0x10} > 34 > % expr {0O10+10+0X10} > 34 > % expr {0o77+99+0xff} > 417 > Weird - i've never seen octals writte

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-03 Thread Sergei Gavrikov
On Thu, 3 Apr 2014, Jan Nijtmans wrote: > 2014-04-03 14:05 GMT+02:00 Sergei Gavrikov : > > Could anyone take a look on the workaround, please? Well, Th_ToInt() > > become itself a bit more slow, but I think it is still more fast than > > strtoll(). At the least, I can say that the patch does not b

Re: [fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-03 Thread Jan Nijtmans
2014-04-03 14:05 GMT+02:00 Sergei Gavrikov : > Could anyone take a look on the workaround, please? Well, Th_ToInt() > become itself a bit more slow, but I think it is still more fast than > strtoll(). At the least, I can say that the patch does not break the > existing Fossil TH1 tests. I'm not fo

[fossil-users] TH1: support for octal and hexadecimal numbers in expressions

2014-04-03 Thread Sergei Gavrikov
Hi I have a small patch (it is attached just for reference) to make TH1 use the integers also in other formats (hexadecimal and octal forms). For example, we would use the same expressions then % expr {010+10+0x10} 34 Could we add such a support in Fossil TH1? I believe the TH1 stands for