Sign in Join

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

Mailing lists / lazarus / 2009-10

fpchmod illegal character "&"

19 messages · 9 people · –

Reply by email Subscribe to this list Your subscription

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

David Touzeau

I try to set

fpchmod(path,&775);

by compilator generate error

zsystem.pas(465,17) Fatal: illegal character "'&'" ($26)

how to force using & character in fpchmod function ?

best regards

Reply by email

Bart
to David Touzeau

Hi David,

Look at the function definition:

Function  FpChmod   (path : AnsiString; Mode : TMode): cInt; inline;

The second parameter must be of type TMode, so you cannot use a "&" in it.

What does "&"755 do if you run chmode from terminal? (What is the meaning of the ampersand in front of the 755 in this case?)

Bart

Reply by email

Vincent Snijders
to Bart
Bart wrote 10 lines
Hi David, Look at the function definition: Function FpChmod (path : AnsiString; Mode : TMode): cInt; inline; The second parameter must be of type TMode, so you cannot use a "&" in it. What does "&"755 do if you run chmode from terminal? (What is the meaning of the ampersand in front of the 755 in this case?)

& means an octal number.

&777 seems a valid octal number and is used in this fpChmod example: http://www.freepascal.org/docs-html/rtl/baseunix/fpchmod.html

Vincent

Reply by email

David Touzeau
to Vincent Snijders

Hum

so i can convert 775 or 666 chmod number privilege to an octal parameter in order to avoid this illegal character error I'm dev in Unix (linux)

-------- Message initial --------
De: Vincent Snijders
Reply-to: Lazarus mailing list
?: Lazarus mailing list
Sujet: Re: [Lazarus] fpchmod illegal character "&" Date: Wed, 14 Oct 2009 13:52:59 +0200

Bart wrote 10 lines
Hi David, Look at the function definition: Function FpChmod (path : AnsiString; Mode : TMode): cInt; inline; The second parameter must be of type TMode, so you cannot use a "&" in it. What does "&"755 do if you run chmode from terminal? (What is the meaning of the ampersand in front of the 755 in this case?)

& means an octal number.

&777 seems a valid octal number and is used in this fpChmod example: http://www.freepascal.org/docs-html/rtl/baseunix/fpchmod.html

Vincent

Reply by email

Vincent Snijders
to David Touzeau
David Touzeau wrote
Hum so i can convert 775 or 666 chmod number privilege to an octal

It is already an octal number.

parameter in order to avoid this illegal character error I'm dev in Unix (linux)

I don't know why your compiler gives this error:
writeln(IntToStr(&755));
gives no error with my compiler (fpc 2.2.4 on windows). I don't think the OS is relevant except that I cannot test compilation of a fpchmod call.

Vincent

Reply by email

Mattias Gärtner
to Vincent Snijders

Zitat von Vincent Snijders :

Show quoted text 15 lines
David Touzeau schreef: > Hum > > so i can convert 775 or 666 chmod number privilege to an octal It is already an octal number. > parameter in order to avoid this illegal character error > I'm dev in Unix (linux) I don't know why your compiler gives this error: writeln(IntToStr(&755)); gives no error with my compiler (fpc 2.2.4 on windows). I don't think the OS is relevant except that I cannot test compilation of a fpchmod call.

It compiles, but the codetools didn't like them.
Fixed in svn rev 22171.

Mattias

Reply by email

David Touzeau
to Mattias Gärtner

OK many thanks

In order to waiting the latest linux Lazarus release with this fix. Is there a workaround ?
How can i set the parameters without "&" character

-------- Message initial --------
De: Mattias G?rtner
Reply-to: Lazarus mailing list
?:
Sujet: Re: [Lazarus] fpchmod illegal character "&" Date: Wed, 14 Oct 2009 14:31:23 +0200

Zitat von Vincent Snijders :

Show quoted text 15 lines
David Touzeau schreef: > Hum > > so i can convert 775 or 666 chmod number privilege to an octal It is already an octal number. > parameter in order to avoid this illegal character error > I'm dev in Unix (linux) I don't know why your compiler gives this error: writeln(IntToStr(&755)); gives no error with my compiler (fpc 2.2.4 on windows). I don't think the OS is relevant except that I cannot test compilation of a fpchmod call.

It compiles, but the codetools didn't like them.
Fixed in svn rev 22171.

Mattias

Reply by email

Mattias Gaertner
to David Touzeau
Show quoted text 5 lines
OK many thanks In order to waiting the latest linux Lazarus release with this fix. Is there a workaround ? How can i set the parameters without "&" character

&765 = 7*64+6*8+5

Mattias

Reply by email

dmitry boyarintsev
to Mattias Gaertner

Here's the patch for synedit pascal highlighter to support '%' (binary) and '&' (octal) as numbers, as shown here: http://imagebin.org/67810
Otherwise the prefix character is colored as symbol rather than as number.

thanks,
dmitry

P.S. sorry, don't have much time for serious development. -------------- next part --------------
A non-text attachment was scrubbed...
Name: synhighlighterpas.pp.patch
Type: application/octet-stream
Size: 1436 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20091015/68886a87/attachment.obj>

Reply by email

Martin
to dmitry boyarintsev

Thanks,

I will attend to it asap. Usually it is better to attach them to a mantis report. So they will not be lost/overlooked.

Martin

dmitry boyarintsev wrote 18 lines
Here's the patch for synedit pascal highlighter to support '%' (binary) and '&' (octal) as numbers, as shown here: http://imagebin.org/67810 Otherwise the prefix character is colored as symbol rather than as number. thanks, dmitry P.S. sorry, don't have much time for serious development. ------------------------------------------------------------------------ -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

dmitry boyarintsev
to Martin
Martin wrote
I will attend to it asap. ?Usually it is better to attach them to a mantis report. So they will not be lost/overlooked.

If it's forgotten, i'll make a bug report. But i was hoping you have some time, for quick fixes :)

thanks,
dmitry

Reply by email

Martin
to dmitry boyarintsev: Here's the patch for synedit pascal highlighter to support '%' (binary) and '&' (octal)…
dmitry boyarintsev wrote 5 lines
Here's the patch for synedit pascal highlighter to support '%' (binary) and '&' (octal) as numbers, as shown here: http://imagebin.org/67810 Otherwise the prefix character is colored as symbol rather than as number.

Applied, in 22180, thanks.

slightly improved, the $%& prefixes must be followed by a number (fpc does not even allow for a space). So if there is no number following the do not highlight as number

Reply by email

Florian Klaempfl
to Martin
Show quoted text 10 lines
dmitry boyarintsev wrote: > Here's the patch for synedit pascal highlighter to support '%' > (binary) and '&' (octal) as numbers, as shown here: > http://imagebin.org/67810 > Otherwise the prefix character is colored as symbol rather than as > number. > Applied, in 22180, thanks. slightly improved, the $%& prefixes must be followed by a number

Keep in mind, $ might be followed by a-f/A-F as well.

And when you're at it: fpc trunk allows reserved works to be used as identifiers by escaping them with & (as Delphi allows). This is mainly needed for COM programing.

Reply by email

dmitry boyarintsev
to Florian Klaempfl
Florian Klaempfl wrote
Keep in mind, $ might be followed by a-f/A-F as well.
$ has been working for years and doesn't need to be fixed.
And when you're at it: fpc trunk allows reserved works to be used as identifiers by escaping them with & (as Delphi allows). This is mainly needed for COM programing.

Any page to read about this?

thanks,
dmitry

Reply by email

Paul Ishenin
to Florian Klaempfl: Keep in mind, $ might be followed by a-f/A-F as well. And when you're at it: fpc trunk…
Florian Klaempfl wrote
And when you're at it: fpc trunk allows reserved works to be used as identifiers by escaping them with & (as Delphi allows). This is mainly needed for COM programing.

I was not able to define a property using reserved word.

Example:

TMyClass = class
private
   FWith: Integer;
public
   property &With: Integer read FWith write FWith;
end;

Although in delphi I am able to do so.

Best regards,
Paul Ishenin.

Reply by email

Florian Klaempfl
to Paul Ishenin
Show quoted text 18 lines
Florian Klaempfl wrote: > And when you're at it: fpc trunk allows reserved works to be used as > identifiers by escaping them with & (as Delphi allows). This is mainly > needed for COM programing. I was not able to define a property using reserved word. Example: TMyClass = class private FWith: Integer; public property &With: Integer read FWith write FWith; end; Although in delphi I am able to do so.

Trunk from at least Monday?

Reply by email

Florian Klaempfl
to dmitry boyarintsev: On Thu, Oct 15, 2009 at 11:43 AM, Florian Klaempfl $ has been working for years and…
Show quoted text 9 lines
On Thu, Oct 15, 2009 at 11:43 AM, Florian Klaempfl wrote: > Keep in mind, $ might be followed by a-f/A-F as well. $ has been working for years and doesn't need to be fixed. > And when you're at it: fpc trunk allows reserved works to be used as > identifiers by escaping them with & (as Delphi allows). This is mainly > needed for COM programing. Any page to read about this?

No. Only an issue report which is currently at assigned to MvC so it will be documented.

Reply by email