Re: [fpc-pascal] help with synapse mime routines...

2011-02-16 Thread Kevin Jesshope
Hi Waldo,

I don't have the mimepart or synaser units available at the moment so
without actually compiling the code I am not certain the following
observations are the cause of your trouble. They are however somewhere
to start.

1 In line 63 you are checking to see if m1 is nil to see if the object
has already been freed. This will not work as Free does not set the
var to nil. Use FreeAndNil(m1) instead to acheive that.
2 In line 49 you are assigning m1 := m.GetSubPart(MyPart - 1) so when
you go to free m1, expecting to free the m1 created in line 44, you
are in fact freeing the result from the GetSubPart function. You have
lost the reference you had to the original TMimePart created at line
44. Declare and use say m2 to fix this one.

Regards

Kevin Jesshope - In Touch Computer Support

> can anyone assist with the reason for the exception?? i'm using the last
> release code of synapse (download zip archive) with FPC 2.4.3... currently
> on win32...
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] help with synapse mime routines...

2011-02-16 Thread waldo kitty


so i take it, from the dearth of replies, that no one on this list uses synapse 
or its mime library?


i've reduced/stripped the code to produce the attached .pas file... while i now 
do not get a line number any more (which i also do not understand), at least i 
can more easily see now that the problem is associated with freeing the second 
(last??) instance of the created m1 var... i'm working with an email message 
that is multipart with a text/plain part first and a text/html part second... i 
don't currently have a three part multipart message to work with and for this 
application, it is doubtful that one will appear but it would be best to code 
for the possibility i think... my goal is to extract only the text/plain portion 
and decode any mime'd characters to CP850 ascii equivalents... no, not 7-bit but 
8-bit if necessary... an example is decoding = 9 9 (that's equal nine nine 
without the spaces) to "(tm)" (that's open parens, Tee, Emm, close parens)...


can anyone assist with the reason for the exception?? i'm using the last release 
code of synapse (download zip archive) with FPC 2.4.3... currently on win32...


here's the screen output for the attached code...

C:\freepascal\projects\arnews>tstmime1 arnews4.req

  entering ProcessParts...
allocate m1 for part 1
assign m1.OnWalkPart for part 1
pulling part 1 into m1-1
** WE HAVE A TEXT/PLAIN SECTION **
finally
  free m1 for part 1...
m1 <> NIL... Destroying... done!
done!

allocate m1 for part 2
assign m1.OnWalkPart for part 2
pulling part 2 into m1-2
This part is not TEXT/PLAIN... DELETING...
  firing m.DeleteSubPart(1
  back from m.DeleteSubPart...
Done!
finally
  free m1 for part 2...
m1 <> NIL... Destroying... An unhandled exception occurred at $6275736E
:
EAccessViolation : Access violation
  $6275736E
{$MODE DELPHI}

Program testmime;

uses
  mimepart, synachar, classes;

type
  Tc = class(TObject)
  public
class procedure ph(const Sender: TMimePart);
  end;

class procedure Tc.ph(const Sender: TMimePart);
begin
  Sender.DecodePart;
  Sender.EncodePart;
end;

var
  m: tmimepart;
  PartCount: integer;
  m1: tmimepart;
  MyPart: integer;
  MyPartCount: integer;

begin
  m := tmimepart.create;
//  try
m.OnWalkPart:=tc.ph;
m.Lines.LoadFromFile(paramstr(1));
m.DecomposeParts;
m.WalkPart;
PartCount := m.GetSubPartCount;
if m.Primary = 'MULTIPART' then
  begin
writeln;
writeln('  entering ProcessParts...');
for MyPart := 1 to PartCount do
  begin
if MyPart > 1 then
  writeln;
  writeln('allocate m1 for part ',MyPart);
  m1 := tmimepart.create;
  try
writeln('assign m1.OnWalkPart for part ',MyPart);
m1.OnWalkPart:=tc.ph;
writeln('pulling part ',MyPart,' into m1-',MyPart);
m1:= m.GetSubPart(MyPart - 1);
if ((m1.Primary = 'TEXT') and (m1.Secondary = 'PLAIN')) then
  writeln('** WE HAVE A TEXT/PLAIN SECTION **')
else
  begin
writeln('This part is not TEXT/PLAIN... DELETING... ');
writeln('  firing m.DeleteSubPart(',MyPart-1);
m.DeleteSubPart(MyPart - 1);
writeln('  back from m.DeleteSubPart...');
writeln('Done!');
  end;
  finally
writeln('finally');
writeln('  free m1 for part ',MyPart,'... ');
if m1 <> NIL then
  begin
write('m1 <> NIL... Destroying... ');
m1.free;
writeln('done!');
  end
else
  writeln('m1 = NIL... no destroy necessary...');
writeln('done!');
  end;
  end;
writeln('  vacating ProcessParts...');
  end;

writeln;
writeln('  fire m.ComposeParts...');
m.ComposeParts;
writeln('  return from m.ComposeParts...');
writeln('  fire m.Lines.SaveToFile...');
m.Lines.SaveToFile(paramstr(1) + '.repack');
writeln('  return from m.Lines.SaveTofile...');
//  finally
writeln;
writeln('finally');
write('  free m... ');
m.free;
writeln('done!');
//  end;
  writeln('Process complete. Terminating...');
end.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Re: Name of the programming language used in/with FPC

2011-02-16 Thread leledumbo

Yeah, he let Pascal in the last state he worked on. But don't you know he's
also an actor behind (Apple's) Object Pascal?
-- 
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Name-of-the-programming-language-used-in-with-FPC-tp3375543p3387995.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Name of the programming language used in/with FPC

2011-02-16 Thread Sven Barth

Am 16.02.2011 17:36, schrieb Rich Saunders:

On 2/16/11 11:27 AM, Sven Barth wrote:

...he's still happily alive: http://en.wikipedia.org/wiki/Niklaus_Wirth

Of course he is. I only meant he has not paid much attention to the
Pascal language for decades. ;)


In that case I've misunderstood you ^^

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Name of the programming language used in/with FPC

2011-02-16 Thread Rich Saunders

On 2/16/11 11:27 AM, Sven Barth wrote:

...he's still happily alive: http://en.wikipedia.org/wiki/Niklaus_Wirth
Of course he is. I only meant he has not paid much attention to the 
Pascal language for decades. ;)


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


Re: [fpc-pascal] Re: Name of the programming language used in/with FPC

2011-02-16 Thread Sven Barth

Am 16.02.2011 17:20, schrieb Rich Saunders:

On 2/16/11 5:40 AM, greim wrote:

I suggest to ask first Professor Niklaus Wirth

I think he has moved on long ago.


Don't let him know that, as he's still happily alive: 
http://en.wikipedia.org/wiki/Niklaus_Wirth


Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Name of the programming language used in/with FPC

2011-02-16 Thread Rich Saunders

On 2/16/11 5:40 AM, greim wrote:

I suggest to ask first Professor Niklaus Wirth

I think he has moved on long ago.


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


[fpc-pascal] help with synapse mime routines...

2011-02-16 Thread waldo kitty


i'm trying to work with the synapse mime library but am running into a bit of a 
problem... i'm an old procedural type coder from the TP3 to TP6 days... it has 
been a long time since i've done much of anything with objects and i've 
forgotten a lot more than i remember... i've not done any delphi coding at all...


so, i'm starting with source\demo\FreePascal\testmime.pas because it reads an 
email message from a text file, processes it a bit and then saves a new copy to 
another text file... what i'm trying to add to this, so as to understand how the 
library works and can be used, is how to step thru the parts of a multipart 
message and work with each individual part...


currently i have something that determines that we are working with a multipart 
message and branches to another routine... in this other routine, we create 
another object for the part, process it just like in the main part, then destroy 
the object as we loop back for the next part... i'm able to see what each part 
is (text, html, etc) and display some info on them BUT when we drop back out of 
the multipart routine and get back to the main section, we get an access 
violation on destroying the initial object at the end of the program 
execution... if i do not destroy the secondary objects in the multipart routine, 
this access violation does not occur...


attached is the mess i'm working with... yes, it is peppered with writeln's so 
as to try to see what's going on where and when since there is no debugger 
support in the fpc i'm working with so i cannot see the contents of the 
variables like i'm so extremely used to doing in the TP/BP IDEs...



{$MODE DELPHI}

Program testmime;

uses
  mimepart, synachar, classes;

type
  Tc = class(TObject)
  public
class procedure ph(const Sender: TMimePart);
  end;

class procedure Tc.ph(const Sender: TMimePart);
begin
  Sender.DecodePart;
  Sender.EncodePart;
end;

Procedure ProcessParts(const Sender: TMimePart; ThePartCount: integer);

var
  m1: tmimepart;
  MyPart: integer;
  MyPartCount: integer;
//
begin
  writeln;
  writeln(' entering ProcessParts...');
  for MyPart := 1 to ThePartCount do
begin
  if MyPart > 1 then
writeln;
  writeln('  allocate m1-',MyPart);
  m1 := tmimepart.create;
  try
writeln('   assign OnWalkPart-',MyPart);
m1.OnWalkPart:=tc.ph;
writeln('   pulling part ',MyPart,' into m1-',MyPart);
m1:= Sender.GetSubPart(MyPart - 1);
writeln('   fire DecomposeParts-',MyPart);
m1.DecomposeParts;
writeln('   return from DecomposeParts-',MyPart);
writeln('   fire WalkPart-',MyPart);
m1.WalkPart;
writeln('   return from WalkPart-',MyPart);
MyPartCount := m1.GetSubPartCount;
writeln('WP-',MyPart,' Target Charset  : ',m1.TargetCharset);
writeln('WP-',MyPart,' Default Charset : ',m1.DefaultCharset);
writeln('WP-',MyPart,' GetSubPartCount : ',MyPartCount);
writeln('WP-',MyPart,' SubLevel: ',m1.SubLevel);
writeln('WP-',MyPart,' MaxSubLevel : ',m1.MaxSubLevel);
writeln('WP-',MyPart,' Primary : ',m1.Primary);
writeln('WP-',MyPart,' Secondary   : ',m1.Secondary);
writeln('WP-',MyPart,' Encoding: ',m1.Encoding);
writeln('WP-',MyPart,' Boundary: ',m1.Boundary);
writeln('WP-',MyPart,' ContentID   : ',m1.ContentID);

  finally
writeln('   finally');
writeln('free m1-',MyPart);
//m1.free;
writeln('  done m1-',MyPart);
  end;
end;
  writeln(' vacating ProcessParts...');
end;

var
  l: tstringlist;
  m: tmimepart;
  PartCount: integer;

begin
  l := TStringList.create;
  m := tmimepart.create;
  try
m.OnWalkPart:=tc.ph;
m.Lines.LoadFromFile(paramstr(1));
writeln('Target Charset : ',m.TargetCharset);
m.TargetCharset := GetCPFromID('ISO_8859_1');
writeln('Target Charset : ',m.TargetCharset);
writeln('Default Charset: ',m.DefaultCharset);
m.DefaultCharset := 'ISO_8859_1';
writeln('Default Charset: ',m.DefaultCharset);
m.DecomposeParts;
writeln('DP Target Charset  : ',m.TargetCharset);
m.TargetCharset := GetCPFromID('ISO_8859_1');
writeln('DP Target Charset  : ',m.TargetCharset);
writeln('DP Default Charset : ',m.DefaultCharset);
m.WalkPart;
PartCount := m.GetSubPartCount;
writeln('WP Target Charset  : ',m.TargetCharset);
writeln('WP Target Charset  : ',m.TargetCharset);
writeln('WP Default Charset : ',m.DefaultCharset);
writeln('WP GetSubPartCount : ',PartCount);
writeln('WP SubLevel: ',m.SubLevel);
writeln('WP MaxSubLevel : ',m.MaxSubLevel);
writeln('WP Primary : ',m.Primary);
writeln('WP Secondary   : ',m.Secondary);
writeln('WP Encoding: ',m.Encoding);
writeln('WP Boundary: ',m.Boundary);
writeln('WP ContentI

Re: [fpc-pascal] Re: Name of the programming language used in/with FPC

2011-02-16 Thread greim

I suggest to ask first

Professor Niklaus Wirth

Regards

Markus Greim
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Name of the programming language used in/with FPC

2011-02-16 Thread Matt Emson

On 16/02/2011 09:48, Frank Church wrote:


How about Apollo?


This was the code name for Adobe Air - I expect it would be hard to get 
traction if Adobe still hold some kind of rights over it.



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


[fpc-pascal] Re: Name of the programming language used in/with FPC

2011-02-16 Thread Ben
Op 2011-02-16 11:48, Frank Church het geskryf:
> 
> How about Apollo?

Some might suggest "Titanic" too. :-)


With my original post I wasn't actually asking for new suggestions, but
simply if FPC considers the language it uses as a "new" language named
for example "Free Pascal", or does it still consider it as standard
"Object Pascal".

But with everybody's replies, I guess it is a difficult question to
answer, because FPC has many hats (various compiler modes), which
affects the language syntax. Even so, I would like to think compiler
mode ObjFPC is FPC's native/default language - the others are just nice
gestures for compatibility sake.


-- 

Ben.

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


Re: [fpc-pascal] Name of the programming language used in/with FPC

2011-02-16 Thread Frank Church
On 8 February 2011 08:34, Ben  wrote:

> Hi,
>
> What is the programming language used in and with the Free Pascal Compiler?
>
> * Object Pascal
> * Delphi
> * Free Pascal
> * Pascal
>
>
> I would have thought the first option [Object Pascal], but I have read
> many articles/blogs on the internet which seem to refer to the Free
> Pascal Compiler project's language as Free Pascal.
>
> So what is the official word/answer on this?
>
> If the Free Pascal Compiler project indeed does consider it having its
> own Pascal dialect, named Free Pascal, then is there a list of what
> syntax it has that is different to Borland's "Object Pascal", or
> Embarcadero's "Delphi" language?
>
>
>


How about Apollo?




> --
>
>Ben.
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>



-- 
Frank Church

===
http://devblog.brahmancreations.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal