Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-12

Jedi Code Format barfs on an Octal number

10 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

brian

Hi folks,

I'm not sure where to flag this bug, whether the version of JCF included with Lazarus is just the vanilla version or whether it's been tweaked in some way, but no doubt one of you can point me to the right place if I should be posting somewhere else.

The bug is a simple one, JCF won't accept the '&' syntax for an octal number. There's absolutely no doubt that this was the problem, all of my units formatted correctly except for the one with the two calls to FpChmod in it, and that one formatted correctly when I changed the octal number to its decimal equivalent.

I'm using the version of Lazarus as downloaded by fpcup_linux_x64 and I updated two days ago. The help page gives the revision as 43538.

Brian.

Reply by email

waldo kitty
to brian
brian wrote
The bug is a simple one, JCF won't accept the '&' syntax for an octal number. There's absolutely no doubt that this was the problem, all of my units formatted correctly except for the one with the two calls to FpChmod in it, and that one formatted correctly when I changed the octal number to its decimal equivalent.

FWIW: the octal format of specifying numbers is relatively new and IIRC only available in FPC mode... TP and Delphi mode should not accept them IIRC and it may be that JCF doesn't distinguish what mode the source code is written for...

further than that, i'm sitting on the sidelines watching the responses ;)

NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com

Reply by email

Michael Van Canneyt
to waldo kitty
waldo kitty wrote 12 lines
On 12/15/2013 6:18 PM, brian wrote: > The bug is a simple one, JCF won't accept the '&' syntax for an octal > number. > There's absolutely no doubt that this was the problem, all of my units > formatted > correctly except for the one with the two calls to FpChmod in it, and that > one > formatted correctly when I changed the octal number to its decimal > equivalent. FWIW: the octal format of specifying numbers is relatively new and IIRC only available in FPC mode...

'relatively new' is relative.
I think octal notation has been available in FPC since many years.

Michael.

Reply by email

waldo kitty
to Michael Van Canneyt
Michael Van Canneyt wrote 15 lines
On Sun, 15 Dec 2013, waldo kitty wrote: > On 12/15/2013 6:18 PM, brian wrote: >> The bug is a simple one, JCF won't accept the '&' syntax for an octal number. >> There's absolutely no doubt that this was the problem, all of my units formatted >> correctly except for the one with the two calls to FpChmod in it, and that one >> formatted correctly when I changed the octal number to its decimal equivalent. > > FWIW: the octal format of specifying numbers is relatively new and IIRC only > available in FPC mode... 'relatively new' is relative. I think octal notation has been available in FPC since many years.

yes, but it is not available in TP/BP and (IIRC) Delphi... for many out here in the wilds, that qualifies ;)

in any case, yes, it is a relative observation of relativistic properties ;)

NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com

Reply by email

Jürgen Hestermann
to waldo kitty
waldo kitty wrote
yes, but it is not available in TP/BP and (IIRC) Delphi...

I am wondering why octal numbers are not allowed in these modes. Why not allow them in all modes?
I can't see how this would cause problems.
It would only avoid them.

Reply by email

Frederic Da Vitoria
to Jürgen Hestermann

2013/12/17 J?rgen Hestermann

Show quoted text 10 lines
Am 2013-12-17 02:42, schrieb waldo kitty: yes, but it is not available in TP/BP and (IIRC) Delphi... > I am wondering why octal numbers are not allowed in these modes. Why not allow them in all modes? I can't see how this would cause problems. It would only avoid them.

Maybe because these modes could be used to ensure that the developer is able to switch back to TP/BP or Delphi. If these modes accepted features which TP/BP or Delphi don't understand, switching back would become difficult. Or you could create a source file which you want to be compatible with FPC and with TP. If you use octal, it won't work.

Frederic Da Vitoria (davitof) Membre de l'April - ? promouvoir et d?fendre le logiciel libre ? - http://www.april.org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131217/27647b11/attachment.html>

Reply by email

Michael Van Canneyt
to Frederic Da Vitoria
Frederic Da Vitoria wrote 15 lines
2013/12/17 J?rgen Hestermann Am 2013-12-17 02:42, schrieb waldo kitty: yes, but it is not available in TP/BP and (IIRC) Delphi... I am wondering why octal numbers are not allowed in these modes. Why not allow them in all modes? I can't see how this would cause problems. It would only avoid them. Maybe because these modes could be used to ensure that the developer is able to switch back to TP/BP or Delphi. If these modes accepted features which TP/BP or Delphi don't understand, switching back would become difficult. Or you could create a source file which you want to be compatible with FPC and with TP. If you use octal, it won't work.

That is exactly the idea.

Michael.

Reply by email

brian
to Michael Van Canneyt
Michael Van Canneyt wrote 25 lines
On Tue, 17 Dec 2013, Frederic Da Vitoria wrote: > 2013/12/17 J?rgen Hestermann > > Am 2013-12-17 02:42, schrieb waldo kitty: > yes, but it is not available in TP/BP and (IIRC) Delphi... > > > I am wondering why octal numbers are not allowed in these modes. > Why not allow them in all modes? > I can't see how this would cause problems. > It would only avoid them. > > > Maybe because these modes could be used to ensure that the developer > is able to switch back to TP/BP or Delphi. If these modes > accepted features which TP/BP or Delphi don't understand, switching > back would become difficult. Or you could create a source > file which you want to be compatible with FPC and with TP. If you > use octal, it won't work. That is exactly the idea.

Which is fair enough, of course, but the formatter obviously isn't a compiler. I cannot see a problem with JCF reformatting code which is the *superset* of all three modes. Incompatible badly-formatted code is certainly no less of a problem than incompatible well-formatted code!

Of course, it's a perfectly understandable problem if JCF hasn't been tweaked in any way for FPC, as it was no doubt written with Object Pascal as the target language. Anyway, it's hardly a problem of any great importance, if you want to keep the modes for fpChmod readable without requiring mental arithmetic then all I did was to rewrite &644 as (6*64)+(4*8)+4

Brian.

Reply by email

Florian Klämpfl
to Marco van de Voort
Marco van de Voort wrote 10 lines
On Mon, Dec 16, 2013 at 08:58:52AM +0100, Michael Van Canneyt wrote: >>> equivalent. >> >> FWIW: the octal format of specifying numbers is relatively new and IIRC only >> available in FPC mode... > > 'relatively new' is relative. > I think octal notation has been available in FPC since many years. 2.0 or 2.2 I guess.

Indeed. It has been implemented in 2002.

Reply by email