Re: [fpc-pascal] Illeagal assignment to For Loop variable in Free pascal

2014-06-18 Thread Ralf Quint

On 6/17/2014 7:54 PM, Jim Leonard wrote:
The error is because FreePascal optimizes loops wherever it can, and 
trying to modify the loop variable would break under that optimization.


While you could enable compilation flags to make things more TP 
compatible, looking at the code, I can see that the 'counter:=1' is 
just an early termination clause.  If the variable 'counter' isn't 
needed after that section, you could replace that line with 'break' 
which would exit the loop immediately (which is what the code does now).


On 6/17/2014 6:05 AM, mokashe.ram wrote:

Hi,

Could Any one help me for fixing below error in free pascal. as i am 
tring
to excute for loop in decemental order using 'DOWNTO' but its thwoing 
error
'Illeagal assignment to For Loop variable 'Counter' as this is 
possible in
TP but in Free pascal its not working so is there any workaround for 
this?


   FOR counter := 8 DOWNTO 1 DO
   IF filename[counter] = ' 'THEN
  DELETE(filename,counter,1)
   ELSE
   counter := 1;
A totally different solution and also more universal (not depending on 
the length of the filename to be exactly 8 characters long would be


   while ((Length (Filename)  0) AND (Filename (Length (Filename) = ' 
') do

   Delete (Filename, Length (Filename), 1);

or if you insist on using a separate integer variable

  Counter = Length (Filename);
  while (Counter  0) AND (Filename [Counter] = ' ') do
  begin
  Delete (Filename, Counter, 1);
  Dec (Counter);
  end;

Ralf

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Error:Operator Is not oberloaded in Free pascal

2014-06-18 Thread mokashe.ram
Hi EveryOne,

   can any one help me on below issue, as in have one variable of type
ARRAY, see below

  * 
  bonus_details_record = RECORD
  terminal_bonus  : ARRAY[1..2] OF REAL;*  IF
terminal_bonus  0 THEN*

as above statement is possible in Turbo pascal but In Free Pascal,
I am geeting Below Error : Operator Is not
oberloaded:'bonus_details_record.array[1..2] of real'   'shortInt'

SO please suggest me the solution 



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Error-Operator-Is-not-oberloaded-in-Free-pascal-tp5719614.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Illeagal assignment to For Loop variable in Free pascal

2014-06-18 Thread Juha Manninen
On Wed, Jun 18, 2014 at 6:42 AM, Ralf Quint redro...@gmail.com wrote:
 A totally different solution and also more universal (not depending on the
 length of the filename to be exactly 8 characters long would be

while ((Length (Filename)  0) AND (Filename (Length (Filename) = ' ') do
Delete (Filename, Length (Filename), 1);

How about :
  Filename := Trim(Filename);

Juha
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Error:Operator Is not oberloaded in Free pascal

2014-06-18 Thread Jonas Maebe


On 18 Jun 2014, at 09:14, mokashe.ram wrote:


  can any one help me on below issue, as in have one variable of type
ARRAY, see below

 *
 bonus_details_record = RECORD
 terminal_bonus  : ARRAY[1..2] OF REAL;*  IF
terminal_bonus  0 THEN*

as above statement is possible in Turbo pascal but In Free Pascal,
I am geeting Below Error : Operator Is not
oberloaded:'bonus_details_record.array[1..2] of real'   'shortInt'


That cannot work either in Turbo Pascal. You probably made a mistake  
somewhere.



Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Error:Operator Is not oberloaded in Free pascal

2014-06-18 Thread mokashe.ram
Thanks Jonas,

  But already THis code is running in Turbo pascal  and i am migrating TP
application to Free pascal.

 so please suggest the solution.

Thanks



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Error-Operator-Is-not-oberloaded-in-Free-pascal-tp5719614p5719617.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Illeagal assignment to For Loop variable in Free pascal

2014-06-18 Thread Bart
On 6/18/14, Juha Manninen juha.mannine...@gmail.com wrote:


 How about :
   Filename := Trim(Filename);

The original code removes trailing spaces only, and Trim() removes
more than spaces (and it removes leading blanks as well).

Bart
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Error:Operator Is not oberloaded in Free pascal

2014-06-18 Thread mokashe.ram


Thanks, Now i got where did i made misake

it should be 

*if terminal_bonus[1]  0 then*

thanks
Sud



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Error-Operator-Is-not-oberloaded-in-Free-pascal-tp5719614p5719620.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Illeagal assignment to For Loop variable in Free pascal

2014-06-18 Thread Juha Manninen
On Wed, Jun 18, 2014 at 2:36 PM, Bart bartjun...@gmail.com wrote:
 The original code removes trailing spaces only, and Trim() removes
 more than spaces (and it removes leading blanks as well).

  Filename := TrimRight(Filename);

:)

Juha
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Illeagal assignment to For Loop variable in Free pascal

2014-06-18 Thread Marco van de Voort
In our previous episode, Juha Manninen said:
 On Wed, Jun 18, 2014 at 2:36 PM, Bart bartjun...@gmail.com wrote:
  The original code removes trailing spaces only, and Trim() removes
  more than spaces (and it removes leading blanks as well).
 
   Filename := TrimRight(Filename);

or 

Filename := TrimRightSet(Filename,[' ']);

:-)
 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-06-18 Thread fredvs
 The ideal thing would be to find some java mechanism that allows him to
`append` this checksynchronize to `the` main loop, some main-loop hook
 of sorts.

Hum, if somebody have some idea how to implement it, he is very welcome to
show his way... ;-)

PS: By the other way, here some conclusions of this topic... (if something
is wrong, please advices...)
=
http://wiki.freepascal.org/Using_Pascal_Libraries_with_Java#Dealing_with_threads_and_synchronize_Java_method_inside_threads.

Thanks.



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Java-crash-when-fpc-library-CallVoidMethod-in-a-thread-tp5719098p5719623.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal