Re: [fpc-devel] STM32F407 fun

2016-03-19 Thread Andrew Haines

On 03/19/2016 09:20 AM, Michael Ring wrote:
OK, seems you are not using trunk or an outdated version of trunk as 
there are quite a number of units for stm32f4 available in current trunk:


stm32f401xx.pp
stm32f407xx.pp
stm32f411xe.pp
stm32f429xx.pp
stm32f446xx.pp

So I'd recomment to either upgrade to current trunk or at least copy 
the unit specially made for your chip to your installation and compile 
it by adding it to the list of controller units in the embedded rtl 
makefile and changing controllerunitstr to match the correct filename.


Ok I updated. I was using a trunk version from late October. Fpc is 
moving pretty fast.


Good that we agree that 128MB is the right memory size, I first 
thought that you are using trunk and that the 128MB configured in the 
cpuinfo are wrong and instead 112MB is correct.
I haven't compiled for this chip for a while, I am mostly targeting 
f401, f411 and lately the f469 chips (I really like the STM32F469 
Discovery board) these days...




I've had this board for probably 6 years sitting waiting for me to do 
something with it. A year or two ago I got a HD44780 lcd to work with it 
using gcc. But didn't go further with it than that. I'm pretty 
inexperienced with embedded stuff.


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


Re: [fpc-devel] STM32F407 fun

2016-03-19 Thread Andrew Haines

On 03/19/2016 07:36 AM, Michael Ring wrote:


Re-reading your initial mail I am kind of wondering what you actually did ?

When using -WpSTM32F407VG you will automagially use stm32f407xx.pp unit
which is the correct one for your chip and also stack should be correct
as ram size is set to 128MB.



First off thanks for looking at this. I'm not sure where you are getting 
128MB...?


How/why did you use STM32F429 unit for the chip?


There was no entry in fpc for STM32F407VG. I added
+  (controllertypestr:'STM32F407VG'; controllerunitstr:'STM32F429'; 
   cputype:cpu_armv7em; fputype:fpu_soft; flashbase:$0800; 
flashsize:$0008; srambase:$2000; sramsize:$0002),



Michael



Am 19.03.16 um 12:36 schrieb Michael Ring:
/Are you sure about RAM? I checked in cpuinfo, it is set to 128MB, this />>/matches what is written in the user manual, (Page 70) />>//>>/http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/DM00037051.pdf 

/>>//>>

On the first page of that link under memories it says:

Up to 192+4 Kbytes of SRAM including 64-
Kbyte of CCM (core coupled memory) data
RAM.

Looking in the C header file stm32f4xx.h I find:
#define CCMDATARAM_BASE   ((uint32_t)0x1000) /*!< CCM(core coupled 
memory) data RAM(64 KB) base address in the alias region  */
#define SRAM1_BASE((uint32_t)0x2000) /*!< SRAM1(112 KB) base 
address in the alias region */
#define SRAM2_BASE((uint32_t)0x2001C000) /*!< SRAM2(16 KB) base 
address in the alias region  */

So starting from SRAM1_BASE there is 128kB of contiguous memory.

1024 * 128 = $2

Looking at 
http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/DM00071990.pdf
 for STM32F429VG is says:
 Up to 256+4 KB of SRAM including 64-KB
of CCM (core coupled memory) data RAM

I couldn't find a specific header for the *29 chip but I'm assuming the extra 
64kB memory it has is in that block so there is 192kB of memory. This matches 
the define for the *29 chip:
(controllertypestr:'STM32F429XG'; controllerunitstr:'STM32F429';
cputype:cpu_armv7em; fputype:fpu_soft; flashbase:$0800; 
flashsize:$0010; srambase:$2000; sramsize:$0003),

1024 * 192 = $3

 
//>>/or are the last 16k for some special use? Could not find a hint while />>/quickly searching through the manual. />>//>>/Michael />>


I attached the changes I made to include the stm32f407vg chip in fpc.



Andrew


Index: compiler/arm/cpuinfo.pas
===
--- compiler/arm/cpuinfo.pas	(revision 32211)
+++ compiler/arm/cpuinfo.pas	(working copy)
@@ -250,7 +250,9 @@
   ct_stm32f107rc,
   ct_stm32f107vb,
   ct_stm32f107vc,
-  
+
+  ct_stm32f407vg, // 1M flash
+
   ct_stm32f429xe, // 512K flash
   ct_stm32f429xg, // 1M flash
   ct_stm32f429xi, // 2M flash
@@ -644,7 +646,9 @@
   (controllertypestr:'STM32F107RC'; controllerunitstr:'STM32F10X_CL'; cputype:cpu_armv7m; fputype:fpu_soft; flashbase:$0800; flashsize:$0004; srambase:$2000; sramsize:$0001),
   (controllertypestr:'STM32F107VB'; controllerunitstr:'STM32F10X_CL'; cputype:cpu_armv7m; fputype:fpu_soft; flashbase:$0800; flashsize:$0002; srambase:$2000; sramsize:$0001),
   (controllertypestr:'STM32F107VC'; controllerunitstr:'STM32F10X_CL'; cputype:cpu_armv7m; fputype:fpu_soft; flashbase:$0800; flashsize:$0004; srambase:$2000; sramsize:$0001),
-  
+
+  (controllertypestr:'STM32F407VG'; controllerunitstr:'STM32F429';cputype:cpu_armv7em; fputype:fpu_soft; flashbase:$0800; flashsize:$0008; srambase:$2000; sramsize:$0002),
+
   (controllertypestr:'STM32F429XE'; controllerunitstr:'STM32F429';cputype:cpu_armv7em; fputype:fpu_soft; flashbase:$0800; flashsize:$0008; srambase:$2000; sramsize:$0003),
   (controllertypestr:'STM32F429XG'; controllerunitstr:'STM32F429';cputype:cpu_armv7em; fputype:fpu_soft; flashbase:$0800; flashsize:$0010; srambase:$2000; sramsize:$0003),
   (controllertypestr:'STM32F429XI'; controllerunitstr:'STM32F429';cputype:cpu_armv7em; fputype:fpu_soft; flashbase:$0800; flashsize:$0020; srambase:$2000; sramsize:$0003),
Index: compiler/systems/t_embed.pas
===
--- compiler/systems/t_embed.pas	(revision 32211)
+++ compiler/systems/t_embed.pas	(working copy)
@@ -401,7 +401,9 @@
   ct_stm32f107rc,
   ct_stm32f107vb,
   ct_stm32f107vc,
-  
+
+  ct_stm32f407vg,
+
   ct_stm32f429xe,
   ct_stm32f429xg,
   ct_stm32f429xi,

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


Re: [fpc-devel] STM32F407 fun

2016-03-19 Thread Andrew Haines

On 03/19/2016 04:19 AM, Jeppe Johansen wrote:

On 03/19/2016 04:47 AM, Andrew Haines wrote:
I'm guessing there is some define I have to use and everything will 
start working :)


Where do I go from here?
You need to remove classes from your used units. It needs a thread 
manager to work.
The default thread manager simply halts the program if anything calls 
it, so that's exactly what you are seeing.

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

Ok well that was easy :) It is working now.

Thanks again,

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


[fpc-devel] STM32F407 fun

2016-03-18 Thread Andrew Haines

Hi,

I've been trying to get a very simple program to run on my discovery 
board that I've had for a while(STM32F407VG). Using st-util with gdb I 
managed to make some progress.


I've been using the code in fpc for STM32F429 since it's pretty similar. 
My first problem was that the stackpointer was too high. The STM32F407VG 
has 64kb less memory than the STM32F429. I added a define in 
compiler/arm/cpuinfo.pas with the correct info and had it use the 
STM32F429 unit. That fixed my first problem.


The next/current problem is in CommonInit in system.
SynchronizeTimeoutEvent:=RtlEventCreate;

RtlEventCreate has:
result:=currenttm.rtleventcreate();
This produces the assembly:
0x8007e08 <SYSTEM_$$_RTLEVENTCREATE$$PRTLEVENT> push   {lr}
(gdb) i registers pc
pc 0x8007e0a0x8007e0a 
<SYSTEM_$$_RTLEVENTCREATE$$PRTLEVENT+2>


0x8007e0a <SYSTEM_$$_RTLEVENTCREATE$$PRTLEVENT+2> ldrr0, [pc, #8]
; (0x8007e14 <SYSTEM_$$_RTLEVENTCREATE$$PRTLEVENT+12>)

(gdb) i registers r0
r0 0x20001dc0   536878528  // the address 1dc0 seems 
reasonable. Location of currenttm+rtleventcreate?


0x8007e0c <SYSTEM_$$_RTLEVENTCREATE$$PRTLEVENT+4> ldrr0, [r0, #0] 
(gdb) i registers r0

r0 0x0  0

0x8007e0e <SYSTEM_$$_RTLEVENTCREATE$$PRTLEVENT+6> blxr0

For the last instruction r0 is nil. This causes the default interrupt 
handler to be called which loops forever.


backtrace is:
(gdb) bt
#0  0x08007e0e in SYSTEM_$$_RTLEVENTCREATE$$PRTLEVENT ()
#1  0x0800ce5e in CLASSES_$$_COMMONINIT ()
#2  0x08012886 in CLASSES_$$_init ()
#3  0x08007a5c in fpc_initializeunits ()
#4  0x08000294 in main () at blinky.lpr:48

I compiled the crosscompiler with:
make clean  buildbase  CROSSINSTALL=1 CROSSOPT="-XParm-none-eabi-" 
OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv7em


the program is compiled with
-Oparmv7em
-WpSTM32F407VG

I'm guessing there is some define I have to use and everything will 
start working :)


Where do I go from here?

Thanks in advance,

Andrew Haines


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


Re: [fpc-devel] AVR embedded Atmega 328p interrupts

2015-11-30 Thread Andrew Haines

On 11/29/2015 06:54 PM, Jeppe Johansen wrote:
Don't use noreturn. It signals to the compiler that your function will 
not return (i.e. do an infinite loop).


Ok, this is good to know.


Use the interrupt directive for interrupt handlers. That makes them 
emit the iret instruction instead of ret to return from the interrupt. 
If you don't use that when you return from the ISR it will not have 
interrupts enabled. That's why it only blinks once.


This is also good to know. Interrupts are new to me. On a side note the 
procedure is called repeatedly using the noreturn keyword, but I'll 
change it to interrupt.


I had not used "interrupt" because this warning was emitted when I used it:
project1.lpr(139,25) Warning: Calling convention directive ignored: 
"OldFPCCall"




Only enable interrupts that you have written handlers for otherwise 
they end up in the default handler which is an infinite loop as you saw.
TIMER0_COMPB and TIMER0_OVF are not called because you don't set 
OCIE0B or OCIE0A in TIMSK0.


This makes sense.

Thanks very much for your input!

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


Re: [fpc-devel] AVR embedded Atmega 328p interrupts

2015-11-29 Thread Andrew Haines

On 11/29/2015 02:13 PM, Jeppe Johansen wrote:

Not sure the timer initialization is right, but it looks ok.

One thing you need is the interrupt procedure directive:

procedure TIMER0_overflow; interrupt; public name 'TIMER0_COMPA_ISR';

Otherwise it'll probably reset at some point.


Ok I got it to work. I have an interrupt:
procedure TIMER0_COMPA; noreturn; public name 'TIMER0_COMPA_ISR';
begin
  ToggleLED;
end;

and the timer is setup with:
procedure TimerInit;
begin
  TCCR0A := TCCR0A or (1 shl WGM01);
  OCR0A := $F9;
  TIMSK0 := TIMSK0 or (1 shl OCIE0A);
  sei;
  TCCR0B := TCCR0B or 5;//scale  5 = Clock / 1024
end;

The keywords "interrupt" or "noreturn" seem to have the same effect but 
are mutually exclusive.


Without the interrupt or noreturn keyword, TIMER0_COMPA is only called 
once and presumably a crash or infinite loop starts somewhere. ( return 
is causing an error?)
With the interrupt or noreturn keyword and those timer settings, the led 
blinks at the edge of human detection. Success!


Setting interrupts for TIMER0_COMPB and TIMER0_OVC have no effect; they 
are never called. I'm probably not understanding some of how to 
configure timers.


Regards,

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


[fpc-devel] AVR embedded Atmega 328p interrupts

2015-11-29 Thread Andrew Haines
Hi,  I am experimenting with the avr embedded compiler from trunk and am 
trying to set an interrupt. I am not sure how to do it. The interrupt I 
want to change is TIMER0_COMPA_ISR.


I see in the startup code there is:
.weak TIMER0_COMPA_ISR

and later there is:
.set TIMER0_COMPA_ISR, Default_IRQ_handler

I have in my test project added a procedure:
procedure TIMER0_overflow; public name 'TIMER0_COMPA_ISR';
begin
  ToggleLED;
end;

OK I'll just include my test program. I am using an arduino duemilanove 
clone. I got most of the code from:

https://sites.google.com/site/qeewiki/books/avr-guide/timers-on-the-atmega328

Anyway there is no LED visible. I have verified using a delay in the 
main loop toggling the LED works.


What am I not doing, or doing wrong? And btw it's awesome that I can do 
anything at all on this controller!


Thanks,

Andrew

program test;
{$mode objfpc}{$H-}
{uses
  ATmega328P;}
const
  PIN13 = $20;
  WGM01 = 2;
  CS02 = 2;
procedure ToggleLED;
begin
  PORTB := PORTB xor PIN13;
end;

procedure TIMER0_overflow; public name 'TIMER0_COMPA_ISR';
begin
  ToggleLED;
end;

procedure TimerInit;
begin
  TIMSK0:= 1 shl TOIE0; // 1
  TCNT0:=0;
  TCCR0A := TCCR0A or 1 shl WGM01;
  TCCR0B := TCCR0B or 1 shl CS02; // 1 shl 2 = 4
  OCR0A:=$F9;

  TIMSK0:= TIMSK0 or 1 shl OCIE0A;
  asm
sei;
  end;
end;

begin
  DDRB := DDRB or $FF;// PIN13;
  TimerInit;
  while True do
  begin
asm
 nop;
end;
  end;
end.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] AVR embedded Atmega 328p interrupts

2015-11-29 Thread Andrew Haines

On 11/29/2015 02:13 PM, Jeppe Johansen wrote:

Not sure the timer initialization is right, but it looks ok.

One thing you need is the interrupt procedure directive:

procedure TIMER0_overflow; interrupt; public name 'TIMER0_COMPA_ISR';

Otherwise it'll probably reset at some point.

What compiler commandline are you using?



ppcrossavr -Tembedded -Pavr -WpATMEGA328P -XPavr- test.lpr

then after compile, a script with:
avrdude -F -vv -p atmega328p -c arduino -P /dev/ttyUSB2 -b57600 -D -U 
flash:w:test.hex || echo Failed to upload





Best Regards,
Jeppe



I added the interrupt keyword with no effect. Also I added interrupt 
handlers for TIMER0_COMPB and TIMER0_OVF just in case.


It looks like the default handler enters an infinite loop. Afaict all 
unassigned interrupts go to the default handler. Maybe I need to assign 
every handler?


procedure Default_IRQ_handler; assembler; nostackframe; public name 
'_Default_IRQ_handler';noreturn;

  asm
  .Lloop:
jmp .Lloop
  end;


Regards,

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


Re: [fpc-devel] Spam in FPC lists (Was: Fwd: [8])

2014-05-09 Thread Andrew Haines
Hi yes unfortunately my account was hacked. Several hundred messages were sent 
in about fifteen minutes before I changed my password. Sorry for the noise.

Andrew Haines

On May 8, 2014 1:41:50 PM EDT, Tomas Hajny xhaj...@hajny.biz wrote:
On Thu, May 8, 2014 16:34, Andrew Haines wrote:
 .
 .


Hello all,

As you probably noticed, some spammer or virus misused an address of
one
of legitimate FPC users and sent several spam messages to fpc-devel and
fpc-pascal lists. Unfortunately, these e-mails slipped through our
anti-spam measures. I have set the address of Andrew Haines to be
moderated for now in order to prevent repetition of this situation (at
least using this address).

Tomas
(one of FPC lists moderators)


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

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


[fpc-devel] Spam from me

2014-05-09 Thread Andrew Haines
Sorry for all the spam from me.  The password was hacked for my email.
I changed it pretty quickly but still at least several hundred emails
were sent from my account.

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


[fpc-devel] Fwd: [8]

2014-05-08 Thread Andrew Haines
Hey! 
http://www.shonko.com.ar/-message.friend?unesimeza=1915968pivutul=220942



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


[fpc-devel] Fw: (8)

2014-05-08 Thread Andrew Haines
Hey there! http://7ydosug.ru/-hi.friend?elumjluf=850034hexofuve=892308


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


Re: [fpc-devel] TStrings Add(array of string)

2012-04-01 Thread Andrew Haines
On 04/01/12 05:13, Marco van de Voort wrote:
 In our previous episode, Michael Van Canneyt said:
 I was thinking about TStrings possibly having an overloaded function Add
 or AddStrings where the argument is an array of string?

 procedure Add(strs: array of string); overload;
 or
 procedure AddStrings(strs: array of string); overload;


 Better implement the second. 
 AddStrings already exists for a TStrings, it is more similar in 
 functionality.
 
 Maybe better extending tprocess to have a array of const function than
 tstrings?
 ___
 fpc-devel maillist  -  fpc-devel@lists.freepascal.org
 http://lists.freepascal.org/mailman/listinfo/fpc-devel

Here are two patches that do both. One extends TStrings with AddStrings
and the other extends TProcess with AddParams.

I'll let someone else decide which is better. :)

Regards,

Andrew
Index: packages/fcl-process/src/process.pp
===
--- packages/fcl-process/src/process.pp	(revision 20684)
+++ packages/fcl-process/src/process.pp	(working copy)
@@ -115,6 +115,7 @@
 procedure CloseInput; virtual;
 procedure CloseOutput; virtual;
 procedure CloseStderr; virtual;
+procedure AddParams(const AParams: array of string);
 Function Resume : Integer; virtual;
 Function Suspend : Integer; virtual;
 Function Terminate (AExitCode : Integer): Boolean; virtual;
@@ -254,6 +255,14 @@
   Inherited Destroy;
 end;
 
+Procedure TProcess.AddParams(const AParams: array of string);
+var
+  s: string;
+begin
+  for s in AParams do
+Parameters.Add(s);
+end;
+
 Procedure TProcess.FreeStreams;
 begin
   If FStderrStreamFOutputStream then
Index: rtl/objpas/classes/stringl.inc
===
--- rtl/objpas/classes/stringl.inc	(revision 20684)
+++ rtl/objpas/classes/stringl.inc	(working copy)
@@ -603,8 +603,22 @@
   end;
 end;
 
+Procedure TStrings.AddStrings(const TheStrings: array of string);
 
+Var Runner : longint;
 
+begin
+  try
+beginupdate;
+if Count + High(TheStrings)+1  Capacity then
+  Capacity := Count + High(TheStrings)+1;
+For Runner:=Low(TheStrings) to High(TheStrings) do
+  self.Add(Thestrings[Runner]);
+  finally
+EndUpdate;
+  end;
+end;
+
 Procedure TStrings.Assign(Source: TPersistent);
 
 Var
Index: rtl/objpas/classes/classesh.inc
===
--- rtl/objpas/classes/classesh.inc	(revision 20684)
+++ rtl/objpas/classes/classesh.inc	(working copy)
@@ -607,6 +607,7 @@
 function AddObject(const S: string; AObject: TObject): Integer; virtual;
 procedure Append(const S: string);
 procedure AddStrings(TheStrings: TStrings); virtual;
+procedure AddStrings(const TheStrings: array of string); overload; virtual;
 procedure Assign(Source: TPersistent); override;
 procedure BeginUpdate;
 procedure Clear; virtual; abstract;
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] TStrings Add(array of string)

2012-03-31 Thread Andrew Haines
I was thinking about TStrings possibly having an overloaded function Add
or AddStrings where the argument is an array of string?

procedure Add(strs: array of string); overload;
or
procedure AddStrings(strs: array of string); overload;

Specifically I want this for TProcess.Parameters. since it's a bit of a
pain to type
Proc.Parameters.Add('-Arg1');
Proc.Parameters.Add('Arg1_Value');
Proc.Parameters.Add('-Arg2');
Proc.Parameters.Add('Arg2_Value');
Proc.Parameters.Add('-Arg3');
Proc.Parameters.Add('Arg3_Value');

even with Proc.Parameters do begin Add(n); ... end;  is a bit ugly
when parameters have arguments.

when I could type:

Proc.Parameters.Add(['-Arg1', 'Arg1_Value']);
Proc.Parameters.Add(['-Arg2', 'Arg2_Value']);
Proc.Parameters.Add(['-Arg3', 'Arg3_Value']);

or even

Proc.Parameters.Add(['-Arg1','Arg1_Value','-Arg2','Arg2_Value','-Arg3',
'Arg3_Value']);

A less generic alternative would be adding a procedure to TProcess
AddArgs(args: array of string);

Is this a good idea?

If yes then I can create a patch.



Regards,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] elf load order

2012-03-16 Thread Andrew Haines
Hi,

I'm trying to figure out the order of events when an elf file is executed.

I think that the _start symbol just points to the start of the .text
section and crt1 is first followed by crti followed by crtbegin. After
that I'm not sure.

I am porting fpc to the xenon platform and it uses the elf file format
for executables.

I know that code in System.pp the begin end block at the end is being
executed but when that procedure (PASCALMAIN?) exits, where is the next
code begin executed?

in my test program.pas the begin end block is not called afaict.

I only have a putline method I wrote to debug. I can't currently follow
the code with a debugger.

Regards,

Andrew

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] elf load order

2012-03-16 Thread Andrew Haines
On 03/16/12 15:27, Sven Barth wrote:
 On 16.03.2012 19:16, Andrew Haines wrote:
 Hi,

 I'm trying to figure out the order of events when an elf file is
 executed.

 I think that the _start symbol just points to the start of the .text
 section and crt1 is first followed by crti followed by crtbegin. After
 that I'm not sure.

 Take a look at e.g. $fpcdir/rtl/linux/i386/prt0.as. This contains the
 startup (and shutdown) code for Free Pascal executables on linux-i386
 that don't use libc. You'll see the call to PASCALMAIN there as well as
 the halt code after it (which is executed once PASCALMAIN returns).
 
Thanks that is helpful. PASCALMAIN is the begin end block at the end of
the system unit? Or is it the begin end block in the program.pas file?

libxenon, which I am linking to, uses newlib.

Regards,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bounty for MIPS

2012-01-30 Thread Andrew Haines
On 01/30/12 07:19, Mark Morgan Lloyd wrote:
 Nikolai Zhubr wrote:
 Hi,
 29.01.2012 19:32, Jy V:
 [...]
 on the WNDR3800 the OpenWRT installed gives
 root@OpenWrt:~# uname -a
 Linux OpenWrt 2.6.32.27 #5 Wed Dec 21 01:59:33 CET 2011 mips GNU/Linux

 I've got wndr3800 too, and moreover I don't use it for the moment. So
 instead of collecting dust it could do something usefull. Installing
 debian on it will probably not be as quick and easy as openwrt but
 still if debian mips userspace is able to run on it, I could give it a
 try and then ssh will be available for FPC developers if installation
 succeeds. It is apparently big endian though. Would it make sense to try?
 
 Bear in mind that there's Debian for both endiannesses of MIPS, I'm
 running mipsel via Qemu to reasonable effect. Experience with small ARM
 systems suggests that having enough memory is crucial, 128Mb with swap
 to 512 should be OK but these days I'd not like to try smaller.
 
 But I don't know to what extent trying to implement the compiler and
 runtimes for mips and mipsel simultaneously would complicate things.
 

I spent a little time researching qemu with MIPS but couldn't find
anything current. Can you give me some pointers on setting that up?

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] cannot compile fpc 2.6.0 for mips

2012-01-06 Thread Andrew Haines
Hi,

I was trying to build a cross complier for mips-linux and met this error:

make crossinstall PP=/usr/local/lib/fpc/2.6.0/ppcx64 OS_TARGET=linux
CPU_TARGET=mipsel

make[4]: Entering directory
`/home/andrew/programming/fpc-2.6.0/packages/fcl-web'
./fpmake clean --localunitdir=../.. --globalunitdir=.. --os=linux
--cpu=mipsel -o -Pmipsel -o -XPmipsel-linux- -o -Xr -o -Ur -o -Xs -o -O2
-o -n -o -Fu/home/andrew/programming/fpc-2.6.0/rtl -o
-Fu/home/andrew/programming/fpc-2.6.0/packages/hash -o
-Fu/home/andrew/programming/fpc-2.6.0/packages/paszlib -o
-Fu/home/andrew/programming/fpc-2.6.0/packages/fcl-process -o
-Fu/home/andrew/programming/fpc-2.6.0/packages/fpmkunit -o -FE. -o
-FUunits/mipsel-linux -o -dmipsel -o -dRELEASE
--compiler=/home/andrew/programming/fpc-2.6.0/compiler/ppcross
An unhandled exception occurred at $00423596 :
EInstallerError : Invalid CPU name mipsel
  $00423596
  $0042BEC1
  $0042B70C
  $0042E015
  $0043BE2B
  $0043BE67
  $00400278

make[4]: *** [clean] Error 217

Anybody know which version of fpc supports mips the best?

Regards,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] New FPC JVM snapshot: Android support

2011-12-12 Thread Andrew Haines
On 12/12/11 13:50, Jonas Maebe wrote:
 Hi,
 
 A new FPC JVM snapshot has been put online at 
 http://wiki.freepascal.org/FPC_JVM
 
 The main new feature is full fledged support for Android/Dalvik, including a 
 Pascal translation of the Android SDK classes. To compile for Android rather 
 than for the Java VM, simply use the -Tandroid command line parameter. The 
 compiler will still generate Java class files, but these can then be 
 translated into Dalvik code by the Android SDK tools just like any 
 javac-compiled class files.

This is amazing, thank you very much for your work!

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] New FPC JVM snapshot: Android support

2011-12-12 Thread Andrew Haines
On 12/12/11 14:55, ik wrote:
 I'm trying to build it from the svn repo:
 http://svn.freepascal.org/svn/fpc/branches/jvmbackend/ .
 I get the following error:
 
 -
 $ make CROSSOPT=-O2 -g CPU_TARGET=jvm OS_TARGET=java all
 make: -iVSPTPSOTO: Command not found
 make: -iSP: Command not found
 make: -iTP: Command not found
 make: -iSO: Command not found
 make: -iTO: Command not found
 make compiler_cycle RELEASE=1
 make[1]: -iVSPTPSOTO: Command not found

I've seen these messages before when fpc or ppc386/ppcx64 is not in the
$PATH

Regards,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] Possible to set an object function/procedure to external?

2011-09-12 Thread Andrew Haines
Hi,

Is it possible to set a object/class procedure/function to external?

I want to do something like this:

TGObject = object
  function new: PGObject; cdecl; external 'libglib.so' name 'g_object_new';

There are other cases where this maps better (i'm ignoring the 'self'
parameter in this example).

Regards,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Running programs with output redirection

2011-07-17 Thread Andrew Haines
On 07/17/11 05:50, Hans-Peter Diettrich wrote:
 Andrew Haines schrieb:
 
 The best way I know is described here:
 http://wiki.lazarus.freepascal.org/Executing_External_Programs#How_to_redirect_output_with_TProcess

 
 Thanks for the link, I didn't know before that redirecting is such a big
 issue.
 
 
 RunCommandAndDirectOutput('diff', '-r dir1 dir2', 'diff.txt');
 
 Can I tell diff to only compare *.xml files?
 
 I want to track modifications in the FPC/Lazarus docs files...
 

I don't know if diff can be made to only match files against a pattern
but it can _ignore_ files matching a pattern. Anyway I made a program
that can do what you want mostly. It may be useful to you or not.

Also the TProcess example is slightly simpler.

Regards,

Andrew Haines
program diffpattern;
{$mode objfpc}{$H+}
uses
  Classes, Process, sysutils;


type

  TFilterProc = function (AName: String): Boolean;

  { TDiffDirs }

  TDiffDirs = class
Dir1,
Dir2: TStringList;
Dir1Name,
Dir2Name: String;
OnFilter: TFilterProc;
OutFile: TStream;
constructor Create(ADir1, ADir2: String);
destructor Destroy; override;
procedure MakeLists;
procedure Diff;
  end;

function CheckFilter(AName: String): Boolean;
begin
  Result := ExtractFileExt(AName) = '.xml';
end;

{ DiffDirs }

constructor TDiffDirs.Create(ADir1, ADir2: String);
begin
  Dir1 := TStringList.Create;
  Dir2 := TStringList.Create;
  Dir1Name := IncludeTrailingPathDelimiter(ADir1);
  Dir2Name := IncludeTrailingPathDelimiter(ADir2);
end;

destructor TDiffDirs.Destroy;
begin
  Dir1.Free;
  Dir2.Free;
  inherited Destroy;
end;

procedure TDiffDirs.MakeLists;
   procedure FindDirFiles(ADir, ASubDirs: String; const AList: TStrings);
   var
 s: TSearchRec;
   begin
 if FindFirst(ADir+ASubDirs+'*', faAnyFile or faDirectory, s) = 0 then
   repeat
 if (s.Attr and faDirectory = faDirectory) and (s.Name[1]  '.') then
   FindDirFiles(ADir, ASubDirs + IncludeTrailingPathDelimiter(s.Name), 
AList)
 else
   if CheckFilter(s.Name) then
 AList.Add(ASubDirs+s.Name);
   until FindNext(s)  0;
   end;
begin
  FindDirFiles(Dir1Name, '', Dir1);
  FindDirFiles(Dir2Name, '', Dir2);
  Dir1.Sort;
  Dir2.Sort;
end;

procedure TDiffDirs.Diff;
  procedure DoDiff(F1, F2: String);
  var
DiffC: String;
p: TProcess;
  begin
DiffC := 'diff -u -N '+ F1 + ' ' + F2; // -N is to treat missing files as 
empty
p := TProcess.Create(nil);
p.CommandLine := DiffC;
p.Options := [poUsePipes];
p.Execute;
while p.Running or (p.Output.NumBytesAvailable  0) do
  OutFile.CopyFrom(p.Output, p.Output.NumBytesAvailable);
p.free;
  end;

var
  File1,
  File2: String;
  j: Integer;
begin

  while 0  Dir1.Count do
  begin
File1 := Dir1Name+Dir1[0];
if Dir2.Find(File1, j) then // generally the first file in the list
begin
  File2 := Dir2Name+Dir2[j];
  Dir2.Delete(j);
end
else
  File2 := Dir2Name+Dir1[0]; // -- a non existant file
dir1.Delete(0);
DoDiff(File1, File2);
  end;
  // now loop through Dir2 to see what doesn't exist in dir1
  while 0  Dir2.Count do
  begin
File1 := Dir1Name+Dir2[0];
File2 := Dir2Name+Dir2[0];
Dir2.Delete(0);
DoDiff(File1, File2);
  end;
end;

begin
  if Paramcount  2 then
  begin
WriteLn ('Usage:');
WriteLn ('diffpattern dir1 dir2');
Writeln ('diff.txt is created in the current directory');
Exit;
  end;
  with  TDiffDirs.Create(ParamStr(1), ParamStr(2)) do
  begin
OutFile := TFileStream.Create('diff.txt', fmCreate or fmOpenWrite);
OnFilter:=@CheckFilter;
MakeLists;
Diff;
OutFile.Free;
Free;
  end;
end.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Running programs with output redirection

2011-07-16 Thread Andrew Haines
On 07/16/11 16:37, Hans-Peter Diettrich wrote:
 There seems to exist an issue with (output) redirection, when I try to
 run an external program from code. What I want to achieve is this:
 
 In a Win32 console I can run
diff -r dir1 dir2  diff.txt
 
 When I use e.g. Exec('diff', args), diff complains about an excess
 argument, it works when  diff.txt is removed. With other functions I
 had less luck (ExecuteProcess, CreateProcess...), no output at all.
 
 Now I assume that output redirection is a shell feature, not available
 in direct invocation of an external program. Right?
 
 Does there exist a simple way to run diff, and to redirect its output
 into an file? A batch file? Platform independence would be nice, of course.
 
 DoDi
 
 _

The best way I know is described here:
http://wiki.lazarus.freepascal.org/Executing_External_Programs#How_to_redirect_output_with_TProcess

something like the following (not tested)

function RunCommandAndDirectOutput(ACommand, AArgs, AOutName: String):
Integer;
var
 proc: TProcess;
 data: TFileStream;
 buffer: array [0..511] of byte;
 count: Integer;

begin
  proc := TProcess.Create(nil);
  proc.commandline := ACommand + ' ' + AArgs;
  proc.options := [pousepipes];

  data := TFileStream.Create(AOutName, fmcreate or fmwrite);

  proc.Execute;
  while proc.running or proc.output.numbytesavailable  0 do
  begin
count := proc.output.numbytesavailable;
if count  512 then
  count := 512;
count := proc.output.read(buffer, count);
data.write(buffer, count);
  end;
  Result := Proc.ExitStatus;
  proc.free;
  data.free;

end;

usage:

RunCommandAndDirectOutput('diff', '-r dir1 dir2', 'diff.txt');

Regards,

Andrew Haines


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Calling conventions

2011-01-03 Thread Andrew Haines
On 01/03/11 06:02, Jonas Maebe wrote:
 
 On 03 Jan 2011, at 04:11, Andrew Haines wrote:
 
 On linux32 and win32 what cc does fpc use by default?
 
 If you mean i386 by 32, it's Delphi-style fastcall, aka register.
 This calling convention is the default on all i386 platforms.
 
 FPC's implementation is not yet 100% Delphi-compatible at this time
 though, so it will still change in the future (since the only reason for
 supporting this is Delphi compatibility).
 
 

Thanks for the info :)

If you want to check it out I pasted the code I have so far here:

http://www.hu.freepascal.org/fpcircbot/cgipastebin?msgid=19098

There are lots of ifdefs so consider yourself warned.

I develop on linux so I haven't tested on windows and in fact I haven't
implemented allocating executable memory there yet either. (VirtualAlloc
afaik)

StdCall, Register, Cdecl, and linux64 calling conventions should be
complete but there could be bugs, I've tried to be thorough. I have yet
to write the win64 calling convention.

My test program is here:

http://www.hu.freepascal.org/fpcircbot/cgipastebin?msgid=19099

I just search replace the calling convention I wish to test.

Please go easy on me since I've never written assembler let alone
opcodes and operands before. It's...interesting.

I plan on using rtti to make the wrapper function only need a TMethod arg.

Also my memory management code can hardly be called that.

Further questions:

Do registers that are used to pass parameters need to be restored before
my trampoline procedure returns? (since I am shifting them to make room
for self)

As far as I know eax for sure can be thrashed but what about edx ecx.
And on linux64 rax can be changed but what about rdi rsi rdx rcx r8 r9?

Can something like this be added to the compiler so that when it detects
a TMethod being assigned to a plain callback type it inserts some code
to call my function?

i.e. the compiler turns
PlainCB := @MyObj.CB - compiler error about mismatched of object
into
PlainCB := MakeMethodTrampoline(@MyObj.CB);

Regards,

Andrew

PS I've mostly gotten my information from:

http://ref.x86asm.net/coder64-abc.html
http://en.wikipedia.org/wiki/X86_calling_conventions
http://www.codeproject.com/KB/cpp/calling_conventions_demystified.aspx
http://unixwiz.net/techtips/win32-callconv-asm.html
and
 AMD64 Architecture Programmer’s Manual Volume 3: General-Purpose and
System Instructions - extremely useful
also I examined some fpc asm code with gdb
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] Calling conventions

2011-01-02 Thread Andrew Haines
Hi,

I am writing a unit to automatically write Trampoline functions on the
fly. So assigning plain callbacks to TMethod's work.

Currently it can handle cdecl on linux32/64. I've tested it with up to 9
parameters and it works well.

I would like to implement whatever is common to interface
winapi(stdcall?) on win32 and just wanted to know if stdcall is for sure
what I want.

I know on x64 there is only one calling convention each for windows64
and everything_else_64.

On linux32 and win32 what cc does fpc use by default?

Thanks,

Andrew Haines
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] Patch for superscript and unicode in rtf

2010-12-17 Thread Andrew Haines
Hi, could somebody apply the patch in this bug
http://bugs.freepascal.org/view.php?id=18245 please? :)

Thanks

Andrew Haines
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] is cross compilation broken?

2010-12-17 Thread Andrew Haines
Hi,

Is cross compilation broken?

If I execute this command:

make crossinstall CPU_TARGET=arm OS_TARGET=linux
CROSSBINDIR=/home/user/lazarus/fpc/binutils/ OPT=-dFPC_ARMEL
INSTALL_PREFIX=/usr

(which I know would fail about the paths not being right)

the result is:

make install CROSSINSTALL=1
make[1]: Entering directory `/home/andrew/programming/fpc'
make compiler_cycle RELEASE=1
make[2]: Entering directory `/home/andrew/programming/fpc'
make -C compiler cycle
make[3]: Entering directory `/home/andrew/programming/fpc/compiler'
Makefile:3582: *** recipe commences before first target.  Stop.
make[3]: Leaving directory `/home/andrew/programming/fpc/compiler'
make[2]: *** [compiler_cycle] Error 2
make[2]: Leaving directory `/home/andrew/programming/fpc'
make[1]: *** [build-stamp.arm-linux] Error 2
make[1]: Leaving directory `/home/andrew/programming/fpc'
make: *** [crossinstall] Error 2

I had the same result trying to crosscompile to ppc386 from ppcx64.

Regards,

Andrew Haines


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] is cross compilation broken?

2010-12-17 Thread Andrew Haines
On 12/17/10 13:19, Jonas Maebe wrote:
 
 On 17 Dec 2010, at 18:48, Andrew Haines wrote:
 
 Is cross compilation broken?
 
 Not any more or less than it was in the past.
 
 make[3]: Entering directory `/home/andrew/programming/fpc/compiler'
 Makefile:3582: *** recipe commences before first target.  Stop.
 
 That's probably an incompatibility with make 3.81.9 and later. Try staying 
 with make 3.81 for now.


Hi, the attached patch seems to fix the problem.

Regards,

Andrew
Index: Makefile
===
--- Makefile(revision 16581)
+++ Makefile(working copy)
@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/09/29]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/12/17]
 #
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd 
i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware 
i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc 
i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux 
m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos 
m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos 
powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd 
sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris 
x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin 
arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux 
powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded 
mipsel-linux
@@ -3578,9 +3578,8 @@
 endif
 else
 cycle:
-override FPC=
-   $(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) CROSSBINDIR= 
BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl
-   $(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) 
EXENAME=$(TEMPNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 
cycleclean compiler
+   FPC= $(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) 
CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl
+   FPC= $(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) 
EXENAME=$(TEMPNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 
cycleclean compiler
$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) 
CPU_TARGET=$(CPU_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 
rtlclean rtl
$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) 
CPU_TARGET=$(CPU_SOURCE) PPC_TARGET=$(CPU_TARGET) EXENAME=$(PPCROSSNAME) 
CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler
 ifndef CROSSINSTALL
Index: Makefile.fpc
===
--- Makefile.fpc(revision 16581)
+++ Makefile.fpc(working copy)
@@ -587,9 +587,8 @@
 cycle:
 # ppc (source native)
 # Clear detected compiler binary, because it can be existing crosscompiler 
binary, but we need native compiler here
-override FPC=
-$(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) CROSSBINDIR= 
BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl
-$(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) 
EXENAME=$(TEMPNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 
cycleclean compiler
+FPC= $(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) 
CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl
+FPC= $(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) 
EXENAME=$(TEMPNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 
cycleclean compiler
 # ppcrossARCH (source native)
 $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) 
CPU_TARGET=$(CPU_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 
rtlclean rtl
 $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) 
CPU_TARGET=$(CPU_SOURCE) PPC_TARGET=$(CPU_TARGET) EXENAME=$(PPCROSSNAME) 
CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] fpc.cfg Question

2009-12-01 Thread Andrew Haines
Henry Vermaak wrote:
 2009/12/1 Andrew Haines andrewd...@aol.com:
 Hi,

 I tried to modify my fpc.cfg like so:

 #IFDEF arm

 #IFDEF i386
 What am I doing wrong?
 
 Hmm, I'm sure I've done something like this.  Does cpuarm and cpui386
 work instead of arm and i386?
 

Yes this was the problem thank you very much!

Andrew Haines
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] fpc.cfg Question

2009-11-30 Thread Andrew Haines
Hi,

I tried to modify my fpc.cfg like so:

#IFDEF arm
-XParm-wince-
-Xd
#ENDIF

#IFDEF i386
-Xd
-Fl/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.4/32
-Fl/emul/linux/x86/usr/lib32
-Fl/emul/linux/x86/lib
-Fl/lib32
-Fl/usr/lib32
-Fl/usr/local/lib32
#ENDIF

I have a ppc386(linux) and also ppcarm(wince)


my computer is linux 64 bit. However these options do not seem to have
any effect. I have to add these to the Other options in lazarus under
Project - Compler Options.

commenting out the lines that start with # will fix the problem until
I use a compiler other than the one the options are needed for.

What am I doing wrong?
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] CHM patches for docs and fpdoc

2009-10-11 Thread Andrew Haines
Hi attached patch for fpdoc adds the option --chm-title so that a nicer
title than the default (rtl,fcl,lcl etc) can be used.

The second patch is the documentation for the new option

Regards,

Andrew
Index: utils/fpdoc/dw_htmlchm.inc
===
--- utils/fpdoc/dw_htmlchm.inc  (revision 13840)
+++ utils/fpdoc/dw_htmlchm.inc  (working copy)
@@ -10,6 +10,7 @@
 FChm: TChmWriter;
 FTempUncompressed: TStream;
 FTempUncompressedName: String;
+FChmTitle: String;
 FTOCName,
 FIndexName,
 FDefaultPage: String;
@@ -451,7 +452,7 @@
   FTempUncompressedName := GetTempFileName+IntToStr(GetProcessID) +'.raw';
   FTempUncompressed := TFileStream.Create(FTempUncompressedName, fmOpenReadWrite  or fmCreate);
   FChm := TChmWriter.Create(FOutChm, False);
-  FChm.Title := Copy(Package.Name, 2, Length(Package.Name));
+  FChm.Title := FChmTitle;
   FChm.TempRawStream := FTempUncompressed;
   FChm.OnGetFileData := @RetrieveOtherFiles;
   FChm.OnLastFile := @LastFileAdded;
@@ -515,8 +516,13 @@
 FNoBinIndex := True
   else if Cmd = '--make-searchable' then
 FMakeSearchable := True
+  else if Cmd = '--chm-title' then
+FChmTitle := arg
   else
 Result:=inherited InterPretOption(Cmd, Arg);
+
+  if Length(FChmTitle) = 0 then
+FChmTitle := Copy(Package.Name, 2, Length(Package.Name));
 end;
 
 class procedure TCHMHTMLWriter.Usage(List: TStrings);
@@ -538,6 +544,8 @@
   List.Add(SCHMUsageAutoTOC);
   List.add('--make-searchable');
   List.Add(SCHMUsageMakeSearch);
+  List.Add('--chm-title');
+  List.Add(SCHMUsageChmTitle);
 end;
 
 
Index: utils/fpdoc/dglobals.pp
===
--- utils/fpdoc/dglobals.pp (revision 13840)
+++ utils/fpdoc/dglobals.pp (working copy)
@@ -117,6 +117,7 @@
   SCHMUsageAutoTOC = 'Automatically generate a Table of Contents. Ignores --toc-file';
   SCHMUsageAutoIDX = 'Automatically generate an Index. Ignores --index-file';
   SCHMUsageMakeSearch = 'Automatically generate a Search Index from filenames that match *.htm*';
+  SCHMUsageChmTitle= 'Title of the chm. Defaults to the value from --package';
 
   STitle   = 'FPDoc - Free Pascal Documentation Tool';
   SVersion = 'Version %s [%s]';
Index: utils/fpdoc/fpdoc.pp
===
--- utils/fpdoc/fpdoc.pp(revision 13840)
+++ utils/fpdoc/fpdoc.pp(working copy)
@@ -16,6 +16,7 @@
 program FPDoc;
 
 uses
+  {$IFDEF LZX_USETHREADS}{$IFNDEF MSWINDOWS}cthreads,{$ENDIF}{$ENDIF}
   SysUtils, Classes, Gettext, DOM, XMLWrite, PasTree, PParser,
   dGlobals,  // GLobal definitions, constants.
   dwriter,   // TFPDocWriter definition.
Index: fpdoc.tex
===
--- fpdoc.tex   (revision 559)
+++ fpdoc.tex   (working copy)
@@ -324,6 +324,12 @@
 meta content=text/html; charset=UTF8 http-equiv=Content-Type
 \end{verbatim}
 
+% chm-title
+\subsection{chm-title}
+\label{suse:chm-title}
+This option is to specifiy a nicer title than the default title which is
+the same value as --package=value.
+
 % content
 \subsection{content}
 \label{suse:content}
@@ -2012,4 +2018,4 @@
 
 %%%
 % End of file
-\end{document}
\ No newline at end of file
+\end{document}
Index: Makefile
===
--- Makefile(revision 559)
+++ Makefile(working copy)
@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/08/08]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/10/10]
 #
 default: help
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
@@ -1858,6 +1858,8 @@
   ifdef CSSFILE
 FPDOCHTMLOPTS+=--css-file=$(CSSFILE)
   endif
+  RTLCHMOPTS=--chm-title=(RTL) Runtime Library
+  FCLCHMOPTS=--chm-title=(FCL) Free Component Library
 endif
 ifndef LATEX
 LATEX = latex
@@ -2254,10 +2256,10 @@
 endif  # USEPLASTEX
 endif  # USEHEVEA
 fcl.chk: $(FCLXML)
-   $(FPDOC) $(FCLOPTS) --format=$(HTMLFMT) --output=fcl$(HTMLSUFFIX) $(FPDOCHTMLOPTS)
+   $(FPDOC) $(FCLOPTS) --format=$(HTMLFMT) --output=fcl$(HTMLSUFFIX) $(FPDOCHTMLOPTS) $(FCLCHMOPTS)
touch fcl.chk
 

[fpc-devel] [PATCH] patch to allow TUnzipper to load it's zip file from wherever

2009-08-02 Thread Andrew Haines
Hi,

This patch allows TUnzipper to load it's file from any TStream
descendant instead of only using a FileName to load a zip stream.

Regards,

Andrew Haines
Index: src/zipper.pp
===
--- src/zipper.pp   (revision 13488)
+++ src/zipper.pp   (working copy)
@@ -362,6 +362,7 @@
   end;
 
   TOnCustomStreamEvent = Procedure(Sender : TObject; var AStream : TStream; AItem : TFullZipFileEntry) of object;
+  TOpenStreamEvent = Procedure(Sender: TObject; var AStream: TStream) of object;
 
   { TFullZipFileEntries }
 
@@ -377,15 +378,17 @@
 
   TUnZipper = Class(TObject)
   Private
+FOnCloseInputStream: TOpenStreamEvent;
 FOnCreateStream: TOnCustomStreamEvent;
 FOnDoneStream: TOnCustomStreamEvent;
+FOnOpenInputStream: TOpenStreamEvent;
 FUnZipping  : Boolean;
 FBufSize: LongWord;
 FFileName   :  String; { Name of resulting Zip file }
 FOutputPath : String;
 FEntries: TFullZipFileEntries;
 FFiles  : TStrings;
-FZipFile : TFileStream; { I/O file variables }
+FZipStream  : TStream; { I/O file variables }
 LocalHdr: Local_File_Header_Type;
 CentralHdr  : Central_File_Header_Type;
 EndHdr  : End_of_Central_Dir_Type;
@@ -418,6 +421,8 @@
 Procedure Examine;
   Public
 Property BufferSize : LongWord Read FBufSize Write SetBufSize;
+Property OnOpenInputStream: TOpenStreamEvent read FOnOpenInputStream write FOnOpenInputStream;
+Property OnCloseInputStream: TOpenStreamEvent read FOnCloseInputStream write FOnCloseInputStream;
 Property OnCreateStream : TOnCustomStreamEvent Read FOnCreateStream Write FOnCreateStream;
 Property OnDoneStream : TOnCustomStreamEvent Read FOnDoneStream Write FOnDoneStream;
 Property OnPercent : Integer Read FOnPercent Write FOnPercent;
@@ -444,6 +449,7 @@
   SErrMissingArchiveName = 'Missing archive filename in streamed entry %d';
   SErrFileDoesNotExist = 'File %s does not exist.';
   SErrNoFileName = 'No archive filename for examine operation.';
+  SErrNoStream = 'No stream is opened.';
 
 { -
 Auxiliary
@@ -1498,7 +1504,10 @@
 Procedure TUnZipper.OpenInput;
 
 Begin
-  FZipFile:=TFileStream.Create(FFileName,fmOpenRead);
+  if Assigned(FOnOpenInputStream) then
+FOnOpenInputStream(Self, FZipStream);
+  if FZipStream = nil then
+FZipStream:=TFileStream.Create(FFileName,fmOpenRead);
 End;
 
 
@@ -1549,7 +1558,9 @@
 Procedure TUnZipper.CloseInput;
 
 Begin
-  FreeAndNil(FZipFile);
+  if Assigned(FOnCloseInputStream) then
+FOnCloseInputStream(Self, FZipStream);
+  FreeAndNil(FZipStream);
 end;
 
 
@@ -1558,18 +1569,18 @@
   S : String;
   D : TDateTime;
 Begin
-  FZipFile.Seek(Item.HdrPos,soFromBeginning);
-  FZipFile.ReadBuffer(LocalHdr,SizeOf(LocalHdr));
+  FZipStream.Seek(Item.HdrPos,soFromBeginning);
+  FZipStream.ReadBuffer(LocalHdr,SizeOf(LocalHdr));
 {$IFDEF FPC_BIG_ENDIAN}
   LocalHdr := SwapLFH(LocalHdr);
 {$ENDIF}
   With LocalHdr do
 begin
   SetLength(S,Filename_Length);
-  FZipFile.ReadBuffer(S[1],Filename_Length);
+  FZipStream.ReadBuffer(S[1],Filename_Length);
   //SetLength(E,Extra_Field_Length);
-  //FZipFile.ReadBuffer(E[1],Extra_Field_Length);
-  FZipFile.Seek(Extra_Field_Length,soCurrent);
+  //FZipStream.ReadBuffer(E[1],Extra_Field_Length);
+  FZipStream.Seek(Extra_Field_Length,soCurrent);
   Item.ArchiveFileName:=S;
   Item.DiskFileName:=S;
   Item.Size:=Uncompressed_Size;
@@ -1592,36 +1603,36 @@
   D : TDateTime;
   S : String;
 Begin
-  EndHdrPos:=FZipFile.Size-SizeOf(EndHdr);
+  EndHdrPos:=FZipStream.Size-SizeOf(EndHdr);
   if EndHdrPos  0 then
-raise EZipError.CreateFmt(SErrCorruptZIP,[FZipFile.FileName]);
-  FZipFile.Seek(EndHdrPos,soFromBeginning);
-  FZipFile.ReadBuffer(EndHdr, SizeOf(EndHdr));
+raise EZipError.CreateFmt(SErrCorruptZIP,[FileName]);
+  FZipStream.Seek(EndHdrPos,soFromBeginning);
+  FZipStream.ReadBuffer(EndHdr, SizeOf(EndHdr));
 {$IFDEF FPC_BIG_ENDIAN}
   EndHdr := SwapECD(EndHdr);
 {$ENDIF}
   With EndHdr do
 begin
 if Signature  END_OF_CENTRAL_DIR_SIGNATURE then
-  raise EZipError.CreateFmt(SErrCorruptZIP,[FZipFile.FileName]);
+  raise EZipError.CreateFmt(SErrCorruptZIP,[FileName]);
 CenDirPos:=Start_Disk_Offset;
 end;
-  FZipFile.Seek(CenDirPos,soFrombeginning);
+  FZipStream.Seek(CenDirPos,soFrombeginning);
   FEntries.Clear;
   for i:=0 to EndHdr.Entries_This_Disk-1 do
 begin
-FZipFile.ReadBuffer(CentralHdr, SizeOf(CentralHdr));
+FZipStream.ReadBuffer(CentralHdr, SizeOf(CentralHdr));
 {$IFDEF FPC_BIG_ENDIAN}
 CentralHdr := SwapCFH(CentralHdr);
 {$ENDIF}
 With CentralHdr do
   begin
   if SignatureCENTRAL_FILE_HEADER_SIGNATURE then
-raise EZipError.CreateFmt(SErrCorruptZIP,[FZipFile.FileName

Re: [fpc-devel] ref,user and prog in chm format

2009-07-29 Thread Andrew Haines
Marco van de Voort wrote:
 
 Btw, could you have a look at this:
 http://bugs.freepascal.org/view.php?id=13540
 
 and see if you notice anything particular?

Sure, I will try to look after work today. Though I remember being
slightly confused as to how the quickref was wrong. The MS reader seemed
not to use it so I never fixed it.

Regards,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] [PATCH] patch for zipper.pp

2009-07-29 Thread Andrew Haines
Micha Nelissen wrote:

 
 Do you mind if I say I think this is a very weird event handler?

No, of course not :)

 
 What is the behaviour? How many times is it called? What does AClosing
 mean? How do I know I don't have a memory leak?
 

Yes you are right of course. It is confusing.

 Why an event handler and not a property? A CustomStream property where
 non-nil means use this stream, if nil then default old behaviour e.g.
 

As Michael said a property does not make much sense.

I just looked a the changes Michael made and it is very straight forward
 now :)

Regards,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] ref,user and prog in chm format

2009-07-29 Thread Andrew Haines
Marco van de Voort wrote:

 
 Btw, could you have a look at this:
 http://bugs.freepascal.org/view.php?id=13540
 
 and see if you notice anything particular?

I made some changes and *think* I have fixed the problem in r13476 and
r13477. Both the ms reader and 7-zip are happy now. Afaict the quickref
section is 100% now.

Regards,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] [PATCH] patch for zipper.pp

2009-07-28 Thread Andrew Haines
Hi,

This patch updates TUnZipper so that files can be unzipped to a custom
user stream.

To use a custom stream here is an example:

UnZip := TUnZipper.Create;

// both of the following have to be set or
// the builtin method will be used (TFileStream)

UnZip.UseCustomOutputStream := True;
UnZip.OnCustomOutput := @UnZipCustomOutput;



procedure tfor...@unzipcustomoutput(Sender: TObject; var AStream:
TStream; AItem: TFullZipFileEntry; AClosing: Boolean);
begin
  if AClosing = False then
  begin
AStream := TMemoryStream.Create;
  end
  else
  begin
DoSomethingCreativeWith(AStream);
AStream.Free;
  end;
end;

Also fixed a bug where if a date was not set on a zipfile entry a crash
would occur.

Regards,

Andrew
Index: packages/paszlib/src/zipper.pp
===
--- packages/paszlib/src/zipper.pp  (revision 13470)
+++ packages/paszlib/src/zipper.pp  (working copy)
@@ -361,6 +361,8 @@
 property CRC32: LongWord read FCRC32 write FCRC32;
   end;
 
+  TOnCustomOutputEvent = Procedure(Sender : TObject; var AStream : TStream; AItem : TFullZipFileEntry; AClosing : Boolean) of object;
+
   { TFullZipFileEntries }
 
   TFullZipFileEntries = Class(TZipFileEntries)
@@ -375,13 +377,14 @@
 
   TUnZipper = Class(TObject)
   Private
+FOnCustomOutput: TOnCustomOutputEvent;
 FUnZipping  : Boolean;
 FBufSize: LongWord;
 FFileName   :  String; { Name of resulting Zip file }
 FOutputPath : String;
 FEntries: TFullZipFileEntries;
 FFiles  : TStrings;
-FOutFile: TFileStream;
+FUseCustomOutputStream: Boolean;
 FZipFile : TFileStream; { I/O file variables }
 LocalHdr: Local_File_Header_Type;
 CentralHdr  : Central_File_Header_Type;
@@ -393,13 +396,13 @@
 FOnStartFile : TOnStartFileEvent;
   Protected
 Procedure OpenInput;
-Procedure CloseOutput;
+Procedure CloseOutput(Item : TFullZipFileEntry; var OutStream: TStream);
 Procedure CloseInput;
 Procedure ReadZipDirectory;
 Procedure ReadZipHeader(Item : TFullZipFileEntry; out AMethod : Word);
 Procedure DoEndOfFile;
 Procedure UnZipOneFile(Item : TFullZipFileEntry); virtual;
-Function  OpenOutput(OutFileName : String) : Boolean;
+Function  OpenOutput(OutFileName : String; var OutStream: TStream; Item : TFullZipFileEntry) : Boolean;
 Procedure SetBufSize(Value : LongWord);
 Procedure SetFileName(Value : String);
 Procedure SetOutputPath(Value:String);
@@ -415,12 +418,14 @@
 Procedure Examine;
   Public
 Property BufferSize : LongWord Read FBufSize Write SetBufSize;
+Property OnCustomOutput : TOnCustomOutputEvent Read FOnCustomOutput Write FOnCustomOutput;
 Property OnPercent : Integer Read FOnPercent Write FOnPercent;
 Property OnProgress : TProgressEvent Read FOnProgress Write FOnProgress;
 Property OnStartFile : TOnStartFileEvent Read FOnStartFile Write FOnStartFile;
 Property OnEndFile : TOnEndOfFileEvent Read FOnEndOfFile Write FOnEndOfFile;
 Property FileName : String Read FFileName Write SetFileName;
 Property OutputPath : String Read FOutputPath Write SetOutputPath;
+Property UseCustomOutputStream : Boolean Read FUseCustomOutputStream Write FUseCustomOutputStream;
 Property Files : TStrings Read FFiles;
 Property Entries : TFullZipFileEntries Read FEntries;
   end;
@@ -529,6 +534,9 @@
   D:=ZD and 31;
   M:=(ZD shr 5) and 15;
   Y:=((ZD shr 9) and 127)+1980;
+
+  if M  1 then M := 1;
+  if D  1 then D := 1;
   DT:=ComposeDateTime(EncodeDate(Y,M,D),EncodeTime(H,N,S,MS));
 end;
 
@@ -1494,7 +1502,7 @@
 End;
 
 
-Function TUnZipper.OpenOutput(OutFileName : String) : Boolean;
+Function TUnZipper.OpenOutput(OutFileName : String; var OutStream: TStream; Item : TFullZipFileEntry) : Boolean;
 Var
   Path: String;
   OldDirectorySeparators: set of char;
@@ -1507,20 +1515,33 @@
   OldDirectorySeparators:=AllowDirectorySeparators;
   AllowDirectorySeparators:=[DirectorySeparator];
   Path:=ExtractFilePath(OutFileName);
-  if (Path'') then
-ForceDirectories(Path);
-  AllowDirectorySeparators:=OldDirectorySeparators;
-  FOutFile:=TFileStream.Create(OutFileName,fmCreate);
+
+  If FUseCustomOutputStream and Assigned(FOnCustomOutput) then
+FOnCustomOutput(Self, OutStream, Item, False)
+  Else
+  Begin
+if (Path'') then
+  ForceDirectories(Path);
+AllowDirectorySeparators:=OldDirectorySeparators;
+OutStream:=TFileStream.Create(OutFileName,fmCreate);
+  end;
+
   Result:=True;
   If Assigned(FOnStartFile) then
 FOnStartFile(Self,OutFileName);
 End;
 
 
-Procedure TUnZipper.CloseOutput;
+Procedure TUnZipper.CloseOutput(Item : TFullZipFileEntry; var OutStream: TStream);
 
 Begin
-  FreeAndNil(FOutFile);
+  if FUseCustomOutputStream and Assigned(FOnCustomOutput) then
+  begin
+FOnCustomOutput(Self, OutStream, Item, True);
+OutStream := nil;
+  end
+  else

Re: [fpc-devel] ref,user and prog in chm format

2009-07-28 Thread Andrew Haines
Marco van de Voort wrote:
 L.s.
 
 I've made a few scripts that 
 (1) fix (some of) the html output of tex4ht.  (fpcdocs/relinkdocs.pp)
 (2) compress them to chm with generated toc and searchability
   (fpcdocs/compilelatexchm.pp)
 
 This enabled me to compile the most recent docs to a fairly usable CHM
 format:
 
 http://www.stack.nl/~marcov/doc-chm.zip
 


Wow this is great! Thanks!

I just fixed a bug in lhelp that allows your TOC links to work correctly
if # is in the link name.

Regards,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] can r12368 be merged to fixes?

2008-12-16 Thread Andrew Haines

Joost van der Sluis wrote:

Op maandag 15-12-2008 om 23:52 uur [tijdzone -0500], schreef Andrew
Haines:
  

It fixes a really terrible memory leak.



No.

Not for now at least. First wait for the testsuite-results (if there are
no tests for this particular part, then we even have to wait some
longer, as we need users to test it). Then let it settle at least a few
days. 

Then we'll see. 
  
Ok, well whatever is fine with me since I don't really use the fixes 
branch. But it fixes an enormous memory leak that was caused by


if some condition then ;   //  improperly placed semicolon
 ExtractAFileToMemory;

Searching for tcontrol in lcl.chm used 200 megabytes of memory. And 
each subsequent search only increased memory usage further.


Regards,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] can r12368 be merged to fixes?

2008-12-15 Thread Andrew Haines

It fixes a really terrible memory leak.

Thanks

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] Is LNet planned to be included in a fpc release?

2008-12-08 Thread Andrew Haines

?

Regards,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] [PATCH] for fpdoc chm part

2008-11-25 Thread Andrew Haines

Hi,

this fixes the TOC and Index when generated in a windows computer so \ 
is changed to /


Regards,

Andrew
Index: dw_htmlchm.inc
===
--- dw_htmlchm.inc  (revision 12229)
+++ dw_htmlchm.inc  (working copy)
@@ -179,12 +179,12 @@
 // by unit
 TmpItem := ObjUnitItem.Children.NewItem;
 TmpItem.Text := Element.Name;
-TmpItem.Local := Allocator.GetFilename(Element, 0);
+TmpItem.Local := FixHTMLpath(Allocator.GetFilename(Element, 0));
 
 //alpha
 TmpItem := GetAlphaItem(AlphaObjItem.Children, UpperCase(Copy(Element.Name, 1, 2))).Children.NewItem;
 TmpItem.Text := Element.Name;
-TmpItem.Local := Allocator.GetFilename(Element, 0);
+TmpItem.Local := FixHTMLpath(Allocator.GetFilename(Element, 0));
 
   end;
   
@@ -195,12 +195,12 @@
 // by unit
 TmpItem := RoutinesUnitItem.Children.NewItem;
 TmpItem.Text := Element.Name;
-TmpItem.Local := Allocator.GetFilename(Element, 0);
+TmpItem.Local := FixHTMLpath(Allocator.GetFilename(Element, 0));
 
 // alpha
 TmpItem := GetAlphaItem(AlphaRoutinesItem.Children, UpperCase(Element.Name[1])).Children.NewItem;
 TmpItem.Text := Element.Name;
-TmpItem.Local := Allocator.GetFilename(Element, 0);
+TmpItem.Local := FixHTMLpath(Allocator.GetFilename(Element, 0));
   end;
 end;
   end;
@@ -287,7 +287,7 @@
   AModule := TPasModule(Package.Modules[i]);
   ParentItem := Index.Items.NewItem;
   ParentItem.Text := AModule.Name;
-  ParentItem.Local := Allocator.GetFilename(AModule, 0);
+  ParentItem.Local := FixHTMLpath(Allocator.GetFilename(AModule, 0));
 
   //  classes
   for j := 0 to AModule.InterfaceSection.Classes.Count-1 do
@@ -295,7 +295,7 @@
 ParentElement := TPasClassType(AModule.InterfaceSection.Classes[j]);
 ParentItem := Index.Items.NewItem;
 ParentItem.Text := ParentELement.Name;
-ParentItem.Local := Allocator.GetFilename(ParentElement, 0);
+ParentItem.Local := FixHTMLpath(Allocator.GetFilename(ParentElement, 0));
 for k := 0 to TPasClassType(ParentElement).Members.Count-1 do
 begin
   TmpElement := TPasElement(TPasClassType(ParentElement).Members.Items[k]);
@@ -314,7 +314,7 @@
 cmtInterface   : TmpItem.Text := TmpElement.Name + ' interface';
 cmtUnknown : TmpItem.Text := TmpElement.Name;
   end;
-  TmpItem.Local := Allocator.GetFilename(TmpElement, 0);
+  TmpItem.Local := FixHTMLpath(Allocator.GetFilename(TmpElement, 0));
   {
   ParentElement = Class
  TmpElement = Member
@@ -322,11 +322,11 @@
   MemberItem := nil;
   MemberItem := GetAlphaItem(Index.Items, TmpElement.Name);
   // ahh! if MemberItem.Local is empty MemberType is not shown!
-  MemberItem.Local := Allocator.GetFilename(TmpElement, 0);
+  MemberItem.Local := FixHTMLpath(Allocator.GetFilename(TmpElement, 0));
 
   TmpItem := MemberItem.Children.NewItem;
   TmpItem.Text := ParentElement.Name;
-  TmpITem.Local := Allocator.GetFilename(TmpElement, 0);
+  TmpITem.Local := FixHTMLpath(Allocator.GetFilename(TmpElement, 0));
 end;
   end;
   // routines
@@ -335,7 +335,7 @@
 ParentElement := TPasProcedureType(AModule.InterfaceSection.Functions[j]);
 TmpItem := Index.Items.NewItem;
 TmpItem.Text := ParentElement.Name + ' ' + TPasFunction(ParentElement).ElementTypeName;
-TmpItem.Local := Allocator.GetFilename(ParentElement, 0);
+TmpItem.Local := FixHTMLpath(Allocator.GetFilename(ParentElement, 0));
   end;
   // consts
   for j := 0 to AModule.InterfaceSection.Consts.Count-1 do
@@ -343,7 +343,7 @@
 ParentElement := TPasElement(AModule.InterfaceSection.Consts[j]);
 TmpItem := Index.Items.NewItem;
 TmpItem.Text := ParentElement.Name;
-TmpItem.Local := Allocator.GetFilename(ParentElement, 0);
+TmpItem.Local := FixHTMLpath(Allocator.GetFilename(ParentElement, 0));
   end;
   // types
   for j := 0 to AModule.InterfaceSection.Types.Count-1 do
@@ -351,7 +351,7 @@
 ParentElement := TPasType(AModule.InterfaceSection.Types[j]);
 TmpItem := Index.Items.NewItem;
 TmpItem.Text := ParentElement.Name;
-TmpItem.Local := Allocator.GetFilename(ParentElement, 0);
+TmpItem.Local := FixHTMLpath(Allocator.GetFilename(ParentElement, 0));
 // enums
 if ParentELement is TPasEnumType then
 begin
@@ -376,7 +376,7 @@
 ParentElement := TPasElement(AModule.InterfaceSection.Variables[j]);
 TmpItem := Index.Items.NewItem;
 TmpItem.Text := ParentElement.Name + ' var';
-TmpItem.Local := Allocator.GetFilename(ParentElement, 0);
+

Re: [fpc-devel] [PATCH] for chm search ability for fpdoc

2008-11-14 Thread Andrew Haines

Michael Van Canneyt wrote:

On Fri, 14 Nov 2008, Andrew Haines wrote:

  

hi attached is a patch to add the option --make-searchable to fpdoc for the
chm target

It can take some time to index all the documents in the rtl for example.



Applied, and merged to fixes, so it gets included in 2.2.4

Can you write a small paragraph for the docs about it ?

Michael.
___
  
Here you go. I had already written it but not sent it since I couldn't 
get the html docs to compile. I installed a dvi viewer and checked it 
that way.


Regards,

Andrew
Index: fpdoc.tex
===
--- fpdoc.tex   (revision 474)
+++ fpdoc.tex   (working copy)
@@ -507,6 +507,12 @@
 implemented. By default, syntax highlighting is provided by the syntax
 package that comes with \fpc.
 
+% make-searchable
+\subsection{make-searchable}
+This option generates an index of all the *.htm* files added in the chm, 
+including files added with the --other-files option so that a full text search
+is possible. This option only applies to the chm backend.
+
 % other-files
 \subsection{other-files}
 \label{suse:other-files}
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] [PATCH] for chm search ability for fpdoc

2008-11-14 Thread Andrew Haines

Michael Van Canneyt wrote:

On Fri, 14 Nov 2008, Andrew Haines wrote:

  

hi attached is a patch to add the option --make-searchable to fpdoc for the
chm target

It can take some time to index all the documents in the rtl for example.



Applied, and merged to fixes, so it gets included in 2.2.4

Can you write a small paragraph for the docs about it ?

  

Hi,

I realized that I didn't add the option --make-searchable to the 
available options when --help is used.


Thanks,

Andrew
Index: dw_htmlchm.inc
===
--- dw_htmlchm.inc  (revision 12090)
+++ dw_htmlchm.inc  (working copy)
@@ -518,6 +518,8 @@
   List.Add(SCHMUsageAutoIDX);
   List.add('--auto-toc');
   List.Add(SCHMUsageAutoTOC);
+  List.add('--make-searchable');
+  List.Add(SCHMUsageMakeSearch);
 end;
 
 
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] [PATCH] for chm search ability for fpdoc

2008-11-13 Thread Andrew Haines
hi attached is a patch to add the option --make-searchable to fpdoc for 
the chm target


It can take some time to index all the documents in the rtl for example.

Regards,

Andrew

Index: dw_htmlchm.inc
===
--- dw_htmlchm.inc  (revision 11973)
+++ dw_htmlchm.inc  (working copy)
@@ -14,6 +14,7 @@
 FIndexName,
 FDefaultPage: String;
 FCSSFile: String;
+FMakeSearchable,
 FAutoTOC,
 FAutoIndex: Boolean;
 FOtherFiles: String;
@@ -60,6 +61,8 @@
 FChm.FilesToCompress.LoadFromFile(FOtherFiles);
   end;
 
+  FChm.FullTextSearch := FMakeSearchable;
+
 end;
 
 function TCHMHTMLWriter.RetrieveOtherFiles(const DataName: String; out
@@ -492,6 +495,8 @@
 FAutoIndex := True
   else if Cmd = '--auto-toc' then
 FAutoTOC := True
+  else if Cmd = '--make-searchable' then
+FMakeSearchable := True
   else
 Result:=inherited InterPretOption(Cmd, Arg);
 end;
Index: dglobals.pp
===
--- dglobals.pp (revision 11973)
+++ dglobals.pp (working copy)
@@ -116,6 +116,7 @@
   SCHMUsageCSSFile = 'Filename of a .css file to be included in the chm.';
   SCHMUsageAutoTOC = 'Automatically generate a Table of Contents. Ignores --toc-file';
   SCHMUsageAutoIDX = 'Automatically generate an Index. Ignores --index-file';
+  SCHMUsageMakeSearch = 'Automatically generate a Search Index from filenames that match *.htm*';
 
   STitle   = 'FPDoc - Free Pascal Documentation Tool';
   SVersion = 'Version %s [%s]';
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] Address of procedures in linked libs

2008-05-06 Thread Andrew Haines
Hi,

In a dynamically linked in library (not dlload) if I do
@SomeProcInSharedObject is it giving me the address of the code in
memory or something else?

For instance I tried to overwrite a proc in gtk like so:

Orig_addr := PtrUInt(@gtk_widget_get_name);
New_addr := PtrUInt(@glue_gtk_widget_get_name);
New_Size := ProcSize(New_addr, PtrUint(@nothing));

DumpMemory(Pointer(Orig_addr), 32);
DumpMemory(Pointer(New_addr), 32);

Move(Pointer(New_addr)^, Pointer(Orig_addr)^, New_Size);

The Output was this:

Memory at Orig_addr:
8B8225FF E900 8B7A25FF E900
Memory of New_addr:
E5894855 F87D8948 CBE8 458B48F0

the memory pointed to at Orig_addr looks bogus to me. Is it a table
somewhere?

The Move command causes an error.

This is in linux/64 bit.

Regards,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] Freepascal in microcontrollers

2008-02-22 Thread Andrew Haines
Can freepascal be used on small processors that are 8 or 16 bits or does
it expect that there are at least 32 bits for most things? I've been
tempted lately to start making little circuits with microcontrollers on
them. I realize that a great deal of the rtl/fcl would not be used on
these little processors. Also since there is no OS on these devices does
that mean that for sure fpc cannot work?

Regards,

Andrew Haines


A 32 bit microcontroller:
http://www.microcontroller.com/news/microchip_pic32.asp
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] [PATCH] docs for fpdoc chm options

2007-12-29 Thread Andrew Haines
Andrew Haines wrote:
 Andrew Haines wrote:
 Hi this documents all the new chm options for fpdoc and also fixes the
 Makefile.fpc file to use a tab instead of spaces for the target chm.

 Regards,

 Andrew



 bump
 
 

ah maybe the tab character is changed by my mail client. I guess for the
makefile just change the spaces to a tab for the one line that is changed.

Thanks,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FP 2.4 questions

2007-12-28 Thread Andrew Haines
Fabio Dell'Aria wrote:
 But on the wiki I found same ppumove winnt examples:
 
 http://www.freepascal.org/docs-html/user/userse42.html#x149-1490008.7
 

I suspect that those docs are outdated. It's been quite some time since
ar.exe needed to be copied to arw.exe or ld.exe needed to be copied to
ldw.exe.

Regards,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] [PATCH] for fpdoc docs

2007-12-23 Thread Andrew Haines
Hi,

I added to the docs imformation on the chm part of fpdoc.

There are five or six options I would like to document better than the
short description --help --format=chm gives, where should they go in
fpdoc.tex?

Regards,

Andrew
Index: fpdoc.tex
===
--- fpdoc.tex   (revision 345)
+++ fpdoc.tex   (working copy)
@@ -110,6 +110,7 @@
 \item[Man] Unix man pages. Each function/procedure/method identifier is a man
 page. Constants are on a separate page, as are types, variables and
 resourcestrings.
+\item[CHM] HTML files compressed into a .chm file using lzx compression.
 \end{description}
 Plans exist to create direct RTF output as well.
 
@@ -342,6 +343,7 @@
 \item[latex] LaTex, which uses the \file{fpc.sty} style used by the \fpc
 documentation. 
 \item[xml-struct] Structured XML.
+\item[chm] Compressed HTML.
 \end{description}
 
 % help
@@ -408,6 +410,14 @@
 directory. Inside the subdirectory, commands as the above could be used to
 provide links to other documentation packages.
 
+Example:
+\begin{verbatim}
+--import=../fcl.cnt,ms-its:fcl.chm::/
+\end{verbatim}
+As in the previous example this will read the file fcl.cnt in the parent 
+directory. But all links to items in the fcl.cnt file, will be prepended 
+with \file{ms-its:fcl.chm::/}. This is how chm's are crosslinked.
+
 Note that for Latex documentation, this option is ignored.
 
 % input
@@ -462,6 +472,7 @@
 This option tells  \fpdoc where the output file should be generated. 
 How this option is interpreted depends on the format that is used. 
 For latex, this is interpreted as the filename for the tex file. 
+For chm, this is interpreted as the output filename.
 For all other formats, this is interpreted as the directory where all 
 documentation files will be written. The directory will be created if 
 it does not yet exist.
@@ -478,6 +489,10 @@
 --format=latex --output=docs/classes.tex
 \end{verbatim}
 will generate latex documentation in the file \file{docs/classes}.
+\begin{verbatim}
+--format=chm --output=docs.chm
+\end{verbatim}
+will generate chm documentation in the file \file{docs.chm}.
 
 % package
 \subsection{package}
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] [PATCH] docs in chm

2007-12-21 Thread Andrew Haines
Hi the attached patch is my attempt of editing the Makefile.fpc file in
the docs repositiory.

It makes it so you can build the rtl and fcl docs as chm files with:
make chm

Regards,

Andrew
Index: Makefile.fpc
===
--- Makefile.fpc(revision 342)
+++ Makefile.fpc(working copy)
@@ -160,6 +160,7 @@
 OUT = $(addsuffix .out, $(DOCS))
 # Html files are build in a directory
 HTML = $(DOCS)
+CHM = $(addsuffix .chm, $(DOCS))
 CHK = $(addsuffix .chk, $(DOCS))
 
 
@@ -215,6 +216,7 @@
 @echo ' dvi   : Make documentation using latex.'
 @echo ' ps: Make documentation using latex and dvips.'
 @echo ' html  : Make HTML documentation using default converter.'
+@echo ' chm   : Make Compressed HTML documentation. (only the FCL and RTL)'
 @echo ' hevea : Make HTML documentation using hevea'
 @echo ' l2h   : Make HTML documentation using latex2html'
 @echo ' 4ht   : Make HTML documentation using tex4ht'
@@ -232,7 +234,7 @@
 
 clean:
 -rm -f preamble.inc date.inc messages.inc rtl.inc
--rm -f *.4tc *.4ct *.css *.lg *.tmp *.xref *.kwd *.xct
+-rm -f *.4tc *.4ct *.css *.lg *.tmp *.xref *.kwd *.xct *.chm
 -rm -rf $(DOCS)
 -rm -f $(CHK) $(TOC) $(LOG) $(DVI) $(PDF) $(AUX) $(OUT) $(PS) $(HTML) *.i* $(LOT) $(TXT)
 # Styles
@@ -309,10 +311,6 @@
 else
 GRAPHDIR=$(FPCSRCDIR)/rtl
 endif
-ifndef RTLLINKPREFIX
-RTLLINKPREFIX=../rtl/
-endif
-FCLOPTS=$(FPDOCOPTS) --package=fcl --hide-protected --warn-no-node --descr=fcl.xml --content=fcl.xct --import=rtl.xct,$(RTLLINKPREFIX)
 #
 # Standard Makeskel update options.
 #
@@ -366,11 +364,11 @@
 FCLZSTREAM= --descr=zstream.xml --input=$(FCLZLIBDIR)/zstream.pp
 
 # Now add to the FCL fpdoc opts.
-FCLOPTS+= $(FCLIOSTREAM) $(FCLPIPES) $(FCLSTREAMIO) $(FCLPROCESS) $(FCLDBUGINTF)
-FCLOPTS+= $(FCLCONTNRS) $(FCLZSTREAM) $(FCLIDEA) $(FCLBUFSTREAM) $(FCLBASE64) 
-FCLOPTS+= $(FCLGETTEXT) $(FCLEZCGI) $(FCLPOOLEDMM) $(FCLDBUGMSG) $(FCLSTREAMEX)
-FCLOPTS+= $(FCLINICOL) $(FCLSTREAMCOL) $(FCLCACHECLS) $(FCLEVENTLOG) $(FCLSYNCOBJS)
-FCLOPTS+= $(FCLCUSTAPP) $(FCLBLOWFISH) $(FCLSIMPLEIPC) $(FCLINIFILES) $(FCLRTTIUTILS)
+FCLUNITOPTS+= $(FCLIOSTREAM) $(FCLPIPES) $(FCLSTREAMIO) $(FCLPROCESS) $(FCLDBUGINTF)
+FCLUNITOPTS+= $(FCLCONTNRS) $(FCLZSTREAM) $(FCLIDEA) $(FCLBUFSTREAM) $(FCLBASE64) 
+FCLUNITOPTS+= $(FCLGETTEXT) $(FCLEZCGI) $(FCLPOOLEDMM) $(FCLDBUGMSG) $(FCLSTREAMEX)
+FCLUNITOPTS+= $(FCLINICOL) $(FCLSTREAMCOL) $(FCLCACHECLS) $(FCLEVENTLOG) $(FCLSYNCOBJS)
+FCLUNITOPTS+= $(FCLCUSTAPP) $(FCLBLOWFISH) $(FCLSIMPLEIPC) $(FCLINIFILES) $(FCLRTTIUTILS)
 
 RTLOPTS=$(FPDOCOPTS) --hide-protected --warn-no-node --package=rtl --descr=rtl.xml --content=rtl.xct
 ifdef CURRENTXMLONLY
@@ -597,12 +595,27 @@
 endif  # USEL2H
 endif  # USEHEVEA
 
+ifndef HTMLFMT
+  HTMLFMT=html
+endif
+
+ifndef RTLLINKPREFIX
+  ifeq (HTMLFMT,html)
+RTLLINKPREFIX=../rtl/
+  else
+RTLLINKPREFIX=ms-its:rtl.chm::/
+  endif
+endif
+
+FCLOPTS=$(FPDOCOPTS) --package=fcl --hide-protected --warn-no-node --descr=fcl.xml --content=fcl.xct --import=rtl.xct,$(RTLLINKPREFIX) $(FCLUNITOPTS)
+
+
 fcl.chk: $(FCLXML)
-$(FPDOC) $(FCLOPTS) --format=html --output=fcl
+$(FPDOC) $(FCLOPTS) --format=$(HTMLFMT) --output=fcl$(HTMLSUFFIX) $(FPDOCHTMLOPTS)
 touch fcl.chk
 
 rtl.chk: $(RTLXML)
-$(FPDOC) $(RTLOPTS) --format=html --output=rtl
+$(FPDOC) $(RTLOPTS) --format=$(HTMLFMT) --output=rtl$(HTMLSUFFIX) $(FPDOCHTMLOPTS)
 touch rtl.chk
 
 user.chk: $(INCLUDES) user.tex messages.inc
@@ -614,6 +627,15 @@
 
 html: $(INCLUDES) $(CHK)
 
+chm: html
+HTMLFMT=chm
+HTMLSUFFIX=.chm
+FPDOCHTMLOPTS=--auto-toc --auto-index
+ifdef CSSFILE
+  FPDOCHTMLOPTS+=--css-file=$(CSSFILE)
+endif
+
+
 endif  # INSTALLDEBUG
 ###
 # Targets to force using a specific tool.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] [PATCH] docs in chm

2007-12-21 Thread Andrew Haines
Michael Van Canneyt wrote:
 
 On Fri, 21 Dec 2007, Andrew Haines wrote:
 
 Hi the attached patch is my attempt of editing the Makefile.fpc file in
 the docs repositiory.

 It makes it so you can build the rtl and fcl docs as chm files with:
 make chm
 
 Applied. Thank you.
 

Wow, that was fast! thanks

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] [PATCH] another patch for fpcdocs

2007-12-21 Thread Andrew Haines
Hi,

Apparently I don't know much about makefiles and the last patch I sent
makes only chm files and not html files ever.

So here is another patch that fixes that.

Also I've decided that I don't like makefiles. :)

I can't believe how long it took for me to find a solution to the problem :(

Regards,

Andrew
Index: Makefile.fpc
===
--- Makefile.fpc(revision 344)
+++ Makefile.fpc(working copy)
@@ -82,7 +82,30 @@
 ASCIIMODE=NO
 endif
 
+ifndef HTMLFMT
+  HTMLFMT=html
+endif
 
+ifndef RTLLINKPREFIX
+  ifeq (chm, $(HTMLFMT))
+RTLLINKPREFIX:=ms-its:rtl.chm::/
+  else
+RTLLINKPREFIX:=../rtl/
+  endif
+endif
+
+FCLOPTS=$(FPDOCOPTS) --package=fcl --hide-protected --warn-no-node --descr=fcl.xml --content=fcl.xct --import=rtl.xct,$(RTLLINKPREFIX) $(FCLUNITOPTS)
+
+ifeq (chm,$(HTMLFMT))
+  HTMLSUFFIX:=.chm
+  FPDOCHTMLOPTS=--auto-toc --auto-index
+  ifdef CSSFILE
+FPDOCHTMLOPTS+=--css-file=$(CSSFILE)
+  endif
+endif
+
+
+
 ###
 # LaTeX Program definitions
 ###
@@ -595,21 +618,6 @@
 endif  # USEL2H
 endif  # USEHEVEA
 
-ifndef HTMLFMT
-  HTMLFMT=html
-endif
-
-ifndef RTLLINKPREFIX
-  ifeq (HTMLFMT,html)
-RTLLINKPREFIX=../rtl/
-  else
-RTLLINKPREFIX=ms-its:rtl.chm::/
-  endif
-endif
-
-FCLOPTS=$(FPDOCOPTS) --package=fcl --hide-protected --warn-no-node --descr=fcl.xml --content=fcl.xct --import=rtl.xct,$(RTLLINKPREFIX) $(FCLUNITOPTS)
-
-
 fcl.chk: $(FCLXML)
 $(FPDOC) $(FCLOPTS) --format=$(HTMLFMT) --output=fcl$(HTMLSUFFIX) $(FPDOCHTMLOPTS)
 touch fcl.chk
@@ -627,15 +635,9 @@
 
 html: $(INCLUDES) $(CHK)
 
-chm: html
-HTMLFMT=chm
-HTMLSUFFIX=.chm
-FPDOCHTMLOPTS=--auto-toc --auto-index
-ifdef CSSFILE
-  FPDOCHTMLOPTS+=--css-file=$(CSSFILE)
-endif
+chm: 
+   $(MAKE) html HTMLFMT=chm
 
-
 endif  # INSTALLDEBUG
 ###
 # Targets to force using a specific tool.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] chmreader [PATCH]

2007-12-13 Thread Andrew Haines
Michael Van Canneyt wrote:
 
 On Wed, 12 Dec 2007, Andrew Haines wrote:
 
 Andrew Haines wrote:
 Hi, the last patch had a couple of writeln's that were left in by
 accident :( Here's a patch.


 bump :)
 
 Can you resend the patch ? I didn't see it ?
 

Attached.

Andrew
Index: packages/extra/chm/chmreader.pas
===
--- packages/extra/chm/chmreader.pas(revision 9423)
+++ packages/extra/chm/chmreader.pas(working copy)
@@ -671,7 +671,7 @@
   I: Integer;
 begin
   Result := 0;
-  WriteLn('Looking for URL : ', Name);
+  //WriteLn('Looking for URL : ', Name);
   if Name = '' then Exit;
   if fDirectoryHeader.DirectoryChunkCount = 0 then exit;
 
@@ -1117,7 +1117,7 @@
 Found := True;
   end;
   if not Found then exit;
-  WriteLn('Looking for URL ', URL, ' in ', AFileName);
+  //WriteLn('Looking for URL ', URL, ' in ', AFileName);
   if CheckOpenFile(AFileName) then
 Result := fLastChm.ObjectExists(URL);
   if Result  0 then NAme := Url;
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] chmreader [PATCH]

2007-12-12 Thread Andrew Haines
Andrew Haines wrote:
 Hi, the last patch had a couple of writeln's that were left in by
 accident :( Here's a patch.
 
 

bump :)
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] weird syntax

2007-12-10 Thread Andrew Haines
Hi,


Is it possible to make this work:

if X  3 or  10 then ...

of course it would be shorthand for: if (X3) or (X10) then

I suppose also it would be possible then to do:

if X  3 or  -1 or = 4000 or = 100 then...

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] internal linker import by index patch (xbox)

2007-09-20 Thread Andrew Haines
Yury Sidorov wrote:
 
 Actually import by ordinal is implemented in works. Look at line 2416 of
 ogcoff.pas
 When AOrdNr  0 it indicates that import is by name, but ordinal number
 is specified as hint. Whan AOrdNr  0 then import by ordinal only.
 

Okay yes I see that, but that is for the import lookup table not the
import address table, the import address table is the same format as the
import lookup table.

Here is the behavior I observed:

I import a function by index

function SomeFunction: stdcall; external 'xboxkrnl.exe' index '1';

when it is compiled the start of the .idata section looks like this:

ImportLookupTablePtr
DateTimeStamp
Junk
PtrToLibName
ImportAddressTablePtr

The Import Lookup Table is written correctly with the ordinal name as
expected. When I look at the Import Address Table, the entries are *not
the same* as the lookup table, as they should be, but instead *point* to
an address that contains the ordinal(not or'ed), when it should contain
$8000 or'ed against the import ordinal.


From the MS docs talking about the Import Address Table:

Import Address Table RVA(Thunk Table): The RVA of the import address
table. The contents of this table are identical to the contents of the
lookup table until the image is bound.

So even if my confusing explanation doesn't make sense, the Address
Table should mirror the Lookup Table which it doesn't.

It looks like maybe you are writing a Hint/Name table entry for an
ordinal which is only done when importing by name.

thanks for your patience,

Andrew


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] internal linker import by index patch (xbox)

2007-09-20 Thread Andrew Haines
Yury Sidorov wrote:
 From: Andrew Haines [EMAIL PROTECTED]
 Yury Sidorov wrote:

 Actually import by ordinal is implemented in works. Look at line 2416 of
 ogcoff.pas
 When AOrdNr  0 it indicates that import is by name, but ordinal number
 is specified as hint. Whan AOrdNr  0 then import by ordinal only.


 Okay yes I see that, but that is for the import lookup table not the
 import address table, the import address table is the same format as the
 import lookup table.

 Here is the behavior I observed:

 I import a function by index

 function SomeFunction: stdcall; external 'xboxkrnl.exe' index '1';

 when it is compiled the start of the .idata section looks like this:

 ImportLookupTablePtr
 DateTimeStamp
 Junk
 PtrToLibName
 ImportAddressTablePtr

 The Import Lookup Table is written correctly with the ordinal name as
 expected. When I look at the Import Address Table, the entries are *not
 the same* as the lookup table, as they should be, but instead *point* to
 an address that contains the ordinal(not or'ed), when it should contain
 $8000 or'ed against the import ordinal.


 From the MS docs talking about the Import Address Table:

 Import Address Table RVA(Thunk Table): The RVA of the import address
 table. The contents of this table are identical to the contents of the
 lookup table until the image is bound.

 So even if my confusing explanation doesn't make sense, the Address
 Table should mirror the Lookup Table which it doesn't.

 It looks like maybe you are writing a Hint/Name table entry for an
 ordinal which is only done when importing by name.
 
 Yes. You are right. Import Address Table should contain the same data as
 Import Lookup Table. Currently it contains different data when importing
 by ordinal.
 It should be fixed, but it currently this bug has no effect on
 win32/64/CE. EXEs with ordinal imports are loaded properly.
 Does it afeect xbox?
 

Yes. The xbox exe loader does not know it is looking at a IAT in the
.idata section, but thinks it is looking at a different IAT not in the
idata (which neither gcc nor fpc create, only the MS compiler seems to
make it) section which does not have a corresponding Lookup table. I
suspect the windows exe loader is checking the Lookup Table when it
finds invalid data in the IAT.


Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] internal linker import by index patch (xbox)

2007-09-19 Thread Andrew Haines
Hi,

This patch is not ready yet, but can anyone give comments on the
correctness of the third hunk in the patch dealing with AOrdNr?

I've been working on getting fpc able to make xbox(1) programs and on
the xbox there are no libraries but only kernel imports which are
imported by number.

A short explanation:

An xbox exe is very similar to a win32 exe. It only links to the xbox
kernel and imports functions by index. If an exe is generated that
doesn't link to the standard win32 libs like kernel32.dll, then the
program can be converted to an xbe(xbox executable) using a program
called cxbe.

So... with the third hunk applied and a bare system unit and a bunch of
small changes here and there, I've been able to make a xbox program with
fpc that I converted with cxbe. (all it does is write to video memory
and then reboot)

Is the patch correct? I suspect that importing by ordinal is not
currently working for regular exe's made with the internal linker.

The patch changes so that the Import address table is putting  $8000
or'ed against the import number instead of an RVA pointing to the import
number(which is incorrect since a RVA is used here only if it is an
import by name)

Sorry if none of this makes sense, I think I may have overloaded my
brain on this one :)


Thanks,

Andrew Haines

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] passing -shared to ld(win32)

2007-08-30 Thread Andrew Haines
Hi, I've been trying to make the xbox a target for fpc and have run into
a problem. I need to pass --shared to ld.

I tried with some c code to see if --dll  was enough but it didn't work

Essentially I've copied the t_win.pas and i_win.pas files and modified
them for the xbox.

[EMAIL PROTECTED] ~/programming/xbox/bin $
~/programming/fpc/compiler/ppcross386 -Txbox ./simpletest.pas -k-shared
-Fl/usr/local/openxdk/
-Fu/home/andrew/programming/fpc/rtl/units/i386-xbox -XPi386-pc-xbox-
-Aas -Xe
Warning: resourcecompiler is already registered!
Free Pascal Compiler version 2.3.1 [2007/08/30] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: xbox for i386
Compiling ./simpletest.pas
Assembling simpletest
Linking simpletest.exe
Cannot export
CLASSES_ACTIVATECLASSGROUP$TPERSISTENTCLASS$$TPERSISTENTCLASS: symbol
not found
Cannot export CLASSES_ADDTHREAD$TTHREAD: symbol not found
Cannot export CLASSES_BEGINGLOBALLOADING: symbol not found
Cannot export CLASSES_BINTOHEX$PCHAR$PCHAR$LONGINT: symbol not found
Cannot export CLASSES_BITSERROR$ANSISTRING: symbol not found
Cannot export CLASSES_BITSERRORFMT$ANSISTRING$array_of_const: symbol not
found


lot's more of this ending with:

Cannot export fpc_write_text_shortstr: symbol not found
Cannot export fpc_write_text_sint: symbol not found
Cannot export fpc_write_text_uint: symbol not found
Cannot export fpc_write_text_variant: symbol not found
Cannot export fpc_write_text_widechar: symbol not found
Cannot export fpc_write_text_widestr: symbol not found
Cannot export fpc_writeln_end: symbol not found
Cannot export operatingsystem_result: symbol not found
simpletest.pas(4,17) Error: Error while linking
simpletest.pas(4,17) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

Is there something I'm missing?

I've tried building the rtl with -bl -WB -WR fPIC and other assemblers
but still this same result.

Regards,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] how _WinMainCRTStartup works?

2007-08-25 Thread Andrew Haines
Hi, I am trying to implement the xbox as a target for fpc and am
wondering how _WinMainCRTStartup is linked into the executable?

all I've found is sysinitpas.pp for win32 which is used by buildrtl.pp
but I don't see that buildrtl is referenced except in the makefile.

So how does the code in sysintpas get included in the executable?

thanks,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] CHM compiler

2007-07-05 Thread Andrew Haines
Hi all,

I've been working on a compiler for creating CHM files. It's pretty much
done. :)

I've written a GUI to create and compile project files also a simple
command line program that compiles project files. And a Sitemap editor
(part the GUI) needed to make the Table of Contents and the Index.

So here are a couple screenshots:

http://hainesservice.com/andrew/chmwriter.png
http://hainesservice.com/andrew/chmwriter2.png


and here is a link to a chm with the rtl fcl and lcl in it. The TOC and
Index are small to the point of being almost useless, they are just to
test that my sitemap editor works.

6.2 mb
http://hainesservice.com/andrew/rtl_fcl_lcl.chm

Please let me know if this works for you.

In Linux you can use GnoCHM, kchmviewer or xchm(wxWidgets based) to open
use the file.

The file is not searchable.

Regards,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] Freepascal made chm compiler test file

2007-06-26 Thread Andrew Haines
Hi, I've been working on a chm compiler that uses no external libs so it
works on linux and windows etc. Attached is a test.chm file and I'd like
to know if it works for you.  It seems to work on winxp sp1 and older
but winxp sp2 doesn't. it should contain a logo from lazarus and this text:

start text
This is a test of a chm that was generated with only pascal code and
uses no external libraries. How cool is that?
/end text

Please let me know if this file works for you.

Thanks,

Andrew Haines


test.chm
Description: application/chm
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] is hu.freepascal.org hacked?

2006-10-20 Thread Andrew Haines
is http://www.hu.freepascal.org/ hacked?

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] is hu.freepascal.org hacked?

2006-10-20 Thread Andrew Haines
Daniël Mantione wrote:
 
 Op Fri, 20 Oct 2006, schreef Andrew Haines:
 
 is http://www.hu.freepascal.org/ hacked?
 
 Not at all, it was showing Scenergy's homepage in progress :)
 

Ok that's good :)

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] x64 resources

2005-12-06 Thread Andrew Haines

Hi,

Is support for resources {$R someresource.res} planned for ppcx64?

Thanks,

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Where can I find tutorials/codes

2005-11-21 Thread Andrew Haines

VisionForce wrote:

Where might I be able to find some good Win32 forms and controls 
tutorials for Pascal?


All the available docs for freepascal are here:

http://www.freepascal.org/docs.html

Have you checked out Lazarus? It's a CrossPlatform Delphi-like IDE.

http://www.lazarus.freepascal.org/

Andrew
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel