با سلام خدومت همه دوستان عزیز:
من این کد ها را در بیشتر کامپوننت ها می بینم ولی نمی دانم که این کد ها چه کاری را انجام می دهند.
و یا این که چه طوری باید آنها را نوشت و خلاصه من می خواستم بدونم که کار اصلی این کد ها چی هست و توضیح هم اگر داده شود بی نهایت از شما ممنون و متشکر می شوم.
کد:
{ ComPort Library global definitions }
{ Fixed up for Delphi 2009 by W.Postma. }
{$B-}
{$X+}
{$H+}
{$IFDEF VER110} { C++ Builder 3 }
{$ObjExportAll On}
{$DEFINE VER_RECOGNIZED}
{$ENDIF}
{$IFDEF VER120} { Delphi 4 }
{$DEFINE DELPHI_4_OR_HIGHER}
{$DEFINE DELPHI_4}
{$DEFINE VER_RECOGNIZED}
{$ENDIF}
{$IFDEF VER125} { C++ Builder 4 }
{$DEFINE DELPHI_4_OR_HIGHER}
{$DEFINE DELPHI_4}
{$ObjExportAll On}
{$DEFINE VER_RECOGNIZED}
{$ENDIF}
{$IFDEF VER130} { Delphi 5 and C++ Builder 5 }
{$DEFINE DELPHI_4_OR_HIGHER}
{$DEFINE DELPHI_5_OR_HIGHER}
{$DEFINE DELPHI_5}
{$IFDEF BCBNOTDELPHI}
{$ObjExportAll On}
{$ENDIF}
{$DEFINE VER_RECOGNIZED}
{$ENDIF}
{$IFDEF VER140} { Delphi 6 and C++ Builder 6}
{$DEFINE DELPHI_4_OR_HIGHER}
{$DEFINE DELPHI_5_OR_HIGHER}
{$DEFINE DELPHI_6_OR_HIGHER}
{$DEFINE DELPHI_6}
{$IFDEF BCBNOTDELPHI}
{$ObjExportAll On}
{$ENDIF}
{$DEFINE VER_RECOGNIZED}
{$ENDIF}
{$IFDEF VER150} { Delphi 7 }
{$DEFINE DELPHI_4_OR_HIGHER}
{$DEFINE DELPHI_5_OR_HIGHER}
{$DEFINE DELPHI_6_OR_HIGHER}
{$DEFINE DELPHI_7_OR_HIGHER}
{$DEFINE DELPHI_7}
{$IFDEF BCBNOTDELPHI}
{$ObjExportAll On}
{$ENDIF}
{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_CAST OFF}
{$DEFINE VER_RECOGNIZED}
{$ENDIF}
{$IFDEF VER170} { Delphi 9 (2005) }
{$DEFINE DELPHI_4_OR_HIGHER}
{$DEFINE DELPHI_5_OR_HIGHER}
{$DEFINE DELPHI_6_OR_HIGHER}
{$DEFINE DELPHI_7_OR_HIGHER}
{$DEFINE DELPHI_7}
{$IFDEF BCBNOTDELPHI}
{$ObjExportAll On}
{$ENDIF}
{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_CAST OFF}
{$DEFINE VER_RECOGNIZED}
{$ENDIF}
{$IFDEF VER180} { Delphi 10 (2006) }
{$DEFINE DELPHI_4_OR_HIGHER}
{$DEFINE DELPHI_5_OR_HIGHER}
{$DEFINE DELPHI_6_OR_HIGHER}
{$DEFINE DELPHI_7_OR_HIGHER}
{$DEFINE DELPHI_2007}
{$DEFINE DELPHI_2007_OR_HIGHER}
{$IFDEF BCBNOTDELPHI}
{$ObjExportAll On}
{$ENDIF}
{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_CAST OFF}
{$DEFINE VER_RECOGNIZED}
{$ENDIF}
{$IFDEF VER185} { Delphi 2007 }
{$DEFINE DELPHI_4_OR_HIGHER}
{$DEFINE DELPHI_5_OR_HIGHER}
{$DEFINE DELPHI_6_OR_HIGHER}
{$DEFINE DELPHI_7_OR_HIGHER}
{$DEFINE DELPHI_2007}
{$DEFINE DELPHI_2007_OR_HIGHER}
{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_CAST OFF}
{$IFDEF BCB}
{$DEFINE BCB11}
{$ObjExportAll On}
{$ENDIF}
{$DEFINE VER_RECOGNIZED}
{$ENDIF}
{$IFDEF VER200} { Delphi 2009 UNICODE }
{$DEFINE DELPHI_4_OR_HIGHER}
{$DEFINE DELPHI_5_OR_HIGHER}
{$DEFINE DELPHI_6_OR_HIGHER}
{$DEFINE DELPHI_7_OR_HIGHER}
{$DEFINE DELPHI_2009}
{$DEFINE DELPHI_2009_OR_HIGHER}
{$DEFINE DELPHI_UNICODE}
{$IFDEF BCBNOTDELPHI}
{$ObjExportAll On}
{$ENDIF}
{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_CAST OFF}
{$DEFINE VER_RECOGNIZED}
{$ENDIF}
{$IFDEF VER210} { Delphi 2010 UNICODE }
{$DEFINE DELPHI_4_OR_HIGHER}
{$DEFINE DELPHI_5_OR_HIGHER}
{$DEFINE DELPHI_6_OR_HIGHER}
{$DEFINE DELPHI_7_OR_HIGHER}
{$DEFINE DELPHI_2009}
{$DEFINE DELPHI_2009_OR_HIGHER}
{$DEFINE DELPHI_UNICODE}
{$IFDEF BCBNOTDELPHI}
{$ObjExportAll On}
{$ENDIF}
{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_CAST OFF}
{$DEFINE VER_RECOGNIZED}
{$ENDIF}
{... Lets try to make it work, for Delphi 2011 and later, right now...}
{$IFNDEF VER_RECOGNIZED}
{$DEFINE DELPHI_4_OR_HIGHER}
{$DEFINE DELPHI_5_OR_HIGHER}
{$DEFINE DELPHI_6_OR_HIGHER}
{$DEFINE DELPHI_7_OR_HIGHER}
{$DEFINE DELPHI_2009}
{$DEFINE DELPHI_2009_OR_HIGHER}
{$DEFINE DELPHI_UNICODE}
{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_CAST OFF}
{$ENDIF}
{$UNDEF VER_RECOGNIZED}
و یا این کد ها با کد های بالا چه فرقی می کنند ممنون.
کد:
{ Compiler Settings }
{$B-} // Complete Boolean Evaluation Off
{$R-} // Range Checking Off
{$Q-} // Overflow Checking Off
{$V-} // Var String Checking Off
{$T-} // Typed @ operator Off
{$X+} // Extended Syntax On
{$P+} // Open String Params On
{$O+} // Optimization On
{$IFDEF WIN32}
{$H+} // Use long strings by default
{$ENDIF}
{ Assume the latest version of compiler is available }
{$DEFINE COMPILER2009_UP}
{$DEFINE COMPILER2007_UP}
{$DEFINE COMPILER2006_UP}
{$DEFINE COMPILER2005_UP}
{$DEFINE COMPILER7_UP}
{$DEFINE COMPILER6_UP}
{$DEFINE COMPILER5_UP}
{$DEFINE COMPILER4_UP}
{ Then detect if it is older (.NET versions are ignored) }
{$IFDEF VER200} // Delphi 2009
{$ENDIF}
{$IFDEF VER185} // Delphi 2007
{$UNDEF COMPILER2009_UP}
{$ENDIF}
{$IFDEF VER180} // Delphi 2006
{$UNDEF COMPILER2009_UP}
{$UNDEF COMPILER2007_UP}
{$ENDIF}
{$IFDEF VER170} // Delphi 2005
{$UNDEF COMPILER2009_UP}
{$UNDEF COMPILER2007_UP}
{$UNDEF COMPILER2006_UP}
{$ENDIF}
{$IFDEF VER150} // Delphi 7
{$UNDEF COMPILER2009_UP}
{$UNDEF COMPILER2007_UP}
{$UNDEF COMPILER2006_UP}
{$UNDEF COMPILER2005_UP}
{$ENDIF}
{$IFDEF VER140} // Delphi 6 & C++Builder 6
{$UNDEF COMPILER2009_UP}
{$UNDEF COMPILER2007_UP}
{$UNDEF COMPILER2006_UP}
{$UNDEF COMPILER2005_UP}
{$UNDEF COMPILER7_UP}
{$ENDIF}
{$IFDEF VER130} // Delphi 5 & C++Builder 5
{$UNDEF COMPILER2009_UP}
{$UNDEF COMPILER2007_UP}
{$UNDEF COMPILER2006_UP}
{$UNDEF COMPILER2005_UP}
{$UNDEF COMPILER7_UP}
{$UNDEF COMPILER6_UP}
{$ENDIF}
{$IFDEF VER130} // Delphi 5 & C++Builder 5
{$UNDEF COMPILER2009_UP}
{$UNDEF COMPILER2007_UP}
{$UNDEF COMPILER2006_UP}
{$UNDEF COMPILER2005_UP}
{$UNDEF COMPILER7_UP}
{$UNDEF COMPILER6_UP}
{$ENDIF}
{$IFDEF VER125} // C++Builder 4
{$UNDEF COMPILER2009_UP}
{$UNDEF COMPILER2007_UP}
{$UNDEF COMPILER2006_UP}
{$UNDEF COMPILER2005_UP}
{$UNDEF COMPILER7_UP}
{$UNDEF COMPILER6_UP}
{$UNDEF COMPILER5_UP}
{$ENDIF}
{$IFDEF VER120} // Delphi 4
{$UNDEF COMPILER2009_UP}
{$UNDEF COMPILER2007_UP}
{$UNDEF COMPILER2006_UP}
{$UNDEF COMPILER2005_UP}
{$UNDEF COMPILER7_UP}
{$UNDEF COMPILER6_UP}
{$UNDEF COMPILER5_UP}
{$ENDIF}
{$IFDEF VER110} // C++Builder 3
{$UNDEF COMPILER2009_UP}
{$UNDEF COMPILER2007_UP}
{$UNDEF COMPILER2006_UP}
{$UNDEF COMPILER2005_UP}
{$UNDEF COMPILER7_UP}
{$UNDEF COMPILER6_UP}
{$UNDEF COMPILER5_UP}
{$UNDEF COMPILER4_UP}
{$ENDIF}
{$IFDEF VER100} // Delphi 3
{$UNDEF COMPILER2009_UP}
{$UNDEF COMPILER2007_UP}
{$UNDEF COMPILER2006_UP}
{$UNDEF COMPILER2005_UP}
{$UNDEF COMPILER7_UP}
{$UNDEF COMPILER6_UP}
{$UNDEF COMPILER5_UP}
{$UNDEF COMPILER4_UP}
{$ENDIF}
{$IFDEF VER93} // C++Builder 1
{$UNDEF COMPILER2009_UP}
{$UNDEF COMPILER2007_UP}
{$UNDEF COMPILER2006_UP}
{$UNDEF COMPILER2005_UP}
{$UNDEF COMPILER7_UP}
{$UNDEF COMPILER6_UP}
{$UNDEF COMPILER5_UP}
{$UNDEF COMPILER4_UP}
{$ENDIF}
{$IFDEF VER90} // Delphi 2
{$UNDEF COMPILER2009_UP}
{$UNDEF COMPILER2007_UP}
{$UNDEF COMPILER2006_UP}
{$UNDEF COMPILER2005_UP}
{$UNDEF COMPILER7_UP}
{$UNDEF COMPILER6_UP}
{$UNDEF COMPILER5_UP}
{$UNDEF COMPILER4_UP}
{$ENDIF}
{$IFDEF VER80} // Delphi 1
{$UNDEF COMPILER2009_UP}
{$UNDEF COMPILER2007_UP}
{$UNDEF COMPILER2006_UP}
{$UNDEF COMPILER2005_UP}
{$UNDEF COMPILER7_UP}
{$UNDEF COMPILER6_UP}
{$UNDEF COMPILER5_UP}
{$UNDEF COMPILER4_UP}
{$ENDIF}