Sign in Join

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

Mailing lists / fpc-pascal / 2012-11

OS/2 and fcl-base\syncobjs

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

waldo kitty

is fcl-base\syncobjs not ready for use with OS/2? i'm trying to work with synapse40... it doesn't have any IFDEFs for OS/2 which i'm sure are or will be needed... the release version of fpc 2.6.0 does not have syncobjs in the units/OS2/fcl-base directory...

/me is stuck... again :/

[compile output]
4OS2-2.51 (0) | X:\fpc\projects\test >fpc -FuX:\fpc\libs\synapse40\source\lib test.lpr
Free Pascal Compiler version 2.6.0 [2011/12/26] for i386 Copyright (c) 1993-2011 by Florian Klaempfl and others Target OS: OS/2
Compiling test.lpr
Compiling X:\FPC\LIBS\SYNAPSE40\SOURCE\LIB\synacode.pas Assembling synacode
Compiling X:\FPC\LIBS\SYNAPSE40\SOURCE\LIB\ssl_openssl.pas Compiling X:\FPC\LIBS\SYNAPSE40\SOURCE\LIB\blcksock.pas Compiling X:\FPC\LIBS\SYNAPSE40\SOURCE\LIB\synafpc.pas Assembling synafpc
Compiling X:\FPC\LIBS\SYNAPSE40\SOURCE\LIB\synsock.pas Fatal: Can't find unit SyncObjs used by synsock
Fatal: Compilation aborted
Error: X:\FP\2.6.0\BIN\OS2\ppc386.exe returned an error exitcode (normal if you did not specify a source file to be compiled)
[/compile output]

[test.lpr source code]
program test;
{$mode objfpc}{$H+}

uses

   {$IFDEF UNIX}{$IFDEF UseCThreads}
   cthreads,
   {$ENDIF}{$ENDIF}
   Classes,
   { you can add units after this }
   SysUtils, synacode, ssl_openssl, httpsend; //using the openssl plugin unit
Const
    myKeepAlive    = False;
    MaxURLFields   = 4;
    URLFields      : array[1..MaxURLFields] of String =
('var1','var2','var3','var4');
    URLValues      : array[1..MaxURLFields] of String =
('val1','val2','val3','val4');
    //myURL          : string = 'http://test.server.invalid/cgi-bin/posttest.cgi';
    myURL          : string = 'https://test.server.invalid/cgi-bin/login.cgi';
    myUserAgent    : string = 'Mozilla/5.0 (myAgent built with synapse40)';
    myHTTPProtVer  : string = '1.1';
var
   myClient      : THTTPSend;
   myList        : TStringList;
   myCounter     : integer;
   myURLElements : String;
begin
   myClient := THTTPSend.Create;
   myList := TStringList.Create;
   myClient.UserAgent := myUserAgent;
   myClient.Protocol := myHTTPProtVer;
   myClient.KeepAlive := myKeepAlive;
   myURLElements := '';
   for myCounter := 1 to MaxURLFields do
     begin
       myURLElements := myURLElements + URLFields[myCounter] + '=' +
EncodeURLElement(URLValues[myCounter]);
       if myCounter < MaxURLFields then
         myURLElements := myURLElements + '&';
     end;
   try
     myClient.Document.Write(Pointer(myURLElements)^, Length(myURLElements));
     myClient.MimeType := 'application/x-www-form-urlencoded';
     if not myClient.HTTPMethod('POST', myURL) then
       begin
	      writeln('ERROR');
         writeln(myClient.Resultcode);
       end
     else
       begin
         write(myURL, ' - ');
         writeln(myClient.Resultcode, ' ', myClient.Resultstring);
         writeln;
         writeln(myClient.headers.text);
         writeln;
         myList.loadfromstream(myClient.Document);
         writeln(myList.text);
      end;
   finally
     myClient.Free;
     myList.free;
   end;
end.
[/test.lpr source code]
Tomas Hajny
to waldo kitty
waldo kitty wrote
is fcl-base\syncobjs not ready for use with OS/2? i'm trying to work with synapse40... it doesn't have any IFDEFs for OS/2 which i'm sure are or will be needed... the release version of fpc 2.6.0 does not have syncobjs in the units/OS2/fcl-base directory...

That's correct. However, it should be possible to add support for this unit quite easily - try the attached version of syncobjs (committed to trunk now). If it works for you, I'm willing to merge this change to fixes (although this probably wouldn't be in 2.6.2 any longer).

/me is stuck... again :/

This one has been doable, let's wait for the next issue. ;-)

Tomas