diff --git a/.gitattributes b/.gitattributes index 61115b5095..89d90ab1d3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -240,6 +240,7 @@ components/printers/unix/cupsprinters.inc svneol=native#text/pascal components/printers/unix/cupsprinters_h.inc svneol=native#text/pascal components/printers/unix/cupsprndialogs.inc svneol=native#text/pascal components/printers/unix/jobsimglist.lrs svneol=native#text/pascal +components/printers/unix/minicupslibc.pas svneol=native#text/plain components/printers/unix/printerprop.lrs svneol=native#text/pascal components/printers/unix/selectprinter.lrs svneol=native#text/pascal components/printers/unix/udlgprintersjobs.lfm svneol=native#text/plain diff --git a/components/printers/printer4lazarus.lpk b/components/printers/printer4lazarus.lpk index 7746d37b0c..c841c42800 100644 --- a/components/printers/printer4lazarus.lpk +++ b/components/printers/printer4lazarus.lpk @@ -25,7 +25,7 @@ - + @@ -135,6 +135,10 @@ + + + + diff --git a/components/printers/printer4lazarus.pas b/components/printers/printer4lazarus.pas index ad8321685c..1f93834cdd 100644 --- a/components/printers/printer4lazarus.pas +++ b/components/printers/printer4lazarus.pas @@ -7,7 +7,7 @@ unit Printer4Lazarus; interface uses - PrintersDlgs, OSPrinters, LazarusPackageIntf; + PrintersDlgs, OSPrinters, MiniCUPSLibc, LazarusPackageIntf; implementation diff --git a/components/printers/unix/cupsdyn.pp b/components/printers/unix/cupsdyn.pp index 4f44264094..45682ece40 100644 --- a/components/printers/unix/cupsdyn.pp +++ b/components/printers/unix/cupsdyn.pp @@ -51,10 +51,15 @@ interface uses Classes, SysUtils, dynlibs, {$ifdef UseLibC} - LibC; + {$IFDEF darwin} + miniCupsLibc + {$ELSE} + Libc + {$ENDIF} {$else} - baseunix, unix, sockets; + baseunix, unix, sockets {$endif} + ; {$PACKRECORDS C} diff --git a/components/printers/unix/minicupslibc.pas b/components/printers/unix/minicupslibc.pas new file mode 100644 index 0000000000..1e30f9737f --- /dev/null +++ b/components/printers/unix/minicupslibc.pas @@ -0,0 +1,51 @@ +{ + ***************************************************************************** + * * + * See the file COPYING.LCL, included in this distribution, * + * for details about the copyright. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * * + ***************************************************************************** +} +unit MiniCUPSLibc; + +{$mode objfpc}{$H+} + +interface + +const + clib = 'c'; + +Type + Time_t = longint; + TTime_T = Time_t; + Ptime_t = ^TTime_T; + +type + Ptm = ^tm; + tm = record + tm_sec : longint; + tm_min : longint; + tm_hour : longint; + tm_mday : longint; + tm_mon : longint; + tm_year : longint; + tm_wday : longint; + tm_yday : longint; + tm_isdst : longint; + case boolean of + false : (tm_gmtoff : longint;tm_zone : Pchar); + true : (__tm_gmtoff : longint;__tm_zone : Pchar); + end; + +function __time(__timer:Ptime_t):time_t;cdecl;external clib name 'time'; +function localtime(__timer:Ptime_t):Ptm;cdecl;external clib name 'localtime'; +function localtime(var __timer : ttime_t):Ptm;cdecl;external clib name 'localtime'; + +implementation + +end. + diff --git a/components/printers/unix/udlgprintersjobs.pp b/components/printers/unix/udlgprintersjobs.pp index bd8ea31243..a864b7bf3f 100644 --- a/components/printers/unix/udlgprintersjobs.pp +++ b/components/printers/unix/udlgprintersjobs.pp @@ -43,9 +43,14 @@ uses Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls, Printers,cupsPrinters,Buttons,ComCtrls,StdCtrls, {$IFNDEF DYNLINK} - Cups, cups_ipp,Libc + Cups, cups_ipp, {$ELSE} - CUPSDyn,LibC + CUPSDyn, + {$ENDIF} + {$IFDEF darwin} + miniCupsLibc, + {$ELSE} + Libc, {$ENDIF} ; diff --git a/components/printers/unix/udlgselectprinter.pp b/components/printers/unix/udlgselectprinter.pp index 2ce79d0d95..66db42b687 100644 --- a/components/printers/unix/udlgselectprinter.pp +++ b/components/printers/unix/udlgselectprinter.pp @@ -3,8 +3,6 @@ ------------ ***************************************************************************** * * - * This file is part of the Lazarus Component Library (LCL) * - * * * See the file COPYING.LCL, included in this distribution, * * for details about the copyright. * * * @@ -43,8 +41,8 @@ interface uses Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, - Buttons, ExtCtrls, Spin, MaskEdit, ComCtrls,LCLType, - Printers, OsPrinters in '../osprinters.pas', CUPSDyn,libc; + Buttons, ExtCtrls, Spin, MaskEdit, ComCtrls, LCLType, + Printers, OsPrinters in '../osprinters.pas', CUPSDyn; type @@ -129,14 +127,21 @@ function LocalToGMTDateTime(aDate : TDateTime) : TDateTime; function LapseLocalToGMT : integer; implementation -uses udlgpropertiesprinter; + +uses + {$IFDEF darwin} + miniCupsLibc, + {$ELSE} + Libc, + {$ENDIF} + uDlgPropertiesPrinter; Type - THackCUPSPrinter=Class(TCUPSPrinter); + THackCUPSPrinter = Class(TCUPSPrinter); {----------- Utile date/time convertion ------------} //Return the lapse time in second -//beetween locatime and gmt time with daylight +//beetween localtime and gmt time with daylight function LapseLocalToGMT : integer; var TT : ttime_t; LOC: PTm;